Skip to content

Commit 6ce04a0

Browse files
committed
lazy ⊃ improvements
1 parent f8022de commit 6ce04a0

File tree

6 files changed

+2484
-165
lines changed

6 files changed

+2484
-165
lines changed

#utilities.lisp#

+2,324
Large diffs are not rendered by default.

.#utilities.lisp

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

libraries/dfns/array/demo.lisp

+9-9
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,15 @@
239239
"││noe│wto│htree│││lapha│ebta│agmma│││erd│lbue│rgeen││"
240240
"│└───┴───┴─────┘│└─────┴────┴─────┘│└───┴────┴─────┘│"
241241
"└───────────────┴──────────────────┴────────────────┘"))
242-
(is "↓disp ⊃sam ⍪vex" #("┌─────┬──────────────────┬────────────────┐"
243-
"│┌───┐│┌─────┬────┬─────┐│┌───┬────┬─────┐│"
244-
"││one│││alpha│beta│gamma│││red│blue│green││"
245-
"│├───┤│└─────┴────┴─────┘│└───┴────┴─────┘│"
246-
"││two││ │ │"
247-
"│├───┤│ │ │"
248-
"││thr││ │ │"
249-
"│└───┘│ │ │"
250-
"└─────┴──────────────────┴────────────────┘"))
242+
(is "↓disp ⊃sam ⍪vex" #("┌───────┬──────────────────┬────────────────┐"
243+
"│┌─────┐│┌─────┬────┬─────┐│┌───┬────┬─────┐│"
244+
"││one │││alpha│beta│gamma│││red│blue│green││"
245+
"│├─────┤│└─────┴────┴─────┘│└───┴────┴─────┘│"
246+
"││two ││ │ │"
247+
"│├─────┤│ │ │"
248+
"││three││ │ │"
249+
"│└─────┘│ │ │"
250+
"└───────┴──────────────────┴────────────────┘"))
251251
(is "↓disp 2⊃sam ⍪vex" #("┌───────────────┬───────┬────────────────┐"
252252
"│┌───┬───┬─────┐│┌─────┐│┌───┬────┬─────┐│"
253253
"││one│two│three│││alpha│││red│blue│green││"

libraries/dfns/numeric/demo.lisp

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
" ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕ "
126126
" ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕ "
127127
" ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕ "))
128-
;; (is "{∧/⍵∧.=⍵∘.{+/⍺ nicediv ⍵}⍵}⍳50" 1)
128+
;; (is "{∧/⍵∧.=⍵∘.{+/⍺ nicediv ⍵}⍵}⍳50" 1) ;; TODO: why is this so slow when lazified?
129129
(is "osc¨⍳30" #(1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1))
130130
(is "0 5 10 15 range ¯2+⍳18" #(0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4))
131131
(is "¯1 0 1 range 1○⍳40"

spec.lisp

+9-5
Original file line numberDiff line numberDiff line change
@@ -1370,8 +1370,13 @@
13701370
(is "⊃,/(⊂'abc') 'def' 'ghi'" #("abc" #\d #\e #\f #\g #\h #\i))
13711371
(is "(×⌿,+⌿)+⌿(⍳2)∘.×⍬∘.×⍳4" #(1 1 1 1 0 0 0 0))))
13721372
(⌿ (has :title "Reduce First")
1373-
(lateral (lambda (operand) (values `(operate-reducing ,operand index-origin nil)
1374-
'(:axis))))
1373+
(lateral (lambda (operand) ;; (values `(operate-reducing ,operand index-origin nil)
1374+
;; '(:axis))
1375+
(values `(op-compose 'vacomp-reduce :left (sub-lex ,operand)
1376+
:index-origin index-origin
1377+
:default-axis index-origin)
1378+
'(:axis))
1379+
))
13751380
(tests (is "+⌿3 4⍴⍳12" #(15 18 21 24))
13761381
(is "-⌿3 4⍴⍳12" #(5 6 7 8))
13771382
(is "{⍺×⍵+3}⌿3 4⍴⍳12" #(63 162 303 492))
@@ -1568,9 +1573,8 @@
15681573
(is "fn←{2+⍵}⍣{10<⍵} ⋄ fn 2" 14)
15691574
(is "fn←{⍵×2} ⋄ fn⍣3⊢4" 32)
15701575
(is "↓⍣2⊢2 2⍴⍳4" #0A#(#(1 2) #(3 4)))
1571-
; (is "⌊1_000_000_000×2○⍣=1" 739085133)
1572-
; (is "⌊100000×{⍵{2.0÷⍨⍵+⍺÷⍵}⍣≡⍵}123456789" 1111111106)
1573-
))
1576+
(is "⌊1_000_000_000×2○⍣=1" 739085133)
1577+
(is "⌊100000×{⍵{2.0÷⍨⍵+⍺÷⍵}⍣≡⍵}123456789" 1111111106)))
15741578
(@ (has :title "At")
15751579
(pivotal (lambda (right left) `(operate-at ,right ,left index-origin)))
15761580
(tests (is "20 20@3 8⍳9" #(1 2 20 4 5 6 7 20 9))

0 commit comments

Comments
 (0)