Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Spock: The odds of surviving another attack are 13562190123 to 1, Captain.


devel / comp.lang.lisp / .Re: lisp code problem, post your solution!

SubjectAuthor
* .Re: lisp code problem, post your solution!Robert L.
`- Re: .Re: lisp code problem, post your solution!Robert L.

1
.Re: lisp code problem, post your solution!

<t19muk$1ups$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!SuenIerR9w710XkqBPrXPQ.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: .Re: lisp code problem, post your solution!
Date: Mon, 21 Mar 2022 11:18:47 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <t19muk$1ups$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="64316"; posting-host="SuenIerR9w710XkqBPrXPQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: XanaNews/1.18.1.6
X-Notice: Filtered by postfilter v. 0.9.2
 by: Robert L. - Mon, 21 Mar 2022 11:18 UTC

Pascal J. Bourguignon wrote:

> >> count from 1 to 100
> >> if the number is divizible by three print fizz
> >> if by 5 print bazz
> >> if by both 3 and 5, print fizzbazz
> >> if none of those, print the number
> >>
> >>
> >>
> >> post your lisp solution!
>
>
> Just put parentheses around your own solution!
>
> (defun divisiblep (n d) (zerop (mod n d)))
>
> (loop for number from 1 to 100
> if (divisiblep number 3) do (princ "fizz")
> if (divisiblep number 5) do (princ "bazz")
> if (not (or (divisiblep number 3) (divisiblep number 5))) do (princ number)
> do (terpri))

Gauche Scheme:

(use srfi-13)

(define (print* a b n)
(let ((s (string-append a b)))
(print (if (#/./ s) s n))))

(for-each
print*
(circular-list "" "" "fizz")
(circular-list "" "" "" "" "buzz")
(iota 15 1))

1
2 fizz
4 buzz
fizz
7 8
fizz
buzz
11
fizz
13
14
fizzbuzz

Re: .Re: lisp code problem, post your solution!

<t19vuv$n9t$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!kSzp3fMQs0HtacJQHFrP+w.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: Re: .Re: lisp code problem, post your solution!
Date: Mon, 21 Mar 2022 13:52:33 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <t19vuv$n9t$1@gioia.aioe.org>
References: <t19muk$1ups$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="23869"; posting-host="kSzp3fMQs0HtacJQHFrP+w.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: XanaNews/1.18.1.6
X-Notice: Filtered by postfilter v. 0.9.2
 by: Robert L. - Mon, 21 Mar 2022 13:52 UTC

On 3/21/2022, Robert L. wrote:

> (use srfi-13)

Correction:

(use srfi-1) ;; for circular-list

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor