The configuration of my program shall be stored in an alist:
(defconstant *config* '((xres . 640) (yres . 480)))
which works fine.
However, I would like to set some properties dynamically:
(defconstant *config* '((xres . 640) (yres . (- 400 50) )))
This obviously doesn't work.
I mucked around quite a bit with backtick quoting and the comma quote,
but I don't seem to have a deep enough understanding to fit them in
here...
Leslie
In article <························@k79g2000hse.googlegroups.com>,
"Leslie P. Polzer" <·············@gmx.net> wrote:
> The configuration of my program shall be stored in an alist:
>
> (defconstant *config* '((xres . 640) (yres . 480)))
>
> which works fine.
>
> However, I would like to set some properties dynamically:
>
> (defconstant *config* '((xres . 640) (yres . (- 400 50) )))
>
> This obviously doesn't work.
>
> I mucked around quite a bit with backtick quoting and the comma quote,
> but I don't seem to have a deep enough understanding to fit them in
> here...
>
> Leslie
'(foo . 100) -> (CONS 'foo 100)
'((foo . 100) (bar . 200)) -> (list (cons 'foo 100) (cons 'bar 200))
So:
(list (cons 'xres 640) (cons 'yres (- 400 50)))
See also
`((xres . 640) (yres . ,(- 400 50)))
or at readtime (if read eval is enabled):
'((xres . 640) (yres . #.(- 400 50)))
--
http://lispm.dyndns.org
On Jun 28, 4:36 pm, Rainer Joswig <······@lisp.de> wrote:
> See also
>
> `((xres . 640) (yres . ,(- 400 50)))
I guess I was almost there...
Thanks for the elaborate explanation!
On Jun 28, 4:36 pm, Rainer Joswig <······@lisp.de> wrote:
> See also
>
> `((xres . 640) (yres . ,(- 400 50)))
>
> or at readtime (if read eval is enabled):
>
> '((xres . 640) (yres . #.(- 400 50)))
Hmmm, neither of those work in SBCL:
CL-USER(29): `((xres . 640) (yres . ,(- 400 50)))
debugger invoked on a COMMON-LISP:READER-ERROR in thread #<THREAD
"initial thread" {A815409}>:
READER-ERROR at 34 (line 1, column 34) on #<SB-IMPL::STRING-INPUT-
STREAM {B0A2E31}>:
More than one object follows . in list.
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(SB-IMPL::%READER-ERROR
#<SB-IMPL::STRING-INPUT-STREAM {B0A2E31}>
"More than one object follows . in list.")
0] 0
Same error with the second expression.
Leslie
In article <························@u2g2000hsc.googlegroups.com>,
"Leslie P. Polzer" <·············@gmx.net> wrote:
> On Jun 28, 4:36 pm, Rainer Joswig <······@lisp.de> wrote:
>
> > See also
> >
> > `((xres . 640) (yres . ,(- 400 50)))
> >
> > or at readtime (if read eval is enabled):
> >
> > '((xres . 640) (yres . #.(- 400 50)))
>
> Hmmm, neither of those work in SBCL:
>
>
> CL-USER(29): `((xres . 640) (yres . ,(- 400 50)))
>
> debugger invoked on a COMMON-LISP:READER-ERROR in thread #<THREAD
> "initial thread" {A815409}>:
> READER-ERROR at 34 (line 1, column 34) on #<SB-IMPL::STRING-INPUT-
> STREAM {B0A2E31}>:
> More than one object follows . in list.
Works for me (SBCL 1.0.5):
* `((xres . 640) (yres . ,(- 400 50)))
((XRES . 640) (YRES . 350))
>
> Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
>
> restarts (invokable by number or by possibly-abbreviated name):
> 0: [ABORT] Exit debugger, returning to top level.
>
> (SB-IMPL::%READER-ERROR
> #<SB-IMPL::STRING-INPUT-STREAM {B0A2E31}>
> "More than one object follows . in list.")
> 0] 0
>
> Same error with the second expression.
>
> Leslie
Works, too.
* '((xres . 60) (yres . #.(- 400 50)))
((XRES . 60) (YRES . 350))
* Which SBCL version are using?
* How are you using SBCL (Terminal, SLIME, ...)?
* Do you have a special setup for SBCL?
--
http://lispm.dyndns.org
On Jun 28, 6:15 pm, Rainer Joswig <······@lisp.de> wrote:
> * Which SBCL version are using?
SBCL 0.9.14
> * How are you using SBCL (Terminal, SLIME, ...)?
Terminal with Linedit (see my rc file below)
> * Do you have a special setup for SBCL?
(require 'asdf)
(require 'asdf-install)
(when (interactive-stream-p *terminal-io*)
(require :sb-aclrepl)
(require :linedit)
(funcall (intern "INSTALL-REPL" :linedit) :wrap-current t))
Leslie
In article <························@m36g2000hse.googlegroups.com>,
"Leslie P. Polzer" <·············@gmx.net> wrote:
> On Jun 28, 6:15 pm, Rainer Joswig <······@lisp.de> wrote:
>
> > * Which SBCL version are using?
>
> SBCL 0.9.14
>
>
> > * How are you using SBCL (Terminal, SLIME, ...)?
>
> Terminal with Linedit (see my rc file below)
>
>
> > * Do you have a special setup for SBCL?
>
> (require 'asdf)
> (require 'asdf-install)
>
> (when (interactive-stream-p *terminal-io*)
> (require :sb-aclrepl)
> (require :linedit)
> (funcall (intern "INSTALL-REPL" :linedit) :wrap-current t))
>
> Leslie
I'm no expert on that. You might want to ask on the SBCL list.
Also getting a newer SBCL could be a good idea anyway.
SBCL 1.0.7 is just out...
http://sourceforge.net/project/showfiles.php?group_id=1373
--
http://lispm.dyndns.org