Building a ::SHE+ILA:: parameter list

Elegant Woman in Purple Gown on Wooden Desk
126
0
  • Squishy Plushie's avatar Artist
    Squishy Pl...
  • Prompt
    Read prompt
  • DDG Model
    DaVinci2
  • Access
    Public
  • Created
    2d ago
  • Try

More about Building a ::SHE+ILA:: parameter list

Consider the function call {Foo ("yay", 42, "squee");}
Given that a ::SHE+ILA:: parameter list is a Buf, we can actually construct a parameter list at runtime using the standard FBI opcodes (FBI=Fundamental Buffer Interface), for example:
{List <:: "yay"; List << 42; List << "squee"; Foo List;}
A variable number of parameters can be passed, as the function Foo can get the parameter list count using the # operator, for example:
Foo <:: [](parm){
count <:: #parm; i <:: 1;
{* i.le.count : ttyout(parm[i++]); *}; }
This uses i as a subscript into the parameter list and loops while i is less than or equal to the number of parameters, calling ttyout for each parameter. (Remember that ::SHE+ILA:: is an Origin 1 language, so indices start at 1, as we use slot 0 as the symbol table.)

Comments


Loading Dream Comments...

Discover more dreams from this artist