[racket-users] Question about type annotations in `define' form

2016-04-25 Thread lfacchi2
Hi, all. Why does the following typecheck: #lang typed/racket (provide group) (define #:forall (A) (group [list : (Listof A)] [count : Exact-Positive-Integer]) : (Listof (Listof A)) (: group-step (All (A) ((Listof A) (Listof A) (Listof (Listof A)) -> (Listo

Re: [racket-users] Re: number->string format guarantees

2016-04-25 Thread Jay McCarthy
Interesting. FWIW, my particular interest is something that I can reliably send to other tools like Unix's bc or C's scanf. Going down this line, however, did make me question using `number->string` all over the place in demo Web programs. On Fri, Apr 22, 2016 at 10:22 AM, Robby Findler wrote: >

Re: [racket-users] Re: number->string format guarantees

2016-04-25 Thread Matthias Felleisen
Perhaps you should introduce a library of functions with names that specifically point to Unix/Linux compatibility — Matthias > On Apr 25, 2016, at 8:37 AM, Jay McCarthy wrote: > > Interesting. FWIW, my particular interest is something that I can > reliably send to other tools like Unix's bc

Re: [racket-users] Re: number->string format guarantees

2016-04-25 Thread Robby Findler
Annoying that you cannot send them the floating point bits and have to rely on their (probably complex) number parsing routines! Robby On Mon, Apr 25, 2016 at 7:37 AM, Jay McCarthy wrote: > Interesting. FWIW, my particular interest is something that I can > reliably send to other tools like Uni

Re: [racket-users] Re: number->string format guarantees

2016-04-25 Thread Matthew Flatt
I agree that the spec for printing inexacts needs to be clarified. The current output format for flonums is consistent with scanf(), at least for non-infinity and non-NaN values, since it's produced by sprintf("%g", ...). Using "%g" means that the number sometimes prints with an "e..." part and so

Re: [racket-users] Re: number->string format guarantees

2016-04-25 Thread Jay McCarthy
Thank you Matthew. The new docs are crystal clear on what I want. Thank you. Jay On Mon, Apr 25, 2016 at 10:50 AM, Matthew Flatt wrote: > I agree that the spec for printing inexacts needs to be clarified. > > The current output format for flonums is consistent with scanf(), at > least for non-in

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Matthew Butterick
On Apr 24, 2016, at 7:35 PM, Matthias Felleisen wrote: > > From the hip: Can your name-producing macro consume (val-producing-macro) and > then just directly generate the case-2 macro call directly: Can this be generalized? As a rule of thumb, is this accurate: You can NEVER use a macro in

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Alex Knauth
> On Apr 25, 2016, at 3:43 PM, Matthew Butterick wrote: > On Apr 24, 2016, at 7:58 PM, Alex Knauth wrote: >> One way to do this would be to make `(name-parsing-macro x "," y "," z)` a >> match-expander >> Does this work for you? Or is your case more complicated? > > Right, `match` is somewha

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Alex Knauth
>> On Apr 25, 2016, at 3:43 PM, Matthew Butterick wrote: >> ;; >> #lang racket >> >> (define-syntax-rule (binding-form _topid (_id ...)) >> (define (_topid) >> (let ([_id '_id] ...) >> (displayln (format "~a bound ~a" '_topid _id)) ...))) >> >> (binding-form foo (a b c)) >>

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Matthew Butterick
>> A macro that wants to put identifiers in a binding position MUST produce the >> whole binding form for those identifiers. > > Well, that's pretty much what match expanders are. Although the `match` forms > have to recognize these match expanders specially, and expand them itself, > one step

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Alex Knauth
> On Apr 25, 2016, at 5:05 PM, Matthew Butterick wrote: >> I was about to try to apply its awesome power to your example, but I just >> realized that in your new example, the s-expression `(id-maker a ZIM b ZAM >> c)` isn't actually used in a binding position. Instead the individual ids >> wi

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Alexis King
> That's why I think of `match` as special: it has its own means of extending > its interface, namely with match expanders. > > What I'm curious about is the more general situation of composing macros that > hold identifiers. It is my understanding that this is what Jack Firth’s generic-syntax

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Matthias Felleisen
On Apr 25, 2016, at 3:43 PM, Matthew Butterick wrote: > A macro that wants to put identifiers in a binding position MUST produce the > whole binding form for those identifiers. In the end and in general, yes. Since the kernel is very small and expands all surface language to a rather small

[racket-users] As clean as possible in a dirty macro

2016-04-25 Thread Nicholas Labich
I'm trying to write a small monad transformer library with macros. My goal: (define-monad IdM [(return a) a] [(bind m f) (f m)] [(foo) 'id-foo]) (define-trans ListT [(return a) (returnₘ (list a))] [(bind m f) (bindₘ m (λ (loa) (foldl (λ (a m′) (returnₘ (append (f a)

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Matthew Butterick
On Apr 25, 2016, at 3:08 PM, Alexis King wrote: > > Even more generally, if you want macros to compose in a more arbitrary > and less structured way, you can call local-expand from the containing > macro in order to “flip” evaluation order as I believe you described > in your original message.

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Alex Knauth
Did you see this earlier email? I got a similar "identifier tainted by macro expansion" error, but changing `define-syntax-rule` to `define-simple-macro` fixed it: > On Apr 25, 2016, at 5:03 PM, Alex Knauth wrote: > > >>> On Apr 25, 2016, at 3:43 PM, Matthew Butterick wrote: > >>> ;

Re: [racket-users] processing calling-site identifiers with a macro

2016-04-25 Thread Matthew Butterick
On Apr 25, 2016, at 3:08 PM, Matthias Felleisen wrote: >> A macro that wants to put identifiers in a binding position MUST produce the >> whole binding form for those identifiers. > > In the end and in general, yes. > > In the special case when you already have a macro whose interface can be

Re: [racket-users] DSL to C code generation with symbolic computations en route

2016-04-25 Thread William Hatch
Late to the party, because I've been ignoring most of my email for a week. I'm the one at the U of U that has started working on the problem as Jay mentioned. But with classes and other study on related, tangentially related, or simply tangential topics I haven't gone beyond the very simplest of