Code Monkey home page Code Monkey logo

Comments (3)

floriankugler avatar floriankugler commented on July 28, 2024

Yes, that's a mistake. We'll fix this in the next update.

from functional-swift.

vjosullivan avatar vjosullivan commented on July 28, 2024

When you update the book for this bug, don't just update the code. Please update the text to make it clear that it is the point that is being shifted, not the region. The current text is wrong in its description of how the function works (and the bug is a direct consequence of the incorrect explanation). I bought this book because I am not familiar with FP, so the explanations need to be clear and correct.

(I had to write several tests in the swift playground to solve this problem. I hope you did the same thing.)
let px1y1 = Position(x:1, y:1)
let px5y5 = Position(x:5, y:5)
let cr2x0y0 = circle(2.0)
cr2x0y0(px1y1) // true.
cr2x0y0(px5y5) // false.

let cr2x4y4 = shift(Position(x:4, y:4), cr2x0y0)
cr2x4y4(px1y1) // false
cr2x4y4(px5y5) // true (but the code in the book returns false)

from functional-swift.

vjosullivan avatar vjosullivan commented on July 28, 2024

Ah, I see that there is an explanation, later in the text. Unfortunately, when I can't understand a text book, I try to understand each sentence before going on to the next, so didn't see the correct explanation that followed the incorrect one.

from functional-swift.

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.