Thursday, June 29, 2023

implement add with + operator with racket

 #lang racket


; implement add without + operator


(define add

  (λ (n m)

    (cond

      ((zero? m) n)

      (else (add1

            (add n (sub1

                    m)))))))


One thing I want to notice is that add1 and sub1 are not what I defined myself.

No comments:

Post a Comment

Task in UnrealEngine

 https://www.youtube.com/watch?v=1lBadANnJaw