Deutsch   English   Français   Italiano  
<102u4dg$32oas$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <Nobody447095@here-nor-there.org>
Newsgroups: comp.lang.lisp
Subject: Re: Can a macro define a macro?
Date: Wed, 18 Jun 2025 10:29:05 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <102u4dg$32oas$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Wed, 18 Jun 2025 12:29:05 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7b5dd1615113a3ddbb6deb02a8e5516a";
	logging-data="3236188"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/Vqg8KPWK7n7l1HDm1jgmc"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:y4+HqSJDQ4mL+fBdILHpc2AR/PA=

Pascal Costanza wrote:

> For example, why don't you just write this?
> 
> (defun powersn (x n)
>    (loop for i from to n collecting (expt x i)))


Rejected by SBCL:

; in: LAMBDA NIL
;     (LOOP FOR I FROM TO N
;           COLLECTING (EXPT X I))
;
; caught ERROR:
;   (in macroexpansion of (LOOP FOR I ...))
;   (hint: For more precise location, try *BREAK-ON-SIGNALS*.)
;   unknown LOOP keyword: N
;   current LOOP context: N COLLECTING.

Gauche Scheme.

(define (powersn x n)
  (map (cut  expt x <>) (liota n 1)))


(powersn 3 5)
  ===>
(3 9 27 81 243)