|
|
Subscribe / Log in / New account

An introduction to the Julia language, part 1

An introduction to the Julia language, part 1

Posted Aug 29, 2018 17:15 UTC (Wed) by raegis (subscriber, #19594)
Parent article: An introduction to the Julia language, part 1

OK, I just downloaded Julia. Two quick comparisons with Octave.

In Julia it looks like ^ is right-associative:

julia> 3^2^3
6561

while in Octave ^ is left-associative:

>> 3^2^3
ans = 729

Another example which had me stumped for several minutes: In Julia,

julia> [1,2]*[1,2]'
2×2 Array{Int64,2}:
1 2
2 4

but in Octave,

>> [1,2]*[1,2]'
ans = 5

I see now the style in Julia is different. Commas and semicolons in Julia seem to delimit rows, but in Octave commas are optional, so

julia> [1 2]*[1 2]'
1×1 Array{Int64,2}:
5

is correct for the example.

I'm not blaming Julia, but it looks like there will be some surprises for those coming from other systems.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds