Re: [racket-users] Macro guards question

2019-05-29 Thread Kevin Forchione
> On May 29, 2019, at 11:09 AM, Sorawee Porncharoenwase > wrote: > > (foo a) ;=> 1 > (foo "a") ;=> 2 > (foo 10) ;=> 3 > (foo 'a) ;=> 4 > (foo (bar x)) ;=> 5 Ah… thanks so much for the explanation. That’s put me much closer (I hope!) to the solution I’m after. A bit of stumbling around through

Re: [racket-users] anyone using single-flonums?

2019-05-29 Thread Matthew Flatt
At Wed, 29 May 2019 12:33:24 -0400, George Neuner wrote: > Question: does/will Chez support converting to/from 32-bit floats for C > libraries? Yes. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiv

Re: [racket-users] anyone using single-flonums?

2019-05-29 Thread Doug Williams
I support them in various packages, but I rarely use them, per se. Those packages would have to be updated, but it wouldn't be a big deal for me. Doug On Wed, May 29, 2019 at 9:52 AM Matthew Flatt wrote: > Does anyone use single-flonums in Racket? > > I don't mean `_float` or `f32vector`s, whic

Re: [racket-users] anyone using single-flonums?

2019-05-29 Thread Dmitry Pavlov
My guess is that no one uses them currently, because it's rare that you'd want to trade speed for *im*precision. Single-flonums in Racket are significantly slower than regular flonums, because they're not treated as a common case. The only use I can think of, and the one that inspired the origi

Re: [racket-users] Macro guards question

2019-05-29 Thread Sorawee Porncharoenwase
The issue is that #'arg will always be a syntax object. An identifier is a kind of syntax object, so it makes sense to test (identifier? #’arg). However, (symbol? #’arg) and (string? #’arg) will always fail. Suppose then that you invoke the macro with "1" as the operand, it would fail every case i

Re: [racket-users] Macro guards question

2019-05-29 Thread Ryan Kramer
#'arg is a syntax object, therefore (number? #'arg) or (string? #'arg) will always be false. If you are trying to dispatch based on literals, you could use e.g. (number? (syntax-e #'arg)) to identify a numeric literal. But it is not very common that a macro handles a numeric literal differently

[racket-users] Macro guards question

2019-05-29 Thread Kevin Forchione
Hi Guys, What are the rules for macro guards? I’ve only seen examples with (identifier? #’val) being used. What about (number? #’val) or (spring? #’val)? When I try these I get a foo: bad syntax so I’m suspecting these can’t be used or there’s some trick to them. What I’ve been trying to creat

Re: [racket-users] anyone using single-flonums?

2019-05-29 Thread George Neuner
On 5/29/2019 11:52 AM, Matthew Flatt wrote: Does anyone use single-flonums in Racket? I don't mean `_float` or `f32vector`s, which convert C `float`s or 32-bit array elements into regular double-precision Racket flonums. I mean literals like `3.0f0` or functions like `real->single-flonum`, whi

[racket-users] anyone using single-flonums?

2019-05-29 Thread Matthew Flatt
Does anyone use single-flonums in Racket? I don't mean `_float` or `f32vector`s, which convert C `float`s or 32-bit array elements into regular double-precision Racket flonums. I mean literals like `3.0f0` or functions like `real->single-flonum`, which produce a Racket number that uses only 32 bit

[racket-users] How to implement "APL" bitstrings in racket?

2019-05-29 Thread Raoul Schorer
Hi, I would like to know how you would implement bitstrings "à la APL", meaning bitstrings/bitvectors of arbitrary dimensions with packed representation and possibilities for implicit parallelism. I am under the impression that this essentially means adding a bit type to the numeric tower, but