It seems to me that
(and (typep x 'integer) (>= x low) (<= x high))
and
(typep x `(integer ,low ,high))
are computationally equivalent. Is the latter form acceptable style-wise?
+ ·············@swipnet.se (Peter Lewerin):
| It seems to me that
|
| (and (typep x 'integer) (>= x low) (<= x high))
|
| and
|
| (typep x `(integer ,low ,high))
|
| are computationally equivalent. Is the latter form acceptable style-wise?
I don't know, but I think
(and (typep x 'integer) (<= low x high))
is preferable to the first one.
--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
than thinking does: but it deprives us of whatever chance there is
of getting closer to the truth. -- C.P. Snow
Harald Hanche-Olsen wrote:
> I don't know, but I think
>
> (and (typep x 'integer) (<= low x high))
>
> is preferable to the first one.
It's the little things about Lisp that make it so cool. I love the fact that
you can say "(<= low x high)." That's just soooo clear and convenient.
--
Dave Roberts, ·············@re-move.droberts.com
Slowly but surely, the programming world is finding Lisp...
http://www.findinglisp.com/blog
* Dave Roberts
> It's the little things about Lisp that make it so cool. I love the fact that
> you can say "(<= low x high)." That's just soooo clear and convenient.
I am not sure if I am a victim of some subtile trolling or is unable
to spot a double sarcasm, men if I interprete your irony here, you
don't find it neither clear nor convenient.
Thus I ask: Is it equal clear and convenient to say (* 3 4 5)?
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, ··············@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 22 85 24 92
* Dave Roberts
> It's the little things about Lisp that make it so cool. I love the fact that
> you can say "(<= low x high)." That's just soooo clear and convenient.
I am not sure if I am a victim of some subtile trolling or is unable
to spot a double sarcasm, men if I correctly interprete your irony
here, you find it neither clear nor convenient.
Thus I ask: Is it equally clear and convenient to say (* 3 4 5)?
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, ··············@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 22 85 24 92
In my opinion.. Yes
On 05 May 2004 09:09:33 +0200, Jon Haugsand <·······@ifi.uio.no> wrote:
> * Dave Roberts
>> It's the little things about Lisp that make it so cool. I love the fact
>> that
>> you can say "(<= low x high)." That's just soooo clear and convenient.
>
> I am not sure if I am a victim of some subtile trolling or is unable
> to spot a double sarcasm, men if I correctly interprete your irony
> here, you find it neither clear nor convenient.
>
> Thus I ask: Is it equally clear and convenient to say (* 3 4 5)?
>
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jon Haugsand <·······@ifi.uio.no> writes:
> * Dave Roberts
> > It's the little things about Lisp that make it so cool. I love the fact that
> > you can say "(<= low x high)." That's just soooo clear and convenient.
>
> I am not sure if I am a victim of some subtile trolling or is unable
> to spot a double sarcasm, men if I correctly interprete your irony
> here, you find it neither clear nor convenient.
I think it's common to think of < as an order predicate where each
number to the right is bigger.
Petter
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
> > * Dave Roberts
> > > you can say "(<= low x high)." That's just soooo clear and convenient.
Petter Gustad
> I think it's common to think of < as an order predicate where each
> number to the right is bigger.
The (and (<= a b) (<= b c)) vs (<= a b c) discussion is interesting;
personally I'm not sure which style I prefer.
However, what I was asking about was whether it is acceptable to
substitute the test
"does this value belong to the type which is the set of integral
values from low to high, inclusive?" (1)
for the test
"does this value occur within the range bounded by low and high?" (2)
I believe that types in CL are defined as sets of values, so (1)
shouldn't be all that obfuscatory.
·············@swipnet.se (Peter Lewerin) writes:
> It seems to me that
>
> (and (typep x 'integer) (>= x low) (<= x high))
>
> and
>
> (typep x `(integer ,low ,high))
>
> are computationally equivalent. Is the latter form acceptable style-wise?
I'd think so, but I'd also think that
(and (integerp x) (<= low x high))
might be clearer.
'mr
--
[Emacs] is written in Lisp, which is the only computer language that is
beautiful. -- Neal Stephenson, _In the Beginning was the Command Line_
yes
P� 3 May 2004 14:17:03 -0700, skrev Peter Lewerin
<·············@swipnet.se>:
> It seems to me that
>
> (and (typep x 'integer) (>= x low) (<= x high))
>
> and
>
> (typep x `(integer ,low ,high))
>
> are computationally equivalent. Is the latter form acceptable
> style-wise?
--
Sender med M2, Operas revolusjonerende e-postprogram: http://www.opera.com/