On 18-01-12 17:47, Matthew Flatt wrote: > At Wed, 18 Jan 2012 12:02:10 +0100, Marijn wrote: >> I would expect both forms to work. This is a reduction of a different >> problem possibly caused by these issues here.
So I tried to cut down my program to a reasonably sized test-case which is attached to this email. model.rkt contains (what's left of) the model macro, demo1.rkt contains a small model and a (require frtime). If you do "racket demo1.rkt" then you get the following error: model.rkt:30:17: make-entry: bad syntax in: (make-entry (= profit (for/hash ((y years)) (values y (- (hash-ref income y 0) (hash-ref expenses y 0))))) (years income expenses profit)) === context === standard-module-name-resolver but if you comment the (require frtime) then the error goes away. I have other code that tests this same simple-economy model with the non-cutdown version of the model macro and supporting code and everything seems to work fine. Any idea what's going on here? Marijn
#lang racket/gui ;;; comment this line to make error go away (require frtime) (require "model.rkt") (define simple-economy (model make-immutable-hash hash-ref ((? years #f) (? income (hash)) (? expenses (hash)) (= profit (for/hash ((y years)) (values y (- (hash-ref income y 0) (hash-ref expenses y 0) )))) )))
#lang racket (provide model) (struct variable ((value #:mutable) rule)) (define-syntax make-store (syntax-rules () ((_ _make-store_ _get-value_ ((_type_ _id_ _args_ ...) ...)) (let-syntax ((make-entry (syntax-rules (? =) ((_ (? __id__ __init-value__) __other-ids__) `(__id__ . ,(variable __init-value__ #f))) ((_ (= __id__ __rule__) (__other-id__ (... ...))) `(__id__ . ,(variable #f (lambda () (let-syntax ((__other-id__ (syntax-id-rules () (_ (_get-value_ '__other-id__)))) (... ...)) __rule__)))))))) (letrec ((store (_make-store_ `(,(make-entry (_type_ _id_ _args_ ...) (_id_ ...)) ...)) )) store))))) (define-syntax model (syntax-rules () ((_ _make-store_ _store-ref_ ((_type_ _id_ _args_ ...) ...)) (let () (define (get-variable id) (_store-ref_ store id)) (define (get-value id) (variable-value (get-variable id))) (define store (make-store _make-store_ get-value ((_type_ _id_ _args_ ...) ...))) (match-lambda* ((list 'get id) (get-value id))) ))))
signature.asc
Description: OpenPGP digital signature
_________________________ Racket Developers list: http://lists.racket-lang.org/dev