Question

I am running a program using the command line version of Racket.

At some point I call:

(sort(some-function (car set) (POWER (cdr set))))

The sort procedure looks like this:

(define (sort l)
  (if (null? l)
      '()
      (insert (car l)
              (sort (cdr l)))))

But when I run the program, it says:

Welcome to Racket v5.1.1.
> > > > > > procedure sort: expects 2 arguments plus optional arguments with keywords #:cache-keys? and #:key, given 1: (some-function (car set) (POWER (cdr set)))

Why does it say sort expects two arguments? When running it through the Racket GUI, I have no problems.

Was it helpful?

Solution

It seems that you're trying to execute Racket's built-in sort procedure, which in fact receives 2 arguments (a list and a comparison procedure) plus optional arguments with keywords.

Make sure that the sort procedure you defined is in fact the one that gets called, by defining it first before the point where you're actually using it, or just to be sure rename it to say, mysort and use that name consistently - because anyway it's not always a good idea to overwrite existing procedures.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top