6 kyu
Factorial Lambda Calculus
43 of 75JohanWiltink
Loading description...
Functional Programming
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This comment has been hidden.
I've seen it once before, probably doing something very similar ( but it's been a while ). I never really solved that then.
I think it just can't be done in GHC. But you don't need
Y
, you are allowed to just use a direct recursive definition ( because it's Haskell, and not strictly LC ), and I suspect it'll work that way.Does that answer your question?
Ahah, yeah, I guess I was still in the mindset of pure LC, I will try again with direct recursion, if possible. If not, I did read of ways of defining Y in haskell in a proper way, thank you.
Just import
fix
😝I could have also used that, yeah, for a more lambda calculus-like function, but in the end there's also the lambda calculus version of the kata, so I did that properly as well.
I think this kata should have at least level 5 and pred definition looks even more complicated than factorial.
That's why you get
pred
for free :PSorry, can't wrap my tiny little brain around this.
It happens. You can watch some lectures about lambda calculus. Some of them can even be understood by mortals :)
That can happen if Lambda calculus or Church encoding is new for you. Read the
#Help
links at the end of the description, and sleep on it for a night. If you have any questions tomorrow, get help here or try Discord.As far as I can see, everything is fine.
Approved :)
now...:
x)
better do some other "double checking", I believe
Why are you looking for
IZ_ZERO
when the description specifiesIS_ZERO
?IS_ZERO
looks to be there.Yeah, I'm pretty sure this is not a kata issue.
humpf... XD
any idea why I get
ReferenceError: SUCC is not defined
...?It seems
SUCC
is defined in sample tests, but not in preloadedI promised that would be in
Preloaded
, but it wasn't. I don't know how that happened.It's fixed now.