I think that's because it's being parsed as @map (+1):10 11:20
If you're using operators on their own, it's a good idea to put them in parens: @map (+) 1:10 11:20 On 14 January 2015 at 09:36, yi lu <zhiwudazhanjiang...@gmail.com> wrote: > @map + 1:10 11:20 > > failed > :) > > On Wed, Jan 14, 2015 at 5:23 PM, Mike Innes <mike.j.in...@gmail.com> > wrote: > >> Using $(args...) should do the trick, I think. >> >> On 14 January 2015 at 09:20, yi lu <zhiwudazhanjiang...@gmail.com> wrote: >> >>> Hi, >>> >>> I want to write a macro which works as map function. >>> >>> It should work for these. >>> >>> ``` >>> @map x->x+1 1:10 >>> @map + 1:10 11:20 >>> ``` >>> >>> I know it is just copying the argument list in the macro to the map >>> function, but I get stuck. >>> >>> ``` >>> macro map(f,args...) >>> quote >>> map($f, $args...) >>> end >>> end >>> ``` >>> >>> won't work. >>> >>> ``` >>> macro map(f,args...) >>> quote >>> map($f, $args[1:end]) >>> end >>> end >>> ``` >>> >>> won't work either. >>> >>> What is the problem here? How can I get a correct @map macro? >>> >>> >>> Best wishes, >>> Yi >>> >> >> >