Skip to content

Commit 618522e

Browse files
committed
work on lazy operator fixes
1 parent a0eaff5 commit 618522e

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

functions.lisp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,8 @@
10951095
;; populate it with the function's identity value
10961096
(xdotimes output (i (size output))
10971097
(setf (row-major-aref output i)
1098-
(if (functionp identity) (funcall identity) identity)))
1098+
(enclose (if (functionp identity)
1099+
(funcall identity) identity))))
10991100
output)
11001101
(error "The operand of [/ reduce] has no identity value.")))
11011102
;; if reduction produces a scalar, the result is the identity value
@@ -1225,7 +1226,7 @@
12251226
(if oscalar (setq output (enclose (funcall op-rendered (disclose-any oscalar))))
12261227
(xdotimes output (i (size omega) :synchronous-if (not threaded))
12271228
(setf (row-major-aref output i)
1228-
(render-varrays (funcall op-rendered (row-major-aref omega i)))))))
1229+
(time (render-varrays (funcall op-rendered (row-major-aref omega i))))))))
12291230
output))))))
12301231

12311232
(defun operate-commuting (operand)

libraries/dfns/array/array.apl

+13-13
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ acc ← { ⊃⍺⍺{(⊂⍺ ⍺⍺⊃⍬⍴⍵),⍵}/1↓{⍵,⊂⍬⍴⍵}¯1
3636
disp { ⎕IO0 Boxed sketch of nested array.
3737
dec ctd2 1:decorated, 1:centred.
3838

39-
box{ Recursive boxing of nested array.
39+
box{ ⎕IO0 Recursive boxing of nested array.
4040
isor :⎕FMT ⎕or: '∇name'.
4141
1=,:dec open ⎕FMT dec open simple array: format.
4242
matmatr 1/dec open matrix of opened subarrays.
@@ -46,43 +46,43 @@ disp ← { ⎕IO←0 ⍝ Boxed sketch of nested ar
4646
()gaps plane subs collection into single plane.
4747
}
4848

49-
aligned{ Alignment and centring.
49+
aligned{ ⎕IO0 Alignment and centring.
5050
rows colssepr¨ subarray dimensions.
5151
sizes(/rows).,cols aligned subarray sizes.
5252
ctd=0:sizes¨ top-left alignment.
5353
v hsepr0.5×(¨)-sizes vertical and horizontal rotation.
5454
v¨h¨sizes¨ centred aligned subarrays.
5555
}
5656

57-
gaps{ Gap-separated sub-planes.
57+
gaps{ ⎕IO0 Gap-separated sub-planes.
5858
2: lowish rank: done.
5959
subs(-1)¨ sub-hyperplanes.
6060
widthsubs width of inter-plane gap.
6161
fill( width-3 0)' ' inter-plane gap.
6262
{fill}/1 open subs gap-separated planes.
6363
}
6464

65-
plane{ Boxed rank-2 plane.
65+
plane{ ⎕IO0 Boxed rank-2 plane.
6666
2<⍴⍴: join gap-separated sub-planes.
6767
odec(dec shape )outer outer type and shape decoration.
6868
idecinner inner type and shape decorations.
6969
(odec,idec)collect collected, formatted subarrays.
7070
}
7171

72-
join{ Join of gap-separated sub-planes.
72+
join{ ⎕IO0 Join of gap-separated sub-planes.
7373
sep()÷1 sub plane separation.
7474
split(0=sep|)[0] separation along first axis.
7575
(¯1)plane¨split sub-plane join.
7676
}
7777

78-
outer{ Outer decoration.
78+
outer{ ⎕IO0 Outer decoration.
7979
sizes1 0{()}¨sepr¨ row and col sizes of subarrays.
8080
sidessizes/¨¨'│─' vert and horiz cell sides.
8181
bordsdec¨'├┬'glue¨sides joined up outer borders.
8282
,¨/('' '') bords'└┐' vertical and horizontal borders.
8383
}
8484

85-
inner{ Inner subarray decorations.
85+
inner{ ⎕IO0 Inner subarray decorations.
8686
deco{(type ),1 shape } type and shape decorators.
8787
sepr deco¨matr dec open decorators: tt vv hh .
8888
}
@@ -94,20 +94,20 @@ disp ← { ⎕IO←0 ⍝ Boxed sketch of nested ar
9494
lft,top,/boxes completed collection.
9595
}
9696

97-
right{ Border right each subarray.
97+
right{ ⎕IO0 Border right each subarray.
9898
types2¨()=¯1+ right border lower corner types.
9999
chars'┼┤┴┘'[types] .. .. .. chars.
100100
rgt{,(-)()1 1/'',} form right border.
101101
((matr 1 open ),¨chars)rgt¨ cells bordered right.
102102
}
103103

104-
lower{ Border below each subarray.
104+
lower{ ⎕IO0 Border below each subarray.
105105
split{((¯2+1)/'')glue } decorators split with horiz line.
106106
bot{(-1) split } lower border.
107107
(matr,¨/)bot¨matr cells bordered below.
108108
}
109109

110-
type{ Type decoration char.
110+
type{ ⎕IO0 Type decoration char.
111111
dec<|:'' nested: '─'
112112
isor :'' ⎕or: '∇'
113113
sst{ simple scalar type.
@@ -118,7 +118,7 @@ disp ← { ⎕IO←0 ⍝ Boxed sketch of nested ar
118118
{(1=)'+'},sst¨dec open array: mixed or uniform type.
119119
}
120120

121-
shape{ Row and column shape decorators.
121+
shape{ ⎕IO0 Row and column shape decorators.
122122
dec0=⍴⍴:/¨'│─' no decoration or scalar.
123123
cols(ׯ1)'⊖→' zero or more cols.
124124
rsig(××/¯1)'⌽↓' zero or more rows.
@@ -146,7 +146,7 @@ display ← { ⎕IO←0 ⍝ Boxed display of array.
146146
top'─⊖→'[¯1],hrz upper border with axis
147147
bot(),hrz lower border with type
148148
rgt'┐│',vrt,'' right side with corners
149-
lax'│⌽↓'[¯11],¨vrt left side(s) with axes,
149+
lax'│⌽↓'[¯11],¨vrt ⍝ left side(s) with axes,
150150
lft'',(lax),'' ... and corners
151151
lft,(topbot),rgt fully boxed array
152152
}
@@ -159,7 +159,7 @@ display ← { ⎕IO←0 ⍝ Boxed display of array.
159159
type{{(1=)'+'},char¨} simple array type
160160
line{(49=⎕DT 1)' -'} underline for atom
161161

162-
{ recursive boxing of arrays:
162+
{ ⎕IO0 recursive boxing of arrays:
163163
0=:' '(open ⎕FMT )line simple scalar
164164
1 ()():'' 0 0 box ⎕FMT object rep: ⎕OR
165165
1=:(deco )box open ⎕FMT open simple array

spec.lisp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1393,8 +1393,8 @@
13931393
(is "+⍀[2]3 4⍴⍳12" #2A((1 3 6 10) (5 11 18 26) (9 19 30 42)))))
13941394
(\¨ (has :title "Each")
13951395
(lateral (lambda (operand)
1396-
`(operate-each ,operand) ; "bla←{ ⍺[0] } ⋄ {⎕io←0 ⋄ {⍵∘bla¨⊂0 1} ⎕←⍵} 3 4"
1397-
;; `(op-compose 'vacomp-each :left (sub-lex ,operand))
1396+
;;`(operate-each ,operand) ; "bla←{ ⍺[0] } ⋄ {⎕io←0 ⋄ {⍵∘bla¨⊂0 1} ⎕←⍵} 3 4"
1397+
`(op-compose 'vacomp-each :left (sub-lex ,operand))
13981398
))
13991399
(tests (is "⍳¨1 2 3" #(#(1) #(1 2) #(1 2 3)))
14001400
(is "⊃¨↓⍳5" 1)

varray/varray.lisp

+2
Original file line numberDiff line numberDiff line change
@@ -3664,6 +3664,8 @@
36643664
ashape))))
36653665

36663666
(defmethod indexer-of ((varray vacomp-each) &optional params)
3667+
;; (setf (vacmp-omega varray) (render (vacmp-omega varray))
3668+
;; (vacmp-alpha varray) (render (vacmp-alpha varray)))
36673669
(let ((this-shape (shape-of varray))
36683670
(oshape (shape-of (vacmp-omega varray)))
36693671
(ashape (shape-of (vacmp-alpha varray)))

0 commit comments

Comments
 (0)