954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

more scheme help

I wrote a a program that calculates the volume of cylinders using named functions and un-named functions, however, i'm having trouble doing the same using the let-form in scheme.

here's my program although it doesn't work

(define main6(lambda ()
              (let (
                     (volumec6 (lambda (d h)
                                 (let ( pi (3.14159265))
                                 (* h(* (* (/ d 2)(/ d 2)) 3.14)))
                                 )
                               )
                     )
                )
               )
  )


it gives me this error
let: bad syntax in: (let ((volumec6 (lambda (d h) (let (pi (3.14159265)) (* h (* (* (/ d 2) (/ d 2)) 3.14)))))))

vladdy19
Newbie Poster
20 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
 

It looks as though you're trying to write a function that returns a function, which I'm sure is not what you intended. Also, the LET form takes either an atom or a two-element list of atoms. What's the matter with just:

(define (volumec6 d h)
  (let ((pi 3.14159265))
    (* h pi (* (/ d 2) (/ d 2)))))
azimuth0
Light Poster
36 posts since May 2006
Reputation Points: 11
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You