On Sun, Jan 26, 2025 at 12:51:10AM -0800, Lindsay Lawrence wrote:
> Is there a simpler way to set the curry environment's State value to Seed
> than what I am doing here?
> 
> Regards,
> Lindsay
> 
> (de randomLehmer (Seed)
>    (let
>       (Fn
>          (curry
>             ((State . 1))
>             NIL
>             (setq State (% (* State 279470273) 4294967291)) ) )
>       (set
>          (nth Fn 2 2 2)
>          (cons
>             'State
>             (if Seed Seed (inc (abs (rand)))) ) )
>       Fn ) )
> 
> 
> : (pretty (randomLehmer 97))
> (NIL
>    (job '((State . 97))
>       (setq State (% (* State 279470273) 4294967291)) ) )-> ")"

'curry' is a bit overkill here. I would directly 'fill' a 'job':

   (de randomLehmer (Seed)
      (let @Seed (or Seed (inc (abs (rand))))
         (fill
            '(()
               (job '((State . @Seed))
                  (setq State (% (* State 279470273) 4294967291)) ) ) ) ) )

: (pretty (randomLehmer 97))
(NIL
   (job '((State . 97))
      (setq State (% (* State 279470273) 4294967291)) ) )-> ")"

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to