Rookie Scheme Mistake
I’m currently reading Structure and Interpretation of Computer Programs and during the first minutes of trying my luck into scheme
I faced the following error:
; application: not a procedure;
; expected a procedure that can be applied to arguments
; given: 5
After googling for a while without success I’ve realized that my rookie mistake. Instead of using the super friendly Polish Notation, I was using the usual Infix notation.
I had this:
1
2
3
4
5
(define (square n)
(n * n)
)
(square 5)
When I should be doing this:
1
2
3
4
5
(define (square n)
(* n n)
)
(square 5)
Problem solved :D