Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Almost nothing in Perl serves a single purpose. -- Larry Wall in <199712040054.QAA13811@wall.org>


devel / comp.lang.lisp / Q: Lambda lists with dots are only allowed in macros

SubjectAuthor
* Q: Lambda lists with dots are only allowed in macrosBrian McGuinness
`* Re: Q: Lambda lists with dots are only allowed in macrosKaz Kylheku
 +* Re: Q: Lambda lists with dots are only allowed in macrosSpiros Bousbouras
 |`- Re: Q: Lambda lists with dots are only allowed in macrosKaz Kylheku
 +- Re: Q: Lambda lists with dots are only allowed in macrosMadhu
 `* Re: Q: Lambda lists with dots are only allowed in macrosTom Russ
  +* Re: Q: Lambda lists with dots are only allowed in macrosBrian McGuinness
  |`* Re: Q: Lambda lists with dots are only allowed in macrosSpiros Bousbouras
  | `- Re: Q: Lambda lists with dots are only allowed in macrosSpiros Bousbouras
  `- Re: Q: Lambda lists with dots are only allowed in macrosKaz Kylheku

1
Q: Lambda lists with dots are only allowed in macros

<fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17214&group=comp.lang.lisp#17214

  copy link   Newsgroups: comp.lang.lisp
X-Received: by 2002:ae9:ed06:0:b0:6f9:efd2:9b96 with SMTP id c6-20020ae9ed06000000b006f9efd29b96mr38254402qkg.651.1667854066173;
Mon, 07 Nov 2022 12:47:46 -0800 (PST)
X-Received: by 2002:a05:6870:d10e:b0:13c:50b8:6fdd with SMTP id
e14-20020a056870d10e00b0013c50b86fddmr37351198oac.200.1667854065919; Mon, 07
Nov 2022 12:47:45 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.lisp
Date: Mon, 7 Nov 2022 12:47:45 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=71.255.90.16; posting-account=h3IwYwoAAAAeE2lWQnRSCqcQ0dO-KDvQ
NNTP-Posting-Host: 71.255.90.16
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com>
Subject: Q: Lambda lists with dots are only allowed in macros
From: b.mcguinness747@gmail.com (Brian McGuinness)
Injection-Date: Mon, 07 Nov 2022 20:47:46 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2567
 by: Brian McGuinness - Mon, 7 Nov 2022 20:47 UTC

I am learning Lisp from the 1981 Winston and Horn book. I am trying to solve problem 8-9 on p. 102, using the freeware clisp interpreter to experiment with.

The problem is to create a macro to generate lambda functions to create temporary variables. So the expression

(LET ((VAR1 (EXPR1)) (VAR2 (EXPR2))...))

should be translated to

(LAMBDA (VAR1 VAR2 ...) (EXPR1) (EXPR2)...)

I just created a sample expression to experiment with:

