From daec1746288490bb5ba515bb8cea3a8a3ae92b46 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Tue, 25 Mar 2025 18:03:41 +0300 Subject: Add example to ccl.7 --- ccl.7 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'ccl.7') 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 , -- cgit 1.4.1