vseloved / rutils

Radical Utilities for Common Lisp
Other
250 stars 37 forks source link

Reader Macros don't work #40

Closed observant2 closed 5 years ago

observant2 commented 5 years ago

I put (:use :rutilsx) in my package definition and the ? operator also works.

But when I try to use the literal syntax for hashtables like this:

  (setf *state* #h(
                   :spaceship-acceleration 0.2
                   :max-speed 16.0
                   :inc-speed-p nil
                   :dec-speed-p nil
                   :rotate-delta 0.0
                   :player-dead-p nil
                   :init-timeout-millis 3000
                   :game-start-time (get-millis)
                   :spaceship nil))

I get

; caught ERROR:
;   READ error during COMPILE-FILE:
;   
;     no dispatch function defined for #\H

Am I using it wrong?

vseloved commented 5 years ago

You need to add (named-readtables:in-readtable rutilsx-readtable) at the beginning of the file with such code or in the REPL before evaluating this code

observant2 commented 5 years ago

Thank you, that worked! Could be a nice addition to the docs page. I'm relatively new to lisp, but I think reader macros are for advanced lispers and it should be mentioned how to activate the literal syntax somewhere. Maybe somewhere, where it gets extracted into quickdocs or at the top of core/readtable.lisp.

By the way: Thank you for this awesome library! 👽

vseloved commented 5 years ago

You're welcome. I'm glad you find it handy. Hopefully, reading the tutorial will help make it even more useful