summary refs log tree commit diff
diff options
context:
space:
mode:
authorNakidai <nakidai@disroot.org>2025-03-25 18:03:41 +0300
committerNakidai <nakidai@disroot.org>2025-03-25 18:03:41 +0300
commitdaec1746288490bb5ba515bb8cea3a8a3ae92b46 (patch)
tree0879ac4657f66bedd8031ca5ca2fab8e9fcd952a
parent00b1d65b7906775ef9fecdcdf1612fc7a70b2f8d (diff)
download3cl-1d339452a038718dd8cb4c250ed5b13dadfbd8b2.tar.gz
3cl-1d339452a038718dd8cb4c250ed5b13dadfbd8b2.zip
Add example to ccl.7 v1.0.1
-rw-r--r--ccl.726
1 files changed, 26 insertions, 0 deletions
diff --git a/ccl.7 b/ccl.7
index 254fe04..899b1ac 100644
--- a/ccl.7
+++ b/ccl.7
@@ -269,6 +269,32 @@ Variable with a given name
 must exist.
 .El
 .
+.Sh EXAMPLES
+This procedure
+calculates nth number
+of a fibonacci sequence,
+accepting the parameter
+and returning the result
+over last cell on the stack:
+.Bd -literal -offset indent
+F {
+    / define some local variables to work with
+    &a &b &c
+
+    / if the parameter is either 0 or 1,
+    / return with it
+    c? #; $c+ = c
+    c? #;
+
+    / otherwise, get 2 previous numbers
+    / of a sequence and sum them
+    = c $c $c
+    - @F = a
+    -- @F = b
+    $a $b*
+}
+.Ed
+.
 .Sh SEE ALSO
 .Xr ascii 7 ,
 .Xr 3cl 1 ,