Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!newsfeed.internetmci.com!EU.net!sun4nl!cs.vu.nl!kswleek
From: kswleek@cs.vu.nl (Lee-Kon-Fong KSW)
Subject: HELP: functional programming in scm (Read this one)
Nntp-Posting-Host: galjoen.cs.vu.nl
Sender: news@cs.vu.nl
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Date: Wed, 14 Feb 1996 09:18:55 GMT
Message-ID: <DMrDvK.8Dt.0.-s@cs.vu.nl>
Lines: 57


Hello,

(Sorry for the previous article; i'm not used posting articles via
Netscape. Anybody know how i can cancel articles with Netscape? )

I just started to learn how to program in SCHEME using the scm interpreter.
I need to make a program that can take a list as argument and returns a
solution.
For example:
	     The syntax looks like:
                                           ; a list
                <problem>   ::= (<domains> <variables> <constraints>)
		<domains>   ::= <domain>+
		<variables> ::= <variable>+
		etc...
                                           ; another list
		<domain>   ::= (domain <domain_name> <domain_values>)
		<variable> ::= (variable <variable_name>+ <domain_name>)
		etc...
				           ; another list of (1 or more
				           ; integers) or (1 or more
		  	                                   ; scheme symbols)
		<domain_values> ::= (<integer>+) | (<symbol>+)
		etc...

             As input it gets:             ;a list of lists

		( (domain domname (domvalues))
	          (variable varname domname)
		  etc...
		)

My code looks like:

		(define problem
			(lambda (problemlist)
				; the bodypart:
				; unpack list with car, cadr
				; check the first elements of every
				; sublist to match the constants domain,
				; variable ... etc.
			)
		)

The interpreter gives an error in the lambda function about "unbound domain"
when i give some list of lists (as mentioned above) as input. How can i
make the program see that the argument given to the lambda function is a list,
so i can check for the constants?
Also, do i need to put other functions that i use in the bodypart of the lambda
function, inside the definepart of problem?

Please email me if you've any suggestions.
Thanks in advance.

Regards,
K. Lee
