tekknolagi/scrapscript

Pattern matching on string concatenation

Opened this issue · 2 comments

get_match "bxyz"
. get_match =
  | "a" ++ rest -> "A"
  | "b" ++ rest -> "B"
  | "c" ++ rest -> "C"

Not 100% sure we want this, but we should have some way of implementing something like substring directly in Scrapscript. Pattern matching seems more idiomatic for Scrapscript than indexing directly into a string

huh I kinda like this