views:

57

answers:

3

So here's my code:

(define *graph* (read(open-input-file "starbucks4.sxml")))

(define get-artifacts
  (lambda (l)
   (member (list 'opm:artifact) l)))

When I type get-artifacts(*graph*) I get an error saying procedure application: expected procedure, given:...(the whole of my file contents)

Anyone see what I'm doing wrong? Thanks guys :)

PS: I'm really new to Scheme so it's probably some stupid syntax I'm forgetting!

+2  A: 

The syntax for calling a function in scheme is (function-name arguments), not function-name(arguments).

When you write get-artifacts(*graph*), racket first evaluates get-artifacts which evaluates to itself.

Then it tries to evaluate (*graph*), which it takes to be a function call with no arguments. That does not work because *graph* is a list and not a function. So you get the error.

sepp2k