Let's take a look at this error:
"format-id: undefined;
cannot reference an identifier before its definition
phase: 1"
Since format-id is undefined, we need to require the corresponding module.
The docs say the identifier is from racket/syntax.
Now
(require racket/syntax) w
Nevermind, I got it working (or at least it seems to work):
(define-syntax-rule (defpref ident default test?)
(begin
(define ident
(case-lambda
[() (pref 'ident)]
[(value) (pref 'ident value)]))
(pref 'ident default test?)))
Best,
Erich
--
You received this mess
Thanks for your your help. Unfortunately, I haven't managed to get my
head around the phases and the question of when symbols are quoted or
evaluated. I tried Matthew Buttericks change but it yields an error:
"format-id: undefined;
cannot reference an identifier before its definition
phase: 1"
> On Jan 12, 2017, at 6:21 AM, Erich Rast wrote:
>
> #lang racket
> (require framework/preferences)
> (provide init-preferences const:app-name const:app-version
> pref:db-path)
>
> (define const:app-name "Virtual Assistant")
> (define const:app-version 1.0)
>
> (define default-datapath
Hi all,
I'm programming in Racket for many years and still haven't used macros
or delved into how they work. Kind of embarrassing... anyway, it should
be clear what I want to achieve in the code below. I like to wrap a
module around framework/preferences, abstracting from the preference
implementa
5 matches
Mail list logo