more scheme help

Please support our Legacy and Other Languages advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2007
Posts: 20
Reputation: vladdy19 is an unknown quantity at this point 
Solved Threads: 0
vladdy19's Avatar
vladdy19 vladdy19 is offline Offline
Newbie Poster

more scheme help

 
0
  #1
Jul 4th, 2007
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)))))))
Last edited by vladdy19; Jul 4th, 2007 at 3:22 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 36
Reputation: azimuth0 is an unknown quantity at this point 
Solved Threads: 5
azimuth0 azimuth0 is offline Offline
Light Poster

Re: more scheme help

 
0
  #2
Jul 4th, 2007
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)))))
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Legacy and Other Languages Forum
Thread Tools Search this Thread



Tag cloud for Legacy and Other Languages
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC