34 ms·
Quick Overview of Julia language [pdf]
- sundarurfriend 6y agoThis 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`.
- open-source-ux 6y ago"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-superior-to-c-python-why-julia-doesnt-use-class-based-oop/52058 https://discourse.julialang.org/t/is-julias-way-of-oop-super...
- dandanua 6y agoIndeed, 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 https://www.youtube.com/watch?v=kc9HwsxE1OY
- deleted 6y ago[deleted]
- Grimm1 6y agoThe 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?
- cameronperot 6y agoLooks 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 https://www.youtube.com/watch?v=kc9HwsxE1OY&t=392s
- east2west 6y agoPerhaps 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.
- erwincoumans 6y agoLike Matlab and Lua, 1-based indexing :(
- ogogmad 6y agoThis 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. This created some problems for me when I translated the pseudo-code to Python (which is 0-based).
- amelius 6y agoPython has other quirks, such as a[-1] being the last element of the array.
- st1x7 6y agoIt's really a strength, not a quirk. Negative indexing and array slicing in general are great in Python. Really easy to pick up and way more convenient than any other language that I've come across.
- ogogmad 6y ago> array slicing in general) are great in Python Without checking, I'm not sure whether a[-1:0:-1] reverses a list. I'm not sure if it includes the first element of the list or not [edit: It doesn't]. I'm not sure why in contrast a[::-1] does reverse a list. I found array slicing (and ranges) to be a source of confusion when programming the aforementioned linear algebra algorithms. IMO, the Julia approach is better: 3:-1:1 produces [3,2,1]. Both the starting and ending points of the range are included.
- hansvm 6y agoThe example a[-1:0:-1] should be pretty understandable once you've spent enough time in the language -- you're inclusive at -1 and exclusive at 0, so the list is reversed and is missing its formerly first element (should one exist). That logic is pretty consistent. The start is always inclusive, so it needs to be `len(a)-`, `-`, or `None`. The end is always exclusive, so you need to choose `None`. As a result, counting all the syntactic sugar available to you, you have 8 slices that can reverse a list. To name a few you have a[::-1], a[None:None:-1], and a[-1::-1]. IMO a much more interesting example for the strengths of inclusive indexes is a[len(a)-1:-1:-1]. The result is always empty, but it wouldn't be too much of a stretch to think you included len(a)-1, you decremented to -1 exclusively (thus including 0), and hence reversed the entire list. The problem is that -1 is a valid index, and unlike the a[0:len(a)] case you don't have any values "before" the beginning of the list to include 0 in an _exclusive_ expression. It's all a bit of a moot point though. I know Python especially chose its [inclusive,exclusive) convention largely because it wanted expressions like range(len(a)) to not require additional arithmetic for common use cases given that it had zero-based indexing. Julia has one-based indexing, so for common use cases an [inclusive,inclusive] pattern falls out as the most natural choice. I have no idea if Julia actually cared about that sort of thing or if such a convention came about by accident, but it seems like a clean choice for a one-based language.
- thoughtsunific4 6y agoUntil Hacker News deletes this account they will be promoting the following: - 9/11 never happened. - Jews were responsible for the propagation of Communism. - New Testament is false
- patrec 6y agoThere is an annoying error: % is not 'modulo', it's the (less useful) remainder operator. julia> -1%9 -1 julia> mod(-1, 9) 8 python >>> -1%9 8