1 Problem, 5 Programming Languages

Поделиться
HTML-код
  • Опубликовано: 23 янв 2025

Комментарии • 44

  • @taylorallred6208
    @taylorallred6208 3 года назад +57

    I didn’t realize the fortran community was so passionate haha

  • @LoganKilpatrickYT
    @LoganKilpatrickYT 3 года назад +29

    Awesome work! Love the point free solution in Julia.

  • @skyRoller1588
    @skyRoller1588 Год назад +10

    The Julia solution is amazing, it would be interesting to see more problems solved by Julia.

  • @ZippyMagician
    @ZippyMagician 3 года назад +50

    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.

    • @CheeseOfMasters
      @CheeseOfMasters 3 года назад +2

      Yeah let's open a repo where contributions can be used as source for interesting examples.

    • @Wyklepheph
      @Wyklepheph 2 года назад

      Rosetta code has a ton of that

  • @walterspector735
    @walterspector735 2 года назад +4

    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.

    • @Gabryx_
      @Gabryx_ Год назад +1

      a similar thing could be done in the nim code by changing "proc" to "func"

  • @AsherMancinelli
    @AsherMancinelli 3 года назад +4

    I’m absolutely thrilled to see FORTRAN covered here!! Love your content.

  • @JanSordid
    @JanSordid 3 года назад +7

    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.

  • @ralluriutah
    @ralluriutah Год назад +4

    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!!

  • @halneufmille
    @halneufmille 3 года назад +3

    That point-free Julia solution sure looks nice with just two colors.

  • @japedr
    @japedr 3 года назад +10

    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?).

  • @MarkFaldborg
    @MarkFaldborg 3 года назад +4

    You love to see a community supporting newcomers, thanks fortran for being supportive!

  • @enderger5308
    @enderger5308 3 года назад +4

    Fortran now has GCD in the standard library.

  • @MattKoski
    @MattKoski 3 года назад +16

    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.

    • @code_report
      @code_report  3 года назад +29

      Microsoft PowerPoint 2019 with Morph Transition

  • @friend7120
    @friend7120 3 года назад +1

    I think this is quickly becoming my favourite channel on RUclips

  • @jhbonarius
    @jhbonarius 3 года назад +2

    How do you pas 'nums' in the point-free operation in Julia?

    • @vldthdrgn
      @vldthdrgn 3 года назад +7

      Unless I'm mistaken, you just call the function like you normally would.

    • @code_report
      @code_report  3 года назад +3

      @@vldthdrgn Yep

    • @spacelem
      @spacelem 2 года назад +1

      nums = rand(1:100, 10); find_gcd(nums)
      or without nums at all:
      rand(1:100, 10) |> find_gcd

  • @danielsmith5626
    @danielsmith5626 3 года назад +2

    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?

  • @technicalmachine1671
    @technicalmachine1671 3 года назад

    4:27 Why the backslash in the Raku code?

    • @MogTM
      @MogTM 3 года назад +4

      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 }

  • @EdouardTavinor
    @EdouardTavinor Год назад

    Returning the result of the last expression in a block was used by lisp in 1960. I imagine Ruby gets it from there.

  • @pikachu7748
    @pikachu7748 Год назад

    In Fortran, I think you don't need to mention the function's name in the last line, just `end function` would be enough.

    • @0LoneTech
      @0LoneTech 4 месяца назад

      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.

  • @janniksco
    @janniksco 3 года назад +4

    Beautiful! How do you get syntax highlighting in PowerPoint?

    • @code_report
      @code_report  3 года назад +11

      Just copy from VS Code

    • @jawad9757
      @jawad9757 3 года назад +5

      Copying and pasting from vsc usually retains formatting, it works in Google docs too

  • @nested9301
    @nested9301 2 года назад

    what a great video😍

  • @xtiooplus
    @xtiooplus Год назад +1

    Julia is amazing... and sooo fast. TX

  • @DejiAdegbite
    @DejiAdegbite Год назад +2

    Everyone keeps forgetting Perl. I'm hurt right now. 😒

    • @teacul
      @teacul Год назад

      They covered Raku… aka Perl 6

    • @viridianite
      @viridianite Год назад +2

      @@teacul Raku and Perl aren't the same language, even if they've a shared ancestry.

  • @vladlu6362
    @vladlu6362 3 года назад +1

    But you aren't getting the GCD of an array...

  • @thedeathstar420
    @thedeathstar420 Год назад

    Julia is such a special language. Pretty much my favorite high level language that has so many cool features

  • @nngnnadas
    @nngnnadas 3 года назад +2

    minimun also offers more opportunities for typos

  • @alexanderyavorskiy1835
    @alexanderyavorskiy1835 Год назад

    Using a splat operator with the min() function in Julia is a VERY bad idea, because this operation gets way slower than minimum()

  • @thegeniusfool
    @thegeniusfool 3 года назад +2

    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)