aboutsummaryrefslogtreecommitdiff
path: root/examples/working-compiler/curry.test
blob: f641fb0542aec4522c73583e8543238cb2f08b63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ _ ==f _ sys .typed .inputs ==inputs
          sys .typed .outputs ==outputs
  inputs len 2 lt { f } {
    { "t from curry should never execute" die }
      [ inputs len 1 sub inputs * ] outputs '' ==t
    0 inputs len 2 sub range reverse { ==i t [ i inputs * ] [ t ] '' =t } each
    1 inputs len range reverse { ==i
      f < =*g { { g }_ } > -- [ i inputs * ] [ t ] '' =f
      0 t sys .typed .outputs * =t
    } each
    f
  } ? *
} /curry deffd

|add curry ==a
5 5 a * * dump

a sys .typed .inputs dump
a sys .typed .outputs _ dump 0 -01 * ==b
b sys .typed .inputs dump
b sys .typed .outputs _ dump 0 -01 * ==c

3 3 |a |a mul * * dump

# vim: syn=elymas