arliss_obsidian/fp/Language/Expressions/Lambda Functions.md
Orion Kindel 3ee2a9bbbd
update
2024-09-24 17:52:08 -05:00

425 B

lambda functions are anonymous functions (as opposed to Functions) that can be written anywhere:

\ <params> -> <body>
prependHello a = "hello, " <> a

appendName = \a -> a <> "henry!"

str = appendName $ prependHello ""
-- hello, henry!

their parameters can destructure their arguments:

let
  getFoo = \{foo} -> foo
in
  getFoo {foo: "hello"}
-- "hello"