How do I make a module in PLT Scheme?

Posted by kunjaan on Stack Overflow See other posts from Stack Overflow or by kunjaan
Published on 2009-07-12T17:28:09Z Indexed on 2010/06/08 21:22 UTC
Read the original article Hit count: 420

I tried doing this:

#lang scheme
(module duck scheme/base
      (provide num-eggs quack)
      (define num-eggs 2)
      (define (quack n)
        (unless (zero? n)
          (printf "quack\n")
          (quack (sub1 n)))))

But I get this error:

module: illegal use (not at top-level) in: 
(module duck scheme/base (provide num-eggs quack) (define num-eggs 2) (define (quack n) (unless (zero? n) (printf "quack\n") (quack (sub1 n)))))

what is the correct way?

© Stack Overflow or respective owner

Related posts about functional-programming

Related posts about lisp