@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
>>
>
>

Reply via email to