Skip to content

13-trace

Source: examples/13-trace.metta

Imports

This module has no imports.

Symbols

SymbolKindType
sum-tofunction(-> 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

Released under the Apache-2.0 License.