Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Nothing ever becomes real until it is experienced. -- John Keats


devel / comp.lang.lisp / .Re: Road to Clojure Survey 2.0

SubjectAuthor
* .Re: Road to Clojure Survey 2.0Robert L.
`* Re: .Re: Road to Clojure Survey 2.0Zyni Moë
 `* Re: .Re: Road to Clojure Survey 2.0Kaz Kylheku
  +* Re: .Re: Road to Clojure Survey 2.0Jeff Barnett
  |`- Re: .Re: Road to Clojure Survey 2.0Kaz Kylheku
  `- Re: .Re: Road to Clojure Survey 2.0Zyni Moë

1
.Re: Road to Clojure Survey 2.0

<surpf8$1f1m$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!eYeqBzNjiJ3ACJwkx5pzXw.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: .Re: Road to Clojure Survey 2.0
Date: Sat, 19 Feb 2022 22:03:22 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <surpf8$1f1m$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="48182"; posting-host="eYeqBzNjiJ3ACJwkx5pzXw.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. - Sat, 19 Feb 2022 22:03 UTC

Alex Mizrahi wrote:

> than version you've wrote in CL. i would write it like this:
>
> (defun factorial (n)
> (loop with p = 1
> for i from 1 to n
> do (setf p (* p i))
> finally (return p)))
>
> IMHO that's cleaner. or if i absolutely must use recursion:

(define (factorial n)
(if (zero? n) 1 (* n (factorial (- n 1)))))

(factorial 5)
===>
120

(factorial 20)
===>
2432902008176640000

Re: .Re: Road to Clojure Survey 2.0

<sut3v6$jio$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no_email@invalid.invalid (Zyni Moë)
Newsgroups: comp.lang.lisp
Subject: Re: .Re: Road to Clojure Survey 2.0
Date: Sun, 20 Feb 2022 10:08:38 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <sut3v6$jio$1@dont-email.me>
References: <surpf8$1f1m$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 20 Feb 2022 10:08:38 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="34ab99218a0dc42ad078f68a3a68e034";
logging-data="20056"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18AKTkZ+UfmLoltLoi52LxwTswl+4O1C40="
User-Agent: NewsTap/5.5 (iPad)
Cancel-Lock: sha1:WepWyXax3MEhsveACjZHF7C/H1Y=
sha1:JDgN12NkkUNoMqY5EI9U4vagRGE=
 by: Zyni Moë - Sun, 20 Feb 2022 10:08 UTC

Robert L. <No_spamming@noWhere_7073.org> wrote:

> [terrible non-TR factorial function]
>

Troll is not only troll, he is stupid troll.

--
the small snake

Re: .Re: Road to Clojure Survey 2.0

<20220220091115.86@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-1380@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: .Re: Road to Clojure Survey 2.0
Date: Sun, 20 Feb 2022 17:17:30 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <20220220091115.86@kylheku.com>
References: <surpf8$1f1m$1@gioia.aioe.org> <sut3v6$jio$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 20 Feb 2022 17:17:30 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="05e270eb53b3f247700a85436199fb36";
logging-data="25950"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+nw1LYYDu+bGZsocFNgHwyqZeU9P4jBV4="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:DW6FHdWfT1mqlgaHZlAZSOZAN+U=
 by: Kaz Kylheku - Sun, 20 Feb 2022 17:17 UTC

On 2022-02-20, Zyni Moë <no_email@invalid.invalid> wrote:
> Robert L. <No_spamming@noWhere_7073.org> wrote:
>
>> [terrible non-TR factorial function]
>>
>
> Troll is not only troll, he is stupid troll.

Wow, that person is still posting? How old are they now.

I remember when they posted some Scheme code that was doing something
like:

(some-function (inc var) (inc var) (inc var))

Where inc is an increment macro, not realizing that Scheme has
unspecified order of argument evaluation, similarly to C.

The macro didn't take care of multiple evaluation, either, I think.

It's worth avoiding stack-consuming recursion in factorial because it
can conceivably produce a bignum value that itself fits into memory, yet
requires so many factors that the stack is blown. If the number of
factors, and thus stack frames, were like logarithmic in the size of
that number, it would be a different story.

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

Re: .Re: Road to Clojure Survey 2.0

<suu46l$fda$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jbb@notatt.com (Jeff Barnett)
Newsgroups: comp.lang.lisp
Subject: Re: .Re: Road to Clojure Survey 2.0
Date: Sun, 20 Feb 2022 12:18:44 -0700
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <suu46l$fda$1@dont-email.me>
References: <surpf8$1f1m$1@gioia.aioe.org> <sut3v6$jio$1@dont-email.me>
<20220220091115.86@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64
Injection-Date: Sun, 20 Feb 2022 19:18:45 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="412c7a660c6fe6f0876173c7e9b548f1";
logging-data="15786"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yHp+3qgUiIW9Py7Aem/ZaZt/trYES35s="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.6.1
Cancel-Lock: sha1:ib4sZsb84DpCtAbqFq6YMJVAllE=
In-Reply-To: <20220220091115.86@kylheku.com>
Content-Language: en-US
 by: Jeff Barnett - Sun, 20 Feb 2022 19:18 UTC

