[gambit-list] help with port from DrScheme?
Bill Richter
richter at math.northwestern.edu
Sun Oct 17 22:07:23 EDT 2004
I just downloaded gambc40b9 (haven't even built it; Linux binaries
seem to work), and I have some dumb questions about Gambit. I have a
fair amount of DrScheme code, which runs very slow, and I'm a bit
tired of PLT right now, although I profited a lot from their teaching
approach. I thought I'd port to Gambit for a speed increase. So:
Mostly I'm doing mod 2 linear algebra. That is, all my numbers are
either 0 or 1. Isn't there some way to take advantage of that?
Does Gambit have a case sensitive mode? I didn't see anything like
this in the info files, but maybe there's an easy way to get it.
Has anyone worked out ports of various DrScheme things, such as the
local construction? Here's one dumb example:
(define (merge-1 shortlist longlist less-than?)
;; (listof x)^2 (x x -> boolean) -> (listof x)
;; to merge a short list into a longer list, deleting repetitions, using less-than?.
;; (merge-1 '(4 8 9) '(1 2 3 5 6 7 9 10 11) <) => (1 2 3 4 5 6 7 8 10)
(local ((define (phi a B X less-than?)
;; x (listof x)^2 (x x -> boolean) -> (listof x)
;; to send a X B to (x_1 ... x_r a (mu B (x_{r+1} ... ))) if x_r < a < x_{r+1}
(if (empty? X)
(cons a B)
(let ([x_1 (first X)])
(if (equal? a x_1)
(merge-1 B (rest X) less-than?)
(if (less-than? a x_1)
(cons a (merge-1 B X less-than?))
(cons x_1 (phi a B (rest X) less-than?))))))))
(if (empty? shortlist)
longlist
(phi (first shortlist) (rest shortlist) longlist less-than?))))
I could turn all my local's into letrec's of course. There's other
DrScheme stuff I use, like their quicksort & mergesort, I imagine
there's already (faster) Gambit versions of these
More information about the Gambit-list
mailing list