libera/#sicl - IRC Chatlog
Search
8:36:45
Duuqnd
Here's my implementation for a random number generator system for SICL: https://gist.github.com/johnlorentzson/f6c2389b9896c13ea3d9c23f95527070
8:38:20
Duuqnd
It's all in one file because it doesn't depend on other SICL modules and I just wanted to prototype it easily
8:39:08
Duuqnd
And the CL symbols used are shadowed but not exported because I don't know what the standard practice for that is in SICL and I just wanted to be able to test this in SBCL without issues.
8:40:16
Duuqnd
There's still a few things I'm not so sure about here but I'd like some feedback before I begin making a pull request
8:48:20
moon-child
Duuqnd: you do not need to ':reader random-bits' for mt19937-random; it will be inherited from random-state
8:51:56
moon-child
as a point of style, I think (let ((y ...)) (setf y) (setf y) (setf y)...) would do better to shadow than mutate. (let* so it doesn't end up deeply nested)
8:56:48
Duuqnd
I mainly did the three setf because I was more or less following the pseudo-code from Wikipedia and SBCL does the same but yeah, let* does make more sense.
8:59:25
Duuqnd
Alright, I've made the changes: https://gist.github.com/johnlorentzson/ed0ed853732b5c7a84e3df5319ecbdca
9:00:21
moon-child
ah, two more things. (loop for i... for xi-1 = (aref). Since the array in question is full of integers, xi-1 will never be NIL; but in principle if it became nil, it would halt the loop, so using for there can subvert expectations. So I would prefer _as_ xi-1 = ...
9:01:06
moon-child
and, you allow state-array to be set by the user (where it could have arbitrary length), but elsewhere assume its length is +mt19937-size+
9:01:16
moon-child
I am sure others have feedback as well. But make a PR! This is all very nitpicky stuff