Currying in ::SHE+ILA:: [$4D]

Elegant Woman in Purple Gown at Lavish Dining Table
102
2
  • Squishy Plushie's avatar Artist
    Squishy Pl...
  • Prompt
    Read prompt
  • DDG Model
    DaVinci2
  • Access
    Public
  • Created
    1d ago
  • Try

More about Currying in ::SHE+ILA:: [$4D]

Currying is the Comp-Sci term for building a function from another function which embeds some of its parameters, for example :
Foo1 <:: &{ whatever (%!1, %!2, woowoo); }
Here "Foo1" will be called with two parameters, but calls "whatever" with three parameters. A better example is :
Foo2 <:: &{(savedlambda=%!1, savedparam=%!2);
&{(embeddedlambda=savedlambda, embeddedparam=savedparam); embeddedlambda (embeddedparam << &%);}; }
Calling the function "Foo2" with four parameters, for example :
MyNewFunc <:: Foo2 (&myfunc, "hello");
MyNewFunc (123, 456);
which effectively calls myfunc ("hello", 123, 456);
results in a function which embeds and calls the function supplied as the first parameter, passing the second parameter implicitly.
E&OE (untested code) :)

Comments


Loading Dream Comments...

Discover more dreams from this artist