Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,11 @@
class Writer{
fcn init(x){ var X=x, logText=Data(Void," init \U2192; ",x.toString()) }
fcn unit(text) { logText.append(text); self }
fcn lift(f,name){ unit("\n %s \U2192; %s".fmt(name,X=f(X))) }
fcn bind(f,name){ lift.fp(f,name) }
fcn toString{ "Result = %s\n%s".fmt(X,logText.text) }
fcn root{ lift(fcn(x){ x.sqrt() },"root") }
fcn half{ lift('/(2),"half") }
fcn inc { lift('+(1),"inc") }
}

View file

@ -0,0 +1 @@
Writer(5.0).root().inc().half().println();

View file

@ -0,0 +1,2 @@
w:=Writer(5.0);
Utils.Helpers.fcomp(w.half,w.inc,w.root)(w).println(); // half(inc(root(w)))

View file

@ -0,0 +1,3 @@
w:=Writer(5.0);
root,inc,half := w.bind(fcn(x){ x.sqrt() },"root"), w.bind('+(1),"+ 1"), w.bind('/(2),"/ 2");
root(); inc(); half(); w.println();