langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,18 @@
option explicit
class closure
private composition
sub compose( f1, f2 )
composition = f2 & "(" & f1 & "(p1))"
end sub
public default function apply( p1 )
apply = eval( composition )
end function
public property get formula
formula = composition
end property
end class

View file

@ -0,0 +1,26 @@
dim c
set c = new closure
c.compose "ucase", "lcase"
wscript.echo c.formula
wscript.echo c("dog")
c.compose "log", "exp"
wscript.echo c.formula
wscript.echo c(12.3)
function inc( n )
inc = n + 1
end function
c.compose "inc", "inc"
wscript.echo c.formula
wscript.echo c(12.3)
function twice( n )
twice = n * 2
end function
c.compose "twice", "inc"
wscript.echo c.formula
wscript.echo c(12.3)