• DeriHunter@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 year ago

    Nope recursion would be a bigger cable connected to same cable only smaller, connected to the same cable only smaller, etc…

    If this is how your recursion looks like you have a problem and you need to rethink your recursion step and and stop condition :)

    • MagicShel@programming.dev
      link
      fedilink
      arrow-up
      5
      ·
      1 year ago

      I disagree. Recursion is the same thing over and over again until the exit condition. Nothing is getting smaller except the remaining entries.

        • Kogasa@programming.dev
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          1 year ago

          There’s no formal reason why the input to a recursive function must be a “smaller” or “simpler” version of itself, that’s just a way of explaining it intuitively/informally. You need to reduce the “complexity” (meant informally as ‘deviation from a trivial case’) at every step (only) if you want to the algorithm to actually finish.

          • DeriHunter@lemmy.world
            link
            fedilink
            arrow-up
            2
            ·
            1 year ago

            And still you get it wrong. I just linked you an academic article about it, fml. Never got people who are to proud to admit they are wrong.

            • jlar@lemmy.world
              link
              fedilink
              arrow-up
              3
              ·
              1 year ago

              What the flip did you just freaking say about my code, you little script kiddie? I’ll have you know I’ve been writing code for 35 years and I’ve used recursion on several occasions, and I have over 300 confirmed successful deployments. I am trained in twelve different programming languages and I’m the top coder in the entire Stack Overflow leaderboard. You are nothing to me but just another code review. I will debug you the flip out with precision the likes of which has never been seen before on this GitHub, mark my freaking words. You think you can get away with saying that crap to me over the Internet? Think again, scripter. As we speak I am contacting my secret network of tech support across the globe and your IP is being traced right now so you better prepare for the DDoS, maggot. The storm that wipes out the pathetic little thing you call your Python script. You’re freaking terminated, kid. I can be anywhere, anytime, and I can refactor your code in over seven hundred ways, and that’s just with my bare hands. Not only am I extensively trained in machine learning, but I have access to the entire arsenal of Google Cloud Services and I will use it to its full extent to wipe your miserable code off the face of the repository, you little wannabe. If only you could have known what unholy retribution your little ‘clever’ comment was about to bring down upon you, maybe you would have held your tongue. But you couldn’t, you didn’t, and now you’re paying the price, you goddamn rookie. I will rain code all over you and you will drown in it. You’re freaking done, kiddo.

            • MagicShel@programming.dev
              link
              fedilink
              arrow-up
              1
              ·
              1 year ago

              Point is I know how it works. Maybe you want to argue the analogy, but that doesn’t mean I don’t understand recursion. I’ve used it on several occasions.

      • Kogasa@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        1 year ago

        That’s just “recurrence.” The same as a “while” loop. Recursion is specifically when a procedure invokes itself.

          • Kogasa@programming.dev
            link
            fedilink
            arrow-up
            4
            ·
            1 year ago

            The thing that’s getting smaller is the “complexity” or “distance from the trivial case” of the function invocation. This is an informal notion though.