From 7dfcc480ba1e19bd3232349fc733caef94034292 Mon Sep 17 00:00:00 2001 From: stainer_t Date: Mon, 8 Sep 2025 13:48:49 +0200 Subject: Initial commit from Polytechnique Montreal --- PyGan/data/fact_proc/fact.c2m | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 PyGan/data/fact_proc/fact.c2m (limited to 'PyGan/data/fact_proc/fact.c2m') diff --git a/PyGan/data/fact_proc/fact.c2m b/PyGan/data/fact_proc/fact.c2m new file mode 100644 index 0000000..45a6dfd --- /dev/null +++ b/PyGan/data/fact_proc/fact.c2m @@ -0,0 +1,19 @@ + ! + ! Example of a recursive procedure. + ! + ! input to "fact": *n* + ! output from "fact": *n_fact* + ! + INTEGER n n_fact prev_fact ; + :: >>n<< ; + IF n 1 = THEN + EVALUATE n_fact := 1 ; + ELSE + EVALUATE n := n 1 - ; + ! Here, "fact" calls itself + PROCEDURE fact ; + fact :: <> >>prev_fact<< ; + EVALUATE n_fact := n 1 + prev_fact * ; + ENDIF ; + :: <> ; + QUIT " Recursive procedure *fact* XREF " . -- cgit v1.2.3