Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Do something unusual today. Pay a bill.


comp / comp.lang.lisp / Re: distinction?

SubjectAuthor
o Re: distinction?B. Pym

1
Subject: Re: distinction?
From: B. Pym
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Fri, 5 Jul 2024 19:09 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (B. Pym)
Newsgroups: comp.lang.lisp
Subject: Re: distinction?
Date: Fri, 5 Jul 2024 19:09:07 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <v69gc7$3dg8t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Fri, 05 Jul 2024 21:09:07 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b71e9748513bf7ccca82e860ed43b8e1";
logging-data="3588381"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PA0PYTUAfJwk4bkp84Oys"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:OprD3z8h97NKO+OXrQZ1qgORyGk=
View all headers

Kent M. Pitman wrote:

> > > Even non-programmers know
> > > what it means to say "For every setting at the table, make sure the
> > > napkin is arranged right".
>
> > This can be expressed functionally in Scheme using map (like mapcar in CL).
> > It's not necessary to use iteration.
>
> But MAP is not good for expressing "For every number from 0 to 9, make sure
> it appears on the phone dial" because Scheme does not provide an object
> over which one can "map" numeric ranges, as CL's LOOP does.

Gauche Scheme:

(define phone-dial '(0 1 2 3 4 5 6 7 8 9))

(every (cut member <> phone-dial) (iota 10))
===>
(9)

(every (cut member <> phone-dial) '(2 6 8 22))
===>
#f

(find (lambda(x) (not (member x phone-dial))) '(2 6 8 22))
===>
22

(use srfi-1)

(lset-difference = '(2 6 8 22) phone-dial)
===>
(22)

1

rocksolid light 0.9.8
clearnet tor