[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jul 16 12:39:52 1993 
Subject:Re:quickie test 
From:jonr (Jonathan Rowe) 
Volume-ID:930716.02 


Robin Popplestone suggests using partial application:

> define get_results( p );
>     lvars p;
>     [% p() %]
> enddefine;

  get_results(dest(%[a b c]%) )

which is all very well if you know the explicit arguments and number of
arguments at compile time.

However, I was trying to write an infix operator & which has the following
behaviour:

    (f & g)(...)
means:
    g gets its arguments, f gets its arguments, f runs, g runs

(see my recent posting describing how I did it with pdnargs. A use for this
is for things like:

    : syssort( [[1 a][2 b][3 c], hd & hd <> nonop > ) =>
    ** [[3 c][2 b][1 a]]

)

But when writing the definition of &, you don't know in advance what, or even
how many, arguments there will be. I wanted to do something like:

define 6 &( f, g );
    lvars f g  g_result;
    procedure()
        [% g() %] -> g_result;  ;;; OR get_results( g ) -> g_result;
        f();
        explode( g_result );
    endprocedure
enddefine;

So how do I do this?

Jon Rowe