From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19835 invoked from network); 5 Mar 2021 21:52:39 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 5 Mar 2021 21:52:39 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 6ECC99CA6E; Sat, 6 Mar 2021 07:52:35 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 076DF9CA68; Sat, 6 Mar 2021 07:51:57 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (2048-bit key; unprotected) header.d=iitbombay-org.20150623.gappssmtp.com header.i=@iitbombay-org.20150623.gappssmtp.com header.b="v/xy/z/n"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 3A1C79CA68; Sat, 6 Mar 2021 07:51:55 +1000 (AEST) Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) by minnie.tuhs.org (Postfix) with ESMTPS id D6AE79C9D6 for ; Sat, 6 Mar 2021 07:51:53 +1000 (AEST) Received: by mail-oi1-f177.google.com with SMTP id a13so4178824oid.0 for ; Fri, 05 Mar 2021 13:51:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iitbombay-org.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=GPQBccttgCONy0VxQ7hGd76d0/EpfWesGWmOwXVBJqE=; b=v/xy/z/nq95AVyop8q2b22n7pbIjSAyksFmR27BPfOdRj1AJ3IEBAYe9G2KEMp/Y4B vd1zukRFZKNC2o5dexFQLo1vcDRJkujUSjGDy1i/A3THFo/y9QosYYc4llQe/ywp4Y2C pWy4Oe03u7mjBcWrwp4E2Nvdd41xo14Ib0KSUa43MribKO0HgO2Mz0Hq/wFDfju7onPZ k2Wmh3bR0REObXFvT8318vvyuumXu59C1SiOV5HX/kXD/DxtnOlje4WBvMmq0H5bxJxF KtQZmPBWt6E2SHroZ4nrCTxKkd7FkSSJOumHzABdJuanJS75ibRVYtWwragARkFbY560 106g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=GPQBccttgCONy0VxQ7hGd76d0/EpfWesGWmOwXVBJqE=; b=aYPc3/V5t8wOMuiszwTUt2Ec2HSBLL7/t4pD4zYvNCMpykpo1n0vhR/Zl1iHE1rIHe M3Ke40M39yIIRJJBJFlgMjSnZcsNNZlVicuJgsw73dIDlfmSKf5H8mjUttc5OIcJoBQZ QaxyNzuTNLAc+c1Q+wOl/Z7WGNw51YbiNzfgsYPJSOgEOIP4hLOBLgHd/9oaHORhooMZ o/0b46z7TDbotmAPACaqXjkN5w21jUR+1lnH0+d259BCOqjev+D3Ftaax3yroToz31kI e034LvbV9v4TSTfKJ+G9DMJNd0QdFISBXyJTJBwYt9dotUdGAk3R5tX0BP16rpNBnDw3 MRxQ== X-Gm-Message-State: AOAM533K4oVks8rZeHugA98OzwrqITgOUIGL9n83E+O3SaQrCp9ZUzF/ gG/avWpZ5/JlKY1SfwYNPMgzVRHfp7J7SQ== X-Google-Smtp-Source: ABdhPJxWA5GJsbQuPccB7v2fl36M+eDRDd2H+dZOUgKqYpuC2W08v9ecV5P8TQbH8fgK0HtCOFnEeQ== X-Received: by 2002:aca:ad57:: with SMTP id w84mr5736434oie.100.1614981113151; Fri, 05 Mar 2021 13:51:53 -0800 (PST) Received: from [192.168.125.11] (107-215-223-229.lightspeed.sntcca.sbcglobal.net. [107.215.223.229]) by smtp.gmail.com with ESMTPSA id w5sm762884oig.24.2021.03.05.13.51.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Mar 2021 13:51:18 -0800 (PST) From: Bakul Shah Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_1A14D4B5-C880-4E3F-96C9-76C625773820" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Date: Fri, 5 Mar 2021 13:51:09 -0800 In-Reply-To: To: John Cowan References: <20210304212459.GA6303@eureka.lemis.com> <20210304212917.GB6303@eureka.lemis.com> <20210304221250.GD6303@eureka.lemis.com> <20210305141348.DIpGG%steffen@sdaoden.eu> X-Mailer: Apple Mail (2.3654.60.0.2.21) Subject: Re: [TUHS] tabs vs spaces - entab, detab X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: TUHS main list Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --Apple-Mail=_1A14D4B5-C880-4E3F-96C9-76C625773820 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Mar 5, 2021, at 12:24 PM, John Cowan wrote: >=20 > On Fri, Mar 5, 2021 at 9:14 AM Steffen Nurpmeso > wrote:=20 > =20 > But, not important. A real change to my coding style came when > i looked around Plan9 source code, the pragmatism to simply not > use spaces in language constructs aka statements at all, for > example "if(a){" instead of "if(a) {" or "if (a) {", and let alone > "if (a)\nALIGN{\nALIGN" and whatever else. =20 >=20 > That way lies APL madness. To exemplify, Kona is an open-source = interpreter for Arthur Whitney's K version 3 language, which is closely = related to APL, but crams almost all of the APL operators onto single = ASCII characters with massive overloading. For example, monadic ! is = APL "iota", but dyadic ! is "modulo" if both arguments are numbers and = "rotate" if the right argument is a number and the left argument is a = vector. What any of these has to do with the rest is beyond me: I had = to create a set of flash cards to help me learn them all. Not sure what this has to do with tabs but note that APL itself did a = lot of punning in that unary and binary functions of the same name were = related. K does something similar but perhaps not as consistently.=20 > Well, here's a procedure definition from the Kona source, in a file = helpfully named kc.c (almost all of the source files have 1-2 character = names): People should perhaps look at Whitney's original C code[1] that started = all this (see below). I can no longer compile this but it is worth studying. This was the = genesis of both K & J languages. There is method to Whitney's madness = but it takes a while to grok his style. Given that he has produced 6 or = so versions of K, a specialized C compiler, as well as an OS prototype = (kOS), clearly it has worked extremely well for him! Whiney once = explained "It is a lot easier to find your errors in four lines of code = than in four hundred." [2] Though his style is not for most people! typedef char C;typedef long I; typedef struct a{I t,r,d[3],p[2];}*A; #define P printf #define R return #define V1(f) A f(w)A w; #define V2(f) A f(a,w)A a,w; #define DO(n,x) {I i=3D0,_n=3D(n);for(;i<_n;++i){x;}} I *ma(n){R(I*)malloc(n*4);}mv(d,s,n)I *d,*s;{DO(n,d[i]=3Ds[i]);} tr(r,d)I *d;{I z=3D1;DO(r,z=3Dz*d[i]);R z;} A ga(t,r,d)I *d;{A z=3D(A)ma(5+tr(r,d));z->t=3Dt,z->r=3Dr,mv(z->d,d,r); R z;} V1(iota){I n=3D*w->p;A z=3Dga(0,1,&n);DO(n,z->p[i]=3Di);R z;} V2(plus){I r=3Dw->r,*d=3Dw->d,n=3Dtr(r,d);A z=3Dga(0,r,d); DO(n,z->p[i]=3Da->p[i]+w->p[i]);R z;} V2(from){I r=3Dw->r-1,*d=3Dw->d+1,n=3Dtr(r,d); A z=3Dga(w->t,r,d);mv(z->p,w->p+(n**a->p),n);R z;} V1(box){A z=3Dga(1,0,0);*z->p=3D(I)w;R z;} V2(cat){I an=3Dtr(a->r,a->d),wn=3Dtr(w->r,w->d),n=3Dan+wn; A z=3Dga(w->t,1,&n);mv(z->p,a->p,an);mv(z->p+an,w->p,wn);R z;} V2(find){} V2(rsh){I r=3Da->r?*a->d:1,n=3Dtr(r,a->p),wn=3Dtr(w->r,w->d); A z=3Dga(w->t,r,a->p);mv(z->p,w->p,wn=3Dn>wn?wn:n); if(n-=3Dwn)mv(z->p+wn,z->p,n);R z;} V1(sha){A z=3Dga(0,1,&w->r);mv(z->p,w->d,w->r);R z;} V1(id){R w;}V1(size){A z=3Dga(0,0,0);*z->p=3Dw->r?*w->d:1;R z;} pi(i){P("%d ",i);}nl(){P("\n");} pr(w)A w;{I r=3Dw->r,*d=3Dw->d,n=3Dtr(r,d);DO(r,pi(d[i]));nl(); if(w->t)DO(n,P("< ");pr(w->p[i]))else DO(n,pi(w->p[i]));nl();} C vt[]=3D"+{~<#,"; A(*vd[])()=3D{0,plus,from,find,0,rsh,cat}, (*vm[])()=3D{0,id,size,iota,box,sha,0}; I st[26]; qp(a){R a>=3D'a'&&a<=3D'z';}qv(a){R a<'a';} A ex(e)I *e;{I a=3D*e; if(qp(a)){if(e[1]=3D=3D'=3D')R st[a-'a']=3Dex(e+2);a=3D st[ a-'a'];} R qv(a)?(*vm[a])(ex(e+1)):e[1]?(*vd[e[1]])(a,ex(e+2)):(A)a;} noun(c){A z;if(c<'0'||c>'9')R 0;z=3Dga(0,0,0);*z->p=3Dc-'0';R z;} verb(c){I i=3D0;for(;vt[i];)if(vt[i++]=3D=3Dc)R i;R 0;} I *wd(s)C *s;{I a,n=3Dstrlen(s),*e=3Dma(n+1);C c; DO(n,e[i]=3D(a=3Dnoun(c=3Ds[i]))?a:(a=3Dverb(c))?a:c);e[n]=3D0;R e;} main(){C s[99];while(gets(s))pr(ex(wd(s)));} [1] https://code.jsoftware.com/wiki/Essays/Incunabulum One summer weekend in 1989, Arthur Whitney visited Ken Iverson at Kiln = Farm and produced=E2=80=94on one page and in one afternoon=E2=80=94an = interpreter fragment on the AT&T 3B1 computer. I (Roger Hui) studied = this interpreter for about a week for its organization and programming = style; and on Sunday, August 27, 1989, at about four o'clock in the = afternoon, wrote the first line of code that became the implementation = described in this document. [2] http://archive.vector.org.uk/art10501320= --Apple-Mail=_1A14D4B5-C880-4E3F-96C9-76C625773820 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On = Mar 5, 2021, at 12:24 PM, John Cowan <cowan@ccil.org> wrote:

On Fri, Mar 5, 2021 at 9:14 AM Steffen = Nurpmeso <steffen@sdaoden.eu> wrote: 
 
But, not important.  A real = change to my coding style came when
i looked around Plan9 source code, the pragmatism to simply not
use spaces in language constructs aka statements at all, for
example "if(a){" instead of "if(a) {" or "if (a) {", and let alone
"if (a)\nALIGN{\nALIGN" and whatever else. 

That way lies APL madness.  To = exemplify, Kona is an open-source interpreter for Arthur Whitney's K = version 3 language, which is closely related to APL, but crams almost = all of the APL operators onto single ASCII characters with massive = overloading.  For example, monadic ! is APL "iota", but dyadic ! is = "modulo" if both arguments are numbers and "rotate" if the right = argument is a number and the left argument is a vector.  What any = of these has to do with the rest is beyond me: I had to create a set of = flash cards to help me learn them = all.

Not = sure what this has to do with tabs but note that APL itself did a lot of = punning in that unary and binary functions of the same name were = related. K does something similar but perhaps not as = consistently. 

Well, here's a = procedure definition from the Kona source, in a file helpfully named = kc.c (almost all of the source files have 1-2 character = names):

People should = perhaps look at Whitney's original C code[1] that started all this (see = below).

I can no longer compile this = but it is worth studying. This was the genesis of both K & J = languages. There is method to Whitney's madness but it takes a while to = grok his style. Given that he has produced 6 or so versions of K, a = specialized C compiler, as well as an OS prototype (kOS), clearly it has = worked extremely well for him! Whiney once explained "It is a lot easier = to find your errors in four lines of code than in four hundred." [2] = Though his style is not for most people!

typedef char C;typedef =
long I;
typedef struct a{I t,r,d[3],p[2];}*A;
#define P printf
#define R return
#define V1(f) A f(w)A w;
#define V2(f) A f(a,w)A a,w;
#define DO(n,x) {I i=3D0,_n=3D(n);for(;i<_n;++i){x;}}
I *ma(n){R(I*)malloc(n*4);}mv(d,s,n)I *d,*s;{DO(n,d[i]=3Ds[i]);}
tr(r,d)I *d;{I z=3D1;DO(r,z=3Dz*d[i]);R z;}
A ga(t,r,d)I *d;{A =
z=3D(A)ma(5+tr(r,d));z->t=3Dt,z->r=3Dr,mv(z->d,d,r);
 R z;}
V1(iota){I n=3D*w->p;A z=3Dga(0,1,&n);DO(n,z->p[i]=3Di);R z;}
V2(plus){I r=3Dw->r,*d=3Dw->d,n=3Dtr(r,d);A z=3Dga(0,r,d);
 DO(n,z->p[i]=3Da->p[i]+w->p[i]);R z;}
V2(from){I r=3Dw->r-1,*d=3Dw->d+1,n=3Dtr(r,d);
 A z=3Dga(w->t,r,d);mv(z->p,w->p+(n**a->p),n);R z;}
V1(box){A z=3Dga(1,0,0);*z->p=3D(I)w;R z;}
V2(cat){I an=3Dtr(a->r,a->d),wn=3Dtr(w->r,w->d),n=3Dan+wn;
 A =
z=3Dga(w->t,1,&n);mv(z->p,a->p,an);mv(z->p+an,w->p,wn);=
R z;}
V2(find){}
V2(rsh){I r=3Da->r?*a->d:1,n=3Dtr(r,a->p),wn=3Dtr(w->r,w->d=
);
 A z=3Dga(w->t,r,a->p);mv(z->p,w->p,wn=3Dn>wn?wn:n);
 if(n-=3Dwn)mv(z->p+wn,z->p,n);R z;}
V1(sha){A z=3Dga(0,1,&w->r);mv(z->p,w->d,w->r);R z;}
V1(id){R w;}V1(size){A z=3Dga(0,0,0);*z->p=3Dw->r?*w->d:1;R z;}
pi(i){P("%d ",i);}nl(){P("\n");}
pr(w)A w;{I r=3Dw->r,*d=3Dw->d,n=3Dtr(r,d);DO(r,pi(d[i]));nl();
 if(w->t)DO(n,P("< ");pr(w->p[i]))else =
DO(n,pi(w->p[i]));nl();}

C vt[]=3D"+{~<#,";
A(*vd[])()=3D{0,plus,from,find,0,rsh,cat},
 (*vm[])()=3D{0,id,size,iota,box,sha,0};
I st[26]; qp(a){R  a>=3D'a'&&a<=3D'z';}qv(a){R a<'a';}
A ex(e)I *e;{I a=3D*e;
 if(qp(a)){if(e[1]=3D=3D'=3D')R st[a-'a']=3Dex(e+2);a=3D st[ a-'a'];}
 R qv(a)?(*vm[a])(ex(e+1)):e[1]?(*vd[e[1]])(a,ex(e+2)):(A)a;}
noun(c){A z;if(c<'0'||c>'9')R 0;z=3Dga(0,0,0);*z->p=3Dc-'0';R =
z;}
verb(c){I i=3D0;for(;vt[i];)if(vt[i++]=3D=3Dc)R i;R 0;}
I *wd(s)C *s;{I a,n=3Dstrlen(s),*e=3Dma(n+1);C c;
 DO(n,e[i]=3D(a=3Dnoun(c=3Ds[i]))?a:(a=3Dverb(c))?a:c);e[n]=3D0;R e;}

main(){C s[99];while(gets(s))pr(ex(wd(s)));}
[1] https://code.jsoftware.com/wiki/Essays/Incunabulum
One summer weekend in 1989, Arthur Whitney visited Ken = Iverson at Kiln Farm and produced=E2=80=94on one page and in one = afternoon=E2=80=94an interpreter fragment on the AT&T 3B1 computer. = I (Roger Hui) studied this interpreter for about a week for its = organization and programming style; and on Sunday, August 27, 1989, at = about four o'clock in the afternoon, wrote the first line of code that = became the implementation described in this document.

= --Apple-Mail=_1A14D4B5-C880-4E3F-96C9-76C625773820--