aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/control/function/contract.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/control/function/contract.lux10
1 files changed, 7 insertions, 3 deletions
diff --git a/stdlib/source/library/lux/control/function/contract.lux b/stdlib/source/library/lux/control/function/contract.lux
index ce62f8c45..0fb706a14 100644
--- a/stdlib/source/library/lux/control/function/contract.lux
+++ b/stdlib/source/library/lux/control/function/contract.lux
@@ -2,7 +2,9 @@
[library
[lux #*
[control
- ["." exception (#+ exception:)]]
+ ["." exception (#+ exception:)]
+ [parser
+ ["<.>" code]]]
[data
[text
["%" format (#+ format)]]]
@@ -28,7 +30,8 @@
[]
(panic! message)))
-(syntax: .public (pre test expr)
+(syntax: .public (pre [test <code>.any
+ expr <code>.any])
{#.doc (example "Pre-conditions."
"Given a test and an expression to run, only runs the expression if the test passes."
"Otherwise, an error is raised."
@@ -39,7 +42,8 @@
(~ test))
(~ expr))))))
-(syntax: .public (post test expr)
+(syntax: .public (post [test <code>.any
+ expr <code>.any])
{#.doc (example "Post-conditions."
"Given a predicate and an expression to run, evaluates the expression and then tests the output with the predicate."
"If the predicate returns #1, returns the value of the expression."