This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
craig@onshore.com writes: > > I am writing a little makefile generator for the various documentation > tools we use around the office here, and I wanted to use keywords to > do a little deffin' and was surprised to find keywords apparently > busticated in guile 1.2. I have not tried any other version so far. > > For example: > > guile> (keyword? :key) > ERROR: While evaluating arguments to keyword? in expression (keyword? :key): > ERROR: Unbound variable: :key > ABORT: (misc-error) > > Should it not just evaluate to itself? This is straight from an > example in the docs. This works in CMUCL 8^) > > Please tell me I'm doing something wrong. I can work around this by > just making some symbols, but keywords are just so darn useful for > this. You can either use #:keyword as the syntax (this is the default print and read syntax) or you can use a reader option to also recognize the :keyword syntax, but I forget what it is (I thought is was (read-enable 'keywords) but that doesn't work for me). I reccomend using the #:keyword syntax, as apparently there is useful Scheme library code out there that has symbols starting with a colon. Incidentally, if you want to have nice handling of keyword arguments (and optional args as well), you can try the file scheme/optargs.scm in the scwm distribution. An improved version of this will likely make its way into Guile as soon as I can get papers signed by my company (I hate lawyers); it provides lambda*, define*, define*-public etc which take lambda-lists rather similar to Common Lisp. Extensive docs are in the file. If you are planning to use keywords for purposes other than keyword arguments, I reccomend against; quoted symbols are generally better for such pruposes. - Maciej