[plt-scheme] questions about modules and keyword arguments and so on

From: Tyler McMullen (tbmcmullen at gmail.com)
Date: Sat Jul 5 03:11:17 EDT 2008

I'm rather new to Scheme, so please excuse me if I sound like an

So, I have two files: web.scm and site.scm.  web.scm is supposed to
define a module "web"... which site.scm then loads and uses.  web.scm
gets required just fine... however when it tries to run "start" I get
the following error:

> (load "site.scm")
struct procedure:serve: expects 0 arguments plus an argument with
keyword #:dispatch plus optional arguments with keywords #:initial-
connection-timeout, #:listen-ip, #:max-waiting, #:port, and #:tcp@,
given 4: #:port port #:dispatch #<procedure:dispatch-mvc>

Suffice it to say that I'm really confused.  Any pointers?

web.scm ---

(module web mzscheme
	(require web-server/web-server

	(define routes '())

	(define (dispatch-mvc conn req)
	     (eval (cdr (assoc (url->string (request-uri req)) routes)))))

	(define (start rts port)
	  (set! routes rts)
	  (serve #:port port
		 #:dispatch dispatch-mvc))

	(provide start))

site.scm ---

(require "web.scm")

(define (hello-world) "hello world!")
(define (goodbye-world) "goodbye cruel world")

(define my-routes
  '(("/" hello-world)
    ("/foo" goodbye-world)))

(start my-routes 3000)

Posted on the users mailing list.