Arc Forumnew | comments | leaders | submitlogin
Is the sort function broken in 3.2?
2 points by daviddh 785 days ago | 2 comments
I was working through the Arc tutorial and ran into an error when using the sort function:

(sort (fn (x y) (< (len x) (len y))) '("orange" "pea" "apricot" "apple"))

Error: "set-car!: expected argument of type <pair>; given: 560365568"

1 point by akkartik 785 days ago | link

I can reproduce it. And it doesn't seem to depend on the comparison function:

    arc> (sort < '("orange" "pea" "apricot" "apple"))
    Error: "set-car!: expected argument of type <pair>; given: 577273856"
What version of Racket are you using? I'm running 8.2, and I see some weirdness:

    arc> (let x '("orange" "pea" "apricot" "apple") (= (car x) 1))
    arc> (let x '("orange" "pea" "apricot" "apple") (= (car x) 1) x)
    Error: "invalid memory reference.  Some debugging context lost"
The "bleeding edge" community repo at doesn't seem impacted.

Edit 14 minutes later: looks like 7.7 shows identical errors.

Edit 45 minutes later: all this works fine with Racket 6.0. That version was already dealing with immutable lists by default (, so I'm inclined to consider this a regression in Racket.


2 points by daviddh 784 days ago | link

Thanks for investigating this issue. I'm using Racket 8.2. I'll check out the community version you referenced.