Even less interesting is that this order of evaluation is built into
the definition of + rather than being a general facility of the
language.

That said, I think "right fold" is available as a feature in most
modern lisps (and, of course, if it's not, it's easy to write).

-- 
Raul

On Wed, Jul 4, 2012 at 2:50 PM, Devon McCormick <[email protected]> wrote:
> I recently discovered interactive Lisp mode in emacs - M-ielm - so I
> answered my own question about how Lisp does more generalized
> reduction - e.g. with a non-commutative (non-associative) verb like
> minus.  Unfortunately, it incorporates the less interesting
> left-to-right order of evaluation.
>
> ELISP> (+ 2 3)
> 5
> ELISP> (+ 2 3 5 10)
> 20
> ELISP> (- 2 3 5 10)
> -16
> ELISP> (- 2 3)
> -1
> ELISP> (- 2 3 4)
> -5
> ELISP> (- 2 3 4 5)
> -10
>
> On Wed, Jul 4, 2012 at 2:43 PM, Raul Miller <[email protected]> wrote:
>> On Wed, Jul 4, 2012 at 2:33 PM, Brian Schott <[email protected]> wrote:
>>> Lisp is pretty foreign to me, but I wonder about how to mimic Lisp's
>>> postfix (I hope that's the right term for something like "sum(3 2)" if
>>> that is actually Lisp syntax)?
>>
>> Lisp syntax is:
>>
>> (sum 3 2)
>>
>> The equivalent J expression would be:
>>
>>    +/3 2
>>
>> I think you're getting at the issue of lisp argument passing?  If so,
>> I can try spelling out what I was trying to say about it.
>>
>> --
>> Raul
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
> --
> Devon McCormick, CFA
> ^me^ at acm.
> org is my
> preferred e-mail
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to