in reply to Re: An infix fix
in thread An infix fix

Lots of Irritating Silly Paranthesis? Hope not! (I like functional languages though, it's just the syntax of Lisp that makes me dizzy.)

And actually is the result (3 30 7 9) or 222?

RPN? You mean Reverse Polish Notation? Oh my. Man you do have some pretty perverted tastes ;-)

Jenda
We'd like to help you learn to help yourself
Look around you, all you see are sympathetic eyes
Stroll around the grounds until you feel at home
   -- P. Simon in Mrs. Robinson

Replies are listed 'Best First'.
Re^3: An infix fix
by dragonchild (Archbishop) on Mar 23, 2005 at 14:03 UTC
    I don't know LISP and even I know the result is 222. The prefix operators are greedy.

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      It's quite a few years since I did anything with Lisp myself so I do not know whether the + and * was made to accept a variable number of parameters or just two. Suppose you defined a function yourself and it expected two parameters, what would the result of (foo 1 2 3) be then? The same as (foo 1 2) or ((foo 1 2) 3) or even (foo (foo 1 2) 3) or (foo 1 (foo 2 3))?

      Jenda
      We'd like to help you learn to help yourself
      Look around you, all you see are sympathetic eyes
      Stroll around the grounds until you feel at home
         -- P. Simon in Mrs. Robinson

        It depends. I suspect, and this is without study, that Lisp functions are naturally greedy and that the fact you only used two parameters is your problem, not Lisp's. I do remember in Paul Graham's book on Lisp (the few chapters I did read) that the mathematical operators are greedy, so the answer would be 222.

        Being right, does not endow the right to be rude; politeness costs nothing.
        Being unknowing, is not the same as being stupid.
        Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
        Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Re^3: An infix fix
by hardburn (Abbot) on Mar 23, 2005 at 14:09 UTC

    It's all about efficiency, both of the computer and yourself. LISP has an extremely simple grammar and makes it easy to operate on large lists. RPN lets you do away with operator precedence tables without using parans.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.