diff --git a/src/examples/lib.pbl b/src/examples/lib.pbl index 91c7782..e85b374 100644 --- a/src/examples/lib.pbl +++ b/src/examples/lib.pbl @@ -18,3 +18,15 @@ ; Return the smaller of the two (def min (fn (a b) (if (< a b) a b))) + +(def switch (fn (pair_list) + (if (= 0 (len pair_list)) + "no match" + ( + (def _pair (at 0 pair_list)) + (if (at 0 _pair) + (at 1 _pair) + (switch (rest pair_list)) + ) + )) +))