• Advertisement
Sign in to follow this  

Scheme forward declaration

This topic is 4580 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm attempting to learn Scheme, but I'm running into a basic problem of not being able to call a function that appears lower in the file than the function calling it. What is the syntax for forward declarations of function in scheme?

Share this post


Link to post
Share on other sites
Advertisement
You should only get a warning at the most if you define a function using a symbol that wasn't defined yet. If you want to make the warning go away, you can do the following, but I've never seen anyone bother.

(define blah #f) ; forward decl of sorts.
(define (bloo x y z) (blah 1 2 3)) ; using the forwardly decled function.
(set! blah (lambda (x y z) (+ x y z))) ; define the function.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement