From: Peter Lewerin
Subject: Style question
Date: 
Message-ID: <b72f3640.0405031317.55581464@posting.google.com>
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?

From: Harald Hanche-Olsen
Subject: Re: Style question
Date: 
Message-ID: <pcobrl5kug3.fsf@shuttle.math.ntnu.no>
+ ·············@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
From: Dave Roberts
Subject: Re: Style question
Date: 
Message-ID: <z%%lc.25498$IG1.1104744@attbi_s04>
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
From: Jon Haugsand
Subject: Re: Style question
Date: 
Message-ID: <dm65bbbbva.fsf@nelja.ifi.uio.no>
* 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
From: Jon Haugsand
Subject: Re: Style question
Date: 
Message-ID: <dm1xlzbb9u.fsf@nelja.ifi.uio.no>
* 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
From: John Thingstad
Subject: Re: Style question
Date: 
Message-ID: <opr7iucxappqzri1@firmanav-hvb4va.upc.no>
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/
From: Petter Gustad
Subject: Re: Style question
Date: 
Message-ID: <m3u0yv187x.fsf@scimul.dolphinics.no>
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?
From: Peter Lewerin
Subject: Re: Style question
Date: 
Message-ID: <b72f3640.0405060205.73f8748@posting.google.com>
> > * 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.
From: rydis (Martin Rydstr|m) @CD.Chalmers.SE
Subject: Re: Style question
Date: 
Message-ID: <w4cd65lp0pi.fsf@boris.cd.chalmers.se>
·············@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_
From: John Thingstad
Subject: Re: Style question
Date: 
Message-ID: <opr7gdeigsxfnb1n@news.chello.no>
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/