# Get dimension of a list [duplicate]

Find out the dimension of a simple nested list:

[] -> 1
[[]] -> 2
[[[]]] -> 3
...


List taken as input, dimension as output. No counting length of strings - list manipulation and loops only. i.e. no getting the length of the input and dividing by 2.

Any language is permitted. Get golfing!

• Isn't it just counting the number of [? – Morgan Thrapp Oct 6 '16 at 18:10
• @WheatWizard I'd say no, only because this doesn't actually require any parsing. Now, it's probably going to end up being a dupe of that, but it's not currently. – Morgan Thrapp Oct 6 '16 at 18:11
• Okay, so I'll count the number of ]. Or divide the length of the input by 2. This challenge in its current state is trivial. The sandbox is a great place to get input on your challenges before posting them. – Morgan Thrapp Oct 6 '16 at 18:13
• Read about patching out approaches. – xnor Oct 6 '16 at 18:23
• avoid Do X without Y. In Python the len() function works for list so I could claim print len(raw_input())/2 is list manipulation, not string counting. – Linus Oct 6 '16 at 18:32

# Jelly, 2 bytes

ŒḊ


TryItOnline

It's a single atom, the depth monad.

• Great solution! – Geno Racklin Asher Oct 6 '16 at 18:25

# Brain-Flak, 443632 26 + 3 = 29 bytes

Try it online

([])({<({}[()()])>()}{}<>)


+3 bytes from the -a flag.

## Explanation

([])                         #Push the stack height
{<({}[()()])>()}{}      #For loop decrement by 2
(                  <>)   #Push number of runs to the offstack


# Retina, 2 1 bytes

]


Just Regex.

One byte to Martin Ender.

• ] saves a byte. – Martin Ender Oct 6 '16 at 18:19
• Invalid since the last edit – TuxCrafting Oct 6 '16 at 18:21