Live data from Hacker News

I thought I understood recursion

functional.christmas

31–40 of 124 posts

Re: I thought I understood recursion

#31
post #15

Earlier quoted context omitted.

So if you consider some stack to be inferior (maybe because its highly inconsistent in its design or it only runs on closed and locked down platforms or whatever) you still should just dismiss it as 'oh its just a tool' instead of accepting that it's shitty and makes you miserable when working with it? Why wouldn't I want to work with best thing ever if it helps me keep my sanity every day? Do you want to use somethi…

Maybe you should look within yourself and fix up whatever part of your personality is making you miserable? I'm not being flippant. Programming languages don't make people miserable. There isn't really an argument, just an observation that the most efficient way of thinking about programming is in data structures and algorithms which are mostly language independent. Nobody should be spending most of their time levera…

Saying a language makes you "miserable" does not forcibly mean you literally want to kill yourself because of it.

I can totally see myself having more or less fun executing the exact same programming job, depending on the language I'm asked to used. And yes, to some extent, some projects (especially the ones where you have to start from an old codebase in a deprecated and ancient language) make me "miserable". That doesn't mean I'll quit my job on the spot.

Re: I thought I understood recursion

#32
post #25
post #10

Earlier quoted context omitted.

It's not obvious to me why choosing the right tool for the job is better than choosing the right job for the tool.

Might it be easier to switch tools than jobs for most people?

That has not been my experience. In a C# shop, if you want to do something not-C#, best is to switch employers. I don't say that placing such high value just into what tool you use is smart; but changing tools in a company is often a total no-go.

Re: I thought I understood recursion

#35

Earlier quoted context omitted.

So if you consider some stack to be inferior (maybe because its highly inconsistent in its design or it only runs on closed and locked down platforms or whatever) you still should just dismiss it as 'oh its just a tool' instead of accepting that it's shitty and makes you miserable when working with it? Why wouldn't I want to work with best thing ever if it helps me keep my sanity every day? Do you want to use somethi…

I think an analogy would be the following: You need to hammer a nail in a piece of wood. You could do this with a screwdriver but hammer is better suited for the job. However, a hammer made out of glass is less useful than the screwdriver. In other words, some kinds of tools are better suited for a problem than others, but there exist tools that inferior even though they were designed to solve your original problem .…

I think parents point was, for whom does the hammer made of glass helpfully accomplish anything for?

Re: I thought I understood recursion

#36
post #7

> My background is in OO programming, mostly using C#. C# being the versatile language it is, I have had the perception that whatever you do in other programming languages, you can with a little more code and hassle achieve in C# as well. If need be, I can program C# using a functional paradigm. And, of course I use recursion all the time. I know all there is to know about recursion. IME there are two kinds of progra…

i don't blame them, i was like that a couple decades ago, too

This seems like a fairly good indication there probably aren't really two kinds of programmers. Unless you experienced that particular change, from those particular initial conditions in some strikingly discrete fashion and also believe those are both universal.

Re: I thought I understood recursion

#37
Sure you can. Here's a super grotty (and expensive) c# version.

        static IEnumerable infinite()
        {
            int x = 2;
            while (true)
            {
                yield return x++;
            }
        }

        static IEnumerable primes(IEnumerable l)
        { 
            int head = l.First();
            yield return head;
            foreach (var x in primes(l.Skip(1).Where(x => x % head != 0)))
                yield return x;
        }


        static void Main(string[] args)
        {
            System.Console.WriteLine(string.Join(",", primes(infinite()).Take(20).Select(x => x.ToString()))); 
        }

Re: I thought I understood recursion

#38

Earlier quoted context omitted.

So if you consider some stack to be inferior (maybe because its highly inconsistent in its design or it only runs on closed and locked down platforms or whatever) you still should just dismiss it as 'oh its just a tool' instead of accepting that it's shitty and makes you miserable when working with it? Why wouldn't I want to work with best thing ever if it helps me keep my sanity every day? Do you want to use somethi…

I think an analogy would be the following: You need to hammer a nail in a piece of wood. You could do this with a screwdriver but hammer is better suited for the job. However, a hammer made out of glass is less useful than the screwdriver. In other words, some kinds of tools are better suited for a problem than others, but there exist tools that inferior even though they were designed to solve your original problem .…

I take your point, but can we avoid this analogy please? Let’s talk about actual code if we’re going to talk about the best tool for a job that requires it.

It reminds me of something early in my career that irked me like few work-related things things have: “Building software is like building a house” — No, it isn’t. Not even a little bit.

Re: I thought I understood recursion

#39
post #31
post #15

Earlier quoted context omitted.

Maybe you should look within yourself and fix up whatever part of your personality is making you miserable? I'm not being flippant. Programming languages don't make people miserable. There isn't really an argument, just an observation that the most efficient way of thinking about programming is in data structures and algorithms which are mostly language independent. Nobody should be spending most of their time levera…

Saying a language makes you "miserable" does not forcibly mean you literally want to kill yourself because of it. I can totally see myself having more or less fun executing the exact same programming job, depending on the language I'm asked to used. And yes, to some extent, some projects (especially the ones where you have to start from an old codebase in a deprecated and ancient language) make me "miserable". That d…

I agree.

I used to be a C++ programmer. I was good at it. I could do advanced template magic. I understood multiple inheritance and used it correctly, for the right purpose. I literally had dreams in C++.

Then I started using Java, and realised that I could be 5x as productive with far fewer headaches chasing down yet another linker error with some unintelligible error message.

What do you mean __malloc is undefined!? How could it possibly be missing? It was there a minute ago! I'm linking the standard library already, so what exactly do you want me to do about it, Mr C++ Compiler!?

Then I discovered IntelliJ IDEA, and I swear that I felt like the skies had opened up, there was a beam of light shining upon me, my spirits were lifted, and I could hear the voice of God saying: "Fear not! For now you can make changes globally and ye can rest assured that this will not break thy code!"

And then along came C#, which was just-like-Java, but with another 2x boost in productivity from all the built-in stuff that Java was missing, the language niceties, and the removal of the boilerplate. It has made me so happy over the years. Nearly two decades of effortless productivity.

I mean, seriously, how ridiculously awesome and simple is the "async" keyword!? It's like magic! I love it. LINQ is neat. The debugger is awesome. IntelliTrace is nifty. I could go on.

At one point recently I was forced to use C++ to write just a few hundred lines of code. It was physically painful. The language is a quagmire of footguns. The code I wrote was trivial string processing code, yet despite using only std::string it still somehow managed to crash.

I decided right then and there that I'm never going back to C++. Never! It's not worth it. My sanity, nay, my very soul deserves better.

Re: I thought I understood recursion

#40

Earlier quoted context omitted.

So if you consider some stack to be inferior (maybe because its highly inconsistent in its design or it only runs on closed and locked down platforms or whatever) you still should just dismiss it as 'oh its just a tool' instead of accepting that it's shitty and makes you miserable when working with it? Why wouldn't I want to work with best thing ever if it helps me keep my sanity every day? Do you want to use somethi…

I think an analogy would be the following: You need to hammer a nail in a piece of wood. You could do this with a screwdriver but hammer is better suited for the job. However, a hammer made out of glass is less useful than the screwdriver. In other words, some kinds of tools are better suited for a problem than others, but there exist tools that inferior even though they were designed to solve your original problem .…

One of the main problems I have with that analogy is that a language is not like a tool at all. Frameworks and libraries are like tools. Different classes are like a different flavor of tools - Haskell/ML, C#/Java, and a plethora of others.
Post reply on HN