Article View: comp.lang.misc
Article #612Re: What I'd really like to see in an if-statement...
From: Evan Kirshenbaum
Date: Tue, 05 Sep 1989 18:16
Date: Tue, 05 Sep 1989 18:16
35 lines
1861 bytes
1861 bytes
In article <89723@ti-csl.csc.ti.com> gateley@m2.UUCP (John Gateley) writes:
>In article <282@castle.ed.ac.uk> db@lfcs.ed.ac.uk (Dave Berry) writes:
>>In article <13359@megaron.arizona.edu> gudeman@arizona.edu (David Gudeman) writes:
>>>In article <8620@batcomputer.tn.cornell.edu> lacey@batcomputer.tn.cornell.edu (John Lacey) writes:
>>>>In talking about _Real Conditionals_ :),
>>>>So far, Lisp, Icon, and BCPL have all tried and failed to meet the challenge
>>>
>>>Urr. I thought both Lisp and Icon succeeded. [...]
>>I agree about Icon, but are you sure about Lisp? I thought that
>>(< a b) returned either t or nil. If so, although it can handle
>>cases like (< a b c d), it can't handle (<= (< a b) c).
In scheme, one should be able to do something of the form:
(extend-syntax (order)
((order) '#!true)
((order a op b more ...)
(with ((temp (gensym)))
(let ((temp b))
(and (op a temp)
(order temp more ...))))))
which would allow you to write infix relations of the form
(order a < b >= c != d = e divides f)
This allows any binary operation to be used as an operator, and should
be trivially optimized by the compiler.
Evan Kirshenbaum
HP Laboratories
3500 Deer Creek Road, Building 26U
Palo Alto, CA 94304
kirshenbaum@hplabs.hp.com
(415)857-7572
Technical Details
Message-ID:
<5410@hplabsb.HP.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ucbvax!hplabs!hplabsb!kirshenbReferences:
<13359@megaron.arizona.edu> <282@castle.ed.ac.uk> <89723@ti-csl.csc.ti.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!ucbvax!hplabs!hplabsb!kirshenb From: kirshenb@hplabsb.HP.COM (Evan Kirshenbaum) Newsgroups: comp.lang.misc Subject: Re: What I'd really like to see in an if-statement... Message-ID: <5410@hplabsb.HP.COM> Date: 5 Sep 89 18:16:35 GMT References: <13359@megaron.arizona.edu> <282@castle.ed.ac.uk> <89723@ti-csl.csc.ti.com> Reply-To: kirshenb@hplabsb.UUCP (Evan Kirshenbaum) Organization: Hewlett-Packard Labs, Palo Alto, CA Lines: 35