From 8eb512ebccac3c5909ac8c56eefe2801835f039e Mon Sep 17 00:00:00 2001 From: "William J. Bowman" Date: Sat, 9 Jan 2016 04:24:25 -0500 Subject: [PATCH] Documented new nat functions --- scribblings/stdlib/nat.scrbl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scribblings/stdlib/nat.scrbl b/scribblings/stdlib/nat.scrbl index cfbd3e3..fb0b90a 100644 --- a/scribblings/stdlib/nat.scrbl +++ b/scribblings/stdlib/nat.scrbl @@ -41,6 +41,35 @@ Add @racket[n] and @racket[m]. (plus (s (s z)) (s z))] } +@defproc[(mult [n Nat] [m Nat]) Nat]{ +Multiply @racket[n] and @racket[m]. + +@examples[#:eval curnel-eval + (mult (s z) (s z)) + (mult z (s z)) + (mult (s (s z)) (s z))] +} + + +@defproc[(exp [m Nat] [e Nat]) Nat]{ +Compute @racket[e] to the @racket[m]th exponent. +Due to limitations in Cur, running @racket[exp] takes to long to be +useful on numbers larger than @racket[(s z)]. + +@;@examples[#:eval curnel-eval +@; (exp (s z) (s z)) +@; (exp z (s z))] +} + +@defproc[(square [m Nat]) Nat]{ +Compute @racket[m] squared, i.e., @racket[(exp m (s (s z)))]. +Due to limitations in Cur, running @racket[square] takes to long to be +useful on numbers larger than @racket[(s z)]. + +@;@examples[#:eval curnel-eval +@; (square z)] +} + @defproc[(nat-equal? [n Nat] [m Nat]) Bool]{ Return @racket[true] if and only if @racket[n] is equal to @racket[m].