[HN Gopher] Quick Overview of Julia language [pdf]
___________________________________________________________________
Quick Overview of Julia language [pdf]
Author : gurjeet
Score : 54 points
Date : 2021-01-10 20:38 UTC (2 hours ago)
(HTM) web link (algorithmsbook.com)
(TXT) w3m dump (algorithmsbook.com)
| [deleted]
| erwincoumans wrote:
| Like Matlab and Lua, 1-based indexing :(
| ogogmad wrote:
| This small detail always comes up for some reason.
|
| Anyway, I recently tried implementing some numerical linear
| algebra algorithms based on descriptions from papers and books.
| The books and papers all used 1-based indexing, and this
| created some problems for me when I translated the pseudo-code
| to Python (which is 0-based).
| rscho wrote:
| Most languages designed for scientific (vs. business) use cases
| are 1-based. Mathematicians prefer it to zero.
| warlog wrote:
| And R!
|
| 1-based works for folks that count things (Scientists).
| Jtsummers wrote:
| I've seen this in other Julia discussions. Can someone show me
| a use case other than trying to cycle over the same data (EDIT:
| or range) repeatedly where 0-based is fundamentally better than
| 1-based? I mean, that's the only case I can think of where
| 0-based is actually going to be easier and more sensible.
|
| But I'd argue that languages should stop having fixed offsets,
| 1-based and 0-based are both too limiting. Ada is around 40
| years old (and it's not unique in this) and it provides
| arbitrary index ranges and the option to use any discrete type
| as the index so that you can use whatever index is most natural
| for your particular problem.
| warlog wrote:
| If I'm not mistaken, Lua let's you assign any key (index) you
| want.
| tester756 wrote:
| Sometimes I do wonder... maybe 1 based indexing is better and
| would cause less off by 1 bugs for non-US devs?
| sundarurfriend wrote:
| This is a pretty good overview, and I like it for the same reason
| I liked the "Half-hour to learn Rust" one from a few days ago -
| compressed presentation, that's easy to skim through, but without
| shying away from details too much.
|
| It's strange to see a Julia overview without any mention of
| multiple dispatch though. "Function overloading" is briefly
| mentioned, but if this had been a pragmatic overview like the
| Rust one (instead of one given for use in book exercises), I
| would have suggested including multiple dispatch, type
| instability, and the use of `@code_warntype`.
| dandanua wrote:
| Indeed, Julia's abstract type system with multiple dispatch is
| its killer feature. It enables generic programming in a
| beautiful and concise fashion. Here [1] Stefan Karpinski gives
| some explanations of why multiple dispatch is so effective.
|
| [1] https://www.youtube.com/watch?v=kc9HwsxE1OY
| open-source-ux wrote:
| " _It 's strange to see a Julia overview without any mention of
| multiple dispatch though._"
|
| The link below is an informative recent discussion on OOP vs
| multiple dispath on the Julia website forums. There is some
| overlap but I much prefer the multiple dispatch approach:
|
| _Discussion: Why does Julia not use class-based OOP?_
|
| https://discourse.julialang.org/t/is-julias-way-of-oop-super...
| Grimm1 wrote:
| The thing that has kept me from Julia is the size of the
| ecosystem, but this was maybe 2 years ago now that I last tried
| it otherwise I thought the language seemed very nice. How are
| things doing for ML, NLP specifically if anyone knows?
| komuher wrote:
| Still same as it was 2 years ago Flux + some other smaller
| repos.
| Grimm1 wrote:
| Gotcha, thank you
| cameronperot wrote:
| Looks like a decent basic summary. Section G.2.6 should probably
| be called "Multiple Dispatch" rather than "Function Overloading"
| though. Defining multiple methods of the same function in Julia
| is different to function overloading in a language like C++ [1].
|
| [1] https://www.youtube.com/watch?v=kc9HwsxE1OY&t=392s
| east2west wrote:
| Perhaps the author was trying to make the overview beginner-
| friendly by using familiar terms. I have found it helpful to
| compare and contrast Julia concepts with C++ template concepts.
| For example, term trait is used in similar ways in both
| languages, but the big difference is that in Julia type
| information can be passed in run-time, not just in compile-
| time.
___________________________________________________________________
(page generated 2021-01-10 23:00 UTC)