egallesio / STklos

STklos Scheme
http://stklos.net
GNU General Public License v2.0
67 stars 17 forks source link

SRFI 27 problems #614

Closed jpellegrini closed 7 months ago

jpellegrini commented 7 months ago

Hi @egallesio ! I have opened this issue so we can talk about SRFI-27 here.

I have put SRFI-27 back into a private branch of STklos here, and I see this:

stklos> (import (srfi 27))
stklos> (random-integer 100)
**** Error:
error: no applicable method for #[<generic> %random-source-state-ref (1)]
in call (%random-source-state-ref #[<random-source-mt> 7f0d958c5870] 100)

But in lib/srfi/27.stk we have:

(define-class <random-source> ()
  ((algorithm #:init-keyword #:algorithm)
   (state     #:init-keyword #:state
              #:getter       %random-source-state-ref
              #:setter       %random-source-state-set!)))

...

(define (random-integer n) (%random-integer-from-source-mt
                            (%random-source-state-ref default-random-source n)))

Which seems correct and should work.

Maybe something changed when you changed the access to global variables in modules?

I'll keep digging.

jpellegrini commented 7 months ago

Ah, I think I found the problem. Will update and make a PR later

egallesio commented 7 months ago

Closing this issue, since your PR fixed the problem.