On 2/20/2022 10:17 AM, Kaz Kylheku wrote:
> On 2022-02-20, Zyni Moë <no_email@invalid.invalid> wrote:
>> Robert L. <No_spamming@noWhere_7073.org> wrote:
>>
>>> [terrible non-TR factorial function]
>>>
>>
>> Troll is not only troll, he is stupid troll.
>
> Wow, that person is still posting? How old are they now.
>
> I remember when they posted some Scheme code that was doing something
> like:
>
> (some-function (inc var) (inc var) (inc var))
>
> Where inc is an increment macro, not realizing that Scheme has
> unspecified order of argument evaluation, similarly to C.
>
> The macro didn't take care of multiple evaluation, either, I think.
>
> It's worth avoiding stack-consuming recursion in factorial because it
> can conceivably produce a bignum value that itself fits into memory, yet
> requires so many factors that the stack is blown. If the number of
> factors, and thus stack frames, were like logarithmic in the size of
> that number, it would be a different story.
The memory allocation for a number is, roughly, proportional to the
logarithm of the SIZE (i.e., the value) of the number; It is linearly
proportional to the LENGTH (i.e., number of digits in a base > 1) of the
number representation. This is a quibble as is the fact that many
implementations put big numbers in the heap. not the stack. In any
event, the/your point is that that factorial can produce lots of
computational garbage. It's a great function to introduce recursion as a
pedagogical tool. If you are doing serious combinatorial computations,
you probably need a junior Knuth to hack up the support tool, e.g., the
one who can write the a decent number package in the first place.
--
Jeff Barnett

Re: .Re: Road to Clojure Survey 2.0

<20220220112611.481@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-1380@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: .Re: Road to Clojure Survey 2.0
Date: Sun, 20 Feb 2022 19:46:48 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 66
Message-ID: <20220220112611.481@kylheku.com>
References: <surpf8$1f1m$1@gioia.aioe.org> <sut3v6$jio$1@dont-email.me>
<20220220091115.86@kylheku.com> <suu46l$fda$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 20 Feb 2022 19:46:48 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="05e270eb53b3f247700a85436199fb36";
logging-data="28020"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZbtsSS06XEd+lG4LnY3BlIt8dGhGh4AE="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:U3zGcGrsqVQ1WFM46G+dDwgaBn4=
 by: Kaz Kylheku - Sun, 20 Feb 2022 19:46 UTC

On 2022-02-20, Jeff Barnett <jbb@notatt.com> wrote:
> On 2/20/2022 10:17 AM, Kaz Kylheku wrote:
>> On 2022-02-20, Zyni Moë <no_email@invalid.invalid> wrote:
>>> Robert L. <No_spamming@noWhere_7073.org> wrote:
>>>
>>>> [terrible non-TR factorial function]
>>>>
>>>
>>> Troll is not only troll, he is stupid troll.
>>
>> Wow, that person is still posting? How old are they now.
>>
>> I remember when they posted some Scheme code that was doing something
>> like:
>>
>> (some-function (inc var) (inc var) (inc var))
>>
>> Where inc is an increment macro, not realizing that Scheme has
>> unspecified order of argument evaluation, similarly to C.
>>
>> The macro didn't take care of multiple evaluation, either, I think.
>>
>> It's worth avoiding stack-consuming recursion in factorial because it
>> can conceivably produce a bignum value that itself fits into memory, yet
>> requires so many factors that the stack is blown. If the number of
>> factors, and thus stack frames, were like logarithmic in the size of
>> that number, it would be a different story.
> The memory allocation for a number is, roughly, proportional to the
> logarithm of the SIZE (i.e., the value) of the number; It is linearly
> proportional to the LENGTH (i.e., number of digits in a base > 1) of the

I'm a C programmer; size is length plus 1 (for null termination). :)

> number representation. This is a quibble as is the fact that many
> implementations put big numbers in the heap. not the stack. In any
> event, the/your point is that that factorial can produce lots of
> computational garbage.

I don't mean that at all. I mean that, for instance, (fac 100)
produces (O 100) decimal digits. (Lisp version of big-Oh notation.)

(expt 100 n) produces a (+ (* 2 n) 1)
digit decimal number; for (expt 100 100) that is 201.

(expt n n) has a number of digits that is an upper bound
on the number of digits of (fac n), and that is proportional to n.
The number of recursive frames of (fac n) is also proprtional to n.

The value of the argument to fac approximately specifies how much
storage the resulting number will require, and how much stack storage
the ordinary recursion will require.

That's a Kinda Bad Thing, since available stack space is often smaller
than available heap.

> pedagogical tool. If you are doing serious combinatorial computations,
> you probably need a junior Knuth to hack up the support tool, e.g., the
> one who can write the a decent number package in the first place.

Doing it yourself, without being a complete idiot, will go a long way,
too, though! Particularly if you "know what you don't know" and research
it.

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

Re: .Re: Road to Clojure Survey 2.0

<sv10vh$783$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no_email@invalid.invalid (Zyni Moë)
Newsgroups: comp.lang.lisp
Subject: Re: .Re: Road to Clojure Survey 2.0
Date: Mon, 21 Feb 2022 21:42:09 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <sv10vh$783$1@dont-email.me>
References: <surpf8$1f1m$1@gioia.aioe.org>
<sut3v6$jio$1@dont-email.me>
<20220220091115.86@kylheku.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 21 Feb 2022 21:42:09 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="eeac1872bbcecaea83bd6cfe85271410";
logging-data="7427"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1YM5R9THuoO/8WHd7HnVIMEyVJ39ca0U="
User-Agent: NewsTap/5.5 (iPad)
Cancel-Lock: sha1:Ur7Y2Lm6hluMlk5quVgMMpSNsV0=
sha1:Eqz+yo4ZKX9nCBtWoGPcwAry7lQ=
 by: Zyni Moë - Mon, 21 Feb 2022 21:42 UTC

Kaz Kylheku <480-992-1380@kylheku.com> wrote:

>
> Wow, that person is still posting? How old are they now.

I don't know if they are the same one as ?WJ? but they smell like they are.

--
the small snake


devel / comp.lang.lisp / .Re: Road to Clojure Survey 2.0

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor