From: SourceForge.net <no...@so...> - 2011-10-23 18:26:25
|
Bugs item #3427590, was opened at 2011-10-23 12:26 Message generated for change (Tracker Item Submitted) made by robert_dodier You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3427590&group_id=1355 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: clisp Group: ANSI compliance issue Status: Open Resolution: None Priority: 5 Private: No Submitted By: Robert Dodier (robert_dodier) Assigned to: Bruno Haible (haible) Summary: random state not maintained correctly Initial Comment: Clisp doesn't seem to maintain the random state correctly. Here's an example from the CLHS. See: http://www.lispworks.com/documentation/HyperSpec/Body/v_rnd_st.htm#STrandom-stateST I have adapted it by putting in the required argument for RANDOM. (setq snap-shot (make-random-state)) ;; The series from any given point is random, ;; but if you backtrack to that point, you get the same series. (list (loop for i from 1 to 10 collect (random 100)) (let ((*random-state* snap-shot)) (loop for i from 1 to 10 collect (random 100))) (loop for i from 1 to 10 collect (random 100)) (let ((*random-state* snap-shot)) (loop for i from 1 to 10 collect (random 100)))) Expected output: first two lists are the same, second two lists are the same. That is the behavior shown in the CLHS example. (I don't see any reason to believe the output displayed in the CLHS is inconsistent with the CLHS's descriptions of *RANDOM-STATE* and MAKE-RANDOM-STATE.) Actual output: ((61 35 13 7 80 62 20 2 22 86) (8 6 74 57 36 32 39 71 92 14) (65 29 40 51 38 72 16 75 74 9) (70 65 29 40 51 38 72 16 75 74)) I tried the same example w/ ECL and with SBCL, and in both cases they show the expected behavior. $ uname -a Linux robert-laptop 2.6.24.6 #1 SMP Sat Jan 1 00:37:06 MST 2011 i686 GNU/Linux $ clisp --version GNU CLISP 2.49 (2010-07-07) (built 3517447027) (memory 3517449770) Software: GNU C 4.2.4 (Ubuntu 4.2.4-1ubuntu4) gcc -g -O2 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare -Wno-format-nonliteral -O2 -fexpensive-optimizations -falign-functions=4 -DENABLE_UNICODE -DDYNAMIC_MODULES -I. -lncurses -ldl -L/home/robert/tmp/clisp-2.49/tools/i686-pc-linux-gnu/lib -lsigsegv -lc libgnu_cl.a SAFETY=0 HEAPCODES LINUX_NOEXEC_HEAPCODES GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY libsigsegv 2.8 Features: (REGEXP SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN GETTEXT UNICODE BASE-CHAR=CHARACTER PC386 UNIX) C Modules: (clisp i18n syscalls regexp) Installation directory: /usr/local/lib/clisp-2.49/ User language: ENGLISH Machine: I686 (I686) robert-laptop [127.0.0.1] ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101355&aid=3427590&group_id=1355 |