Session Output Ellipses

This topic is specifically for discussions on the new APL64 Project currently in development. This topic is open for all to browse. However, to post, one must have a registered account on the APLDN forum only available to APL+Win licensee under a current APL+Win Subscription.

Moderators: Tech Support, phpbb_admin

Session Output Ellipses

Postby brent hildebrand » October 2nd, 2018, 12:28 pm

Sometimes I wish I could view the contents of a large array to get the general idea of the array, but not see the whole thing. Particularly if it is a large array. Here is a sample function which shows only part of an array adding ellipsis to show continuation. It might be nice to be able to toggle this kind of display on or off in the APL session.
Code: Select all
   a←1000 1000⍴⍳1000000
      PW a
      1      2      3      4      5      6      7      8      9     10     11     12     13     14     15     16     17     18     1...
   1001   1002   1003   1004   1005   1006   1007   1008   1009   1010   1011   1012   1013   1014   1015   1016   1017   1018   101...
   2001   2002   2003   2004   2005   2006   2007   2008   2009   2010   2011   2012   2013   2014   2015   2016   2017   2018   201...
   3001   3002   3003   3004   3005   3006   3007   3008   3009   3010   3011   3012   3013   3014   3015   3016   3017   3018   301...
   4001   4002   4003   4004   4005   4006   4007   4008   4009   4010   4011   4012   4013   4014   4015   4016   4017   4018   401...
   5001   5002   5003   5004   5005   5006   5007   5008   5009   5010   5011   5012   5013   5014   5015   5016   5017   5018   501...
   6001   6002   6003   6004   6005   6006   6007   6008   6009   6010   6011   6012   6013   6014   6015   6016   6017   6018   601...
   7001   7002   7003   7004   7005   7006   7007   7008   7009   7010   7011   7012   7013   7014   7015   7016   7017   7018   701...
   8001   8002   8003   8004   8005   8006   8007   8008   8009   8010   8011   8012   8013   8014   8015   8016   8017   8018   801...
   9001   9002   9003   9004   9005   9006   9007   9008   9009   9010   9011   9012   9013   9014   9015   9016   9017   9018   901...
  10001  10002  10003  10004  10005  10006  10007  10008  10009  10010  10011  10012  10013  10014  10015  10016  10017  10018  1001...
  11001  11002  11003  11004  11005  11006  11007  11008  11009  11010  11011  11012  11013  11014  11015  11016  11017  11018  1101...
  12001  12002  12003  12004  12005  12006  12007  12008  12009  12010  12011  12012  12013  12014  12015  12016  12017  12018  1201...
  13001  13002  13003  13004  13005  13006  13007  13008  13009  13010  13011  13012  13013  13014  13015  13016  13017  13018  1301...
  14001  14002  14003  14004  14005  14006  14007  14008  14009  14010  14011  14012  14013  14014  14015  14016  14017  14018  1401...
  15001  15002  15003  15004  15005  15006  15007  15008  15009  15010  15011  15012  15013  15014  15015  15016  15017  15018  1501...
  16001  16002  16003  16004  16005  16006  16007  16008  16009  16010  16011  16012  16013  16014  16015  16016  16017  16018  1601...
  17001  17002  17003  17004  17005  17006  17007  17008  17009  17010  17011  17012  17013  17014  17015  17016  17017  17018  1701...
  18001  18002  18003  18004  18005  18006  18007  18008  18009  18010  18011  18012  18013  18014  18015  18016  18017  18018  1801...
  19001  19002  19003  19004  19005  19006  19007  19008  19009  19010  19011  19012  19013  19014  19015  19016  19017  19018  1901...
  20001  20002  20003  20004  20005  20006  20007  20008  20009  20010  20011  20012  20013  20014  20015  20016  20017  20018  2001...
  21001  21002  21003  21004  21005  21006  21007  21008  21009  21010  21011  21012  21013  21014  21015  21016  21017  21018  2101...
  22001  22002  22003  22004  22005  22006  22007  22008  22009  22010  22011  22012  22013  22014  22015  22016  22017  22018  2201...
  23001  23002  23003  23004  23005  23006  23007  23008  23009  23010  23011  23012  23013  23014  23015  23016  23017  23018  2301...
  24001  24002  24003  24004  24005  24006  24007  24008  24009  24010  24011  24012  24013  24014  24015  24016  24017  24018  2401...
 .
 .
 .
 998001 998002 998003 998004 998005 998006 998007 998008 998009 998010 998011 998012 998013 998014 998015 998016 998017 998018 99801...
 999001 999002 999003 999004 999005 999006 999007 999008 999009 999010 999011 999012 999013 999014 999015 999016 999017 999018 99901...


Code: Select all
      PW ?10000⍴1000
455 611 409 105 133 353 380 687 634 837 211 439 158 854 370 965 72 419 373 214 281 123 235 56 42 388 291 660 826 165 197 808 40 384 ...


