Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Q: Why did the lone ranger kill Tonto? A: He found out what "kimosabe" really means.


comp / comp.lang.lisp / Re: Learning Lisp in Linux? -- Bang, Lbang

SubjectAuthor
* Re: Learning Lisp in Linux?B. Pym
`- Re: Learning Lisp in Linux? -- Bang, LbangHenHanna

1
Subject: Re: Learning Lisp in Linux?
From: B. Pym
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Tue, 18 Jun 2024 13:54 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: Learning Lisp in Linux?
Date: Tue, 18 Jun 2024 13:54:16 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <v4s3i7$1cfk0$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Tue, 18 Jun 2024 15:54:17 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7acdda7ec629d74a48e7a7b7014fd8af";
logging-data="1457792"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/EyB1TnbAPsMesJwAX6/S1"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:iRrFkf+5CIHnEkgD+Uq/uJlO0xI=
View all headers

Pascal Costanza wrote:

>
> (defun bang (n)
> (loop for x from 1 to n
> for r = 1 then (* x r)
> finally (return r)))

(define (bang n)
(if (< n 2) 1 (* n (bang (- n 1)))))

(bang 5)
===>
120

Subject: Re: Learning Lisp in Linux? -- Bang, Lbang
From: HenHanna
Newsgroups: comp.lang.lisp
Organization: A noiseless patient Spider
Date: Tue, 18 Jun 2024 20:02 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: HenHanna@devnull.tb (HenHanna)
Newsgroups: comp.lang.lisp
Subject: Re: Learning Lisp in Linux? -- Bang, Lbang
Date: Tue, 18 Jun 2024 13:02:25 -0700
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <v4sp4j$1gg3n$1@dont-email.me>
References: <v4s3i7$1cfk0$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 Jun 2024 22:02:27 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="1ff5838eddcfee2869179dd23adb7000";
logging-data="1589367"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+uP7xBiFOmoU3wfK1576a9rVIpjnQAfZ8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:JKM3VgxSTpkXnJ8MkbBvIj1+kMk=
In-Reply-To: <v4s3i7$1cfk0$2@dont-email.me>
Content-Language: en-US
View all headers

On 6/18/2024 6:54 AM, B. Pym wrote:
> Pascal Costanza wrote:
>
>>
>> (defun bang (n)
>> (loop for x from 1 to n
>> for r = 1 then (* x r)
>> finally (return r)))
>
> (define (bang n)
> (if (< n 2) 1 (* n (bang (- n 1)))))
>
> (bang 5) ===> 120

(define (lbang x)
(fold * 1
(map * (make-list x 1) (lrange 1))))

(print (lbang 0))
(print (lbang 1))
(print (lbang 3))
(print (lbang 5))
(print (lbang 10))

1

rocksolid light 0.9.8
clearnet tor