Confused on excerise on htdp

i am struggling to understand this question

Exercise 15. Define ==>. The function consumes two Boolean values, call them sunny and friday. Its answer is #true if sunny is false or friday is true. Note Logicians call this Boolean operation implication, and they use the notation sunny => friday for this purpose.

is it asking me to run a variable becuase for a function i would need a parameter to run but in my case it cant be used as its only checking wether something is true or false,here is my code

(define  ==>  (if (not( or (boolean? sunny #false) (boolean? friday #true) #true))))

What does the exercise want you to do?

What is boolean? what does it expect as input, what is its output?
What are functions ending with a question mark ? called?
Here is where functions are first introduced: Prologue: How to Program


In general it seems you have skipped parts of the book and it is difficult to help you, because I don't know which parts you may have skipped. And me giving you the solution wouldn't help you in learning.

To make it easier to help us, help you, you should follow the design-recipe:
I Fixed-Size Data: 3.1 Designing Functions

This way it is easier for other people reading your code to recognize what parts you already understand and which parts you need guidance with.

Following the design recipe is also for yourself, because it structures a task in a way that causes you to get clear about what you are trying to accomplish and it gives you a clear structure to follow,
this allows you to reach the goal incrementally, avoiding confusion.

In general I advise you to go back to the beginning and see what parts you need to re-read, because there are definitely parts you have skipped, those skipped parts now cause your confusion.


Too be a bit more cheeky :stuck_out_tongue:: if you can't be bothered to follow the design recipe, then I can't be bothered to answer any more questions. (I am a volunteer and a lot of other people here are...)

Why? Because it is not productive if I replicate what How to Design Programs teaches, spread across a lot of different help topics.

If I can see that you can do what the book wants you to do:
follow the design recipe and you still need help, then I am more inclined to spend my free time, volunteering to help someone.

There is a reason why netiquette is a thing, because with it, it is more likely that people want to answer.
Within the context of How to Design Programs you should follow the design recipe.

3 Likes

Osman, it sounds like you might be confused about what a function is. I blame your math teachers. It may be that they told you that a function is exclusively a thing that takes in numbers. That's not true! Functions can also take in booleans, and return them. This is an example of a function that takes in booleans, and returns one. Does that help you?

This phrase means your functions starts like this:

(define (==> sunny friday)
   your_computation_here )
1 Like