I've been playing with Scheme for about 10 minutes and stumbled across this error:
scheme@(guile-user) [2]> (define (a one two) ((* one two)))
scheme@(guile-user) [2]> (a 2 3)
ERROR: In procedure 6:
ERROR: Wrong type to apply: 6
I was expecting this to return 6. How does "apply" enter into this? What does this error mean?
Parentheses in Scheme are not just a grouping construct. They generally mean function application.
The error is related to the body of your define. Specifically,
((* one two))
means
Call the result of multiplying one by two
The JS equivalent is something like
function a (one, two) { (one * two)(); }
You most likely meant to define that function as
(define (a one two) (* one two))
which is just the multiplication, and should work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With