Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think matlab has the most succint language for writing matricies

  [1 2 3; 4 5 6; 7 8 9]
then lisp

   #2A((1 2 3) (3 4 5) (7 8 9))
then python comma freak show

   [[1,2,3],[4,5,6],[7,8,9]]
python's greatest achievement was bringing open source to matrix calculations and dethroning matlab. python is what it is today because it offered 99% of what matlab offered in open source and for $0 to uni students


I was curious about how Julia does 2D matrices and arrays, given they target mathemeticians. They seem to have no shortage of methods of creating them.

  julia> [1,2,3] # An array of `Int`s
  3-element Vector{Int64}:
   1
   2
   3

  julia> [1:2, 4:5] # Has a comma, so no concatenation occurs.
  2-element Vector{UnitRange{Int64}}:
   1:2
   4:5

  julia> [1:2  4:5  7:8]
  2×3 Matrix{Int64}:
   1  4  7
   2  5  8

  julia> [[1,2]  [4,5]  [7,8]]
  2×3 Matrix{Int64}:
   1  4  7
   2  5  8

  julia> [1 2
          3 4]
  2×2 Matrix{Int64}:
   1  2
   3  4

  julia> a=[1 2 5 8 9; 3 4 2 1 33]
  2×5 Array{Int64,2}:
   1  2  5  8   9
   3  4  2  1  33
https://docs.julialang.org/en/v1/manual/arrays/


What about Octave and R, which are open source and for $0?


octave was always seen as subpar version of matlab and r is a statistics programming language. in comparison python was already back then a proper practical programming language that people were using for things other than math




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: