[Question]
  [
Given a ragged list of positive integers find the size of the largest list contained somewhere in it.
For example:
```
[1,[1,[8,2,[1,2],5,4,9]],2,[],3]
```
Here the answer is 6 because one of the lists has 6 elements and all other lists have fewer.
```
[1,[1,[8,2,[1,2],5,4,9]],2,[],3]
       ^ ^ ^     ^ ^ ^
```
The length doesn't care in any way about the *value* of the elements, so a list can be longer than the list that contains it.
## Task
Given a ragged list of positive integers output the size of the largest list contained somewhere in it. You may take input in any reasonable format.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so answers will be scored in bytes with the goal being to minimize the size of your source-code.
## Testcases
```
[] -> 0
[[]] -> 1
[1,2,3] -> 3
[[1,2,3]] -> 3
[1,2,[],1] -> 4
[1,[1,[8,2,[1,2],5,4,9]],2,[],3] -> 6
```
  
[Answer]
# [Python 2](https://docs.python.org/2/), 40 bytes
```
f=lambda a:a>[]and max(len(a),*map(f,a))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m728oLIkIz_PaMGCpaUlaboWNzXSbHMSc5NSEhUSrRLtomMT81IUchMrNHJS8zQSNXW0chMLNNJ0EjU1oeo1C4oy80oU0jSiDXVAyELHCEQbxeqY6pjoWMbGgvixOsaxUA0wiwA)
Uses Python 2's global ordering: lists are all considered greater than ints. We can also use `>` instead of `>=`, because `[]>[]` is `False` which is the same as `0`, which would be the result anyway from the `max(len(a),*map(f,a))`.
This also uses the var-args version of `max` which is shorter than constructing a list. Normally we wouldn't be able to do this, because the var-args form of `max` only works with 2 or more arguments, but if we know `a>[]` then `a` is non-empty, so `*map(f,a)` always adds at least one more argument to the call.
# [Whython](https://github.com/pxeger/whython), 34 bytes
```
f=lambda a:max(len(a),*map(f,a))?0
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m728PKOyJCM_b8GCpaUlaboWN5XSbHMSc5NSEhUSrXITKzRyUvM0EjV1tHITCzTSdBI1Ne0NoCq1Cooy80o00jSiDXVAyELHCEQbxeqY6pjoWMbGgvixOsaxmpoQHTA7AA)
When a member is an integer, the `len` call fails; we just catch this and replace the result with `0`. When `a` is an empty list, this also fails because `max` gets only one argument, but catching and returning `0` conveniently fixes this too.
[Answer]
# [R](https://www.r-project.org/), 58 bytes
```
f=function(x)max(l<-length(x),if(l&is.list(x))sapply(x,f))
```
[Try it online!](https://tio.run/##K/qfk5@XnlpcEp@TWVxi@z/NNq00L7kkMz9Po0IzN7FCI8dGNyc1L70kA8jXyUzTyFHLLNYDqQXyNYsTCwpyKjUqdNI0NVEM0gATmpoKygq6dgoGXJhyhjpGOsYwBcZYFCCrwqMMpAJimY4hTJ0JVnXIlAVMF1C7po6pjomOpaYmwiS4w8z@AwA "R ‚Äì Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/) + [free](https://hackage.haskell.org/package/free-5.1.7/docs/Control-Monad-Free.html#t:Free), ~~[40](https://codegolf.stackexchange.com/revisions/240685/1)~~ 37 bytes
*3 bytes saved by Lynn*
Haskell doesn't have a built in ragged list type so we need to build one out of free monads from the [free](https://hackage.haskell.org/package/free-5.1.7/docs/Control-Monad-Free.html#t:Free) package.
```
iter(maximum.((:)=<<length)).fmap(*0)
```
[Try it online!](https://tio.run/##bZBBT4QwEIXv/Io5kNga2ahHApzMJp704M1szLi0y0RaCBTlsP8dpy2smngo6fvmzcwrDY4fqm2XLIMzPChNluwJXEMjNGpQMJI9KtYK9KAUmK6eWgU02isH@InU4jvrzsLL41NSo0PYe58GTABKeJ54hr@eIxcaxGaQMknIjg55AzsE7Cd7dN0AmpXkwwOqC1zbPP/yyUJdG@x5lAhrZglloBDXplyZ/9jCiF@2oNNYFtEkuSUhpwbI859APghHR8gqzu2/2yMCiQ1vaw42lBvrG1rXGk@DvBSKtGK86NITYXAmM5mdELksi6JV9uQaKXc@l7i@lYtBsmXdcfZ@IOvC@@Ls14P8j4Y0dzfxb9wf5PIN "Haskell ‚Äì Try It Online")
## Explanation
First we replace every number with `0` because that is their length, or at least it's the length they should be to make the math work out.
Then from there we make a function `maximum.((:)=<<length`. This looks complicated, but really all it does is take the length of a list of integers, put it on the front of the list and take the maximum of that. So it gives the max of the list or the length of the list whichever is larger.
With this we use `iter` to "tear down" the list. `iter` will start first with the lists containing only integers and run this on them then replace them with their results, and then it will do that again, and again until we've reduced the entire structure down to a single element.
We can visualize the entire process as:
```
[1,[1,[8,2,[1,2],5,4,9]],2,[],3]
[0,[0,[0,0,[0,0],0,0,0]],0,[],0] -- Replace everything with 0
[0,[0,[0,0,2,0,0,0]],0,0,0]
[0,[0,6],0,0,0]
[0,6,0,0,0]
6
```
[Answer]
# [BQN](https://mlochbaum.github.io/BQN/), ~~15~~ 13 bytes[SBCS](https://github.com/mlochbaum/BQN/blob/master/commentary/sbcs.bqn)
-2 bytes thanks to Razetime!
```
{(‚â†‚åà¬¥ùïä‚çü=¬®)√óùï©}
```
[Run online!](https://mlochbaum.github.io/BQN/try.html#code=RiDihpAgeyjiiaDijIjCtPCdlYrijZ89wqgpw5fwnZWpfQoKPuKLiOKfnEbCqCDigKJKc8Ko4p+oIltdIgoiWzEsMiwzXSIKIltbMSwyLDNdXSIKIlsxLDIsW10sMV0iCiJbMSxbMSxbOCwyLFsxLDJdLDUsNCw5XV0sMixbXSwzXSLin6k=)
```
{(‚â†‚åà¬¥ùïä‚çü=¬®)√óùï©}   # Anonymous function taking the list as right argument ùï©
          √óùï©    # Sign of each number, converts all numbers to 1
 =ùï©     ¬®       # For each value in the list
     ùïä‚çü=        #   do a recursive call if it is a list (rank 1)
                #   and return integers unchanged (rank 0)
     ‚â†‚åà¬¥        # Maximum reduction of the results starting with the length of ùï©
```
or questionable 12 bytes:
```
{(‚â†‚åà¬¥ùïä‚éä0¬®)ùï©}
```
[Run online!](https://mlochbaum.github.io/BQN/try.html#code=RiDihpAgeyjiiaDijIjCtPCdlYrijoowwqgp8J2VqX0KCj7ii4jin5xGwqgg4oCiSnPCqOKfqCJbXSIKIlsxLDIsM10iCiJbWzEsMiwzXV0iCiJbMSwyLFtdLDFdIgoiWzEsWzEsWzgsMixbMSwyXSw1LDQsOV1dLDIsW10sM10i4p+p)
This relies on exceeding the maximum call stack size, which means this only works if such a limit exists and is larger than the maximum depth of the ragged list.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 14 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
ŒîDgÀÜ íÀúgƒÄ}‚Ç¨`}¬Ø√†
```
[Try it online](https://tio.run/##yy9OTMpM/f//3BSX9NNtpyadnpN@pKH2UdOahNpD6w8v@P8/2lAHhCx0jEC0UayOqY6JjmVsLIgfq2NsYmpmbmFpEAsA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/c1Nc0k@3nZp0ek76kYbaR01rEmoPrT@84L/OoS3/o6NjdRSiDXWMdIxBDCgLJgaUNISwQcgCJAIUjtUx1THRsQSqAqswNjE1M7ewNIiNBQA).
**Explanation:**
```
Œî             # Loop until the result no longer changes:
 D            #  Duplicate the current list
  g           #  Pop and push its length
   ÀÜ          #  Pop and add this to the global array
     í         #  Filter the items within the list:
     Àú        #   Flatten it
      g       #   Pop and push the length
       ƒÄ      #   Check that this is not 0
    }         #  After the filter:
     ‚Ç¨`       #  Flatten the list one level down
}             # After the loop:
 ¬Ø            # Push the global array with lengths
  √†           # Pop and push its maximum
              # (which is output implicitly as result)
```
Bug-abuses the fact that [`Àú` gives an error on integers](https://tio.run/##yy9OTMpM/f//9Jz//41NTM3MLSwNAA), causing them to be removed after the filter. Most errors in 05AB1E are simply ignored, which would be incorrect in this case, since the `gƒÄ` would result in a truthy result.
---
Could have been **13 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)** in the [legacy version of 05AB1E](https://github.com/Adriandmen/05AB1E/tree/fb4a2ce2bce6660e1a680a74dd61b72c945e6c3b) if all integers were guaranteed to contain less digits than the intended result:
```
Àúg'Œµ√ó√¶'g¬´‚Ç¨.VZ
```
[Try it online](https://tio.run/##MzBNTDJM/f//9Jx09XNbD08/vEw9/dDqR01r9MKi/v@PNtRRAGMLHQUjCNMoVkfBVEfBREfBMjYWIgqkjGMB) or [verify all test cases](https://tio.run/##MzBNTDJM/V9Waa@k8KhtkoKSfeWhlf9Pz0lXP7f18PTDy9TTD60@t/XQumK9sNqo/zr/o6NjdRSiDXWMdIxBDCgLJgaUNISwQcgCJAIUjtUx1THRsQSqAqsAKgcA).
```
Àú             # Flatten the (implicit) input-list
 g            # Pop and push its length
  'Œµ√ó        '# Push a string of that many "Œµ"
     √¶        # Pop and push the powerset of this string
              # (the prefixes would be enough, but that builtin doesn't include
              # an empty string which the powerset builtin does)
      'g¬´    '# Append a trailing "g" to each
         ‚Ç¨    # Map over each string
          .V  #  Execute it as 05AB1E code with the (implicit) input-list
              #  (where `Œµ` is a map, and `g` pushes the length)
            Z # Push the flattened maximum of this list
              # (which is output implicitly as result)
```
This unfortunately doesn't work if the integers are too big, because the `Œµg` would include the lengths of each inner integer in the resulting list of lists, which could potentially be larger than the intended result.  
[See that it fails if an input-number contains too many digits.](https://tio.run/##MzBNTDJM/f//9Jx09XNbD08/vEw9/dDqR01r9MKi/v@PNtQBIQsdIxBtFKtjqmOiYxkbC@LH6hibmJqZW1gaxAIA)
Minor note: Luckily the `'Œµ√ó` isn't a dictionary word. If we would use `‚Ç¨` instead of `Œµ` it wouldn't work, because [`'‚Ç¨√ó` is the dictionary word for `"view"`](https://tio.run/##MzBNTDJM/f9f/VHTmsPT//8HAA).
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~14~~ ~~13~~ 11 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
√ã¬∂√î¬©√üD√ÉrwUl
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=y7bUqd9Ew3J3VWw&input=WwpbXQpbMSwyLDNdCltbMSwyLDNdXQpbMSwyLFtdLDFdClsxLFsxLFs4LDIsWzEsMl0sNSw0LDldXSwyLFtdLDNdCl0KLW0) (includes all test cases)
```
√ã¬∂√î¬©√üD√ÉrwUl     :Implicit input of array U
√ã               :Map each D
 ¬∂              :  Test for strict equality with
  √î             :    Max with nothing if an integer (which, for some reason, returns an object)
  √î             :    Itself reversed if an array (which works because reversing mutates the array)
   ¬©            :  Logical AND with
    √üD          :   Recursive call with argument D
      √É         :End map
       r        :Reduce by
        w       :  Maximum
         Ul     :  With initial value of length of U
```
[Answer]
# [Python 3](https://docs.python.org/3/), 41 bytes
```
f=lambda x:x*-1or max([len(x),*map(f,x)])
```
[Try it online!](https://tio.run/##FcdBCoAgEEDRq7SckWmRFlTQSWQWRkmBmkiL6fSG8OHx8/deTzK1@i24uB@uk1VUPzyli07AhjOBIKnoMngSZKy53OkFD3ag1ky6qZkmGmlhbs9kGLH@ "Python 3 ‚Äì Try It Online")
-10 bytes thanks to loopy walt with a better way of typechecking
[Answer]
# [Factor](https://factorcode.org/), 41 bytes
```
[ [ array? ] deep-filter longest length ]
```
[Try it online!](https://tio.run/##VY5NC8IwDIbv/RXvH3AwP8CPg0fx4kU8jR3KzOZgdrWNhzH62@vqitRAyJs8b0JqWXFv/O16vpz2kMbIwcLS602qokRldyINbYh50KZVjIMQo8AUI1ysk/rpHEusEhL7Px78eTKZc/slgTtssMYubEV3uOiEL1DMvx5RIny2qNuOyaDrVUOW0ZFq@IHSP6VG5j8 "Factor ‚Äì Try It Online")
Get a list of every list (no matter the depth), then find the length of the longest one. `deep-filter` is like `filter` except instead of traversing elements in a linear fashion, it traverses nested sequences using a depth-first search algorithm. (`deep-reduce` is also an approach that works, but it offers atoms and so it's verbose to check for and ignore them.)
```
                        ! { 1 { 1 { 8 2 { 1 2 } 5 4 9 } } 2 { } 3 }
[ array? ] deep-filter  ! {
                        !     { 1 { 1 { 8 2 { 1 2 } 5 4 9 } } 2 { } 3 }
                        !     { 1 { 8 2 { 1 2 } 5 4 9 } }
                        !     { 8 2 { 1 2 } 5 4 9 }
                        !     { 1 2 }
                        !     { }
                        ! }
longest                 ! { 8 2 { 1 2 } 5 4 9 }
length                  ! 6
```
[Answer]
# [R](https://www.r-project.org/), ~~66~~ 64 bytes
```
f=function(x)"if"(is.list(x)&(l=length(x)),max(l,sapply(x,f)),0)
```
[Try it online!](https://tio.run/##K/r/P802rTQvuSQzP0@jQlMpM01JI7NYLyezuATIVdPIsc1JzUsvyQByNHVyEys0cnSKEwsKcio1KnTSgEIGmv/TNMCqNTUVlBV07RQMuKAChjpGOsYwUWOYKLIUuhxIGGKWjiFM0gQhiUxZwJQC9WjqmOqY6FgCXQPXDrfX7D8A "R ‚Äì Try It Online")
Currently being out-golfed by [Dominic van Essen](https://codegolf.stackexchange.com/a/240683/67312).
[Answer]
# JavaScript, 40 bytes
```
f=a=>a/a||Math.max(a.length,...a.map(f))
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/P8020dYuUT@xpsY3sSRDLzexQiNRLyc1L70kQ0dPTy8RKFKgkaap@b@gKDOvRCNNIzpWU5MLzomOReEa6hjpGKMqgAhhqIqO1TFEEwQhC5AUUD5Wx1THRMcyNhaiFGTmfwA)
# JavaScript, 43 bytes
```
f=a=>Math.max(~~a.length,...a.map?.(f)??[])
```
```
f=a=>Math.max(~~a.length,...a.map?.(f)??[])
console.log(f([]))
console.log(f([1,2,3]))
console.log(f([[1,2,3]]))
console.log(f([1,2,[],1]))
console.log(f([1,[1,[8,2,[1,2],5,4,9]],2,[],3]))
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 9 bytes
```
-Œª[vxnLJG
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCItzrtbdnhuTEpHIiwiIiwiWzEsMixbMyw0LFs0LDVdLDUsWzYsNyw4XSw5LDEwXSw2XSJd)
```
-         # Subtract from self to generate a list with the same shape but only zeroes
 Œª        # A recursive lambda, which automatically gets called with ^
  [       # If it's truthy (a list)
   vx     # Do a recursive call on each item
     nLJ  # Append the length of the list
        G # Get the maximum
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~28~~ 25 bytes
Full program.
```
l‚Üê‚ç¨
{1<|‚â°l,‚àò‚â¢‚Üê‚çµ:‚àá¬®‚çµ}‚éï
‚åà/l
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKO94H/Oo7YJj3rXcFUb2tQ86lyYo/OoY8ajzkVg0a1WQCWHVgAZtY/6pnI96unQzwHp@q8ABgVcQFGvYH8/9WhDHSMd41h1LgwJqAw2KZBMdKyOIXY5ELIAqQAqi9Ux1THRsYyNhegAWgQA "APL (Dyalog Unicode) ‚Äì Try It Online")
`l‚Üê‚ç¨`‚ÄÉinitiate `l` to an empty list
`‚éï`‚ÄÉget evaluated console input  
`{`‚Ä¶`}`‚ÄÉapply the following anonymous lambda to that; the argument is `‚çµ`:
‚ÄÉ`‚çµ`‚ÄÉthe length of the argument  
‚ÄÉ`l,‚àò‚â¢‚Üê‚çµ`‚ÄÉappend `l` with the argument length, giving the argument as pass-through value  
‚ÄÉ`‚â°`‚ÄÉthe depth (nesting level ‚Äî negative if ragged) of the argument  
‚ÄÉ`|` absolute value of that  
‚ÄÉ`1<`‚Ä¶`:`‚ÄÉif that is greater than 1:  
‚ÄÉ‚ÄÉ`‚àá¬®`‚ÄÉrecurse on each element of the argument
`‚åà/l`‚ÄÉ[implicitly print] the largest value of `l` (lit. max-reduce)
[Answer]
# [BQN](https://mlochbaum.github.io/BQN/), 13 bytes
```
{‚åà¬¥‚â†‚ä∏‚àæùïä¬®‚çü=√óùï©}
```
Anonymous function that takes a list and returns an integer. [Run it online!](https://mlochbaum.github.io/BQN/try.html#code=RiDihpAg4oi+4oiY4oaTwqgKCkYg4p+oImNhdCIsICJoZWxsbyLin6k=)
Found independently of [ovs's solution](https://codegolf.stackexchange.com/a/240678/16766), but takes advantage of a 1-byte savings proposed in a comment on that solution by [Razetime](https://codegolf.stackexchange.com/users/80214).
### Explanation
```
{‚åà¬¥‚â†‚ä∏‚àæùïä¬®‚çü=√óùï©}
            ùï©   Start with the argument, which is either a list or an integer
           √ó    Get its sign (applies itemwise over lists): converts all integers to 1
         ‚çü=    Apply this function 0 times to an integer or 1 time to a list:
       ùïä¬®         Map a recursive call over each element
   ‚â†‚ä∏‚àæ         Prepend the length of the list (or 1 if it's an integer)
 ‚åà¬¥            Take the maximum
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 23 bytes
```
‚äûœÖÔº°Ôº¶œÖÔº¶ŒπÔº¶‚ÅºŒ∫‚Å∫Œ∫‚ü¶‚üß‚äûœÖŒ∫Ôº©‚åàÔº•œÖÔº¨Œπ
```
[Try it online!](https://tio.run/##NczBCsIwDAbgu0/RYwPx4FRQdhQPgkLvJYcy1I513Wwb8e1rOzQEPn7Cn86a0E3G5aw4WskoLn7mJAHa1WMKQjKIxf7n@cXGRTmgUI4XNQGA@NeHUlSh90meTEzyZj79yGNxrtfr3T@TLc/qtDlrvcG6B2yqDeEed3gkqplwS5TXb/cF "Charcoal ‚Äì Try It Online") Link is to verbose version of code. Explanation:
```
‚äûœÖÔº°
```
Collect the input list into the list of lists.
```
Ôº¶œÖ
```
Loop over each list.
```
Ôº¶Œπ
```
Loop over each element.
```
Ôº¶‚ÅºŒ∫‚Å∫Œ∫‚ü¶‚üß
```
If adding the empty list to the element results in a copy of the element, ...
```
‚äûœÖŒ∫
```
...then push the element to the list of lists. (Adding the empty list to a scalar results in an empty list, not the scalar.)
```
Ôº©‚åàÔº•œÖÔº¨Œπ
```
Output the maximum of all the lengths of the lists.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 23 bytes
```
Max[Length@#,#0/@(0#)]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n6Zg@983sSLaJzUvvSTDQVlH2UDfQcNAWTNW7X9AUWZeSbSygq6dQlq0cmysgpqCvoNCdXWtjkK1oY6CkY6CMYgJZyPEQUoMoVwwtoAIg2SBwqY6CuY6CpYgDVDFQM3/AQ "Wolfram Language (Mathematica) ‚Äì Try It Online")
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 10 bytes
```
{ƒãl|ƒã‚àã‚Ü∞}·∂†‚åâ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/v/pId07Nke5HHd2P2jbUPty24FFP5///0YY6IGShYwSijWJ1THVMdCxjY0H8WB3j2P9RAA "Brachylog ‚Äì Try It Online")
### Explanation
```
{      }·∂†     Find all possible outputs of the following predicate:
 ƒã                The input is a list
  l               Output its length
   |            OR
    ƒã             The input is a list
     ‚àã            Take an element of that list (creates choice points for each element)
      ‚Ü∞            Recursively call this predicate
         ‚åâ    Final output is the maximum value of the resulting list of possible outputs
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~¬†7¬†~~ 6 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
¬¨√ü‚Ç¨¬ªL·πÄ
```
**[Try it online!](https://tio.run/##y0rNyan8///QmsPzHzWtObTb5@HOhv@H24Hs//@jo2O5dIAEiDTUMdIxBnMhLJhYdKyOIYQNQhYgEaBwrI6pjomOZWwsRAVQYywA "Jelly ‚Äì Try It Online")**
A monadic Link accepting a list containing any strictly positive integers or nested, similar, lists that yields the maximal length list.
### How?
```
¬¨√ü‚Ç¨¬ªL·πÄ - Link, call this "f": list, A
¬¨      - logical NOT (vectorises) - convert all positive integers to zeros so that
                                    we wont implicitly treat them as ranges
  ‚Ç¨    - for each element, E, in A (...if the current A isn't now a zero):
 √ü     -   call this Link (i.e. f(A=E))
    L  - length of A - Note that zero has length one.
   ¬ª   - maximum (vectorises)
     ·πÄ - maximum (of the resulting list)
```
[Answer]
# [Perl 5](https://www.perl.org/), 34 bytes
```
sub f{max@_+0,map ref?f(@$_):0,@_}
```
[Try it online!](https://tio.run/##hZFJT8MwEIXP5FeMKqMkYNKEbuDINIfeQPQCp9SKAjiRRZNYWaSitvz1YMeI7YLlw5vvvRl5kbzezvqu4XAnmpaQx1ZswS7SnR1amq7SNiVk1RWS16GVVbVjxQAxA3oDPgDDQxmzAQRfIMCXeDKwyXfIwD9Uw5jhYMDTH1jvK22qBMMzPMXXjJmwmTz/J6wKz1v87lkMPe7eArWKNwcJjLhLI5SEnwjlNHMiJFwDkKDm8irq0vdm7J3Rw6Y5hONxXpuIrEXZZqPTi3kDwHeSP7f8hQDiysurVqlcKVHKTmuh9KYcYesEcUqVtQS7erWBgH2/foD1rXr4Y990T5Dt1TdEybmPi1RCzbOlPljiEh9HybHvPwA "Perl 5 ‚Äì Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~44~~ 39 bytes
```
f=->d{d*0==0?0:[d.size,*d.map(&f)].max}
```
[Try it online!](https://tio.run/##RYvhCoJAEIT/31MsBVGyyZkWFVw9yLk/LE8SSkRPuFKf/brLIlh2v5mdabrL09pCrE95nwdcCH7mR5mHbflSGOThI6uXi2JFDsxopZSEwAkZeHQcTRzhBmMn4@9r0n/Da1d1aUh@jp@9992TcIsJHlzjk4sJEHbEKFTZ9dYPWrUaG9V2dz0wMKKQ3iEGNXjw17jVlJWG2bw3QkzhMa3SasaAsZHZNw "Ruby ‚Äì Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/) with `-m32` and `-lm`, ~~94~~ ~~88~~ 87 bytes
* -6 thanks to ceilingcat
32-bit mode used to make bit-twiddling of pointers easier.
As C doesn't have any list primitive, I implemented a tagged value list (lists stored as an item have the least significant bit set.) The function simply gets the total length of the current list and checks to see if any sublist has a longer length.
```
f(l,m,i)int*l,*m;{for(m=l,i=0;l;l=l[1])i++;for(;m;m=m[1])*m&1?i=fmax(f(*m^1),i):0;l=i;}
```
[Try it online!](https://tio.run/##rVXbbptAFHznK45cxWLJusmC0yahpD@Q9q1PhEYUQ7LSLkSA3aip@@l19wJ4MYZUaiUL4z0zZ@ZcwMniIUl2u8xmmGOKaF47DDvcf8mK0uYBwzQ495nPAhaSCNHTU18GfO7zgMsTh8/JRxpkPH62M9vhXwkSaa4FJ6D@dveG5glbr1L4UNUrWrx9vLF6R4x@G5wJD/LMqupyndTAaFXDC2wKugJnE7N16oMZcvL0ufZh61uWYAKt7uWx3eCRoJZpvS5zsEX4qS7va7SBORBBsTSoLjSll7XH1Dhkmyl@AkEyR4@VlQUf1e8h@8nm8OtINnm9VyWb6fqQIIkZKxK7oj/SQkyAISwzscWNIgYbv9Vnx/MPS2eGacNC2yaGUNc7FY5XqwbST4PBcP39kbLUFrbkuBCIhdK3yqq8Ccxqjygc8YlhOLIDRwLT@t5o3zptVqbpSOkW9NNysVkAau1lD1nANQiAZna7bm2/EVIRMAT2O7EH@QrFuyZYLUV0V/7YWq3Rp1KsybhTaUtBMnsWwgw1Frs@v27UEBh3mrIqNfFC7WQ1w@DIJRbL3OH9Vq9z0OKxdKdK2@eASJ61pdZpNVGp4VP36GldV/ZMJjAyfoqfKV9zYGn@UD9ew8nqLr/LhXim9tYyB8O0tqyAxzRXz5jWUi@SMApegGD5ucTgqhtxvcCwxHCl7j352jlYFxYuI2Xp7AzCSHzvy/r85fYWdbEwklEWnkfB/kFsICZLIlpWSLCLvQgWN@D1yHrb51RjYfAYiHMMIuxNh0lDH1Fv5A198rf6ZFqfmPrDtqh/n1faEkaYKGfL/9KZTgRDN5TRtk2ZA@FOfi6lR2E0whd4ia@iSHv29BZ4h3aXI3Y9LXnRNco9ZLojTHeyUBllo/NpuO@mw@@nw5ed58HakOOmiDLlDpZidKjG1Ngg6cHUrv5l4mMPynb3O8lY/FDtFtxzdwvG/wA "C (gcc) ‚Äì Try It Online")
Ungolfed:
```
f(l,m,i)int*l,*m;{
  for(m=l,i=0;l;l=l[1]) i++; // Get length of current list
  for(;m;m=m[1])
    *m&1? // Is this a sublist?
      i=fmax(f(*m^1),i): // Is the sublist longer?
    0;
  l=i;
}
```
[Answer]
# [tinylisp](https://github.com/dloscutoff/Esolangs/tree/master/tinylisp), ~~65~~ 56 bytes
```
(load library
(d M(q((x)(i(v x)1(max(c(length x)(map M x
```
[Try it online!](https://tio.run/##PYpRDoIwEET/OcV8zn62aKKH6CEqGGyyVkBiyunrCsHsJjvv7Swpr5reY63UV@yh6TbHeW3YI3AiizDxgyKOz1jYUe95WB4mjEcElMqAnLSxww4UW9lgooNHu2dwJ5Hji01Y3/3rNhf4n5czTriKeEpbvw "tinylisp ‚Äì Try It Online")
-9 bytes thanks to DLosc's suggestion for type abuse.
[Answer]
# [Julia 1.0](http://julialang.org/), ~~39~~ 34 bytes
```
~a::Int=1
~a=max(length(a),.~a...)
```
[Try it online!](https://tio.run/##yyrNyUw0rPj/vy7Rysozr8TWkKsu0TY3sUIjJzUvvSRDI1FTR68uUU9PT/M/l0NxRn65Ql10LJwVHYtgG@oY6RgjSUH4qPLRsTqGyCIgZAESB0rG6pjqmOhYxsZC1AGN@g8A "Julia 1.0 ‚Äì Try It Online")
Pretty easy to get a general idea of how this works. The `.~(a)` is way of recursively mapping our function (which we've called `~`) on the elements of a.
(-5 bytes thanks to @MarcMush - making use of dispatch instead of the `isa` check.)
]