.)
> #'(for* ([i for-clause] ...) todo ...)]))
>
> (define (nestfortest . args) (displayln args))
>
> (myfor (a b c) '(1 2)
> (displayln `(,a ,b ,c)))
>
>
>
>
> On Mar 13, 2012, at 8:02 PM, rob cook wrote:
>
> > To add to prior query - h
To add to prior query - here's what I did, but I just think there *must* be
a more elegant solution.
(define (nestfor depth forclause todo)
(define (nf depth forclause todo resultant)
(for ((x forclause))
(if (= depth 1)
(apply todo (append (list x) resultant))
(nf
I'd like to be able to create a nested for where the depth of nesting is
determined dynamically.
For example, instead of
(for* ((a '(0 1)) (b '(0 1))) (printf "~v~v " a b))
I could just say
(myfor (2 '(0 1)) ).
such that the above as (myfor (3 '(0 1)) ). would allow me to effect the result:
Still pondering this, seems it is not possible w/o macro or eval.
Using eval as follows:
(eval `(match ',(car z) (,@(cdr words) #t) (_ #f)))
gets me what I need, but the overhead (and ugliness) of using eval is
killing me.
In this example, obviously the result of (car z) is what I'm attempting
trary match expression, and use it for the bar in the match shown
above. Ideas?
Thx again,
Rob
On Fri, Mar 9, 2012 at 4:37 PM, rob cook wrote:
> That is, without using a macro or eval. Id like to do:
>
> (define a 4)
> (define l1 '(1 2 3))
> (match l1
> (`(1 2 ,a) #t)
That is, without using a macro or eval. Id like to do:
(define a 4)
(define l1 '(1 2 3))
(match l1
(`(1 2 ,a) #t)
(_ #f))
So that this example would result in #f, and #t if a bound to 3.
Since of course match has its own quasiquote behavior, this does not seem
possible w/o making a macro for
6 matches
Mail list logo