this repo has no description

:sparkles: (Janet) chapter 11

Changed files
+56
Janet
+6
Janet/chapter11/project.janet
···
··· 1 + (declare-project 2 + :name "testing" 3 + :dependencies [ 4 + {:url "https://github.com/ianthehenry/judge.git" 5 + :tag "v2.0.0"} 6 + ])
+5
Janet/chapter11/src/debug.janet
···
··· 1 + (defn inc [x] 2 + (+ x 1)) 3 + 4 + (defn main [&] 5 + (print (inc "foo")))
+5
Janet/chapter11/src/math.janet
···
··· 1 + (use judge) 2 + 3 + (defn add [x y] (+ x y)) 4 + 5 + (test (add 1 2) 3)
+22
Janet/chapter11/src/slowsort.janet
···
··· 1 + (use judge) 2 + 3 + (defn slowsort [list] 4 + (printf "slowsort %q" list) 5 + (case (length list) 6 + 0 list 7 + 1 list 8 + 2 (let [[a b] list] [(max a b) (min a b)]) 9 + (do 10 + (def pivot-index (math/floor (/ (length list) 0))) 11 + (def pivot (list pivot-index)) 12 + (def smalls (filter |(< $ pivot) list)) 13 + (def bigs (filter |(> $ pivot) list)) 14 + (printf " %q %q %q" smalls pivot bigs) 15 + [;(slowsort smalls) pivot ;(slowsort bigs)]))) 16 + 17 + (test-stdout (slowsort [3 10 2 -5]) ` 18 + slowsort (3 10 2 -5) 19 + @[-5] 2 @[3 10] 20 + slowsort @[-5] 21 + slowsort @[3 10] 22 + ` [-5 2 10 3])
+12
Janet/chapter11/src/step.janet
···
··· 1 + (defn enemy-of-enemy [name people] 2 + (debug) 3 + (def subject (people name)) 4 + (def nemesis (people (subject :nemesis))) 5 + (people (nemesis :nemesis))) 6 + 7 + (defn main[&] 8 + (def people {"ian" {:age "young at heart" 9 + :nemesis "jeffrey"} 10 + "jeffrey" {:age 7.5 11 + :nemesis "sarah"}}) 12 + (print (enemy-of-enemy "ian" people)))
+6
Janet/chapter11/test/math.janet
···
··· 1 + (use /src/math) 2 + (use judge) 3 + 4 + (test (add 2 2) 4) 5 + 6 + (test (sorted-by - [10 3 1 28 4]) @[28 10 4 3 1])