tekknolagi / scrapscript

A functional, content-addressable programming language.
https://scrapscript.fly.dev/repl
Other
170 stars 4 forks source link

Pattern matching on string concatenation #68

Open gregorybchris opened 6 months ago

gregorybchris commented 6 months ago
get_match "bxyz"
. get_match =
  | "a" ++ rest -> "A"
  | "b" ++ rest -> "B"
  | "c" ++ rest -> "C"
gregorybchris commented 6 months ago

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

tekknolagi commented 6 months ago

huh I kinda like this