Personally, I would find a video on a more complicated challenge more interesting. Even if you can’t showcase as many languages, it would be better then a bunch of solutions that are just calling three simple functions. Possibly asking viewers to submit solutions in different languages could allow you to showcase more solutions for longer problems too.
At risk of adding five more characters to your Fortran code, you can add the word "pure" to the function (e.g., "pure integer function..."). This allows the compiler to knows it is supposed to be side-effect free, do appropriate checking, allow use in array expressions, and related optimizations. You'll have to do it with your gcd function as well.
I guess "tier lists" are better suited compared to "rankings" for comparisons like this. Many of the compared languages were deemed nearly-identical, while being multiple ranks away from each other.
As a scientist, who has to optimize most of our HPC by hand, Fortran is my best friend! Python and Fortran the what the future looks like for scientific coding with Matlab pitching in here and there for a quick job or two. Fortran gets a bad rap because most of the people working on computers these days aren't engineers and scientists, they generally have no use for Fortran and find its structure a bit unattractive. Fortran's compiler, unlike c or cpp, which are heavily dependent on pointers, handles things in a simple and concise manner. Oh and don't forget array handling! Fortran is probably the best language to handle arrays, especially with in-built bound checks. But the cake here is highly aggressive optimization, not aliasing pointers has its perks!!
In the previous video I posted a comment with a very simple solution in hardware (Verilog), using the Euclid's method and I tested that on an FPGA. The resulting digital circuit only has an adder, a comparator and a register (all 32 bit). I think it was marked as spam for some reason (perhaps because it included urls?).
What do you use to animate the transitions between code blocks? I can't imagine you manually are animating where each character moves to, but I like the effect and would like to use it in future presentations I might do.
Raku typically uses sigils (one of $ @ % or &) to mark its variables; the different sigils impose different default behaviors/type constraints. Using sigils helps variables stand out from function calls and, once you're used to it, can make the code more readable. But if you don't like sigils (or are new to Raku and find them distracting), you can declare variables with a \ to create it without a sigil. A more idiomatic equivalent might be to use the @ sigil, which signals that the "@nums" variable is an Array/List. That would give you: sub find-gcd(@nums) { [gcd] @nums.minmax.bounds }
This is similar in Ada and VHDL. Specifying what block you are ending catches mismatches. In particular, it can get you better compiler errors as the parser can recover context.
The Fortran solution is so elegant? Yeah, sometimes, old ideas simply suck. Fortran always did. NOTE: I ported a huge Fortran statistics package to Macs back in the days, so have suffered enough through that garbage to earn the right to Tell The Truth (tm)
I didn’t realize the fortran community was so passionate haha
Awesome work! Love the point free solution in Julia.
The Julia solution is amazing, it would be interesting to see more problems solved by Julia.
Personally, I would find a video on a more complicated challenge more interesting. Even if you can’t showcase as many languages, it would be better then a bunch of solutions that are just calling three simple functions. Possibly asking viewers to submit solutions in different languages could allow you to showcase more solutions for longer problems too.
Yeah let's open a repo where contributions can be used as source for interesting examples.
Rosetta code has a ton of that
At risk of adding five more characters to your Fortran code, you can add the word "pure" to the function (e.g., "pure integer function..."). This allows the compiler to knows it is supposed to be side-effect free, do appropriate checking, allow use in array expressions, and related optimizations. You'll have to do it with your gcd function as well.
a similar thing could be done in the nim code by changing "proc" to "func"
I’m absolutely thrilled to see FORTRAN covered here!! Love your content.
I guess "tier lists" are better suited compared to "rankings" for comparisons like this.
Many of the compared languages were deemed nearly-identical, while being multiple ranks away from each other.
As a scientist, who has to optimize most of our HPC by hand, Fortran is my best friend! Python and Fortran the what the future looks like for scientific coding with Matlab pitching in here and there for a quick job or two. Fortran gets a bad rap because most of the people working on computers these days aren't engineers and scientists, they generally have no use for Fortran and find its structure a bit unattractive. Fortran's compiler, unlike c or cpp, which are heavily dependent on pointers, handles things in a simple and concise manner.
Oh and don't forget array handling! Fortran is probably the best language to handle arrays, especially with in-built bound checks. But the cake here is highly aggressive optimization, not aliasing pointers has its perks!!
That point-free Julia solution sure looks nice with just two colors.
In the previous video I posted a comment with a very simple solution in hardware (Verilog), using the Euclid's method and I tested that on an FPGA. The resulting digital circuit only has an adder, a comparator and a register (all 32 bit).
I think it was marked as spam for some reason (perhaps because it included urls?).
You love to see a community supporting newcomers, thanks fortran for being supportive!
Fortran now has GCD in the standard library.
What do you use to animate the transitions between code blocks? I can't imagine you manually are animating where each character moves to, but I like the effect and would like to use it in future presentations I might do.
Microsoft PowerPoint 2019 with Morph Transition
I think this is quickly becoming my favourite channel on RUclips
How do you pas 'nums' in the point-free operation in Julia?
Unless I'm mistaken, you just call the function like you normally would.
@@vldthdrgn Yep
nums = rand(1:100, 10); find_gcd(nums)
or without nums at all:
rand(1:100, 10) |> find_gcd
There's two language "logos" I don't recognize. The lighthouse, and the geometric design with the B in the middle.
What are those languages?
Those are Pharo and BQN.
4:27 Why the backslash in the Raku code?
Raku typically uses sigils (one of $ @ % or &) to mark its variables; the different sigils impose different default behaviors/type constraints. Using sigils helps variables stand out from function calls and, once you're used to it, can make the code more readable. But if you don't like sigils (or are new to Raku and find them distracting), you can declare variables with a \ to create it without a sigil. A more idiomatic equivalent might be to use the @ sigil, which signals that the "@nums" variable is an Array/List. That would give you: sub find-gcd(@nums) { [gcd] @nums.minmax.bounds }
Returning the result of the last expression in a block was used by lisp in 1960. I imagine Ruby gets it from there.
In Fortran, I think you don't need to mention the function's name in the last line, just `end function` would be enough.
This is similar in Ada and VHDL. Specifying what block you are ending catches mismatches. In particular, it can get you better compiler errors as the parser can recover context.
Beautiful! How do you get syntax highlighting in PowerPoint?
Just copy from VS Code
Copying and pasting from vsc usually retains formatting, it works in Google docs too
what a great video😍
Julia is amazing... and sooo fast. TX
Everyone keeps forgetting Perl. I'm hurt right now. 😒
They covered Raku… aka Perl 6
@@teacul Raku and Perl aren't the same language, even if they've a shared ancestry.
But you aren't getting the GCD of an array...
Julia is such a special language. Pretty much my favorite high level language that has so many cool features
minimun also offers more opportunities for typos
Using a splat operator with the min() function in Julia is a VERY bad idea, because this operation gets way slower than minimum()
The Fortran solution is so elegant?
Yeah, sometimes, old ideas simply suck. Fortran always did.
NOTE: I ported a huge Fortran statistics package to Macs back in the days, so have suffered enough through that garbage to earn the right to Tell The Truth (tm)