Coder Social home page Coder Social logo

Recursion Discussion about write-you-a-haskell HOT 5 CLOSED

sdiehl avatar sdiehl commented on May 19, 2024
Recursion Discussion

from write-you-a-haskell.

Comments (5)

sdiehl avatar sdiehl commented on May 19, 2024

Entering a function in Haskell does not create a new stack frame, the logic of the function is simply entered with the arguments on the stack and yields result to the register.

There is no mention of tail recursion in this section explicitly for this reason. The only point I wanted to make is that stack frames are not created when jumping to entry code for a function.

from write-you-a-haskell.

dgstevens avatar dgstevens commented on May 19, 2024

So I just did some quick reading about Haskell's runtime. What's confusing to me about this section is that it mentions the Haskell stack but doesn't actually discuss that the stack in Haskell is different from stacks in most other languages. Without knowing that fact, the obvious conclusion from the fact that the factorial code can crash with a stack overflow is that the paragraph is wrong in some manner. And I will say that I'm probably a pretty good candidate for this tutorial - I've written a compiler for an imperative language before in Haskell, so I don't think my lack of knowledge about the Haskell runtime is unusual.

from write-you-a-haskell.

sdiehl avatar sdiehl commented on May 19, 2024

Well, I implemented a Haskell runtime in Chapter 23 anyways so I'm not going to stress of the exact phrasing of the introduction comment.

from write-you-a-haskell.

dgstevens avatar dgstevens commented on May 19, 2024

Just my two cents, but phrasing in the introduction of a tutorial is very important.

The fact that the tutorial discusses the Haskell runtime in Chapter 23 implies that Chapter 2 doesn't assume knowledge of the Haskell runtime in the introduction. And that in turn means that Chapter 2 could very likely be seen as wrong by the targets of the tutorial, which could lead people to lose confidence and abandon the tutorial.

Another example where phrasing is important in the introduction is Chapter 1's section on static typing. Those two examples are very intimidating for anyone that does not have a good grasp of type systems. So even though later chapters go over that material, I'm sure many readers will give up during the introduction because there is no indication that the tutorial does not assume they understand those examples.

from write-you-a-haskell.

sdiehl avatar sdiehl commented on May 19, 2024

I'm welcome to changing the phrasing or adding qualifiers. Submit a change for how you'd like to see the sentence changed.

https://github.com/sdiehl/write-you-a-haskell/blob/master/001_basics.md

The same goes for the examples on static typing.

from write-you-a-haskell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.