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 function:

#lang racket

(define (hex/f hs)
  (apply bytes
         (for/list ([h hs])
           (string->number (~a h) 16))))

(hex/f '(a b c 1 2 3 41 42 43)) ; #"\n\v\f\1\2\3ABC"


The (marginal) advantage of the macro, of course, is that we can omit the
quote from the function call.

Dan

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAFKxZVX2gx4PWpdUezs1nq3WJEsrujC3yStRDa-6kBvfrHa%3Dwg%40mail.gmail.com.

Reply via email to