[julia-users] What is the goal of -> with @doc macro and Julia 0.5

2016-10-06 Thread Sébastien Celles
Hello,

In this SO question 
http://stackoverflow.com/questions/36191766/metaprogramming-within-docstring-with-eval/36209841#36209841

the following code

for (f, name) in ((:add, "addition"), (:sub, "subtraction"))
@eval begin
@doc """
This is the function $($name)
"""
function $f()
## FUNCTION BODY
end
end
end


works with Julia 0.4 but raises ERROR: LoadError: Invalid @var syntax 'This 
is the function '
with Julia 0.5

I noticed that it can be fixed for Julia 0.5 adding ->


for (f, name) in ((:add, "addition"), (:sub, "subtraction"))
@eval begin
@doc """
This is the function $($name)
""" ->
function $f()
## FUNCTION BODY
end
end
end


What is exactly the goal of -> with @doc macro ?

Why is it necessary with Julia 0.5 and not with Julia 0.4 ?


Kind regards


Re: [julia-users] Re: Julia-i18n logo proposal

2016-10-05 Thread Sébastien Celles
+1 for http://imgh.us/julia-i18n-j.svg

Le jeudi 6 octobre 2016 00:22:13 UTC+2, John Gibson a écrit :
>
> I also prefer the "J" one (http://imgh.us/julia-i18n-j.svg). It's more 
> balanced. The Hindi "ja" in particular fits the circle better and looks 
> more balanced without the diacritic "uu" (the loopy thing underneath).
>
> Nice job!
>
> John
>
> On Wednesday, October 5, 2016 at 4:35:10 PM UTC-4, Islam Badreldin wrote:
>>
>>
>> +1 for the logo with the 'J' sound.
>>
>>   -Islam
>> _
>> From: Stefan Karpinski 
>> Sent: Wednesday, October 5, 2016 10:13 AM
>> Subject: Re: [julia-users] Re: Julia-i18n logo proposal
>> To: Julia Users 
>>
>>
>> On Wed, Oct 5, 2016 at 9:29 AM, Waldir Pimenta  
>> wrote:
>>
>>> Oops, meant to link to julia-i18n-j.svg 
>>>  in the previous message, rather than 
>>> twice to the -ju variant.
>>>
>>
>> I like this one  – it looks nicely 
>> balanced. The letters from the three scripts is really nice.
>>
>>
>>

[julia-users] Metaprogramming functions with doctring from a dict

2016-10-05 Thread Sébastien Celles
Hello,

I'm new to Julia metaprogramming but I had a look at both
http://docs.julialang.org/en/release-0.5/manual/metaprogramming/
and
http://docs.julialang.org/en/release-0.5/manual/documentation/

I'd like to define (using metaprogramming) 4 functions (add, subtract, 
multiply, divide)
with their associated operator and docstring

I also would like to be able to "inspect" high level code... which is quite 
close
to what was asked in https://github.com/JuliaLang/julia/issues/2625

So here is what I did:

D_FUNC = Dict(
:add => (:+, "`add(a,b)` adds `a` and `b` together"),
:subtract => (:-, "`subtract(a,b)` subtracts `b` from `a`"),
:multiply => (:*, "`multiply(a,b)` multiplies `b` from `a`"),
:divide => (:/, "`divide(a,b)` divides `b` from `a`")
)

_D_CODE = Dict{Symbol,Expr}()

for (f, (op, s_doc)) in D_FUNC
expression = quote
$f(a,b) = $op(a,b)
end
_D_CODE[f] = expression
eval(expression)
end

This is quite close to my goals.

I can see generated code

julia> _D_CODE[:add]
quote  # REPL[3], line 3:
add(a,b) = begin  # REPL[3], line 3:
a + b
end
end

Functions are defined correctly:

julia> add(4,3)
7

julia> multiply(4,3)
12

but I don't know how I can "attach" docstring to each function (inside the 
for loop)

Any help will be great.

Kind regards


PS: Remy's answer in this StackOverflow question 
http://stackoverflow.com/questions/36191766/metaprogramming-within-docstring-with-eval
 
might be edited
because it doesn't work anymore with Julia 0.5



Re: [julia-users] Re: Julia-i18n logo proposal

2016-10-05 Thread Sébastien Celles
Hello,

Nice logo but I don't like "J" on top which sound a bit 
"occidental-centred".
Most Julia code use latin characters... so maybe for i18n we could avoid 
latin characters
So I'd remove "J" in this logo
I would put arabic character (ج or جو) into green circle
keep 朱 in the red circle
and an indic character into the purple circle because there's an active 
Julia community in India

Thanks

Le mercredi 5 octobre 2016 05:15:00 UTC+2, Islam Badreldin a écrit :
>
>
>
> +1 for the letters 'جو' in the green circle. (Yes, these are two letters, 
> a consonant and a vowel!)
>
> Another option is to only use the first single letter 'ج', or its modern 
> variation 'چ', which would be the equivalent of 'J' in Arabic. Personally, 
> I think it'd look nicer too.
>
> Thanks,
> Islam
>
> PS: I'm a native Arabic speaker, and I'm actively using Julia :) I hope 
> the Arabic letters in this email display correctly on your system
> _
> From: Waldir Pimenta 
> Sent: Tuesday, October 4, 2016 3:58 AM
> Subject: Re: [julia-users] Re: Julia-i18n logo proposal
> To: julia-users 
>
>
> That's an interesting idea. And Arabic tends to be associated with the 
> color green (well, Islam moreso 
> , but the correlation is 
> pretty high nevertheless), so we'd also get a nice pairing of 
> character-color as with the Chinese one :)
>
> Looking forward to hear what other folks think.
>
> On Tuesday, October 4, 2016 at 5:49:06 AM UTC+1, David P. Sanders wrote:
>>
>> Or just remove the J and put the three characters from the other scripts? 
>
>
>
>