Re: [racket-users] How to handle circular 'requires'

2018-05-14 Thread Matthew Butterick
To add to your pile of options, because you said "certain error conditions": perhaps you might `raise` an exception in the db code that gets caught by the network code (using `with-handlers`). In this way the dependency only runs one direction (network module imports db module) but the db module

Re: [racket-users] How to handle circular 'requires'

2018-05-14 Thread David Storrs
On Mon, May 14, 2018 at 10:07 PM, Greg Hendershott wrote: > David you wrote "both" so I just wanted to point out I read three ways: Good point; I misspoke. (Mistyped?) > 4. It doesn't sound like this is your case, but: If there are many > function calls where you pass the extra parameter, and t

Re: [racket-users] How to handle circular 'requires'

2018-05-14 Thread Greg Hendershott
David you wrote "both" so I just wanted to point out I read three ways: 1. Units 2. Callbacks (pass the function as a parameter). 3. Lazy-requires In a simple case (maybe yours?) I'd suggest trying 2 (callbacks) first, and see how that works for you in practice. Also: 4. It doesn't sound like t

Re: [racket-users] How to handle circular 'requires'

2018-05-14 Thread David Storrs
Brilliant. I knew there had to be a clean way and both of these sound good. Thanks. Dave On Mon, May 14, 2018 at 4:56 PM, Alexis King wrote: > In addition to what Matthias says, you can also sometimes break these > kinds of cycles using lazy-require, which defers the requiring the other > modu

Re: [racket-users] How to handle circular 'requires'

2018-05-14 Thread Alexis King
In addition to what Matthias says, you can also sometimes break these kinds of cycles using lazy-require, which defers the requiring the other module until it is first needed. This is simpler than using units and provides stronger guarantees than using callbacks, but it is a bit more ad-hoc than bo

Re: [racket-users] How to handle circular 'requires'

2018-05-14 Thread Matthias Felleisen
> On May 14, 2018, at 4:28 PM, David Storrs wrote: > > My application retrieves chunks of files from the network and writes > them to disk, as well as writing certain data about them to the > database (e.g. where they are on disk and where they came from on the > network). > > I've split these

[racket-users] How to handle circular 'requires'

2018-05-14 Thread David Storrs
My application retrieves chunks of files from the network and writes them to disk, as well as writing certain data about them to the database (e.g. where they are on disk and where they came from on the network). I've split these functions into separate files: app/network/chunks.rkt app/lib/db/ch

Re: [racket-users] sxml:document

2018-05-14 Thread Neil Van Dyke
As soon as tools get into accessing resources via URLs from the XML (which I don't think is what you're doing, but it might be the next step for someone), it should be documented that there's a need for access control. Sorry, I mostly meant to make a side comment for the list, and I oversta

Re: [racket-users] sxml:document

2018-05-14 Thread 'John Clements' via Racket Users
> On May 13, 2018, at 11:42 PM, Neil Van Dyke wrote: > > John, thank you for your past&present work on the SXML stuff. Two comments: > >> enforcing the “file://“ prefix. > > Sounds like the following doesn't matter in this case, but another way to > support both a given URL or given filename

Re: [racket-users] Macro from list to class init

2018-05-14 Thread Matthias Felleisen
> On May 14, 2018, at 6:55 AM, Denis Michiels wrote: > > Hello, > > I'm trying to build a macro to be able to do : > > ``` > (define data (list (cons 'label "My button") > (cons 'stretchable-width #t))) > > (my-macro button% data) > ``` > > to be translated in : > > ``` >

[racket-users] Edmond's Blossom Algorithm

2018-05-14 Thread Jens Axel Søgaard
Context: I have students A, B, C, ..., Z that needs to work in pairs for their exam. Each student has made a wish list with 3 other students that they'd like to work with. I need to find the maximum possible pairing. I think - maybe - that the algorithm I need is Edmond's blossom algorithm. Am I

[racket-users] Macro from list to class init

2018-05-14 Thread Denis Michiels
Hello, I'm trying to build a macro to be able to do : ``` (define data (list (cons 'label "My button") (cons 'stretchable-width #t))) (my-macro button% data) ``` to be translated in : ``` (new button% [label "My button"] [stretchable-width #t]) ``` (I take gui example, and

[racket-users] S10 - a new commercial product in Racket

2018-05-14 Thread 'Paulo Matos' via Racket Users
Hi all, I was discussing this in racket-money and someone suggested I should quickly reference it here. S10 (https://linki.tools/s10) is a superoptimization framework in Racket. If you are familiar with Mangpo's work on Greenthumb you know what I am talking about. This work follows a similar pat