Re: [racket-users] Simple macro issues

2019-09-09 Thread Daniel Prager
Hi Simon I think you'll find that the if statement is misguided, since it treats numbers as decimal rather than hex valued. Happily, this simplifies the solution. #lang racket (define-syntax-rule (hex h ...) (bytes (string->number (~a (quote h)) 16) ...)) (hex a b c 1 2 3 41 42 43) ;

Re: [racket-users] Simple macro issues

2019-09-09 Thread Philip McGrath
On Mon, Sep 9, 2019 at 2:42 AM Simon Haines wrote: > I'm still trying to figure out why my original, terrible macro behaved the > way it did, but I suspect I'll never know. I would have wasted a lot of > time on that awful construct. I appreciate your help, many thanks. > A great way to

Re: [racket-users] Simple macro issues

2019-09-09 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

[racket-users] community choice winners

2019-09-09 Thread Stephen De Gabrielle
Hi Racketeers, The community choice results are in; 1st: tessellation by Zachary Romero https://github.com/zkry/tessellation 2nd: lightsaber by Justin Zamora https://github.com/standard-fish/lightsaber Best Entry with Butter and Local Maine Maple Syrup: waffle-racket by Connie

Re: [racket-users] Simple macro issues

2019-09-09 Thread Philip McGrath
On Mon, Sep 9, 2019 at 8:17 PM Simon Haines wrote: > What wasted a lot of time for me is that, despite the macroexpander's > results, the macro works as expected in the REPL. If you paste my original > macro into DrRacket, run it, then type '(hex a)' into the REPL you get the > expected result.

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

Re: [racket-users] Downloadable tutorials (e.g. on github)? Tutorial example source codes samples attached to DrRacket instalation?

2019-09-09 Thread Philip McGrath
For pedagogical examples, you may like the games that go along with the "Realm of Racket" book, which are also in the main Racket distribution. For example, try "Open Require Path …" for `realm/chapter2/source`, or here is the whole collection on GitHub: https://github.com/racket/realm On Mon,

Re: [racket-users] Simple macro issues

2019-09-09 Thread Daniel Prager
Hi Simon I only use macros sparingly, and sympathise with your struggles to develop macro-fu. Some simple macros can be written quite simply using define-syntax-rule/s and aren't that much more complex than writing functions. To milk a bit more from this example, here's a similarly themed

Re: [racket-users] transparency in Pict

2019-09-09 Thread Jens Axel Søgaard
You can use a path with an even-odd-fill to cut out parts. An example: #lang racket (require metapict metapict/polygons) (define (cutout p x y r) (defv (w h) (pict-size p)) (with-window (window 0 w 0 h) (brushstipple (pict->bitmap p) (eofill (rectangle (pt 0 0) (pt w

Re: [racket-users] Downloadable tutorials (e.g. on github)? Tutorial example source codes samples attached to DrRacket instalation?

2019-09-09 Thread Prokop Hapala
Aha, /usr/share/racket/pkgs/games/(on Ubuntu 18.04) Great, that is exactly what I was searching for. Thanks ! Only two things: - how can user know that this directory was installed with racket? DrRacket could have some link to this directory somewhere (e.g. under File > Open, or

[racket-users] transparency in Pict

2019-09-09 Thread Hendrik Boom
I'm wondering how to cut a transparent hole in something. Say I have a rectangle and I want to make part of it transparent so that I cn see what's behind it. Drawing a transparent rectangle on top of it won't workm because it'll just reveal the original rectangle. The only way I cn see it to

Re: [racket-users] Downloadable tutorials (e.g. on github)? Tutorial example source codes samples attached to DrRacket instalation?

2019-09-09 Thread Jens Axel Søgaard
FWIW there a lot of (small) examples at https://rosettacode.org/wiki/Category:Racket /Jens Axel Den man. 9. sep. 2019 kl. 16.09 skrev Prokop Hapala : > Hi, > > I recently found Racket when I was searching some tutorials about Lisp and > Metaprogramming. I really like that the community around

[racket-users] Downloadable tutorials (e.g. on github)? Tutorial example source codes samples attached to DrRacket instalation?

2019-09-09 Thread Prokop Hapala
Hi, I recently found Racket when I was searching some tutorials about Lisp and Metaprogramming. I really like that the community around DrRacket seems to be very much interested in education, making talks and tutorials even for childerens. The doc pages https://docs.racket-lang.org/ seems to

Re: [racket-users] Downloadable tutorials (e.g. on github)? Tutorial example source codes samples attached to DrRacket instalation?

2019-09-09 Thread Neil Van Dyke
You can find various Scheme code around the Internet, and various textbooks that use Scheme (sometimes with the code available for download). The Racket code for much of core Racket itself is also available, and some of it will probably be installed already, though it's mostly not written as

[racket-users] Re: Downloadable tutorials (e.g. on github)? Tutorial example source codes samples attached to DrRacket instalation?

2019-09-09 Thread Alex Harsanyi
On Monday, September 9, 2019 at 10:09:02 PM UTC+8, Prokop Hapala wrote: > > Hi, > > I recently found Racket when I was searching some tutorials about Lisp and > Metaprogramming. I really like that the community around DrRacket seems to > be very much interested in education, making talks and

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.