Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,16 @@
;; sorts a vector of objects in place
;; proc is an user defined comparison procedure
(define (bubble-sort V proc)
(define length (vector-length V))
(for* ((i (in-range 0 (1- length))) (j (in-range (1+ i) length)))
(unless (proc (vector-ref V i) (vector-ref V j)) (vector-swap! V i j)))
V)
(define V #( albert antoinette elvis zen simon))
(define (sort/length a b) ;; sort by string length
(< (string-length a) (string-length b)))
(bubble-sort V sort/length)
→ #(zen simon elvis albert antoinette)