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
YANQ - When to map, when to iterate, when to recurse? And why CLOS?
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
  2 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
 
WJ  
View profile  
 More options May 2 2012, 6:34 am
Newsgroups: comp.lang.lisp
From: "WJ" <w_a_x_...@yahoo.com>
Date: 2 May 2012 10:34:55 GMT
Local: Wed, May 2 2012 6:34 am
Subject: Re: YANQ - When to map, when to iterate, when to recurse? And why CLOS?

Racket:

(define (find-indices alist test)
  (for/list ([(x i) (in-indexed alist)]
             #:when (test x))
    i))

(find-indices '(1 2 3 4 5) odd?)
 => '(0 2 4)


 
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.
daniel.elia...@excite.com  
View profile  
 More options May 2 2012, 10:14 am
Newsgroups: comp.lang.lisp
From: daniel.elia...@excite.com
Date: Wed, 2 May 2012 07:14:20 -0700 (PDT)
Local: Wed, May 2 2012 10:14 am
Subject: Re: YANQ - When to map, when to iterate, when to recurse? And why CLOS?
You know, Racket is built on top of Scheme..

I mean, I notice that you are not posting solutions in basic Scheme...  I believe the code in such case would look quite similar to the "labels" version above...  

(Unless you make use of Scheme's "do" form - and I wouldn't without a macro like the Racket macro above!)


 
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 »