I think you can create an Expr whose head is `:function`.
but it will take some more effort to do same thing ...
but I'd like Expr :).
Yakir Gagnon於 2014年10月6日星期一UTC+8上午2時57分10秒寫道:
>
> Awesome!!!
> That's exactly what I needed! I missed the need for symbol in there, and
> tried to put the $k part together with everything else. This is great,
> thanks Toivo!
>
> On Monday, October 6, 2014 4:50:14 AM UTC+10, Toivo Henningsson wrote:
>>
>> I think that you will have to provide a little more detail. When you eval
>> code, the name of a function will be specified by a symbol, which you can
>> create using symbol(name), where name is a string. Then you have to
>> interpolate the function name, eg
>>
>> @eval $(symbol("f$k"))(x) = x + $k
>>
>> should create a function depending on the value in the variable k, eg
>> when k = 10,
>>
>> f10(x) = x + 10
>>
>>