I want to do a functional like pattern match to get the first two elements, and then the rest of an array return value.
For example, assume that perms(x) returns a list of values, and I want to do this:
seq=perms(x)
a = seq[0]
b = seq[1]
rest = seq[2:]
Of course I can shorten to:
[a,b] = seq[0:2]
rest = seq[2:]
Can I use some notation to do this?
[a,b,more] = perms(x)
or conceptually:
[a,b,more..] = perms(x)
PROLOG & functional languages do list decomposition so nicely like this!