[CM] 2 questions
Rick Taube
taube@uiuc.edu
Thu, 17 Oct 2002 15:03:18 -0500
>Hi all,
>
>Two questions concerning cm with guile:
>
>1. when specifying a new pattern I figure it is required to specify
> the type of pattern elements. How is it possible to store arbitrary
> symbols in a cycle pattern in order to get the following:
>
> (next (new cycle my-items <?> '(*a* *b* 'foo 'bang *c*)) #t)
>
> -> (*a* *b* 'foo 'bang *c*)
No, patterns dont care what you put in them, just do:
(define foo (new cycle of '(*a* *b* foo bang *c*)))
But note that I REMOVED your internal quoting of foo and bang!!!
>2. How can I access the symbol-value of a symbol?
>
Ive defined a symbol-value for Guile. Its in the tarball im
releasing tomorrow. It may also be in the code you have -- look
in guile.scm to see if its there.
But...are you sure you want to do this? If the idea is to put these values into a pattern you can just evaluate the specific args that are variables, ie:
(new cycle of (list *a* *b* 'foo 'bang *c*))
You might also look at the 'pval' macro -- it evals pattern elements
dynamically, ie as the pattern is unfolding. the 'cage' example
shows how to use them.