[parenscript-devel] random, mapcar, and loop

szergling senatorzergling at gmail.com
Tue May 11 10:06:47 UTC 2010


I have three patches to suggest for parenscript. Two seem relatively
minor to me, but a third modifies random to be more like CL:RANDOM. It
gives us the following:

CL-USER> (ps:ps (random 2.3))
"2.3 * Math.random();"
CL-USER> (ps:ps (random 2))
"Math.floor(2 * Math.random());"  ;; as in ps's original random

But I expect the following to be perhaps a bit more contentious...

CL-USER> (ps:ps (random (+ 2 2)))
"var max1 = 2 + 2;
var val2 = max1 * Math.random();
if (Math.floor(max1) === max1) {
    Math.floor(val2);
} else {
    val2;
};"

Hope I haven't tried too hard to be like CL here? I hope my patches are
useful and would like them to be considered for inclusion.

Thanks,

Yong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Renamed-function-argument-as-to-arrs-for-consist.patch
Type: text/x-diff
Size: 1354 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20100511/dec9ae3b/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Changed-gensym-to-ps-gensym-for-consistency-replicab.patch
Type: text/x-diff
Size: 884 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20100511/dec9ae3b/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Make-RANDOM-more-Common-Lispy-by-adding-support-for.patch
Type: text/x-diff
Size: 1425 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20100511/dec9ae3b/attachment-0002.patch>


More information about the parenscript-devel mailing list