title: A function builder in scheme
body: <p>A function I'm supposed to build is supposed to take in a list of numbers as a parameter, and give a single function as an output that does as follows: If the number in the list is a positive number, add it, if it is negative multiply by it, and if it is 0, square the number. </p>
  
  <p>For example, if I pass in (4 -1 0), it should return a function that takes in a single parameter, adds 4 to it, multiplies it by -1, squares it, and returns that.</p>
  
  <p>I think I'm on the right track, but I'm getting seriously confused at this point. I'm not necessarily looking for a solution, but any help getting there would be amazing. Here's what I have so far:</p>
  
  <pre><code>(define (buildseries L)
    (define (a x) 
      (lambda (y) (+ x y)))
    (define (m x) 
      (lambda (y) (* x y)))
    (define (s x) 
      (lambda (x) (* x x)))
    (define (funcfind d)
      (cond
       [(null? d) (a 0)]
       [(&gt; d 0) (a d)]
       [(= d 0) (s d)]
       [(&lt; d 0) (m d)]))
    (funcfind (first L)))
  
  ((buildseries '(2)) 2)
  </code></pre>
  
  <p>I don't know how to build a function that is a composite of other functions... Just feeling lost here.</p>