Re: [racket-users] Simple macro issues

2019-09-12 Thread Simon Haines
Thanks again Philip, this is making sense now. I appreciate your help with this. Regards, Simon. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+u

Re: [racket-users] Simple macro issues

2019-09-09 Thread Simon Haines
Thanks again Philip for taking the time to reply. This is a rather unpleasant pitfall of the REPL. If you try to evaluate the > expression `(if #f some-unbound-identifier 1)`, you will see that it > evaluates to `#f` in the REPL but raises an unbound identifier error in a > module. At the REPL,

Re: [racket-users] Simple macro issues

2019-09-09 Thread Simon Haines
Thanks Phillip for providing a very thorough example. There is much to digest in there, and some novel ideas I didn't know about (attaching values as attributes to syntax). What wasted a lot of time for me is that, despite the macroexpander's results, the macro works as expected in the REPL. If

Re: [racket-users] Simple macro issues

2019-09-08 Thread Simon Haines
Thanks Dan, I am learning a fair bit today: a quoted number evaluates to its unquoted value, and the racket/format templates are available outside format (I had forgotten that). I'm still trying to figure out why my original, terrible macro behaved the way it did, but I suspect I'll never know.

Re: [racket-users] Simple macro issues

2019-09-08 Thread Simon Haines
ecause syntax-rules don’t > give you an access to the syntax object. If you do want to manipulate > syntax object, use syntax-cases instead. In your case, however, the > problem is easy enough that you don’t need to directly manipulate syntax > objects. > > On Mon, Sep 9,

[racket-users] Simple macro issues

2019-09-08 Thread Simon Haines
I'm trying to write a macro that will turn a list of hex literals into a byte string. (hex a b c 1 2 3) ; #"\n\v\f\1\2\3" After many hours I have finally come up with this: #lang racket (define-syntax hex (syntax-rules () [(_ num ...) (bytes (let ([e (syntax-e #'num)])

Re: [racket-users] Trouble documenting a form with Scribble

2019-06-26 Thread Simon Haines
Thanks Ben! Took me a while to track this one down using your example as a guide. Because the macro was provided by a submodule of the collection, I needed a (require (for-syntax packrat/parse)) in there as well, otherwise the @defform/subs would not link when it occurred under a @defmodule[packrat

[racket-users] Trouble documenting a form with Scribble

2019-06-25 Thread Simon Haines
I'm porting the PLaneT package 'packrat' to the new package catalog and I'm having trouble documenting a syntax form. Here is the relevant snippet from the scribble documentation: @defform/subs[#:literals (! / := |@| quote) (parse id (nonterminal-id (sequence body body0 ...) ...) .

Re: [racket] DSL for multi-dimensional datasets?

2012-11-06 Thread Simon Haines
y to > Racket? > > That way you get what you need, plus experience in building a DSL, plus > the power and speed of Racket. > > > > > On Nov 5, 2012, at 11:32 PM, Asumu Takikawa wrote: > > > On 2012-11-06 15:22:49 +1100, Simon Haines wrote: > >> As par

Re: [racket] DSL for multi-dimensional datasets?

2012-11-06 Thread Simon Haines
9, Jay McCarthy wrote: > I would suggest looking into PADS as well: > > http://www.padsproj.org/doc.html > > On Mon, Nov 5, 2012 at 9:22 PM, Simon Haines > wrote: > > As part of my work, I frequently have to 'shape' multi-dimensional > datasets. > > This

Re: [racket] DSL for multi-dimensional datasets?

2012-11-06 Thread Simon Haines
mber 2012 15:32, Asumu Takikawa wrote: > On 2012-11-06 15:22:49 +1100, Simon Haines wrote: > >As part of my work, I frequently have to 'shape' multi-dimensional > >datasets. This is reasonably easy to do in Racket and I'm thinking > >about pulling

[racket] DSL for multi-dimensional datasets?

2012-11-05 Thread Simon Haines
As part of my work, I frequently have to 'shape' multi-dimensional datasets. This is reasonably easy to do in Racket and I'm thinking about pulling together some of the functions I use into a library. Before I do this though, I was wondering if there is any similar work I can build upon, or perhaps

Re: [racket] Web server templates

2012-06-05 Thread Simon Haines
On 5 June 2012 22:40, Jay McCarthy wrote: > This question is answered in the FAQ: > Thanks Jay, I read the faq before posting, but it didn't answer my question, hence my post. I'm just going to assume you can't flush the template cache except by restarting the server. I guess I was hoping for a

[racket] Web server templates

2012-06-04 Thread Simon Haines
Is there any way to change a template provided with include-template without having to restart the web server? Cache-control headers don't work. Thanks. -- Simon. Racket Users list: http://lists.racket-lang.org/users

[racket] Functional Data Structures for Typed Racket?

2012-05-22 Thread Simon Haines
I'm pretty keen to try out some of the new data structuresfor typed Racket, but they haven't landed yet--either in 5.2.1, or in the repo last I checked. Is there any notion of when I might be able to get my hands on them? -- Simon. ___

[racket] Recovering the documentation index?

2012-03-05 Thread Simon Haines
Mostly when I install something from planet, the documentation somehow gets screwed up. For example, after I installed untyped/dispatch, I now have the following entries in my ~/.racket/5.2.1/doc/index.html page: (part ("(planet dispatch.scrbl (untyped dispatch.rkt 2 1) scribblings)" "top")) (pa

Re: [racket] Racket 5.2.1 segfault

2012-03-01 Thread Simon Haines
On 1 March 2012 17:16, Kevin Tew wrote: > This is the magic incantation I use to use with valgrind. > > valgrind --tool=memcheck --db-attach=yes > --vex-iropt-precise-memory-exns=yes --leak-check=full --num-callers=40 > > Thanks Kevin, I retried my test with your options, but had the same result

[racket] Racket 5.2.1 segfault

2012-02-29 Thread Simon Haines
I'm coming across a segfault when using racket 5.2.1 in some particular circumstances. Here is a sample to reproduce the problem: #!/home/simon/racket/bin/racket #lang racket/base (display "This is a test, designed to provoke an emotional response") When I chmod +x and run it, it runs just fine:

Re: [racket] Look-ahead in parser-tools?

2012-01-17 Thread Simon Haines
On 17 January 2012 23:53, Dmitry Pavlov wrote: > To work that around, I would > change the lexer rules by putting mandatory quotes around > facts or something like that. > > Thanks Dmitry, I'd contemplated this idea as it simplifies the parser, but complicates the language. I think I've run into

Re: [racket] Look-ahead in parser-tools?

2012-01-17 Thread Simon Haines
Hi Eric, On 17 January 2012 14:19, Erik Silkensen wrote: > Hi Simon, > > I think one problem might be that 'any-string' is including whitespace. > Could you define alias and fact in some way that's more specific? For > example, if you had an 'id' token of just letters ((:+ alphabetic) > (token

[racket] Look-ahead in parser-tools?

2012-01-16 Thread Simon Haines
I've been playing around with parser-tools and am having difficulty expressing the following language: "remember is " "remember " where is any string that does not contain the word 'is', is a well-formed email address and is any string that does not match the previous constraints. Here's (st