Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/Function-definition/Ol/function-definition-1.ol
Normal file
2
Task/Function-definition/Ol/function-definition-1.ol
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(lambda (x y)
|
||||
(* x y))
|
||||
3
Task/Function-definition/Ol/function-definition-2.ol
Normal file
3
Task/Function-definition/Ol/function-definition-2.ol
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(define multiply (lambda (x y) (* x y)))
|
||||
|
||||
(define (multiply x y) (* x y))
|
||||
12
Task/Function-definition/Ol/function-definition-3.ol
Normal file
12
Task/Function-definition/Ol/function-definition-3.ol
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(let multiply ((x n) (y m))
|
||||
(* x y))
|
||||
|
||||
; example of naive multiplication function implementation using local recursion:
|
||||
(define (multiply x y)
|
||||
(let loop ((y y) (n 0))
|
||||
(if (= y 0)
|
||||
n
|
||||
(loop (- y 1) (+ n x)))))
|
||||
|
||||
(print (multiply 7 8))
|
||||
; ==> 56
|
||||
Loading…
Add table
Add a link
Reference in a new issue