> (SETQ X '(LET ((N (PLUS A B)) (COUNT (DIFFERENCE COUNT 2)) )))
(LET ((N (PLUS A B)) (COUNT (DIFFERENCE COUNT 2))))
> (CAR X)
LET
> (CDR X)
(((N (PLUS A B)) (COUNT (DIFFERENCE COUNT 2))))
> (CADR X)
((N (PLUS A B)) (COUNT (DIFFERENCE COUNT 2)))
> (MAPCAR 'CAR (CADR X))
(N COUNT)
> (MAPCAR 'CDR (CADR X))
(((PLUS A B)) ((DIFFERENCE COUNT 2)))
> (MAPCAR 'CADR (CADR X))
((PLUS A B) (DIFFERENCE COUNT 2))
> (APPEND (LIST 'LAMBDA) (LIST (MAPCAR 'CAR (CADR X))) (MAPCAR 'CADR (CADR X)))
(LAMBDA (N COUNT) (PLUS A B) (DIFFERENCE COUNT 2))

Having come up with an expression that seems to work, I put it in a macro:

(DEFUN LET MACRO (X)
(APPEND (LIST 'LAMBDA) (LIST (MAPCAR 'CAR (CADR X))) (MAPCAR 'CADR (CADR X)))
)

But when I try to enter this into clisp, I get an error message:

*** - DEFUN: Lambda lists with dots are only allowed in macros, not here: MACRO

I don't understand what the problem is. I would appreciate halp.

Thanks.

--- Brian

Re: Q: Lambda lists with dots are only allowed in macros

<20221107153725.987@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17215&group=comp.lang.lisp#17215

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: Q: Lambda lists with dots are only allowed in macros
Date: Tue, 8 Nov 2022 00:11:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 177
Message-ID: <20221107153725.987@kylheku.com>
References: <fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com>
Injection-Date: Tue, 8 Nov 2022 00:11:50 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a5a191df1eae4c0a8cb3f9d4960aba53";
logging-data="3903360"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ow/xiFK7qF/reDje9/94/iDaE94bOyL8="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:CXnR3Lyod6JzgVhErtnOZi/7hI0=
 by: Kaz Kylheku - Tue, 8 Nov 2022 00:11 UTC

On 2022-11-07, Brian McGuinness <b.mcguinness747@gmail.com> wrote:
> I am learning Lisp from the 1981 Winston and Horn book. I am trying to solve problem 8-9 on p. 102, using the freeware clisp interpreter to experiment with.
>
> The problem is to create a macro to generate lambda functions to create temporary variables. So the expression
>
> (LET ((VAR1 (EXPR1)) (VAR2 (EXPR2))...))
>
> should be translated to
>
> (LAMBDA (VAR1 VAR2 ...) (EXPR1) (EXPR2)...)

OK; that's the easy direction. Converting an arbitrary
immediately-called lambda, with full blown optional, keyword and rest
arguments, to let, is a bit more challening.

That's also the useful direction; useful for optimizing such lambdas in
a compiler.

> Having come up with an expression that seems to work, I put it in a macro:
>
> (DEFUN LET MACRO (X)
> (APPEND (LIST 'LAMBDA) (LIST (MAPCAR 'CAR (CADR X))) (MAPCAR 'CADR (CADR X)))
> )

(defun let macro (x) ...) is just bad syntax.

You're tryng to define a function called LET, which is undefined
behavior since that's the name of a special operator.

The argument list is the atom macro, which is equivalent to (&rest macro),
and only allowed in macro parameter lists, not in functions.

here is how that works:

[1]> (defmacro mymacro args `'(:args ,args))
MYMACRO
[2]> (mymacro 1 2 3 4)
(:ARGS (1 2 3 4))

Instead of an argument list like (arg1 arg2 ...) we have args.

That gets pattern matched agains all the arguments, so in the macro
call (mymacro 1 2 3 4), the arguments (1 2 3 4) get matched to args.

Why the error message refers to dots is that pattern matching atoms
that take the rest of the list normally occur in the dotted position
of a parameter list:

[1]> (defmacro mymacro (arg1 arg2 . rest) `'(:args ,arg1 ,arg2 :rest ,rest))
MYMACRO
[2]> (mymacro 1 2 3 4 5 6)
(:ARGS 1 2 :REST (3 4 5 6))

These styles of pattern matching parameter lists are not supported
in functions.

[1]> (defun fun args)

*** - DEFUN: Lambda lists with dots are only allowed in macros, not here: ARGS
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [2]> :a
[3]> (defun fun (arg1 . rest))

*** - DEFUN: Lambda lists with dots are only allowed in macros, not here: (ARG1 . REST)
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [4]> :a

You can define rest parameters this way:

[5]> (defun fun (&rest args))
FUN
[6]> (defun fun (arg1 arg2 &rest args))
FUN

That works for macros, too.

In Lisp, you know that nil is an empty list, and that it's an atom: it's
the only atom which is a kind of list.

There are also improper lists in Lisp which are terminated by an atom
other than nil: e.g. (1 2 3 4 . 5). is a four-element list (made of
four cons cells), whose last cons has a CDR of 5. It is an improper
list. You can test this with the proper-list-p predicate.

This is also called a dotted list, because of the dotted notation.
(a . b) is a dotted pair, (a b . c) a dotted list.

OK, so then we can think about the following beast: what is an *empty*
dotted list terminated imporperly by 5?

Why, that is just the atom 5.

So on that basis, the error message is taking your atom macro
and calling it an empty dotted list.

[1]> (defvar improper-list 5)
IMPROPER-LIST
[2]> (push 3 improper-list)
(3 . 5)
[3]> (push 2 improper-list)
(2 3 . 5)
[4]> (push 1 improper-list)
(1 2 3 . 5)

This idea that an atom is an empty dotted list is well supported in
Common Lisp. For instance:

[1]> (append 3)
3
[2]> (append '(1 2) 3)
(1 2 . 3)
[3]> (append '(1 2) '(3 4) 5)
(1 2 3 4 . 5)

But:

[4]> (append '(1 2) '(3 4) 5 '(6 7))

*** - APPEND: 5 is not a list

We can't append past the improper terminator; there is no
place int the structure to retain that.

The other reason you are seeing an error message about dots is
proably that CLISP's code which validates macro argument
lists is just doing recursion. It's assumed in the recursion
that if an non-nil atom appears, it was reached as the CDR
field of the last cons of an improper list.

Very simplified code (not handling recursive or even checking
that parameters are valid symbols):

(defun check-macro-params (params)
(cond
((null params) t) ;; ok
((atom params) (error "dotted macro param list terminated by ~s not allowed" params))
(t (check-macro-params (cdr params)))))

Ok, so that works nicely on these cases, and the error has a wording that makes
sense:

[2]> (check-macro-params '(a b c))
T
[3]> (check-macro-params '(a b c . d))

*** - dotted macro param list terminated by D not allowed
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [4]> :a

but:

[5]> (check-macro-params 'd)

*** - dotted macro param list terminated by D not allowed
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [6]> :a

Only a more seasoned Lisper instantly understands why this is
complaining about something dotted.

In the TXR Lisp dialect, which is not Common Lisp at all, but has some spiritual
ties to it, I made the dotted notation work for empty lists:

1> '(1 2 3 . 4)
(1 2 3 . 4)
2> '(3 . 4)
(3 . 4)
3> '(. 4) ;; Here, Common Lisp people go "what the ... ?"
4

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: Q: Lambda lists with dots are only allowed in macros

<60NPKmXBjFnA1GDKz@bongo-ra.co>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17216&group=comp.lang.lisp#17216

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spibou@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.lisp
Subject: Re: Q: Lambda lists with dots are only allowed in macros
Date: Tue, 8 Nov 2022 03:56:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <60NPKmXBjFnA1GDKz@bongo-ra.co>
References: <fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com> <20221107153725.987@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 8 Nov 2022 03:56:11 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="3f8e1a94a079f32b60adbb43dd9e914e";
logging-data="4036656"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/oOn0i189GxkS4/CaEpJoV"
Cancel-Lock: sha1:9t850cWD66cy3W9bpgBEu3TYEjA=
X-Organisation: Weyland-Yutani
In-Reply-To: <20221107153725.987@kylheku.com>
X-Server-Commands: nowebcancel
 by: Spiros Bousbouras - Tue, 8 Nov 2022 03:56 UTC

On Tue, 8 Nov 2022 00:11:50 -0000 (UTC)
Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> There are also improper lists in Lisp which are terminated by an atom
> other than nil: e.g. (1 2 3 4 . 5). is a four-element list (made of
> four cons cells), whose last cons has a CDR of 5. It is an improper
> list. You can test this with the proper-list-p predicate.

Common Lisp does not have proper-list-p .I don't think it has anything
for checking that an object is a proper list.

Re: Q: Lambda lists with dots are only allowed in macros

<m3iljpd6da.fsf@leonis4.robolove.meer.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17217&group=comp.lang.lisp#17217

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: enometh@meer.net (Madhu)
Newsgroups: comp.lang.lisp
Subject: Re: Q: Lambda lists with dots are only allowed in macros
Date: Tue, 08 Nov 2022 17:07:37 +0530
Organization: Motzarella
Lines: 92
Message-ID: <m3iljpd6da.fsf@leonis4.robolove.meer.net>
References: <fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com>
<20221107153725.987@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="a10ce252fac543c4a136593b160f9401";
logging-data="4095712"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Yv4vZppJeFqLuIp9bTCxui8FFOeq1D3k="
Cancel-Lock: sha1:io9jpEtnj/7Uu67yCwjBpR+MRoY=
sha1:nuVaZqj4SpayqGg0c0WT4Ur3VWk=
 by: Madhu - Tue, 8 Nov 2022 11:37 UTC

* Kaz Kylheku <20221107153725.987 @kylheku.com> :
Wrote on Tue, 8 Nov 2022 00:11:50 -0000 (UTC):
> In Lisp, you know that nil is an empty list, and that it's an atom: it's
> the only atom which is a kind of list.
>
> There are also improper lists in Lisp which are terminated by an atom
> other than nil: e.g. (1 2 3 4 . 5). is a four-element list (made of
> four cons cells), whose last cons has a CDR of 5. It is an improper
> list. You can test this with the proper-list-p predicate.
>
> This is also called a dotted list, because of the dotted notation.
> (a . b) is a dotted pair, (a b . c) a dotted list.
>
> OK, so then we can think about the following beast: what is an *empty*
> dotted list terminated imporperly by 5?

There is no such thing as an empty dotted list in lisp, and has been no
such thing until you presumably invented it in txr.

> Why, that is just the atom 5.
>
> So on that basis, the error message is taking your atom macro
> and calling it an empty dotted list.
>
> [1]> (defvar improper-list 5)
> IMPROPER-LIST
> [2]> (push 3 improper-list)
> (3 . 5)
> [3]> (push 2 improper-list)
> (2 3 . 5)
> [4]> (push 1 improper-list)
> (1 2 3 . 5)

the PUSH and APPEND example which followsfollow from the definitions of
PUSH and APPEND and not from some unarticulated concept of an empty
dotted list.

(PUSH item place) === (setf place (cons item place))

A cons is always created, and the consequences are as you have
shown. the PLACE argument of PUSH can be any object. It can be an
improper list.

setq improper-list '(1 . 5)
push 3 improper-list -> '(3 1 . 5) -- the OBJECT is preserved.

likewise APPEND LISTS is defined explicitly:

OBJECT ANY OBJECT. It creates a cons when the last item list---each must
be a proper list except the last, which may be any object. result---an
object. This will be a list unless the last list was not a list and all
preceding lists were null.

> This idea that an atom is an empty dotted list is well supported in
> Common Lisp. For instance:
>
> [1]> (append 3)
> 3
> [2]> (append '(1 2) 3)
> (1 2 . 3)
> [3]> (append '(1 2) '(3 4) 5)
> (1 2 3 4 . 5)
>
> But:
>
> [4]> (append '(1 2) '(3 4) 5 '(6 7))
>
> *** - APPEND: 5 is not a list

> We can't append past the improper terminator; there is no
> place int the structure to retain that.
> In the TXR Lisp dialect, which is not Common Lisp at all, but has some spiritual
> ties to it, I made the dotted notation work for empty lists:
>
> 1> '(1 2 3 . 4)
> (1 2 3 . 4)
> 2> '(3 . 4)
> (3 . 4)
> 3> '(. 4) ;; Here, Common Lisp people go "what the ... ?"
> 4

Rightly so. Here you have invented a notion of :an empty dotted list:,
and while you are free to do that, but it does not come from any earlier
lisp.

Re: Q: Lambda lists with dots are only allowed in macros

<5ed8454f-6d2b-4f67-b428-5b43b5f7abd2n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17219&group=comp.lang.lisp#17219

  copy link   Newsgroups: comp.lang.lisp
X-Received: by 2002:ac8:4710:0:b0:3a5:2580:6169 with SMTP id f16-20020ac84710000000b003a525806169mr39738563qtp.338.1667945648006;
Tue, 08 Nov 2022 14:14:08 -0800 (PST)
X-Received: by 2002:a05:6870:d04:b0:13b:b343:9b0f with SMTP id
mk4-20020a0568700d0400b0013bb3439b0fmr746774oab.187.1667945647502; Tue, 08
Nov 2022 14:14:07 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.lisp
Date: Tue, 8 Nov 2022 14:14:07 -0800 (PST)
In-Reply-To: <20221107153725.987@kylheku.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2620:0:102f:1005:391d:5695:1b04:8af;
posting-account=05zmAwoAAAAJZM-3jv1hCWLHGZQceqwA
NNTP-Posting-Host: 2620:0:102f:1005:391d:5695:1b04:8af
References: <fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com> <20221107153725.987@kylheku.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5ed8454f-6d2b-4f67-b428-5b43b5f7abd2n@googlegroups.com>
Subject: Re: Q: Lambda lists with dots are only allowed in macros
From: taruss@google.com (Tom Russ)
Injection-Date: Tue, 08 Nov 2022 22:14:08 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2318
 by: Tom Russ - Tue, 8 Nov 2022 22:14 UTC

On Monday, November 7, 2022 at 4:11:55 PM UTC-8, Kaz Kylheku wrote:
> On 2022-11-07, Brian McGuinness <b.mcgui...@gmail.com> wrote:
> > I am learning Lisp from the 1981 Winston and Horn book. I am trying to solve problem 8-9 on p. 102, using the freeware clisp interpreter to experiment with.
....
> > (DEFUN LET MACRO (X)
> > (APPEND (LIST 'LAMBDA) (LIST (MAPCAR 'CAR (CADR X))) (MAPCAR 'CADR (CADR X)))
> > )
> (defun let macro (x) ...) is just bad syntax.

As a historical note, this is valid MacLisp syntax.
Various specialized function-like routines could be defined such as expr, macro or fexpr.
I'm not sure what version of lisp the 1981 Winston and Horn book used, but it could have
been the MacLisp dialect. It was originally published in 1979, so the timeframe is correct.
The 1984 edition mentions that it is based on CommonLisp.

See page 54 in
https://www.softwarepreservation.org/projects/LISP/MIT/Moon-MACLISP_Reference_Manual-Apr_08_1974.pdf

But it would be more useful if the OP could find a lisp text based on CommonLisp, as that
is much more widespread and a lot more modern.

Re: Q: Lambda lists with dots are only allowed in macros

<9a1e48cb-51f6-4de9-81ff-28837dc53068n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17220&group=comp.lang.lisp#17220

  copy link   Newsgroups: comp.lang.lisp
X-Received: by 2002:a05:622a:488c:b0:3a5:516a:9044 with SMTP id fc12-20020a05622a488c00b003a5516a9044mr25979065qtb.192.1668018290219;
Wed, 09 Nov 2022 10:24:50 -0800 (PST)
X-Received: by 2002:a9d:7847:0:b0:66c:4927:ac3c with SMTP id
c7-20020a9d7847000000b0066c4927ac3cmr27156812otm.141.1668018289927; Wed, 09
Nov 2022 10:24:49 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.lisp
Date: Wed, 9 Nov 2022 10:24:49 -0800 (PST)
In-Reply-To: <5ed8454f-6d2b-4f67-b428-5b43b5f7abd2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=71.255.90.16; posting-account=h3IwYwoAAAAeE2lWQnRSCqcQ0dO-KDvQ
NNTP-Posting-Host: 71.255.90.16
References: <fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com>
<20221107153725.987@kylheku.com> <5ed8454f-6d2b-4f67-b428-5b43b5f7abd2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9a1e48cb-51f6-4de9-81ff-28837dc53068n@googlegroups.com>
Subject: Re: Q: Lambda lists with dots are only allowed in macros
From: b.mcguinness747@gmail.com (Brian McGuinness)
Injection-Date: Wed, 09 Nov 2022 18:24:50 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2056
 by: Brian McGuinness - Wed, 9 Nov 2022 18:24 UTC

Thank you for the help.

The book does use MACLISP, as indicated in an appendix. It refers to EXPLODE and IMPLODE functions that are supposed to break an atom up into separate characters and reassemble them. This doesn't work in clisp. There is no mention of a built-in LET keyword. The other dialect the book mentions is INTERLISP.

I have an electronic copy of Common Lisp the Language, 2nd Edition by Guy L.. Steele Jr. so I can go through that. I have also downloaded the MACLISP manual out of curiosity.

Lisp is an interesting language that is fun to experiment with. I see a number of parallels with features of APL and J. I think this language will prove very useful when I get a good grasp of it.

--- Brian

Re: Q: Lambda lists with dots are only allowed in macros

<lWgTmI2TmeIusoZ7V@bongo-ra.co>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17221&group=comp.lang.lisp#17221

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spibou@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.lisp
Subject: Re: Q: Lambda lists with dots are only allowed in macros
Date: Wed, 9 Nov 2022 22:51:27 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <lWgTmI2TmeIusoZ7V@bongo-ra.co>
References: <fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com> <20221107153725.987@kylheku.com> <5ed8454f-6d2b-4f67-b428-5b43b5f7abd2n@googlegroups.com>
<9a1e48cb-51f6-4de9-81ff-28837dc53068n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 9 Nov 2022 22:51:27 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="d8a1c15158dcbdef28faf234d4dcc463";
logging-data="371035"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/p+3b7C8voWiK0ZE08FTQb"
Cancel-Lock: sha1:Y3BEivZCY4YXbQU3Z8UmfbBkNP8=
X-Organisation: Weyland-Yutani
X-Server-Commands: nowebcancel
In-Reply-To: <9a1e48cb-51f6-4de9-81ff-28837dc53068n@googlegroups.com>
 by: Spiros Bousbouras - Wed, 9 Nov 2022 22:51 UTC

On Wed, 9 Nov 2022 10:24:49 -0800 (PST)
Brian McGuinness <b.mcguinness747@gmail.com> wrote:
> I have an electronic copy of Common Lisp the Language, 2nd Edition by Guy L.
> Steele Jr. so I can go through that.

Not a good choice for a beginner. Also there are small differences between
what the book mentions and what the final standard for Common Lisp has and
these can create unpleasant surprises if you decide to use Common Lisp in
earnest in the future. A better choice is "Practical Common Lisp" by Peter
Seibel at gigamonkeys.com/book .The 3rd edition of the Winston and Horn
book is also fine.

> Lisp is an interesting language that is fun to experiment with.

"Lisp" is a family of languages around which an unfortunate tradition has
developed for people to say "Lisp" as if it's only one language. This can
only cause confusion. You need to decide first which Lisp language you
want to learn. Questions about all members of the family are on topic on
this group apart from Scheme for which there exists comp.lang.scheme .In
practice most discussion here is about Common Lisp.

--
The Earth is the cradle of humanity, but one cannot live in a cradle forever.
Konstantin Tsiolkovsky

Re: Q: Lambda lists with dots are only allowed in macros

<TM13xcykMclOo10FT@bongo-ra.co>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17222&group=comp.lang.lisp#17222

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!wMjcvFyyQbKkD1DyxkS8fQ.user.46.165.242.91.POSTED!not-for-mail
From: spibou@gmail.com (Spiros Bousbouras)
Newsgroups: comp.lang.lisp
Subject: Re: Q: Lambda lists with dots are only allowed in macros
Date: Wed, 9 Nov 2022 23:10:19 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <TM13xcykMclOo10FT@bongo-ra.co>
References: <fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com> <20221107153725.987@kylheku.com> <5ed8454f-6d2b-4f67-b428-5b43b5f7abd2n@googlegroups.com>
<9a1e48cb-51f6-4de9-81ff-28837dc53068n@googlegroups.com> <lWgTmI2TmeIusoZ7V@bongo-ra.co>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="36098"; posting-host="wMjcvFyyQbKkD1DyxkS8fQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Server-Commands: nowebcancel
X-Organisation: Weyland-Yutani
X-Notice: Filtered by postfilter v. 0.9.2
 by: Spiros Bousbouras - Wed, 9 Nov 2022 23:10 UTC

On Wed, 9 Nov 2022 22:51:27 -0000 (UTC)
Spiros Bousbouras <spibou@gmail.com> wrote:
> "Lisp" is a family of languages around which an unfortunate tradition has
> developed for people to say "Lisp" as if it's only one language. This can
> only cause confusion. You need to decide first which Lisp language you
> want to learn. Questions about all members of the family are on topic on
> this group apart from Scheme for which there exists comp.lang.scheme .

Well , for Emacs Lisp questions , one of the groups specific to Emacs might be
a better place.

> In practice most discussion here is about Common Lisp.

I think it would be very cool if there was some discussion here about Nyquist ,
a Lisp dialect specifically for music composition. But I've never seen any
such discussion and I've only experimented with the language very little myself.

Re: Q: Lambda lists with dots are only allowed in macros

<20221110070239.233@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17223&group=comp.lang.lisp#17223

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: Q: Lambda lists with dots are only allowed in macros
Date: Thu, 10 Nov 2022 15:04:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <20221110070239.233@kylheku.com>
References: <fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com>
<20221107153725.987@kylheku.com> <60NPKmXBjFnA1GDKz@bongo-ra.co>
Injection-Date: Thu, 10 Nov 2022 15:04:35 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="255f0500f1e1a29d4bf15628aa6bf4b2";
logging-data="614271"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7+EE7RjN5ucbuOlycCEpKl8vZ6YQ5Wsw="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:/vTPkZxjZs2DkAJ+jl36FYpybrI=
 by: Kaz Kylheku - Thu, 10 Nov 2022 15:04 UTC

On 2022-11-08, Spiros Bousbouras <spibou@gmail.com> wrote:
> On Tue, 8 Nov 2022 00:11:50 -0000 (UTC)
> Kaz Kylheku <864-117-4973@kylheku.com> wrote:
>> There are also improper lists in Lisp which are terminated by an atom
>> other than nil: e.g. (1 2 3 4 . 5). is a four-element list (made of
>> four cons cells), whose last cons has a CDR of 5. It is an improper
>> list. You can test this with the proper-list-p predicate.
>
> Common Lisp does not have proper-list-p .I don't think it has anything
> for checking that an object is a proper list.

Thanks for pointing this out, Spiros.

To the original poster, Brian, yes; proper-list-p isn't in Common Lisp;
it appears in the CLISP implementation that you're using, in the
extension package: it is ext:proper-list-p, not cl:proper-list-p.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

Re: Q: Lambda lists with dots are only allowed in macros

<20221110070454.384@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17224&group=comp.lang.lisp#17224

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: 864-117-4973@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: Q: Lambda lists with dots are only allowed in macros
Date: Thu, 10 Nov 2022 15:08:13 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <20221110070454.384@kylheku.com>
References: <fe28cd69-d105-4cfc-b068-d7830cc0e602n@googlegroups.com>
<20221107153725.987@kylheku.com>
<5ed8454f-6d2b-4f67-b428-5b43b5f7abd2n@googlegroups.com>
Injection-Date: Thu, 10 Nov 2022 15:08:13 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="255f0500f1e1a29d4bf15628aa6bf4b2";
logging-data="614271"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX185ea6Sh/BuTBbeoY++uR/Hr3ZTStPGsJA="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:HtZw8DZYiQS+iJ78ssNfLdSpBfU=
 by: Kaz Kylheku - Thu, 10 Nov 2022 15:08 UTC

On 2022-11-08, Tom Russ <taruss@google.com> wrote:
> On Monday, November 7, 2022 at 4:11:55 PM UTC-8, Kaz Kylheku wrote:
>> On 2022-11-07, Brian McGuinness <b.mcgui...@gmail.com> wrote:
>> > I am learning Lisp from the 1981 Winston and Horn book. I am trying to solve problem 8-9 on p. 102, using the freeware clisp interpreter to experiment with.
> ...
>> > (DEFUN LET MACRO (X)
>> > (APPEND (LIST 'LAMBDA) (LIST (MAPCAR 'CAR (CADR X))) (MAPCAR 'CADR (CADR X)))
>> > )
>> (defun let macro (x) ...) is just bad syntax.
>
> As a historical note, this is valid MacLisp syntax.

By the time I got to writing that, I completely forgot Brian's opening
statement revealing that he is working with Winston and Horn from 1981;
I had intended to make a remark about it.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor