Le mardi 10 mars 2015 à 01:40 -0700, David van Leeuwen a écrit :
> Hello,
>
> On Friday, March 6, 2015 at 2:22:42 AM UTC+1, Tony Kelman wrote:
> > I suppose this is related to + and - being unary operators?
>
>
> Ding ding. Unfortunately space being the horizontal
> concatenation operator means some operations parse very
> differently and in highly whitespace-sensitive ways depending
> whether they are inside or outside an array literal. Would be
> nice if that were not the case, but I think we'd need another
> delimiter character aside from , or ; to really separate
> horizontal concatenation from vertical concatenation from list
> construction.
>
>
> I've always found the space as operator a kind-of-upsetting thing in
> Julia. (I refused to use Python---to my own disadvantage---for many
> years because there are semantics in the amount of space used, but I
> finally got over that.)
>
>
> Is it really necessary to have separate operators for horizontal and
> vertical list construction? In most other respects, Julia seems not
> to treat the second dimension really special. E.g., I've argued for
> `nrow()` and `ncol()` because---to me---this is more intuitive than
> the `size(, dim)`, but it was very clear in the discussions that this
> was a wrong way to think about arrays. So now I actually got used to
> `size()`.
>
>
> Do we really use literal matrix construction that often in code? I
> guess one would use it for examples, but in these cases, can't we just
> `hcat()` the columns?
That's exactly the discussion that is going on at
https://github.com/JuliaLang/julia/issues/7128
Regards
> ---david
>
>
> julia> j=2; [ 1 +j ]
> 1x2 Array{Int64,2}:
> 1 2
>
>
> julia> j=2; [ 1 + j ]
> 1-element Array{Int64,1}:
> 3
>
>
> julia> j=2; 1 +j
> 3
>
>
> julia> j=2; 1 + j
> 3
>
>
>
>
> On Thursday, March 5, 2015 at 4:56:20 PM UTC-8, Amuthan A.
> Ramabathiran wrote:
> Not sure if this has been discussed earlier... can
> someone explain whats happening here?
>
> julia> b = [ 1 +j for j = 1:5 ]
> ERROR: syntax: invalid comprehension syntax
>
>
> julia> b = [ 1 + j for j = 1:5 ]
> 5-element Array{Int64,1}:
> 2
> 3
> 4
> 5
> 6
>
>
>
>
> This happens with both + and -, but not with * or /. I
> suppose this is related to + and - being unary
> operators?
>
>
> Thanks!
> Amuthan.