You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jekyll: a hyper-declarative, statically-typed programming language around environment manipulation
# x is introduced to the environment
{ ..?e } → { x:=3 ; ..?e }
# y too ; ?e is not the same row variable as the one above
{ ..?e } → { y:=5 ; ..?e }
# matching the current context on one that contains an x and a y# which allows us to add them to introduce y
{ x ; y ; ..?e } → { z:=x+y ; ..?e }
# this is equivalent to the code above but written in a "one-shot" style
{ .. } as ?e
→ { x:=3 ; ..?e } as ?f
→ { y:=5 ; ..?f } as ?g
→ { z:=x+y ; ..?g }
# the environment contains the types Int, IO, List that we will use,# so let's explicit them
{ IO ; List ; Nat ; .. } as ?e# plain [ ] are used for lists of statements
→ { a:= [:3, 5, 2:] ; ..?e } as ?f# all parameters expect keyword arguments (although they can be omitted when using pipes)
→ { b:= (ListNat).mapped (func:= _ *3-1) (over:=a) ; ..?f } as ?g
→ { c:= (ListNat).mapped (func:=Nat.as_string) (over:=b) ; ..?g }
# this doesn't manipulate the environment
(ListNat).iterated (func:=IO.Terminal.print) (over:=c)
# no need to write down the state of the environment before the introduction# of variables if we have no dependency on it
→ { x:=3 ; .. }
{ String ; .. } as ?e# functions
→ { greetname:="Hello, {name : String}!"name ; ..?e } as ?f# by the way, `greet := "Hello, {name : String}!"` also works# with local bindings!
→ { one_plus_two () := [ → { x:=1 ; y:=2 } ; x+y ] ; ..?f }