13-trace
Source: examples/13-trace.metta
Imports
This module has no imports.
Symbols
| Symbol | Kind | Type |
|---|---|---|
sum-to | function | (-> Number Number) |
Functions
sum-to
Kind: function
metta
(: sum-to (-> Number Number))Sum the numbers from 1 to n, guarding the recursion with if so it stops at 0. (Two rules — a (sum-to 0) base case and a recursive one — would both match 0, so the recursion runs away; the guard keeps it single-valued.)
Source: examples/13-trace.metta:13