I have a hash table, where value is a list of a formula for computing
the value and a few other details irrelevant to this question, the
formula contians other keys in the hash table, what I'm trying to do
is replace each of the keys with its value, which may or may not
contain more keys that need replacing, the total number of keys is
around 15-20, and I have defended against infinite recursion.
I have tried everything I can think of and nothing has worked, mostly
due to either stack overflows or inherant limitations of macrolet, are
there any other ways I should try?
--
Daniel Swanson, Certified Geek
http://www.proofthatgodexists.org

The following message is a courtesy copy of an article
that has been posted to gmane.lisp.ecl.general as well.
Matthew Mondor <mm_lists-xHKImXiT534xnpGSZB1jBA@...>
writes:
> On Mon, 21 Oct 2013 12:24:50 +0200
> "Pascal J. Bourguignon" <pjb-jNDFPZUTrfRkIYSJMME8NAC/G2K4zDHf@...> wrote:
>
>> When reading utf-8 or other unicode streams, invalid byte sequences can
>> signal errors, be substituted by a given character, or be encoded into
>> application reseved code points to be able to transparently transmit the
>> invalid byte sequence. Cf. clisp :INPUT-ERROR-ACTION parameter of
>> ext:make-encoding (clisp encodings are external-format values).
>> http://clisp.org/impnotes/encoding.html#make-encoding
>
> I agree with the above, and it's currently possible in ECL to handle
> UTF-8 decoding errors (ext:stream-decoding-error) with access to the
> octets of the invalid sequence (ext:character-decoding-error-octets),
> with an available restart (invoke-restart 'use-value ...). Thus an
> application is free to also recode the invalid octets to LATIN or to
> implement "UTF8-B" at its discretion, if it implements its own input
> and output.
>
> The advantage of native modes such as UTF8-B or UTF8-LATIN-1 etc would
> be performance and simplicity in cases where this is wanted, but the
> default UTF-8 streams would continue to explicitely signal decoding
> errors, definitely.
>
> If you also mean that CLisp can also optionally do such conversions
> transparently on request (or that its interface allows user code to do
> this more efficiently), that's a good thing to know and I should look
> at its implementation for ideas on the way it presents that interface.
> I've added to my notes the link above, thanks a lot for your answer.
That's not the case, but it could be an additionnal option to the
:input-error-action parameter of make-encoding. In clisp the current
options are:
The :INPUT-ERROR-ACTION argument specifies what happens when an
invalid byte sequence is encountered while converting bytes to
characters. Its value can be :ERROR, :IGNORE or a character to be
used instead. The UNICODE character #\uFFFD is typically used to
indicate an error in the input sequence.
There are several unicode private use areas:
http://en.wikipedia.org/wiki/Private_Use_%28Unicode%29#Private_Use_Areas
So we could add `(:invalid-map ,first-character-or-code) as possible
value for :input-error-action, with the constraint that
(<= 0
(typecase first-character-or-code
(character (char-code first-character-or-code))
(unsigned-byte first-character-or-code)
(t -1))
(- char-code-limit 256))
(There could be some additionnal constraints on the range, if there were
missing characters like in eg. ccl:
clall -r '(length (loop for i below char-code-limit
unless (ignore-errors (code-char i)) collect i))'
Armed Bear Common Lisp --> 0
Clozure Common Lisp --> 2050
CLISP --> 0
CMU Common Lisp --> 0
ECL --> 0
SBCL --> 0
).
To use private areas, the user could restrict first-character-or-code be
of type:
`(or (integer #xe000 ,(- #xf8ff -1 256))
(integer #xf0000 ,(- #xffffd -1 256))
(integer #x100000 ,(- #x10fffd -1 256)))
but we can allow any character range. 0 would be useful to consider
invalid byte sequences as encoded in iso-8859-1.
An additionnal :output-invalid-map parameter would specify the same for
the reverse on output.
Finally, another option to :input-error-action could be to take a
(function (input-stream octet-vector) (values &optional (or character
string))) octet-vector being a vector of invalid bytes read so far from
the stream. The function could further read bytes, and either build and
return a character or string, return no value (ignoring the read bytes),
or signal an error.
:output-invalid-map could take a
(function (output-stream unencodable-character))
that could do whatever it wants to encode, replace or ignore the
unencodable-character on the output-stream.
So I guess :utf-8b could be defined as designing:
(make-encoding :charset :utf-8 :input-error-action '(:invalid-map 0))
or equivalently:
(make-encoding :charset :utf-8
:input-error-action (lambda (stream octet-vector)
(map 'string (function code-char) octet-vector)))
--
__Pascal Bourguignon__
http://www.informatimago.com/

"Pascal J. Bourguignon" <pjb@...> writes:
> I would rather start with Practical Common Lisp
> http://www.gigamonkeys.com/book/
>
> You may read "Land of Lisp" as second or third book.
PCL is indeed a great book. If you do read it, I wouldn't even bother
with LoL. Not that LoL is a bad book, but it covers much less ground
than PCL and so would be redundant by that point.
LoL is good in more of an "intro to programming AND lisp" way,
especially for kids.

On Mon, Oct 21, 2013 at 12:12:25PM +0200, Pascal J. Bourguignon wrote:
> Mayuresh Kathe <mayuresh@...> writes:
>
> > Hello, I'm new to this list and sort of new to Common Lisp.
> > The first work I did with Lisp was at the age of 18 when I had to work
> > on AutoCAD and consequently had to fiddle with AutoLisp.
> > Have fond memories of the experience, but never got to work on Lisp ever
> > again after that one point.
> >
> > Now, I have more than sufficient time at my disposal, and would like to
> > start off in a more structured manner and get thorough command over the
> > language.
> >
> > I've been told to start off with Conrad Barski's "Land of Lisp" by an
> > associate and would like to confirm that it is indeed a good book to run
> > with for a newbie.
>
> I would rather start with Practical Common Lisp
> http://www.gigamonkeys.com/book/
>
> You may read "Land of Lisp" as second or third book.
>
> Check http://cliki.net/Getting+started
> and http://cliki.net in general for all the references.
Excellent material, thanks for the pointers Mr. Bourguignon. :)
~Mayuresh

> I would rather start with Practical Common Lisp
> http://www.gigamonkeys.com/book/
+1. I've learned a lot from this book. It's very approachable and
extremely informative. If I had to teach basic programming in Common
Lisp tomorrow, this is the book I would use.

Mayuresh Kathe <mayuresh@...> writes:
> Hello, I'm new to this list and sort of new to Common Lisp.
> The first work I did with Lisp was at the age of 18 when I had to work
> on AutoCAD and consequently had to fiddle with AutoLisp.
> Have fond memories of the experience, but never got to work on Lisp ever
> again after that one point.
>
> Now, I have more than sufficient time at my disposal, and would like to
> start off in a more structured manner and get thorough command over the
> language.
>
> I've been told to start off with Conrad Barski's "Land of Lisp" by an
> associate and would like to confirm that it is indeed a good book to run
> with for a newbie.
I would rather start with Practical Common Lisp
http://www.gigamonkeys.com/book/
You may read "Land of Lisp" as second or third book.
Check http://cliki.net/Getting+started
and http://cliki.net in general for all the references.
--
__Pascal Bourguignon__
http://www.informatimago.com/

Hello, I'm new to this list and sort of new to Common Lisp.
The first work I did with Lisp was at the age of 18 when I had to work
on AutoCAD and consequently had to fiddle with AutoLisp.
Have fond memories of the experience, but never got to work on Lisp ever
again after that one point.
Now, I have more than sufficient time at my disposal, and would like to
start off in a more structured manner and get thorough command over the
language.
I've been told to start off with Conrad Barski's "Land of Lisp" by an
associate and would like to confirm that it is indeed a good book to run
with for a newbie.
Thanks,
~Mayuresh

We have repeated the same simulation with about the same numbers
several times, and no matter which numbers we use, one gender ends up
having a lot more individuals than the other, usually by a factor of
about 10. The genders start out equal every time. We also tend to end
up with more grass than there are atoms in the universe, but that is a
statistical fluke. I will check for statistical flukage in our numbers
and try more tests.
On Mon, Oct 14, 2013 at 6:30 PM, Sam Steingold <sds@...> wrote:
>> * Daniel Swanson <cbcpbea.gbzngb.qhqr@...> [2013-10-14 16:56:12 -0500]:
>>
>> I have a progam that simulates a certain population animals that I
>> wrote for some friends of mine, and they said that something was wrong
>> with it because there would always be way more of one gender than the
>> other. As far as I can tell, this is due to a biased random number
>> generator, and I was wondering if anyone had a workaround for this, as
>> I don't understand the results I got when I googled this.
>
> This can be caused by your population evolution rather than the RNG
> bias.
> This could also be a statistical fluke.
> I suggest that you try reproducing the problem with a different seed
> (see MAKE-RANDOM-STATE).
>
> --
> Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
> http://www.childpsy.net/http://openvotingconsortium.orghttp://www.memritv.org
> http://mideasttruth.comhttp://jihadwatch.orghttp://palestinefacts.org
> Complete tolerance is impossible: it is insulting to bigots.
--
Daniel Swanson, Certified Geek
http://www.proofthatgodexists.org

> * Daniel Swanson <cbcpbea.gbzngb.qhqr@...> [2013-10-14 16:56:12 -0500]:
>
> I have a progam that simulates a certain population animals that I
> wrote for some friends of mine, and they said that something was wrong
> with it because there would always be way more of one gender than the
> other. As far as I can tell, this is due to a biased random number
> generator, and I was wondering if anyone had a workaround for this, as
> I don't understand the results I got when I googled this.
This can be caused by your population evolution rather than the RNG
bias.
This could also be a statistical fluke.
I suggest that you try reproducing the problem with a different seed
(see MAKE-RANDOM-STATE).
--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/http://openvotingconsortium.orghttp://www.memritv.orghttp://mideasttruth.comhttp://jihadwatch.orghttp://palestinefacts.org
Complete tolerance is impossible: it is insulting to bigots.

Daniel Swanson <popcorn.tomato.dude@...> writes:
> I have a progam that simulates a certain population animals that I
> wrote for some friends of mine, and they said that something was wrong
> with it because there would always be way more of one gender than the
> other. As far as I can tell, this is due to a biased random number
> generator, and I was wondering if anyone had a workaround for this, as
> I don't understand the results I got when I googled this.
CL-USER> (loop
repeat 10000000
if (zerop (random 2))
sum 1 into male
else
sum 1 into female
finally (return (list male female (/ male (+ male female)))))
(4999985 5000015 999997/2000000)
CL-USER> (mapcar 'float *)
(4999985.0 5000015.0 0.4999985)
Doesn't seem to be biased to me. This is on Linux.
--
__Pascal Bourguignon__
http://www.informatimago.com/

I have a progam that simulates a certain population animals that I
wrote for some friends of mine, and they said that something was wrong
with it because there would always be way more of one gender than the
other. As far as I can tell, this is due to a biased random number
generator, and I was wondering if anyone had a workaround for this, as
I don't understand the results I got when I googled this.
--
Daniel Swanson

Ivan Zaigralin <melikamp@...> writes:
> I'll be damned. After I adapted your way and created a new file
> rather than copied cfgunix.lisp and added to the end, it worked!
> I wonder, is it because cfgunix.lisp starts with (in-package "EXT")?
> But how would that affect setting that variable? There is so much I
> don't understand about CL :)
>
> Anyways, thanks a bunch, this is exactly what I wanted. But now I am
> leaning towards simply wrapping the binary in, like, bash or something ;)
By the way, if you're interested in standard behavior, you can invoke
clisp with -ansi:
#!/usr/bin/clisp -q -ansi
also equivalent to:
(setf custom:*ansi* t)
in ~/.clisprc.lisp
--
__Pascal Bourguignon__
http://www.informatimago.com/