RE : crazy run-time fluctuations (mostly super-slow) -- a bit more data
Subject: RE : crazy run-time fluctuations (mostly super-slow) -- a bit more data
From: Oliver Kullmann
Date: Sun, 23 Oct 2011 00:14:23 +0100
Dear Steve,
On Sat, Oct 22, 2011 at 02:44:05PM -0700, Steve Haflich wrote:
> Oiliver --
>
> Maxima currently runs on top of Common Lisp as its implementation
> language (despite Maxima's insistance on calling it "Lisp" nearly
> everywhere, dishonoring McCarthy's request that "Lisp" be used to denote
> this large family of languages, not any specific dialect such as "Common
> Lisp"). That's what Maxima's lisp operator invokes. You need to learn
> about the behavior of random on Common Lisp to understand what you are
> seeing. It would be silly to waste the time of members of the maxima
> list to compose explanations of what is well described in the ANS for
> Common Lisp.
I definitely do not think it would be silly to answer my question ---
would I have otherwise asked my question?
>
> The most accessible (free) version of the ANS is available at
> http://www.lispworks.com/documentation/HyperSpec/Front/index.htm Please
> see the entires for random, random-state, *random-state*, and
> copy-random-state. That should explain everything.
Unfortunately, this doesn't say more than what I have already cited.
The code which I have supplied seems to fulfil the description, and thus
it would be helpful, for me and other readers, to just say in what sense
the sequence of commands I gave misunderstands the spirit of Lisp.
The only information seems to be that example at
http://www.lispworks.com/documentation/HyperSpec/Body/v_rnd_st.htm#STrandom-stateST
Okay, let's enter it:
(%i1) :lisp (random-state-p *random-state*)
T
(%i1) :lisp (setq snap-shot (make-random-state))
#<random-state 0000000001ac5000>
(%i1) :lisp (list (loop for i from 1 to 10 collect (random)) (let ((*random-state* snap-shot)) (loop for i from 1 to 10 collect (random))) (loop for i from 1 to 10 collect (random)) (let ((*random-state* snap-shot)) (loop for i from 1 to 10 collect (random))))
Maxima encountered a Lisp error:
In form
(LISP-EVAL
(LIST (LOOP FOR I FROM 1 TO 10 COLLECT (RANDOM))
(LET ((*RANDOM-STATE* SNAP-SHOT))
(LOOP FOR I FROM 1 TO 10 COLLECT (RANDOM)))
(LOOP FOR I FROM 1 TO 10 COLLECT (RANDOM))
(LET ((*RANDOM-STATE* SNAP-SHOT))
(LOOP FOR I FROM 1 TO 10 COLLECT (RANDOM)))))
Wrong number of arguments passed to function RANDOM.
This doesn't look completely trivial to me, and I think the purpose of
such mailing lists is to look at such things. (This example is a typical
example of bad examples given in such contexts: nothing is explicitly said,
only hinted at, and to understand just a single specific point one
needs to waste time to understand other things, and so on ...)
To help Maxima (and my group, of course) to overcome the very specific
and rather drastic efficiency problems (where finally this example
might not really help, but that is to be investigated), I should not
need to go into details of Lisp.
I do not think that using Maxima should require understanding
Lisp. Sure, one should make attempts, as I did, but Maxima sits on
*top* of Lisp, replacing Lisp --- Maxima is its own language.
Oliver