[gambit-list] Idiomatic Scheme

Adrien Piérard pierarda at iro.umontreal.ca
Thu Jan 19 07:50:29 EST 2012


Hi again,

I couldn't resist answering more :)

>> In particular I'm unhappy with the way the message arguments are accessed as (car arguments) rather than by explicit name.  I can see that being a potential cause of bugs if the number of arguments grows and they vary with each message.

You'll probably enjoy optional parameters, then, even though my code
sample is not really portable extensible:

(lambda (message #!optional arg1)
  (case message
    ((:put-name!)
     (push (make-blob-name arg1) unused-name-list)
     (randomise-list))
    ...))

By the way, why sort the list?
Why not also let the constructor of your data type assign the random value?
I barely use DEFINE-TYPE, but I guess there's a way to make the
constructor call a function to generate the random value or something
like that.
Unfortunately, (random init: (random-integer 42)) doesn't work.

> maybe switch the cond to a case?

Indeed, that too.

P!
-- 
Français, English, 日本語, 한국어



More information about the Gambit-list mailing list