I'm trying to write a function that determines if a number is divisible by 2 or 3. From what i've read online there is already a Scheme predicate divisible? but it is not working for me. I've tried writing one myself, but I don't know how to write a predicate function. Is there any help I can get? Thanks!
相关问题
- Generating powerset in one function, no explicit r
- What is fixed point?
- unfold function in scheme
- Element appears exactly once in the list in Prolog
- returns the first n of list
相关文章
- Does learning one Lisp help in learning the other?
- What is the definition of “natural recursion”?
- EntityFramework Casting issues
- How do I define a sub environment in scheme?
- Why is it legal in a function definition to make s
- Prolog — symetrical predicates
- How to split list into evenly sized chunks in Rack
- Difference between OOP and Functional Programming
The
divisible?
predicate can be expressed in terms of theremainder
procedure, remember: a numbern
is divisible byx
if the remainder of dividingn
byx
is zero.Now we can check if a number is divisible by, say,
3
like this: