mrloop | An event loop for C | Reactive Programming library
kandi X-RAY | mrloop Summary
kandi X-RAY | mrloop Summary
Event loop for C using io_uring which requires linux kernel 5.4.1+.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mrloop
mrloop Key Features
mrloop Examples and Code Snippets
Community Discussions
Trending Discussions on mrloop
QUESTION
Haskell and functional programming is something I am not familiar with, and this semester I got to meet Haskell for the very 1st time. I got unlimited loop when I tried to do a recursion (not very proud of it)
Here's the code
...ANSWER
Answered 2021-Jan-31 at 09:46The first version recurses forever because the mrLoop a (b+1)
action is outside the if/else
expression.
In other words, it either does nothing or prints a*b
, and then it unconditionally recurses into mrLoop a (b+1)
. It'll keep recursing forever.
In the latter example, recursion stops when the pattern-matched function hits the base case where b
is 10
.
Your friend probably means that this isn't the Haskell way because the Haskell way is to separate pure functions from impure actions.
Try if you can write the recursive 'loop' as a pure function (i.e. without IO
). What would it return? How could you then use that return value to print a series of results?
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mrloop
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page