Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix function -> add example #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

srghma
Copy link

@srghma srghma commented Jun 3, 2020

No description provided.

@hdgarrood
Copy link
Contributor

I'm not entirely sure about this example: does it help to write the fibonacci function in this way? as opposed to the more direct version:

fib n
  | n <= 0 = 1
  | n == 1 = 1
  | otherwise = fib (n - 1) + fib (n - 2)

I think I'd rather use an example where fix is needed to prevent an infinite loop, like for example if you were writing a JSON parser where the parser for any JSON value needs to depend on the parser for arrays, but the parser for arrays also needs to depend on the parser for any JSON value.

@srghma
Copy link
Author

srghma commented Oct 13, 2020

agree, my example was just to help me to understand lazy class for functions

I think I'd rather use an example where fix is needed to prevent an infinite loop

yes, this example would be much better, but I dont know how to write it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants