I am starting to study the Scheme and well, I am trying to implement my own max function, which gives a maximum of two parameters.
I wrote the function as follows: (define (myMax xy) (cond ((> xy) (x)) ((< xy) (y))))
But every time I try to call him (myMax 100 40) (example), I get an error message:
The object 100 is not applicable.
Looking for GNU MIT-Scheme documentation, they say: This type indicates an error in which a program attempted to apply an object that is not a procedure. The object being applied is saved in the datum field, and the arguments being passed to the object are saved as a list in the operands field. This type indicates an error in which a program attempted to apply an object that is not a procedure. The object being applied is saved in the datum field, and the arguments being passed to the object are saved as a list in the operands field.
But what does this mean?
Strange, I implemented a very simple function that adds two numbers, and it works just fine, as well as an absolute value function that works fine; can it be conditional?
thanks
source share