From 097b4f312b7426cc9064e5f7b28bea3deb60fe63 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 22 Oct 2017 12:35:52 -0400 Subject: - Better names for piping macros. --- stdlib/test/test/lux/control/pipe.lux | 43 ++++++++++++++++------------------- 1 file changed, 20 insertions(+), 23 deletions(-) (limited to 'stdlib/test') diff --git a/stdlib/test/test/lux/control/pipe.lux b/stdlib/test/test/lux/control/pipe.lux index 23e6cfe60..527db91c3 100644 --- a/stdlib/test/test/lux/control/pipe.lux +++ b/stdlib/test/test/lux/control/pipe.lux @@ -1,13 +1,13 @@ (;module: lux (lux [io] - (control ["M" monad #+ do Monad] + (control [monad #+ do Monad] pipe) (data text/format [number] [product] identity - [text "T/" Eq]) + [text "text/" Eq]) ["r" math/random]) lux/test) @@ -17,44 +17,41 @@ (|> 20 (i.* 3) (i.+ 4) - (_> 0 i.inc) + (new> 0 i.inc) (i.= 1))) (test "Can give names to piped values within a pipeline's scope." - (and (|> 5 - (@> [(i.+ @ @)]) - (i.= 10)) - (|> 5 - (@> X [(i.+ X X)]) - (i.= 10)))) + (|> 5 + (let> X [(i.+ X X)]) + (i.= 10))) (test "Can do branching in pipelines." (and (|> 5 - (?> [i.even?] [(i.* 2)] - [i.odd?] [(i.* 3)] - [(_> -1)]) + (cond> [i.even?] [(i.* 2)] + [i.odd?] [(i.* 3)] + [(new> -1)]) (i.= 15)) (|> 4 - (?> [i.even?] [(i.* 2)] - [i.odd?] [(i.* 3)]) + (cond> [i.even?] [(i.* 2)] + [i.odd?] [(i.* 3)]) (i.= 8)) (|> 5 - (?> [i.even?] [(i.* 2)] - [(_> -1)]) + (cond> [i.even?] [(i.* 2)] + [(new> -1)]) (i.= -1)))) (test "Can loop within pipelines." (|> 1 - (!> [(i.< 10)] - [i.inc]) + (loop> [(i.< 10)] + [i.inc]) (i.= 10))) (test "Can use monads within pipelines." (|> 5 - (%> Monad - [(i.* 3)] - [(i.+ 4)] - [i.inc]) + (do> Monad + [(i.* 3)] + [(i.+ 4)] + [i.inc]) (i.= 20))) (test "Can pattern-match against piped values." @@ -70,5 +67,5 @@ 8 "eight" 9 "nine" _ "???") - (T/= "five"))) + (text/= "five"))) )) -- cgit v1.2.3