diff --git a/src/examples/lib.pbl b/src/examples/lib.pbl index 2230342..1f04c77 100644 --- a/src/examples/lib.pbl +++ b/src/examples/lib.pbl @@ -28,10 +28,9 @@ ; Switch expression ; Doesn't yet work with lambdas (def switch (fn (val pair_list) - (if (= 0 (len pair_list)) "no match" ( - (def current (at 0 pair_list)) - (if (= val (at 0 current)) (at 1 current) ( + (if (= 0 (len pair_list)) "no match" + (if (= val (at 0 (at 0 pair_list))) (at 1 (at 0 pair_list)) ( (switch val (rest pair_list)) )) - )) + ) ))