SainTiss wrote:
> I was suggested to use something similar to Scheme's 'apply', but I didn't 
> find a similar construct in jolt... Is there?
>   
In Lisp-ish languages 'apply' is something like:

    (define apply
         (lambda (func args)
             (eval (cons func args))))

That is, assuming func is a function and args is a list of arguments, 
append func to the front of the args and eval the result.

The difficutly in jolt is that while in lisp, args is a linked list, and 
appending func to it doesn't change it, in jolt args is an Array, which 
has to be copied to avoid changing it, so you want
to do something like ArrayedCollection::addFront, but do it into a new 
array rather than
modifying the existing array.  One way to do that would be to add a new 
constructor to Expression (say Expression::function:arguments:) which 
does just that.

So then apply is just:

     (define apply
          (lambda (func args)
              [[Expression function: func arguments: args] eval]))


                                                                    
-gavin...


_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to