Oops, forgot to include the users list. _____
From: Jos Koot [mailto:jos.k...@gmail.com] Sent: miércoles, 06 de abril de 2016 23:03 To: 'Richard Adler' Subject: RE: [racket-users] macros within expressions. You don't need a macro here. Why not simply: (map point-y points) May be your example is an extract where you realy need a macro. In that case: (define-syntax y-coord (syntax-id-rules () [(y-coord lst) (map point-y lst)])) (y-coord points) You can't map a macro. You could make a macro-mapper though: (define-syntax-rule (map-macro macro arg) (map (λ (x) (macro x)) arg)) (define-syntax-rule (y-macro arg) (point-y arg)) (map-macro y-macro points) But in general it is wise to AVOID MACROS. Good luck, Jos -----Original Message----- From: racket-users@googlegroups.com [ <mailto:racket-users@googlegroups.com> mailto:racket-users@googlegroups.com] Sent: miércoles, 06 de abril de 2016 22:27 To: Racket Users Subject: [racket-users] macros within expressions. I am trying to use a macro, y-coord, in the following way: (struct point (x y)) (define points (list (point 25 25) (point 33 54) (point 10 120)) (map y-coord points) I am expecting the result: '(25 54 120) and the error is "y-coord: bad syntax in: y-coord Here is the macro: (define-syntax y-coord (syntax-id-rules (map) [(map y-coord lst) (map (lambda (p) (point-y p)) lst)])) Can anyone help? Thanks -- 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. For more options, visit <https://groups.google.com/d/optout> https://groups.google.com/d/optout. -- 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. For more options, visit https://groups.google.com/d/optout.