Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Help: I can't find a simple CL function/idiom
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  17 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Michael Naunton  
View profile  
 More options Apr 8 2002, 7:44 pm
Newsgroups: comp.lang.lisp
From: m...@bellatlantic.net (Michael Naunton)
Date: Mon, 08 Apr 2002 23:44:27 GMT
Local: Mon, Apr 8 2002 7:44 pm
Subject: Help: I can't find a simple CL function/idiom
I want to write something like

(apply #'or alist)

but of course #'or is a macro.  I wound up writing

(some (lambda (e) e) alist)

but that seems a bit strained.  I've played "guess the word" in the
HyperSpec, but can't find the idiom I want.

Any help would be appreciated,
Thanks,
Michael Naunton


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dr. Edmund Weitz  
View profile  
 More options Apr 8 2002, 7:51 pm
Newsgroups: comp.lang.lisp
From: e...@agharta.de (Dr. Edmund Weitz)
Date: 09 Apr 2002 01:50:29 +0200
Local: Mon, Apr 8 2002 7:50 pm
Subject: Re: Help: I can't find a simple CL function/idiom

m...@bellatlantic.net (Michael Naunton) writes:
> I want to write something like

> (apply #'or alist)

> but of course #'or is a macro.  I wound up writing

> (some (lambda (e) e) alist)

> but that seems a bit strained.  I've played "guess the word" in the
> HyperSpec, but can't find the idiom I want.

Maybe (find-if-not #'null alist).

--

Dr. Edmund Weitz
Hamburg
Germany

The Common Lisp Cookbook
<http://cl-cookbook.sourceforge.net/>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Apr 8 2002, 7:59 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Mon, 08 Apr 2002 23:59:48 GMT
Local: Mon, Apr 8 2002 7:59 pm
Subject: Re: Help: I can't find a simple CL function/idiom
* Michael Naunton
| I wound up writing
|
| (some (lambda (e) e) alist)
|
| but that seems a bit strained.

  The function identity is predefined.

| I've played "guess the word" in the HyperSpec, but can't find the idiom I
| want.

  For a single list of arguments, some may or may not be misleading.

(find-if #'identity list)
(find-if-not #'null list)

  Note that the name "alist" connotes association lists, for which this
  operation makes little sense.

///
--
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  Post with compassion: http://home.chello.no/~xyzzy/kitten.jpg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Moore  
View profile  
 More options Apr 8 2002, 8:05 pm
Newsgroups: comp.lang.lisp
From: tmo...@sea-tmoore-l.dotcast.com (Tim Moore)
Date: 9 Apr 2002 00:05:17 GMT
Local: Mon, Apr 8 2002 8:05 pm
Subject: Re: Help: I can't find a simple CL function/idiom

On Mon, 08 Apr 2002 23:44:27 GMT, Michael Naunton <m...@bellatlantic.net> wrote:
>I want to write something like

>(apply #'or alist)

>but of course #'or is a macro.  I wound up writing

>(some (lambda (e) e) alist)

>but that seems a bit strained.  I've played "guess the word" in the
>HyperSpec, but can't find the idiom I want.

You could do (some #'identity alist).

You should avoid using apply for these kinds of idioms because you can
run into the call arguments limit fairly quickly.

Tim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "I can't find a simple CL function/idiom" by Joe Marshall
Joe Marshall  
View profile  
 More options Apr 8 2002, 8:10 pm
Newsgroups: comp.lang.lisp
From: "Joe Marshall" <prunesqual...@attbi.com>
Date: Mon, 08 Apr 2002 23:56:28 GMT
Local: Mon, Apr 8 2002 7:56 pm
Subject: Re: I can't find a simple CL function/idiom

"Michael Naunton" <m...@bellatlantic.net> wrote in message

news:slrnab4bq4.fgo.mmn@mmn.bellatlantic.net...

> I want to write something like

> (apply #'or alist)

> but of course #'or is a macro.  I wound up writing

> (some (lambda (e) e) alist)

> but that seems a bit strained.  I've played "guess the word" in the
> HyperSpec, but can't find the idiom I want.

(some #'identity alist)
(find-if #'identity alist)

Still kinda odd looking.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Help: I can't find a simple CL function/idiom" by Kent M Pitman
Kent M Pitman  
View profile  
 More options Apr 8 2002, 8:18 pm
Newsgroups: comp.lang.lisp
From: Kent M Pitman <pit...@world.std.com>
Date: Tue, 9 Apr 2002 00:16:45 GMT
Local: Mon, Apr 8 2002 8:16 pm
Subject: Re: Help: I can't find a simple CL function/idiom

m...@bellatlantic.net (Michael Naunton) writes:
> I want to write something like

> (apply #'or alist)

For all but the most pathological alists (i.e., association lists),
FIRST will usually do the trick here. :-)

Maybe you meant (apply #'or list).

> but of course #'or is a macro.  I wound up writing

> (some (lambda (e) e) alist)

> but that seems a bit strained.  I've played "guess the word" in the
> HyperSpec, but can't find the idiom I want.

What's it called in other languages?

Lisp has a half dozen ultra trivial ways of saying this, which for as
often as it seems to come up seems more than adequate.  

 (loop for x in list thereis x)

 (find-if-not #'null x) ;or #'not

 (find-if #'identity x)

 (some #'identity x)

 (eval `(or ,@(mapcar #'(lambda (x) `',x) list)))

 ...

In the rare situation that I've had a system where this is common, I
have usually written a *OR or *AND function.

It's unfair to take an arbitrary action and complain that you have to
play "guess the word" when the thing you want to do is not even expressable
in most other languages.  The reason it's called a programming language
is that sometimes you have to program.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ozan s yigit  
View profile  
 More options Apr 9 2002, 3:45 pm
Newsgroups: comp.lang.lisp
From: ozan s yigit <o...@blue.cs.yorku.ca>
Date: 09 Apr 2002 15:41:29 -0400
Local: Tues, Apr 9 2002 3:41 pm
Subject: Re: Help: I can't find a simple CL function/idiom
Kent M Pitman:
        ...

> It's unfair to take an arbitrary action and complain that you have to
> play "guess the word" when the thing you want to do is not even expressable
> in most other languages.

um, don't tempt the perl hackers who may be listening in. if there is some
part of common lisp perl programmers want but don't yet have, it will show
up in a perl6 rfc soon. :) [obhref: http://dev.perl.org/rfc/]

oz
--
you take a banana, you get a lunar landscape. -- j. van wijk


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Antoniotti  
View profile  
 More options Apr 9 2002, 4:26 pm
Newsgroups: comp.lang.lisp
From: Marco Antoniotti <marc...@cs.nyu.edu>
Date: 09 Apr 2002 16:26:45 -0400
Local: Tues, Apr 9 2002 4:26 pm
Subject: Re: Help: I can't find a simple CL function/idiom

ozan s yigit <o...@blue.cs.yorku.ca> writes:

> Kent M Pitman:
>    ...
> > It's unfair to take an arbitrary action and complain that you have to
> > play "guess the word" when the thing you want to do is not even expressable
> > in most other languages.

> um, don't tempt the perl hackers who may be listening in. if there is some
> part of common lisp perl programmers want but don't yet have, it will show
> up in a perl6 rfc soon. :) [obhref: http://dev.perl.org/rfc/]

As it did in a Scheme SRFI a few years ago :)

Cheers

--
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Reini Urban  
View profile  
 More options Apr 9 2002, 4:46 pm
Newsgroups: comp.lang.lisp
From: rur...@x-ray.at (Reini Urban)
Date: Tue, 09 Apr 2002 20:37:59 GMT
Local: Tues, Apr 9 2002 4:37 pm
Subject: Re: Help: I can't find a simple CL function/idiom

ozan s yigit wrote:
>Kent M Pitman:
>> It's unfair to take an arbitrary action and complain that you have to
>> play "guess the word" when the thing you want to do is not even expressable
>> in most other languages.

>um, don't tempt the perl hackers who may be listening in. if there is some
>part of common lisp perl programmers want but don't yet have, it will show
>up in a perl6 rfc soon. :) [obhref: http://dev.perl.org/rfc/]

yes, but we don't care.
they haven't even got the underlying basics (such as types) but want
catchy idioms. only perl hackers are proud of this post-modern
our-parser-understands-every-shit aeh we-do-it-all thing.

for looking up common lisp idioms and perl programmers there's the
cl-cookbook project: http://cl-cookbook.sf.net/
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/film/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Naunton  
View profile  
 More options Apr 9 2002, 8:33 pm
Newsgroups: comp.lang.lisp
From: m...@bellatlantic.net (Michael Naunton)
Date: Wed, 10 Apr 2002 00:33:45 GMT
Local: Tues, Apr 9 2002 8:33 pm
Subject: Re: Help: I can't find a simple CL function/idiom
On Tue, 9 Apr 2002 00:16:45 GMT, Kent M Pitman <pit...@world.std.com> wrote:

>m...@bellatlantic.net (Michael Naunton) writes:

>> I want to write something like

>> (apply #'or alist)

>For all but the most pathological alists (i.e., association lists),
>FIRST will usually do the trick here. :-)

Thank you, after reading previous posts on the topic of naming, I will
henceforth call a list a list.

<snip>

>In the rare situation that I've had a system where this is common, I
>have usually written a *OR or *AND function.
>It's unfair to take an arbitrary action and complain that you have to
>play "guess the word" when the thing you want to do is not even expressable
>in most other languages.  The reason it's called a programming language
>is that sometimes you have to program.

But, every other arbitrary action I've wanted to take has had a terse or
idiomatic expression in Common Lisp :)

Thanks to all for your help,
-- MMN


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paolo Amoroso  
View profile  
 More options Apr 10 2002, 5:34 am
Newsgroups: comp.lang.lisp
From: Paolo Amoroso <amor...@mclink.it>
Date: Wed, 10 Apr 2002 11:28:59 +0200
Local: Wed, Apr 10 2002 5:28 am
Subject: Re: Help: I can't find a simple CL function/idiom
On 09 Apr 2002 15:41:29 -0400, ozan s yigit <o...@blue.cs.yorku.ca> wrote:

> um, don't tempt the perl hackers who may be listening in. if there is some
> part of common lisp perl programmers want but don't yet have, it will show
> up in a perl6 rfc soon. :) [obhref: http://dev.perl.org/rfc/]

Hmmm... does this imply that Mr. Wall's opinion on Lisp changed in some
way?

Paolo
--
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://www.paoloamoroso.it/ency/README
[http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Reini Urban  
View profile  
 More options Apr 10 2002, 10:36 am
Newsgroups: comp.lang.lisp
From: rur...@x-ray.at (Reini Urban)
Date: Wed, 10 Apr 2002 14:29:44 GMT
Local: Wed, Apr 10 2002 10:29 am
Subject: Re: Help: I can't find a simple CL function/idiom

Paolo Amoroso wrote:
>On 09 Apr 2002 15:41:29 -0400, ozan s yigit <o...@blue.cs.yorku.ca> wrote:
>> um, don't tempt the perl hackers who may be listening in. if there is some
>> part of common lisp perl programmers want but don't yet have, it will show
>> up in a perl6 rfc soon. :) [obhref: http://dev.perl.org/rfc/]

>Hmmm... does this imply that Mr. Wall's opinion on Lisp changed in some
>way?

not him, but all the others around him.
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/film/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mark Jason Dominus  
View profile  
 More options Apr 15 2002, 3:29 am
Newsgroups: comp.lang.lisp
From: m...@plover.com (Mark Jason Dominus)
Date: Mon, 15 Apr 2002 07:39:59 +0000 (UTC)
Local: Mon, Apr 15 2002 3:39 am
Subject: Re: Help: I can't find a simple CL function/idiom
In article <jQG0PHyI+3cOl+J5WfuR+vicL...@4ax.com>,
Paolo Amoroso  <amor...@mclink.it> wrote:

>On 09 Apr 2002 15:41:29 -0400, ozan s yigit <o...@blue.cs.yorku.ca> wrote:

>> um, don't tempt the perl hackers who may be listening in. if there is some
>> part of common lisp perl programmers want but don't yet have, it will show
>> up in a perl6 rfc soon. :) [obhref: http://dev.perl.org/rfc/]

>Hmmm... does this imply that Mr. Wall's opinion on Lisp changed in some
>way?

I believe Larry's objection to Lisp has always been entirely on
syntactic grounds.

--
Mark Jason Dominus                                               m...@plover.com
Philadelphia Excursions Mailing List:    http://www.plover.com/~mjd/excursions/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dr. Edmund Weitz  
View profile  
 More options Apr 15 2002, 4:09 am
Newsgroups: comp.lang.lisp
From: e...@agharta.de (Dr. Edmund Weitz)
Date: 15 Apr 2002 10:08:28 +0200
Local: Mon, Apr 15 2002 4:08 am
Subject: Re: Help: I can't find a simple CL function/idiom
m...@plover.com (Mark Jason Dominus) writes:

> In article <jQG0PHyI+3cOl+J5WfuR+vicL...@4ax.com>,
> Paolo Amoroso  <amor...@mclink.it> wrote:
> >On 09 Apr 2002 15:41:29 -0400, ozan s yigit <o...@blue.cs.yorku.ca> wrote:

> >> um, don't tempt the perl hackers who may be listening in. if there is some
> >> part of common lisp perl programmers want but don't yet have, it will show
> >> up in a perl6 rfc soon. :) [obhref: http://dev.perl.org/rfc/]

> >Hmmm... does this imply that Mr. Wall's opinion on Lisp changed in some
> >way?

> I believe Larry's objection to Lisp has always been entirely on
> syntactic grounds.

Really? What about this one?

  "Lispers are among the best grads of the
   Sweep-It-Under-Someone-Else's-Carpet School of Simulated
   Simplicity. [Was that sufficiently incendiary? :-)]"

This to me looks as if he's had an overdose of Scheme when he was
younger... :)

Cheers,
Edi.

--

Dr. Edmund Weitz
Hamburg
Germany

The Common Lisp Cookbook
<http://cl-cookbook.sourceforge.net/>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ozan s yigit  
View profile  
 More options Apr 15 2002, 11:00 am
Newsgroups: comp.lang.lisp
From: ozan s yigit <o...@blue.cs.yorku.ca>
Date: 15 Apr 2002 10:45:23 -0400
Local: Mon, Apr 15 2002 10:45 am
Subject: Re: Help: I can't find a simple CL function/idiom
e...@agharta.de (Dr. Edmund Weitz) writes:

> > I believe Larry's objection to Lisp has always been entirely on
> > syntactic grounds.

> Really? What about this one?

>   "Lispers are among the best grads of the
>    Sweep-It-Under-Someone-Else's-Carpet School of Simulated
>    Simplicity. [Was that sufficiently incendiary? :-)]"

that was a 92 post. CL was not quite what it is today. :)

> This to me looks as if he's had an overdose of Scheme when he was
> younger... :)

i think he only paid attention to scheme after he had already designed
and implemented perl. [btw, an important distinction about him is that he
articulates various linguistic aspects of his language, and why he thinks
it works well for programmers, eg. www.wall.org/~larry/natural.html or
state of the onion addresses. maybe his overdose is something else. :-]

oz
--
*double-sigh*cough*cough* -- eli barzilay


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Apr 15 2002, 12:09 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Mon, 15 Apr 2002 16:09:30 GMT
Local: Mon, Apr 15 2002 12:09 pm
Subject: Re: Help: I can't find a simple CL function/idiom
* ozan s yigit <o...@blue.cs.yorku.ca>
| that was a 92 post. CL was not quite what it is today. :)

  It is still much more descriptive of people's experiences with Scheme.
  Even in 1992, Common Lisp was a real programming language suitable for
  production use.  It is unlikely that anyone would seriously argue against
  Common Lisp at that time as being "simulated simplicity".  That fake idea
  of "elegance" and "simplicity" has always been something to associated
  with Scheme and no other Lisp-lookalike.

| i think he only paid attention to scheme after he had already designed
| and implemented perl. [btw, an important distinction about him is that he
| articulates various linguistic aspects of his language, and why he thinks
| it works well for programmers, eg. www.wall.org/~larry/natural.html or
| state of the onion addresses. maybe his overdose is something else. :-]

  I think the Common Lisp designers were years ahead of him, there.  The
  Scheme folks obviously were not, focusing instead on formal semantics.
  It is kind of funny how much Perl has "stolen" from Common Lisp (but not
  from Scheme).  Both Common Lisp and Perl aim to be practical and useful.

///
--
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  Post with compassion: http://home.chello.no/~xyzzy/kitten.jpg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paolo Amoroso  
View profile  
 More options Apr 15 2002, 2:18 pm
Newsgroups: comp.lang.lisp
From: Paolo Amoroso <amor...@mclink.it>
Date: Mon, 15 Apr 2002 20:05:46 +0200
Local: Mon, Apr 15 2002 2:05 pm
Subject: Re: Help: I can't find a simple CL function/idiom
On 15 Apr 2002 10:45:23 -0400, ozan s yigit <o...@blue.cs.yorku.ca> wrote:

[about Larry Wall]

> and implemented perl. [btw, an important distinction about him is that he
> articulates various linguistic aspects of his language, and why he thinks
> it works well for programmers, eg. www.wall.org/~larry/natural.html or

Anybody can easily create a software system that is a mess, and then
justify it by claiming that he purposely designed it that way in order to
mimic real life, which is well known to be a mess :)

Paolo
--
EncyCMUCLopedia * Extensive collection of CMU Common Lisp documentation
http://www.paoloamoroso.it/ency/README
[http://cvs2.cons.org:8000/cmucl/doc/EncyCMUCLopedia/]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »