Meta Functions

Here are some implementations of build-in functions

Add

;;add : number number -> number
;;to produce n+x without using operator +
;;example : (add 3 2) => 5
(define (add n x)
  (cond
    [(= x 0) n]
    [else
     (add1 (add n (sub1 x)))]))
 
sci/cs/scheme/meta.txt · Last modified: 2006/06/22 00:40 by flanker27
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki