Skip to content

Instantly share code, notes, and snippets.

@developedby
Created October 28, 2023 09:48
Show Gist options
  • Save developedby/25c4d835e33bbd13a14de7a1da2cf359 to your computer and use it in GitHub Desktop.
Save developedby/25c4d835e33bbd13a14de7a1da2cf359 to your computer and use it in GitHub Desktop.
Some = λx λs λn (s x)
None = λs λn n
Tie = λval λlft λrgt λtie λnew (tie val lft rgt)
New = λtie λnew new
BitO = λx λo λi λe (o x)
BitI = λx λo λi λe (i x)
BitE = λo λi λe e
Got = λmap (map GotT GotN)
GotT =
λval λlft λrgt λkey (key
λpred (GotL val (Got lft pred) rgt)
λpred (GotR val lft (Got rgt pred))
((Tie val lft rgt), val)
)
GotN = λkey (New, None)
GotL = λval λlft λrgt
let (lft, res) = lft
((Tie val lft rgt), res)
GotR = λval λlft λrgt
let (rgt, res) = rgt
((Tie val lft rgt) res)
main =
let map = (Tie (Some 1) New New)
let key = BitE
(Got map key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment