MN> I don't think that TABs should be treated different than SPCs anywhere.
RM> Perhaps in tab delimited files? Or binary files?
"Anywhere" where the text is supposed to be J code, of course.
I was thinking of
".
3 : '.....'
1 2 3 4 : 0
....
)
11 12 13 : ...
For example:
3 : '4 + y.' NB. spaces, OK.
3 : '4 + y.'
3 : '4 + y.' NB. a tab, a space, UGH!
3 : (52 9 43 32 121 46{a.)
Likewise, I like to indent all my explicit code using tabs.
NB. While this....
twolines =. 3 : 0
NB. just a comment
9 + y
)
NB. ... will display OK:
twolines
3 : 0
NB. just a comment
9 + y
)
NB. the following...
oneline =. 3 : 0
9 + y
)
NB. ... does not:
oneline
3 : (9 57 32 43 32 121{a.)
The 13!: stack displays suffer from the same TAB treatment.
"Hey! This must be binary!"
For those with source, this is probably a remedy (patch against
Release 4.05):
engine 13 > diff -u rl.c*
--- rl.c.orig Thu Dec 21 15:30:06 2000
+++ rl.c Thu Jan 13 02:00:57 2011
@@ -76,7 +76,7 @@
RZ(w);
n=AN(w); u=v=CAV(w); d=*v;
j=2; b=7<n||1<n&&1<AR(w);
- DO(n, c=*v++; if(c==CQUOTE)++j; b&=c==d; p&=31<c&&c<127;);
+ DO(n, c=*v++; if(c==CQUOTE)++j; b&=c==d; p&=c==9||31<c&&c<127;);
if(b){n=1; j=MIN(3,j);}
if(!p){
if(equ(alp,w))R cstr("a.");
engine 14 >
And this is a patch addressing the original poster's quibble with
TABs in dyadic ". vectors:
engine 47 > diff -u wn.c.orig wn.c
--- wn.c.orig Thu Jan 13 02:54:34 2011
+++ wn.c Thu Jan 13 02:53:42 2011
@@ -192,8 +192,9 @@
for(i=0;i<m;++i){I j;
b=1; k=0;
for(j=0;j<n;++j){
- p=b; d=*v; b=' '==d;
+ p=b; d=*v; b='\t'==d||' '==d;
switch(d){
+ case '\t':
case ' ': *v=C0; break;
case '+': *v='?'; break;
case CSIGN: *v='-';
engine 48 >
Caveat: This is all fresh and has not gone through either practical
usage or the test suite yet.
Martin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm