Live data from Hacker News

26 Programming Languages in 25 Days

matt.might.net

71–80 of 82 posts

Re: 26 Programming Languages in 25 Days

#71

Earlier quoted context omitted.

APL might be an outlier here. For the rest, I think the difference lies more in the standard libraries of those languages than the languages themselves. Yes, differences in core language design start to matter when you are considering performance, or structuring larger applications, but for simpler scripts, you're mostly dealing with the standard library. On the other hand, differences will start to show them selves…

Erlang doesn't have loops. You've got filter, map, reduce, and recursion. It's safe to say for most programs that your Erlang solution is going to look rather different than your ALGOL family one. And Java didn't, until relatively recently (oh god Java 8 was almost 10 years ago), have anonymous functions, which means that you'd be more inclined to express solutions in terms of vulgar loops rather than a map, filter,…

> You've got filter, map, reduce, and recursion.

Right, and you can implement a recursive function in Haskell, OCaml, or Scheme that looks more or less identical in all 3 languages, and is only a recursion-transformation away from the for-loop version seen in Python, Ruby, Java, etc. So all the functional recursion-based implementations will look similar, and all the imperative loop-based implementations will look similar, and the two classes of implementations will also have a lot of overarching similarity.

The basic pattern of "obtain system state, do thing, set up next system state, proceed to next thing" is the same. The differences between languages (read: sets of tools that you are given for expressing algorithms) tend not to become apparent until you've spent a little while working with them.

I can't speak specifically to Erlang because I haven't used it, but from what I've seen the story should be the same.

Re: 26 Programming Languages in 25 Days

#72
post #7

No FORTH, APL, Clojure or Rust? My HN bingo card is empty...

rust is def not a language you can pick up in a day.

It took me a week from a cold start to get a working mergesort toy example working. By comparison, elixir took me 1.5 hours. 2 to make it multicore.

Re: 26 Programming Languages in 25 Days

#74

Earlier quoted context omitted.

Erlang doesn't have loops. You've got filter, map, reduce, and recursion. It's safe to say for most programs that your Erlang solution is going to look rather different than your ALGOL family one. And Java didn't, until relatively recently (oh god Java 8 was almost 10 years ago), have anonymous functions, which means that you'd be more inclined to express solutions in terms of vulgar loops rather than a map, filter,…

> You've got filter, map, reduce, and recursion. Right, and you can implement a recursive function in Haskell, OCaml, or Scheme that looks more or less identical in all 3 languages, and is only a recursion-transformation away from the for-loop version seen in Python, Ruby, Java, etc. So all the functional recursion-based implementations will look similar, and all the imperative loop-based implementations will look si…

The semantics of a language shape its use in practice, though.

For example: If you're in a language that primarily uses recursion as the primary iteration mechanism, if you have to iterate through every element of a tree you will just about never do a breadth-first search unless it is absolutely necessary. It's just a pain to express recursively compared to a depth-first traversal. In contrast, in an iterative language, a breadth first traversal is the same (somewhat obnoxious) complexity as any other traversal. But that's assuming both languages would be traversing a tree at all: trees are vastly more likely to be used at all in languages where recursion is the norm.

Like, sure, any iterative function of the form:

    f(x) = {
      state = h(x)
      cond = true
      while(cond) do
         state = j(x,state)
         cond = k(x,state)
      end
      post_work = l(state,x)
      return post_work
    }
Can be re-written as

    f(x) = l(m(x,h(x)))
    m(x,state) = state if k(x,state) else m(x,j(x,state))
But if your language only supports one or the other, you're going to approach the problem in fundamentally different ways. Whereas the iterative solution is likely to jump directly into the loop with a trivial h(), the functional language is far more likely to do more work in h() to offload work out of j() prior to what would likely end up being a fold operation.

Put another way: for(i=0;i<x;i++) loops are common in iterative codebases I've worked on, but it's exceedingly rare to see f(x,i) = blah return f(g(x),i++) in a functional codebase.

Re: 26 Programming Languages in 25 Days

#75

