T-SQL, 54 bytes (the trivial solution)
PRINT'(<(<>(<>.(<>.<(<>.<>(<>.<>)<>.<>)>.<>).<>)<>)>)'
I like this challenge, simple and yet so annoying.
I tried hard to find alternates, but nothing was shorter, due mostly due to the length of SQL keywords. Hmm, maybe I need to create GolfSQL with minimized keywords and other optimizations...
Here's my best attempt at a procedural solution (97 bytes golfed, presented here formatted):
DECLARE @ INT=-4, @o VARCHAR(99)=''
a:
SET @o+=SUBSTRING('(<>.<>)',@,7)
SET @+=1
IF @<7 GOTO a
PRINT @o
This works because SUBSTRING
can take a negative start value, in which case it simply reduces the length.
Edit: Found a slightly shorter non-trivial solution (96 bytes):
SELECT STRING_AGG(SUBSTRING('(<>.<>)',number-4,7),'')FROM
spt_values WHERE TYPE='P'AND number<11
Only works on MS SQL Server, where the master
database has a built-in system table called spt_values
. This table (when filtered by WHERE TYPE='P'
) can be used as a number table to generate the values from -4 to 6.
5Note: this string is the concatenation of substrings of
(<>.<>)
:"(<" + "(<>" + "(<>." + ... + "(<>.<>)" + "<>.<>)" + ">.<>)" + ... + ">)"
– JungHwan Min – 2017-06-20T11:38:01.5972This would've been a little less "hardcode all the text!" if it were a bigger crowd... – totallyhuman – 2017-06-20T21:56:29.320
@totallyhuman Will think about it next time – LiefdeWen – 2017-06-21T06:15:23.000