>
> Yes, you could define an impersonator property and then wrap your
> generator with `impersonate-procedure`:
>
This is amazing! I feel it now does exactly what I want. Thanks!
>
>
>
> #lang racket
> (require (except-in racket/generator yield)
>
> On Feb 20, 2019, at 4:29 PM, Kees-Jochem Wehrmeijer wrote:
>
> With your define/ideal-world form, is there a way to test whether something
> was created using that form? E.g. by generating a predicate like ideal-world?
> That way I can make sure with a contract that my function gets passed a
> You can make a new `define` form where `yield` means something different:
>
Ha that's really cool! I definitely need to read up more on the different
macro tricks. I'm new to Racket (my nearest experience is in Clojure), so
David's point about looking for idiomatic ways is well taken. There's
de
> You would know better than I would, but I wonder if you are making an
> effort to bring familiar constructs into Racket that don't really fit,
> instead of looking for more idiomatic ways to do what you want.
>
Yeah, I know what you mean. It's always a struggle to remain both concise,
but at the
> On Feb 20, 2019, at 8:47 AM, Kees-Jochem Wehrmeijer wrote:
>
> While this scheme works, it silently breaks if a user accidentally calls
> (yield) instead of ((yield)). It might not be a big deal, but in an ideal
> world I'd only allow the 'correct' way.
You can make a new `define` form whe
On Wed, Feb 20, 2019 at 11:48 AM Kees-Jochem Wehrmeijer
wrote:
>
> Yeah, that works. I came up with a similar scheme where if the value that's
> passed to the generator is an exception, it will raise it. Your scheme is a
> little simpler, but for completeness I listed mine below too. One thing I
Yeah, that works. I came up with a similar scheme where if the value that's
passed to the generator is an exception, it will raise it. Your scheme is a
little simpler, but for completeness I listed mine below too. One thing I'm
still a little unhappy with is that whoever uses it, needs to remember
How about this?:
On Tue, Feb 19, 2019, 9:57 PM Kees-Jochem Wehrmeijer
wrote:
> Basically when I call the function throw. So e.g.
>
> (define mygenerator (generator ()
>(with-handlers ([exn:fail? (lambda (e) 42)])
> (yield 1)
>
Basically when I call the function throw. So e.g.
(define mygenerator (generator ()
(with-handlers ([exn:fail? (lambda (e) 42)])
(yield 1)
(yield 2)
(yield 3
> (my
Under what circumstances would you want it to throw? When the generator
runs out, or...?
On Tue, Feb 19, 2019, 3:59 PM Kees-Jochem Wehrmeijer
wrote:
> Hi,
>
> Python allows to call a .throw() method on a generator. I was wondering if
> Racket generators have a similar feature. From the docs it d
Hi,
Python allows to call a .throw() method on a generator. I was wondering if
Racket generators have a similar feature. From the docs it doesn't seem to
have that. One way I could see around this is to set a parameter and then
check for that parameter in the generator and raise an exception ba
11 matches
Mail list logo