Here is a example on a matrified version of []VR of a large function:
Code: Select all
      PW VR 'Wildcard'
    ∇ ret←pat Wildcard word;p;n;⎕io;l;word;pat;flag;r;∆p;escape;Where;PatternRange;Step;negate;case;∆word;bv;mask;chars;check;bp;i;i...
[1]   ⍝∇ ret←larg Wildcard rarg
[2]   ⍝∇ larg ←→ string, strand or matrix of patterns to search (may include * ? # @ [] wildcard characters - escape character \ )
[3]   ⍝∇ rarg ←→ character string or matrix or words to search
[4]   ⍝∇ r ←→ boolean vector marking pat in word
[5]   ⍝∇ wildcards:  * = any character, +=1 or more characters, ? = single character
[6]   ⍝∇             @ = any number (0-9), # = single number
[7]   ⍝∇            [a-c,f,1-3] = "abcf123", Range of single character
[8]   ⍝∇            ~ now negates the wildcards
[9]   ⍝∇ Examples:
[10]  ⍝∇       See the Wildcard_UT function
[11]  ⍝∇
[12]  ⍝∇ BH 2018.09.25 [1.11] - lumped ??? and ### patterns together.
[13]
[14]  ⎕io←1
[15]  ← 2018 6 11 15 27 38  ⎕def 'ret←Where rarg' 'ret←(rarg≠0)/⍳⍴rarg'
[16]  ← 2018 9 24 18 56 5   ⎕def 'ret←larg Patterns rarg;bv;bv0;i;c;b;c0' '⍝ ?#@+*\[   group ??? and ### together' '' 'b←(⍴,rarg)⍴0'...
[17]
[18]  :if 0∊⍴,word
[19]  ⍝    :returnif 0=⍴,pat :res 1 ⍝ maybe 0 is better?
[20]      :return 0
[21]  :end
[22]
[23]  case←1=⎕vget 'WILDCARD_CASE' 1
[24]
 .
 .
 .
[295] :end
    ∇


Here is an example where on the horizontal, the ellipsis is not at the end of the line:
Code: Select all
      PW ?1000 1000⍴1000
 948  824  96  831 596 596 851 398  798 684  665 228 191  902  478  206 557  408   81  333 689   31  456  85...  766   74  454 961  258
 786   57  56  484 760 406 198 416  424 757   40 132 221  187  660  235 802  177  268  376  47   52  408  54...  725  706  209 533  859
 790  369 925  737 441 229 410 822  351 456  269 241 645    6  180  538 397  356   24  714 115  682   95  25...  241  760  831   7  819
 678  638 738  546 610 567 764 490  453 320   18 554 540  262  374  503 282  505  656  802 681  379  427  52...  570  837  501 707  647
  86  206 744  332 466 450 649 112   30 468  519 311   4  606  901  715 665  663   15  313 378  179   24  31...  143  333  156  95  216
 452  970  15  519 913  19 540 885  988 528  857 304 706  945  840  747 879  531  801  141 961  933  653   8...  961  102  752 278  894
 489   96 229  147 292 731 146 621  327 432  425 414 300  601  416  938 167  192  288   57 905  751  246  21...  558  923  339 826  750
 303   34 350  632 177 244 365 186  232 895  987 208 318  196  184  331 604  877  841  356 588  881  774   4...  387  657  549 939  934
 924  477 430  573 638 852 671 710   64 336  261 559 487  264  319  822 122  725  330  747 304  616  658  22...  209  994  874 701  731
 183  283 547  493 919 990 200 642   20 849  303 775 774  869  751  645 999  371  814  763 530  143  724  82...  223  808  256  58  443
 993   84 437  252 239 363 428  13  901 575  169 772 791  400  752  349 198  784  984  268 489  131  320  58...  158  857  516  59  940
  37  289  96  570 805 837 374 373  704 107  667 564 224  375  304  349  56  828  667  880 617  915  829  72...  427  668  213 798  504
 748  802 666  302 694 163 694 907  480 716  343 506 361  966  669  903 228  541  776  570 819  398  130  99...  610  440  977 559  125
 877  213 700  591 917 766 166 697  468 282  153 633 806  567  423  179 991   98  392  415 162  243  398  46...  361  919  232 805   79
 134  335 585  704 695 581 286 919  181 968  711 678  83  873  666   40  46  629  456  672 128  674  696  39...  894  642  664 733  630
  65  502 644  196 426 682 425 711    9 364  486 711 629  634  302  779  94  514  300  504 310   25  416  45...  467  713  694 605  105
 630   47 196  413 715 933 930 557  304 331  406 238 366  998   23  109 515  154  615  598 696   84  766  60...  210  699  300 269  411
 100  469 822  993 415 983 867 124  876 802  543 414 239  397  516  790 534  304  835  188 655  237  657  14...  463  443  694 306  890
 171  827 180  139 600 750 310 576  816 996  209 242  46  660   89   33 770  411  553  827 551  645  243  69...   58   31  242 861  612
 493  244 500  432 262 434  30 174   96 391  277 666  52  404  795  529 330  639  405  221 589  249  157  71...  754  395  970 679  372
 606  676 830  461 791 716 841  74  505 239  467 333 228  628  362  122 382  601  958  868 777   88  592  90...  374  378  421 393  342
 710  450 899  883 542  25 866 840  116 236  710  88 354  357  842  953 123  935   39  139 648   81  559  83...  593  901  434  66  893
 511  216 686  209 787 423 197 228  155 102  946 702 304  557  185  542 267  276  381  924 710  687  589    ...  985  637   52 303   90
  27  283 241  479 294 905 182  85  530 526  478 720 819   83  378  142  64  746  229  460 125  616  883  77...  385  944  696 767  738
 795  303 401  672 451  98 523 982  432 914  534   4 811  373  120  995  89  619  853  122 986  367  987  97...  776  301  741 450  742
 .
 .
 .
 620  881 482  918 555 747 815 219  182 473  245 186 265  791  387  786 144  989   87  604 325  387  927  53...  821  143  294 181   76
 311  728 888  868 579 106 759 728   73 501  800 384 647  390  878  111 612  981  952  757  82  153   71  38...  631  695   75 799  217


This is my sample Ellipsis generating function.
Code: Select all
    ∇ ret←hw PW rarg;pw;p;w;h;split
[1]   ⍝ display output on one screen adding ellipses
[2]   hw←⎕vget 'hw' (30,⎕pw) ⍝ hw=height width
[3]   :if 2=⍴,hw             ⍝ set values
[4]       (h w)←hw
[5]   :else
[6]       w←⎕pw
[7]       h←↑hw
[8]   :end
[9]   
[10]  rarg←⎕cn ⍕rarg         ⍝ char nest of results (note ⍕ does not work well for 2<⍴⍴rarg)
[11]  p←∊w<⍴¨rarg
[12]  :if 1                  ⍝ ellipsis at end = default
[13]      (p/rarg)←((w-3)↑¨p/rarg),¨⊂'...'
[14]  :else                  ⍝ '...' in text
[15]      split←⌊.8×w
[16]      (p/rarg)←(split↑¨p/rarg),¨(⊂'...'),¨(-w-split+3)↑¨p/rarg
[17]  :end
[18] 
[19]  :if h<⍴rarg            ⍝ set vertical ellipsis.
[20]      rarg←((h-5)↑rarg),(3⍴⊂' .'),¯2↑rarg
[21]  :end
[22] 
[23]  ret←⊃rarg
    ∇
brent hildebrand
 
Posts: 538
Joined: February 12th, 2007, 5:53 pm
Location: Loma Linda, CA

Re: Session Output Ellipses

Postby Davin Church » October 5th, 2018, 6:56 pm

As I understand it, if you set your session to show results in their own sub-window (either in-line or in a separate window), then that sub-window will have its own horizontal and vertical scroll bars, and I presume that line-wrapping could or would be turned off for those. In such a case, everything would be displayed but if you wanted to see anything beyond the right margin then you would scroll to it; otherwise it would be chopped off like "..." does. Does that sound like it would satisfy your desires?
Davin Church
 
Posts: 651
Joined: February 24th, 2007, 1:46 am

Re: Session Output Ellipses

Postby brent hildebrand » October 5th, 2018, 7:25 pm

If I were to try to view a variable with 1,000,000 rows, for which there is no real practical reason one can truly review a variable of that size, I'd rather see ellipses instead of the whole thing. Granted, I should be aware of what I'm trying to review. Currently in APL+Win, after showing between 25,000 and 30,000 rows usually, the session will lock up and Ctrl+Break will not interrupt the session, the session does not update, and the whole session appears to not be responding and will not respond until every row has been passed to the session, and that can be a fair bit of time. Ellipses can prevent that. It could be a toggle option perhaps.

To demonstrate, try the following in APL+Win.
a←1000000 100⍴⍳100000000
a

Wait for a bit, then move the mouse around and try to click on the Session - the session become non-responsive, and now you just have to be very patient for the session to return.

So what I am thinking, a little smarts with the session, to compensate for my lack of smarts, have the session say to itself, do you really want to display 100,000,000 values to the session? Probably not, so add ellipsis.
brent hildebrand
 
Posts: 538
Joined: February 12th, 2007, 5:53 pm
Location: Loma Linda, CA

Re: Session Output Ellipses

Postby Davin Church » October 5th, 2018, 8:53 pm

That sounds somewhat reasonable. However, something that extremely large was probably a mistake anyway and you don't want it displayed at all.

As far as being unresponsive, that sounds like it's been fixed in APL64. They talk about decoupling the session AND calculation engine from the output, so it seems from the examples like you can go ahead and interrupt a long-running output or start working on something new, while it's still outputting.

Of course, it can still ask first if we do something apparently unreasonable.
Davin Church
 
Posts: 651
Joined: February 24th, 2007, 1:46 am


Return to APL64 Project

Who is online

Users browsing this forum: No registered users and 3 guests

cron