Metropoli BBS
VIEWER: display.txt MODE: TEXT (ASCII)
d#s display a;Lio;r;c;hl;hc;ht;hb;vl;vb;v;w;n;b
" display a general array in pictorial form
"  normal call is monadic.  dyadic call used only in
"    recursion to specify display rank, shape, and depth
Lio#0
C(0=Lnc 's')/'s#Ra'
r#YR,s				" pseudo rank.
c#'++++'				" ur, ul, ll, and lr corners.
hl#'-'				" horizontal line.
hc#hl,'@$',hl,'~+E'		" horizontal borders.
ht#hc[(0<r)X1+0<Y-1Y,s]
"w#,0`=`1Y0R`Z(1SRa)Ya
"                          this expression will produce 1 if all items
"                          in variable a are numeric, or will fail with
"                          a domain error otherwise.
"                          a      1 if 0 items in a, otherwise count of
"                          a      items in a.
"                          a      b
"                          a      bbbbbb
"                          aaaaaaaaaaaaaaaaa
hb#hc[3+3D('2X~a`=Fa' Lea '1+YE0X(1SX/Ra)Y,a')+3X1<RRs]
vl#'|'				" vertical line.
vb#vl,'OU'			" vertical border.
v#vb[(1<r)X1+0<-1Y-1U,s]
C(0ERa)/'a#(1SRa)R`ZYa'	" show prototype of empties
$(1<`=a)/gen
$(2<RRa)/d3
d#Fa					" simple arrays
w#1YRd#(-2Y1 1,Rd)Rd
n#-1+1URd
$(0=RRa)/ss
d#(c[1],v,((w_1)Rvl),c[2]),((ht,nRhl),[0]d,[0]hb,nRhl),c[0],(wRvl),c[3]
$0
ss:hb#((0 ' ')=Y0R`Za)/' -'
d#' ',(' ',[0]d,[0]hb,nR' '),' '
$0
gen:d#Fdisplay`1a		" enclosed ...
n#dV.^=' '
d#(nV~1`On)`/d
d#(V`/~'  '`Ed)/d
d#((1,Rs)Rs)display d
$(2ZR,s)Ud3e,0
d3:d#0 -1U0 1UF`Za		" multi-dimensional
w#1YRd
n#-1+1URd
d#(c[1],v,((w_1)Rvl),c[2]),((ht,nRhl),[0]d,[0]hb,nRhl),c[0],(wRvl),c[3]
d3e:n#-2+R,s
v#c[nR1],[0]vb[1+0<-2U,s],[0](((-3+YRd),n)Rvl),[0]c[nR2]
d#v,d
" copied from IBM's tryapl2 workspace
[ RETURN TO DIRECTORY ]