I hereby claim:
- I am levjj on github.
- I am levjj (https://keybase.io/levjj) on keybase.
- I have a public key whose fingerprint is 3E82 6587 6849 C5F1 C755 C4D0 AEE8 2C3C 2A03 EDFA
To claim this, I am signing this object:
let function = macro { | |
rule { // proper tail call | |
$n ( $x (,) ... ) { | |
if ($b ... ) return $l:expr ; | |
return $n ( $y:expr (,) ...) ; | |
} | |
} => { | |
function $n ( $( $x ,) ... $xl) { | |
var tmp = {}; | |
while (!($b ...)) { |
I hereby claim:
To claim this, I am signing this object:
(~>) : Signal a -> (a -> b) -> Signal b | |
(~>) = flip lift | |
infixl 4 ~> | |
main : Signal Element | |
main = (fps 25 | |
|> count) | |
~> flip mod 100 | |
~> toFloat | |
~> ngon 3 |
import Window | |
tick : Signal Float | |
tick = (((+) 100) . toFloat . ((flip mod) 100)) <~ count (fps 25) | |
shape : Float -> Form | |
shape i = ngon 5 20 | |
|> filled (hsva (i / 16) 0.5 1.0 1.0) | |
|> rotate (64 / i) | |
|> scale (i / 10) |
// Some minimal class for values with units | |
// (nothing exciting going on...) | |
function Unit(name,val) { | |
this.name = name; | |
this.val = val; | |
} | |
Unit.prototype.toString = function() { | |
return this.val + " " + this.name; | |
} |
macro fac { | |
case infix { $acc:lit | fac 0 } => { return #{$acc} } | |
case infix { $acc:lit | fac $n:lit } => { | |
var acc = #{$acc}, n = #{$n}; | |
var res = acc[0].token.value * n[0].token.value; | |
var n1 = n[0].token.value - 1; | |
return withSyntax($res = [makeValue(res,n)], | |
$n1 = [makeValue(n1,n)]) { | |
return #{$res fac $n1} | |
} |