apl: ⎕ system functions + drive corpus to 100+ (+13 tests, 328/328)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 51s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 51s
This commit is contained in:
@@ -925,6 +925,52 @@
|
||||
(apl-quicksort (apl-compress (apl-gt arr pivot) arr))))
|
||||
(apl-catenate less (apl-catenate eq greater))))))))
|
||||
|
||||
(define apl-quad-io (fn () (apl-scalar apl-io)))
|
||||
|
||||
(define apl-quad-ml (fn () (apl-scalar 1)))
|
||||
|
||||
(define apl-quad-fr (fn () (apl-scalar 1248)))
|
||||
|
||||
(define apl-quad-ts (fn () (make-array (list 7) (list 1970 1 1 0 0 0 0))))
|
||||
|
||||
(define apl-quad-fmt-scalar (fn (v) (str v)))
|
||||
|
||||
(define
|
||||
apl-quad-fmt-vector
|
||||
(fn
|
||||
(ravel)
|
||||
(if
|
||||
(= (len ravel) 0)
|
||||
""
|
||||
(reduce
|
||||
(fn (acc x) (str acc " " x))
|
||||
(str (first ravel))
|
||||
(rest ravel)))))
|
||||
|
||||
(define
|
||||
apl-quad-fmt
|
||||
(fn
|
||||
(arr)
|
||||
(let
|
||||
((shape (get arr :shape)) (ravel (get arr :ravel)))
|
||||
(cond
|
||||
((= (len shape) 0) (apl-quad-fmt-scalar (first ravel)))
|
||||
((= (len shape) 1) (apl-quad-fmt-vector ravel))
|
||||
((= (len shape) 2)
|
||||
(let
|
||||
((rows (first shape)) (cols (last shape)))
|
||||
(reduce
|
||||
(fn
|
||||
(acc r)
|
||||
(let
|
||||
((row-ravel (map (fn (j) (nth ravel (+ (* r cols) j))) (range 0 cols))))
|
||||
(str acc (apl-quad-fmt-vector row-ravel) "\n")))
|
||||
""
|
||||
(range 0 rows))))
|
||||
(else (apl-quad-fmt-vector ravel))))))
|
||||
|
||||
(define apl-quad-print (fn (arr) arr))
|
||||
|
||||
(define
|
||||
apl-reduce
|
||||
(fn
|
||||
|
||||
Reference in New Issue
Block a user