Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

You have been selected for a secret mission.


comp / comp.lang.lisp / re: Advice for a new lisper

SubjectAuthor
o re: Advice for a new lisperB. Pym

1
Subject: re: Advice for a new lisper
From: B. Pym
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Sun, 14 Jul 2024 09:57 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Nobody447095@here-nor-there.org (B. Pym)
Newsgroups: comp.lang.lisp
Subject: re: Advice for a new lisper
Date: Sun, 14 Jul 2024 09:57:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <v707ep$3enb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Sun, 14 Jul 2024 11:57:50 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="2af9a93e51c2354c9c01f27f8d2b9bf3";
logging-data="113387"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3mFvJu8DSMvVfYnGTvmf2"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:wHQd+avSF/SAjmYk9v/n9TSeQNE=
View all headers

Kenny Tilton wrote:

> > (defun straightp (hand)
> > (if (null (cdr hand))
> > t
> > (and (= (caar hand) (- (caadr hand) 1)) (straightp (cdr hand)))))
>
> Not bad, except of course for the caar/caadr thing. Lisniks have an
> irrational bias against recursion where iteration will do, so if they
> turn on you just come back with:
>
> (loop for (c1 c2) on hand
> unless c2 return t
> unless <in order> return nil)

Gauche Scheme

;; Not a fully functional procedure; just for testing.
(define (in-order a b) (= 1 (- b a)))

(define (straight? hand)
(every
in-order
hand
(cdr hand)))

1

rocksolid light 0.9.8
clearnet tor