thautwarm / Site-33

https://thautwarm.github.io/Site-33/
10 stars 0 forks source link

pattern matching use case #4

Open thautwarm opened 2 years ago

thautwarm commented 2 years ago

handling information stored in a sequence.

before:

info1 = seq[1]
info2 = seq[2]
....

info3 = seq[3:length(info2)+3]

after:

match seq with
| [info1, info2, args...] -> args[:length(info2)]

unexpected bugs from hard encoding (seq[3:length(info2)+3]) is eliminated.