Learning a programming language in 1 day to solve a particular problem isn’t the same as learning it over years to write actual production code. I doubt the author was writing “idiomatic” code and he probably transplanted paradigms from more familiar languages in the newer ones. But it’s still very useful and I’m sure he learned a lot and absorbed of some of the new languages’ programming styles. You don’t master idi…

For what it's worth, the author is well-known in the field of programming languages and was a professor in that area at the University of Utah for a number of years before changing life focus and relocating to the University of Alabama's Precision Medicine Institute.

Which isn't to say that you're wrong, but rather that the author is likely well aware of these particular shortcomings of the exercise. But then the exercise wasn't "write perfectly idiomatic code in a different language every day", but just "learn some languages I didn't know before".

Re: 26 Programming Languages in 25 Days

#77

Earlier quoted context omitted.

Hello world is different from solving actual problems in AoC.

AoC is somewhat more difficult, but is it worth a blog post? Especially for a professor? The stats https://adventofcode.com/2022/stats show that there are ~9000 people who solved all of the problems. Even if a fraction of those wrote a "I solved 25 problems" blog post, there'd be HN front-page material for months. P.S. I'm somewhat surprised by this community's adoration of AoC and at the same time aversion to Leetco…

> AoC is somewhat more difficult, but is it worth a blog post?

The AoC isn't the blog post; the choice of using a different language every day is the blog post. Does that not seem even remotely interesting to you?

> I'm somewhat surprised by this community's adoration of AoC and at the same time aversion to Leetcode and/or competitive programming in general.

AoC is deliberately a game. It's spirited and fun. Leetcode is a by-product of an interviewing system that worked kind-of well at one company once upon a time, and then everybody decided they needed to do the same thing because that company had a Big Name, and now we have a broken interview process that is — in most practical respects — completely useless.

That's not to say some Leetcode problems aren't good or fun problems to work on, but the website itself was purpose-built to help people game a broken interview process (which has, incidentally, only made the process worse).

Re: 26 Programming Languages in 25 Days

#80

Earlier quoted context omitted.

AoC is somewhat more difficult, but is it worth a blog post? Especially for a professor? The stats https://adventofcode.com/2022/stats show that there are ~9000 people who solved all of the problems. Even if a fraction of those wrote a "I solved 25 problems" blog post, there'd be HN front-page material for months. P.S. I'm somewhat surprised by this community's adoration of AoC and at the same time aversion to Leetco…

> AoC is somewhat more difficult, but is it worth a blog post? The AoC isn't the blog post; the choice of using a different language every day is the blog post. Does that not seem even remotely interesting to you? > I'm somewhat surprised by this community's adoration of AoC and at the same time aversion to Leetcode and/or competitive programming in general. AoC is deliberately a game. It's spirited and fun. Leetcode…

> > > Next on HN: "Hello World in 100 languages, in just 2 hour"

> > Hello world is different from solving actual problems in AoC.

> ...

> The AoC isn't the blog post; the choice of using a different language every day is the blog post

This thread started when someone suggested a similar learning project. Would "hello world in 100 languages" be worthy of a blog post?

> Does that not seem even remotely interesting to you?

It is mildly interesting, but in my opinion, not worth a blog post from anyone more experienced than a college student. I think the whole endeavor is silly. I think that learning the syntax of a language well enough to solve one day of AoC is a dubious achievement. You don't learn the language well enough (in my opinion that takes at least several weeks with the language), you don't even get a head start if you were to later start a project in that language, since you saved a few hours at best. The only thing you get, is to brag about it in a blog post. But who are you trying to impress?

> ... Leetcode ..., but the website itself was purpose-built to help people game a broken interview process

I used Leetcode as a generic name, but I don't mean just them. There's lots of platforms that were build around competitive programming, (starting with Topcoder, Codeforces and many others). Everyone is excited about AoC, but very few people spend time on those other platforms for fun.

> AoC is deliberately a game. It's spirited and fun.

Competitive programming problems are just as fun if not more so. Yet not many people here solve these type of problems for fun. Nobody would write the "25 algorithmic problems in 25 days" blog post. In my opinion, most people are excited about AoC because those problems are not too difficult, and anyone can solve a few problems at the start.

Post reply on HN