chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Trouble w/ ersatz


From: Ivan Raikov
Subject: Re: [Chicken-users] Trouble w/ ersatz
Date: Thu, 8 Nov 2012 15:25:54 +0900


Hi Matt,
  
   Thanks for your offer to write documentation. Of course I will be happy to accept your contributions.

   You are correct that  '((a Tstr "foo") (x Tstr "bar")) is also an alist, but the use of quote means that the Tstr constructor is not evaluated. There is a longer discussion on quote vs. quasiquote on Stack Overflow: http://stackoverflow.com/questions/134887/when-to-use-quote-in-lisp . So the "value" in your example ends up being a list that consists of the symbol 'Tstr and the string "bar". Whereas the evaluation of (Tstr "bar") yields a record of type tvalue, which is what the ersatz evaluator understands.

One way to construct the models alist without quasiquotation would be the following

 (list 
        (cons 'a (Tstr "foo"))
        (cons 'x (Tstr "bar"))
)

This yields the same result as the quasiquotation example, namely that each element of the alist is an ordered pair where the first element is a symbol and the second element is a record of type tvalue.


  -Ivan

On Thu, Nov 8, 2012 at 12:35 PM, Matt Gushee <address@hidden> wrote:
 
The models argument must be an association list, i.e. a list of dotted pairs of the form (NAME . VALUE) where NAME is a symbol and VALUE is a template value.

... yes, got that ... am I mistaken in thinking that '((a b c) (x y z)) [or '((a Tstr "foo") (x Tstr "bar"))] is effectively an alist, where the cdr of each element is itself a pair?
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]