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,9 @@
package require Tcl 8.6
proc partial {f1 f2} {
variable ctr
coroutine __curry[incr ctr] apply {{f1 f2} {
for {set x [info coroutine]} 1 {} {
set x [{*}$f1 $f2 [yield $x]]
}
}} $f1 $f2
}

View file

@ -0,0 +1,15 @@
proc fs {f s} {
set r {}
foreach n $s {
lappend r [{*}$f $n]
}
return $r
}
proc f1 x {expr {$x * 2}}
proc f2 x {expr {$x ** 2}}
set fsf1 [partial fs f1]
set fsf2 [partial fs f2]
foreach s {{0 1 2 3} {2 4 6 8}} {
puts "$s ==f1==> [$fsf1 $s]"
puts "$s ==f2==> [$fsf2 $s]"
}