문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top