From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.6 required=5.0 tests=BAYES_05,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7fb761492573daee X-Google-Attributes: gid103376,public From: brh@cray.com (Brian Hanson) Subject: Re: No top schools use Ada Date: 1995/04/20 Message-ID: <1995Apr20.105933.18413@driftwood.cray.com>#1/1 X-Deja-AN: 101283287 references: organization: Cray Research, Inc., Eagan, MN reply-to: brh@cray.com newsgroups: comp.lang.ada originator: brh@fir306 Date: 1995-04-20T00:00:00+00:00 List-Id: In article 798344756@gnat, dewar@cs.nyu.edu (Robert Dewar) writes: > Regarding using Ada to teach computer science > Scheme is a different issue: to me it is limiting to live only in the > functional world. For example, today I was presenting heapsort. The > essence of this algorithm is the in place tree mapping, that's what > makes the algorithm interesting. Huh? Over in the comp.lang.scheme there have been long drawn out arguments about how scheme is not really a functional language as it is not a pure functional language. I have written a number of significant programs in scheme and never really written in functional style. Scheme is a lean and elegant lisp. ;; The following sorts are short but horribly inefficient (define (insertion-sort a) (do ((i 1 (+ i 1))) ((>= i (vector-length a)) a) (do ((v (vector-ref a i) v) (j i (- j 1))) ((or (< j 1) (< (vector-ref a (- j 1)) v)) (vector-set! a j v)) (vector-set! a j (vector-ref a (- j 1)))))) (define (swap! a i j) (let ((v (vector-ref a i))) (vector-set! a i (vector-ref a j)) (vector-set! a j v))) (define (bubble-sort a) (do ((i (- (vector-length a) 1) (- i 1))) ((< i 0) a) (do ((j 1 (+ j 1))) ((> j i)) (if (> (vector-ref a (- j 1)) (vector-ref a j)) (swap! a j (- j 1)))))) (define l (list 1 5 7 8 2 4 1 5 6 2)) (define (run sort a) (sort a) (display a) (newline)) (run insertion-sort (list->vector l)) (run bubble-sort (list->vector l)) $ vscm > (load "../src/scm/sort.scm") #(1 1 2 2 4 5 5 6 7 8) #(1 1 2 2 4 5 5 6 7 8) ;value (after 170ms... comp: 0 (0 GC), exec: 170 (0 GC)): #t > -- -- Brian Hanson -- brh@cray.com