Sign in to follow this  
Mulligan

Scheme forward declaration

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this