|
|
|
|
|
by kamov
801 days ago
|
|
This isn't quite right, linked lists and trees in functional languages can be represented extremely succintly, i.e. data List a = Nil | Node a (List a)
data Tree a = Leaf a | Node (Tree a) (Tree a)
there is nothing stopping you from writing something like this in JS const list = { kind: 'node', val: 3, next: { kind: 'nil' } };
And then using a switch case to navigate the list/tree matching on the kind field. |
|