Commit 1dee28f299675e6301205e49288b2c54a3d20f0d

Thomas de Grivel 2024-04-09T09:30:34

readme

diff --git a/.ic3_history b/.ic3_history
index 511cba2..7e61012 100644
--- a/.ic3_history
+++ b/.ic3_history
@@ -1,7 +1,3 @@
-if true then 1 else 2 end
-if true 1 else 2 end
-def fib = fn (x) { if x < 0 1 else fib(x - 2) + fib(x - 1) end }
-fib(-1)
 def fib = fn (x) { if x < 0 0 else fib(x - 2) + fib(x - 1) end }
 def fib = fn (x) { if x < 0 then 0 else fib(x - 2) + fib(x - 1) end }
 def fib = fn { (0) { 1 } (1) { 1 } (x) { if x < 0 then 0 else fib(x - 2) + fib(x - 1) end }}
@@ -97,3 +93,7 @@ z
 x
 y
 z
+if true then true end
+if 42 then true end
+if 0 then true end
+if 0 then true else false end
diff --git a/README.md b/README.md
index 5736b0b..ff822bc 100644
--- a/README.md
+++ b/README.md
@@ -383,12 +383,16 @@ Macros are like functions but start with `macro` instead of `fn` and
 their arguments do not get evaluated. However they get pattern matched
 and the full power of the pattern matcher is available for arguments
 destructuring. Use a map if you want named arguments. Use a list if you
-want &rest or &body arguments.
+want &rest arguments, use a block if you want a &body argument.
 
 When evaluated, a macro call returns a tag which is in turn evaluated
 in the calling site lexical environment. This allows for DSLs and custom
 control structures to be defined in C3.
 
+Many basic operations in C3 are defined as macros : error handling,
+free operations with `unwind-protect`, graph database operations like
+`Facts.with`.
+
 
 #### If, then, else.
 
@@ -415,6 +419,13 @@ first (then) block gets evaluated. If the condition is false the second
 block gets evaluated. If the condition is false and an `else` block is
 not provided, then `void` gets returned.
 
+One liner examples with `then` :
+```
+ic3> if 42 then true end
+true
+ic3> if 0 then true else false end
+false
+```
 
 ### c3s