Re: infix via code walker hook.

Liste des GroupesRevenir à cl lisp 
Sujet : Re: infix via code walker hook.
De : monnier (at) *nospam* iro.umontreal.ca (Stefan Monnier)
Groupes : comp.lang.lisp
Date : 04. Apr 2025, 19:17:20
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <jwvldsfrecv.fsf-monnier+comp.lang.lisp@gnu.org>
References : 1 2 3
User-Agent : Gnus/5.13 (Gnus v5.13)
  1> (parse-infix '(sin a + b + c + d))
  (sin (+ (+ (+ a b) c)
          d))
>
But, if we put parentheses on the operand of sin, then it's no longer
the unary sin, but a function call with that argument:
>
  2> (parse-infix '(sin (a) + b + c + d))
  (+ (+ (+ (sin a) b)
c)
     d)

For someone coming from "statically typed functional programming", this
is *very* weird.
All those languages (Haskell/OCaml/SML/Coq/Idris/Agda/...) treat

    (sin a + b + c + d)

the same as

    (sin (a) + b + c + d)

I think it is already better than SRFI-105 curly braces and some
other systems.

A related effort was Honu:
https://users.cs.utah.edu/plt/publications/gpce12-rf.pdf


        Stefan

Date Sujet#  Auteur
31 Mar 25 * infix via code walker hook.9Kaz Kylheku
2 Apr 25 `* Re: infix via code walker hook.8Kaz Kylheku
4 Apr 25  `* Re: infix via code walker hook.7Kaz Kylheku
4 Apr 25   `* Re: infix via code walker hook.6Stefan Monnier
4 Apr 25    `* Re: infix via code walker hook.5Kaz Kylheku
4 Apr 25     `* Re: infix via code walker hook.4Stefan Monnier
5 Apr 25      +- Re: infix via code walker hook.1Kaz Kylheku
5 Apr 25      `* Re: infix via code walker hook.2Stefan Ram
5 Apr 25       `- Re: infix via code walker hook.1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal