0

1 Problem, 16 Programming Languages (C++ vs Rust vs Haskell vs Python vs APL...)

 2 years ago
source link: https://www.youtube.com/watch?v=UVUjnzpQKUo
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
0:00 / 27:37

1 Problem, 16 Programming Languages (C++ vs Rust vs Haskell vs Python vs APL...)

19,721 views
Aug 28, 2021

A video taking a look at 16 programming language solutions (C++, Rust, D, Clojure, Ruby, Elixir, Raku [Perl 6], Haskell, Racket, Julia, Python, APL, J, BQN, Pharo Smalltalk & Fortran) to one problem.

ADSP Podcast: https://adspthepodcast.com/ Array Cast: https://www.arraycast.com/

Contest: 255 Problem Name: Find GCD of Array Problem Link: https://leetcode.com/problems/find-gr... Problem Type: Greedy

Github Links / Chapters: 0:00 Intro 1:47 Problem Statement 2:43 Python: https://github.com/codereport/LeetCod... 3:20 Julia: https://github.com/codereport/LeetCod... 3:50 Raku: https://github.com/codereport/LeetCod... 4:36 Ruby: https://github.com/codereport/LeetCod... 5:00 Elixir: https://github.com/codereport/LeetCod... 5:34 Haskell: https://github.com/codereport/LeetCod... 6:28 Racket: https://github.com/codereport/LeetCod... 6:51 Clojure: https://github.com/codereport/LeetCod... 7:30 C++: https://github.com/codereport/LeetCod... 9:15 D: https://github.com/codereport/LeetCod... 9:35 Rust: https://github.com/codereport/LeetCod... 10:18 APL: https://github.com/codereport/LeetCod... 11:23 Fork / S' Combinator / Starling' / Phoenix 14:18 J: https://github.com/codereport/LeetCod... 15:11 BQN: https://github.com/codereport/LeetCod... 16:52 Pharo: https://github.com/codereport/LeetCod... 17:32 Fortran: https://github.com/codereport/LeetCod... 20:19 Languages not covered 21:30 Rankings 26:00 Summary 26:56 Podcasts and Outro

Follow me on Github: https://github.com/codereport Follow me on Twitter: https://twitter.com/code_report Follow me on LinkedIn: https://www.linkedin.com/company/code...

Show lessShow more

153 Comments

Sort by
default-user=s48-c-k-c0x00ffffff-no-rj
Add a public comment...
I'd be interested in seeing a Cobol solution in one of those videos. We all hear about how horrible Cobol is, but most of us never seen examples as to why.

1 month ago

"Languages should have GCD in the core library" - why? How often does the average programmer use this?

Fortran is great for programming array programs across multiple cores and servers - Julia is the modern alternative.

Read more 1 month ago

4:36 Ruby is expression based, the last line will be implicitly returned if you leave off 'return'

1 month ago

Hey Conor! Java could absolutely have a gcd method within java.lang.Math, generics have nothing to do with it, but the other question I have is: Why do you consider gcd an essential function? To me it always appeared as more of a toy for an interesting algorithm but I haven't really seen a use case outside of cryptography (and crypto code is not something one should write themselves unless you really know what you're doing), so I'm curious as to why you have a different view on it.

Read more 1 month ago

I'm so glad you were a good sport and gave Fortran a go, it gives a nice contrast to the other languages.

1 month ago

liftM2 takes a function (a -> b -> c) and returns a function (f a -> f b -> f c), (f : Monad) note that you don't need the monad constraint since maximum does not rely on the result of minimum or vice versa - and could just use liftA2 from Control.Applicative - not that it matters in this case but Monad is sequential where as solution using Applicative could be made to be parallell.

or: gcd <$> minimum <*> maximum

Read more 1 month ago

Hey! Ruby also has a minmax method, so this is how the ruby solution would look like: nums.minmax.reduce(:gdc). Love your channel! <3

1 month ago

People that requested Fortran wanted to see you suffer :D

1 month ago


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK