|
|
|
|
|
by devmunchies
1937 days ago
|
|
Does gleam let me destructure a list so that I can bind the head and body each to a variable? e.g. in f# let splitHeadAndTail = function
| h :: [] -> printfn "got head and EMPTY tail"
| h :: t -> printfn "got head and tail"
| [] -> printfn "got empty list"
The example in their docs does a 1:1 map and doesn't show if you can bind the whole tail[1][1]: https://gleam.run/book/tour/case-expressions.html#destructur... |
|
It'd be kind of silly to create a greenfield BEAM language that doesn't expose one of the most fundamental operations you can do in BEAM bytecode, and that every list-processing function ultimately relies upon :)