0

I recently started learning Scheme and I'm trying to create this recursive function which finds the number from 0 to the given parameter.

Below is my code:

(define (summer n)
((if (positive? n) (+ n (summer(- n 1))) 0)))
Akash21
  • 39
  • 5
  • *syntax is the set of rules, principles, and processes that govern the structure of sentences in a given language*. lispy languages are awesome, because there is minimal syntax. but it also means that you have to format your code in some helpful, readable way. otherwise you get lost in 2 line functions. – rsm Feb 04 '18 at 22:07
  • Possible duplicate of [My code signals the error "application: not a procedure" or "call to non procedure"](https://stackoverflow.com/questions/48064955/my-code-signals-the-error-application-not-a-procedure-or-call-to-non-procedu) – Sylwester Feb 04 '18 at 22:25

1 Answers1

2

You simply have too many parentheses.

(define (summer n)
  (if (positive? n)
      (+ n (summer(- n 1)))
      0))
law-of-fives
  • 643
  • 4
  • 8