Re: [racket-users] raise an exception in a generator

2019-02-19 Thread David Storrs
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) >

Re: [racket-users] raise an exception in a generator

2019-02-19 Thread Kees-Jochem Wehrmeijer
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

Re: pkgs still has no docs? (was: Re: [racket-users] Questions about Scribble docs)

2019-02-19 Thread David Storrs
Speaking of things with no docs, the abnf package seems intriguing. Does anyone have a short summary or example? On Tue, Feb 19, 2019, 5:14 PM John Clements wrote: > Looks like… this is still the case? Specifically, reloading > pkgs.racket-lang.org still shows that all packages are missing > doc

Re: [racket-users] raise an exception in a generator

2019-02-19 Thread David Storrs
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

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Matthew Butterick
> On Feb 19, 2019, at 2:33 PM, Brian Adkins wrote: > > Awesome - that did the trick. I'm confused as to why it helped to inject STR > into the lexical context - it ends up being just a string, and it was working > fine with respect to loading the template. I would think the fix would be to >

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Brian Adkins
On Tuesday, February 19, 2019 at 5:06:32 PM UTC-5, Matthew Butterick wrote: > > > > On Feb 19, 2019, at 1:28 PM, Brian Adkins > wrote: > > Oops - I spoke too soon. It appears the lexical context is unavailable to > the template when include-template is used in this manner. > > > Ah right, one ha

[racket-users] mixed integer programming using glpk

2019-02-19 Thread 'John Clements' via Racket Users
I’m pleased to announce that I had a good reason to extend the glpk package to provide an interface to glpk’s mixed integer programming package; this means that if you can express your problem as a sequence of linear constraints on a set of variables where some of them need to be integers, you c

pkgs still has no docs? (was: Re: [racket-users] Questions about Scribble docs)

2019-02-19 Thread 'John Clements' via Racket Users
Looks like… this is still the case? Specifically, reloading pkgs.racket-lang.org still shows that all packages are missing documentation. I thought I’d seen a message suggesting that this was resolved, but it appears I was mistaken. John > On Feb 16, 2019, at 8:08 PM, David Storrs wrote: >

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Matthew Butterick
> On Feb 19, 2019, at 1:28 PM, Brian Adkins wrote: > > Oops - I spoke too soon. It appears the lexical context is unavailable to the > template when include-template is used in this manner. Ah right, one has to inject STR into the same lexical context, like so: #lang racket (require web-s

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Brian Adkins
On Tuesday, February 19, 2019 at 4:03:02 PM UTC-5, Brian Adkins wrote: > > On Tuesday, February 19, 2019 at 1:45:43 PM UTC-5, Matthew Butterick wrote: >> >> >> On Feb 19, 2019, at 8:25 AM, Brian Adkins wrote: >> >> But, I'm guessing that the include-template macro is unable to consume >> the ou

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Brian Adkins
On Tuesday, February 19, 2019 at 1:45:43 PM UTC-5, Matthew Butterick wrote: > > > On Feb 19, 2019, at 8:25 AM, Brian Adkins > wrote: > > But, I'm guessing that the include-template macro is unable to consume the > output of my view macro. Is there anything I can do to get (view login) to > be ex

[racket-users] raise an exception in a generator

2019-02-19 Thread Kees-Jochem Wehrmeijer
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

[racket-users] Transfer code from "intermediate student with lamnda" to "Pretty big"

2019-02-19 Thread orenpa11
Hi Is it possible to transfer code from "intermediate student with lamnda" to "Pretty big" for exmple : (require 2htdp/image) (require 2htdp/universe) (define (join-together ls1 ls2) (local [; help : [ListOf X] -> [ListOf X] ; (help ls1) drops the invariant argument ls2 (define

Re: [racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Matthew Butterick
> On Feb 19, 2019, at 8:25 AM, Brian Adkins wrote: > > But, I'm guessing that the include-template macro is unable to consume the > output of my view macro. Is there anything I can do to get (view login) to be > expanded prior to when include-template needs it? Wrap `include-template` with yo

[racket-users] Bending use of include-template to my needs (or, macro results as macro arguments)

2019-02-19 Thread Brian Adkins
I would like to take the following web request handler: (define (login request) (render-string (include-template "../views/authentication/login.html"))) and eventually get to something like: (define (login request) (render login)) My current lack of understanding with respect to macros i