> On Jun 3, 2019, at 9:09 AM, Matthias Felleisen <matth...@felleisen.org> wrote:
> 
> 
> Or, 
> 
> #lang racket
> 
> (require (for-syntax ) racket/stxparam)
> 
> (define-syntax-parameter return (syntax-rules ()))
> (define-syntax-parameter false (syntax-rules ()))
> 
> (define-syntax fn
> (syntax-rules ()
>   [(_ (arg ...) body ...)
>    (λ (arg ...)
>      (let/cc fn-exit
>        (syntax-parameterize ([return (syntax-rules () [(_ x) (fn-exit x)])])
>          (syntax-parameterize ([false (syntax-rules () [(_) (return #f)])])
>            body ...))))]))
> 
> ((fn (x y) (when (< x y) (return x)) y) 2 30) ; => 2
> ((fn (x y) (when (< x y) (false)) y) 2 30)   ;=> #f
> 

Oh! I see! That solves the expansio issue! Wonderful. You’ve opened up a whole 
new set of possibilities for me. Thanks, Matthias.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/F77FB88D-5D84-4F67-87F5-8F53717DFF61%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to