Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

46
Task/Vector/Ol/vector.ol Normal file
View file

@ -0,0 +1,46 @@
(define :+ +)
(define (+ a b)
(if (vector? a)
(if (vector? b)
(vector-map :+ a b)
(error "error:" "not applicable (+ vector non-vector)"))
(if (vector? b)
(error "error:" "not applicable (+ non-vector vector)")
(:+ a b))))
(define :- -)
(define (- a b)
(if (vector? a)
(if (vector? b)
(vector-map :- a b)
(error "error:" "not applicable (+ vector non-vector)"))
(if (vector? b)
(error "error:" "not applicable (+ non-vector vector)")
(:- a b))))
(define :* *)
(define (* a b)
(if (vector? a)
(if (not (vector? b))
(vector-map (lambda (x) (:* x b)) a)
(error "error:" "not applicable (* vector vector)"))
(if (vector? b)
(error "error:" "not applicable (* scalar vector)")
(:* a b))))
(define :/ /)
(define (/ a b)
(if (vector? a)
(if (not (vector? b))
(vector-map (lambda (x) (:/ x b)) a)
(error "error:" "not applicable (/ vector vector)"))
(if (vector? b)
(error "error:" "not applicable (/ scalar vector)")
(:/ a b))))
(define x [1 2 3 4 5])
(define y [7 8 5 4 2])
(print x " + " y " = " (+ x y))
(print x " - " y " = " (- x y))
(print x " * " 7 " = " (* x 7))
(print x " / " 7 " = " (/ x 7))