Remove the extra parens in a comparison between ;: 5!:5 <'f' and ;: 5!:6 <'f'
----- Original Message ----- From: Oleg Kobchenko <[EMAIL PROTECTED]> Date: Wednesday, July 30, 2008 13:25 Subject: Re: [Jgeneral] tracing tacit definition execution To: General forum <[email protected]> > I've been thinking about the paren representation too. > > If it were possible to remove the parens yet leaving its > map brackes, it would provide even better combination of > structure and clarity. Here it is illustrated manually. > I don't yet have an idea how it could be automated. > > Here I use "fetch" from S: as an example. > > map > 5!:5<'fetch' NB. linear map > >@({&>/)@(<"0@|[EMAIL PROTECTED] , <@])"1 _ > └────┘ └──────────────┘ > > map > 5!:6<'fetch' NB. paren map with paren removed > >@({&>/)@(<"0@|[EMAIL PROTECTED] , <@])"1 _ > > └─┘ > └─┘ > └────┘ > └────┘ └──────┘ └─┘ > └──────┘ └──────────────┘ > └───────────────────────┘ > NB. original paren map > map 5!:6<'fetch' > ((>@(({&>)/))@((((<"0)@|.)@[) , (<@])))"1 _ > └───┘ > └───┘ > └────────┘ > └──────┘ > └────────────┘ └───┘ > └──────────┘ > └──────────────────────┘ > └─────────────────────────────────────┘ > > > Also map can be applied to explicit definitions: > > ;<@map;._2,&LF 5!:5<'map' > 3 : > 0 > (9!:6 '') map > y > └───────┘ > : > b=. (i.->./t) </ t=. +/\ (=/\''''~:y) * 1 _1 0 {~ '()' i. y > > └───────┘ └──────────┘ > y , (2 #.\"(1) 0,.b) { ' ',6 8 > 10{x > > └─┘ > > └──────────────┘ > ) > > > > > From: Roger Hui <[EMAIL PROTECTED]> > > > > map=: 3 : 0 > > (9!:6 '') map y > > : > > b=. (i.->./t) > y , (2 #.\"(1) 0,.b) { ' ',6 8 10{x > > ) > > > > f=: [: (#~ (0 ~: 1&{"1))@; <@(0&{ ,. 1&{ ([EMAIL PROTECTED] ,. (] +//. > ["0) ,. [ * [EMAIL PROTECTED]) > > 2&}.)"1 > > > > map 5!:5 <'f' > > [: (#~ (0 ~: 1&{"1))@; <@(0&{ ,. 1&{ ([EMAIL PROTECTED] ,. (] +//. ["0) > ,. [ * [EMAIL PROTECTED]) 2&}.)"1 > > └──────────┘ > > > > > └──────────┘ └───────────────────────────────┘ > > └───────────────┘ > └─────────────────────────────────────────────────┘ > > > > map ' ~:/\ @ (''())))'' = ])' > > ~:/\ @ ('())))' = ]) > > └───────────┘ > > > > map 5!:5 <'assert' > > 0 0"_ $ 13!:8^:((0: e. ])`(12"_)) > > └───────┘ └────┘ > > └────────────────┘ > > map 5!:6 <'assert' > > (0 0"_) $ ((13!:8)^:(((0:) e. ])`(12"_))) > > └──┘ > > └─────────┘ └────┘ > > └─────┘ └──────────────────┘ > > └─────┘ └─────────────────────────────┘ > > > > > > > > ----- Original Message ----- > > From: Raul Miller > > Date: Wednesday, July 30, 2008 9:32 > > Subject: Re: [Jgeneral] tracing tacit definition execution > > To: General forum > > > > > On 7/30/08, Roger Hui wrote: > > > > map=: 3 : 0 > > > > (9!:6 '') map y > > > > : > > > > b=. (i.->./t) > > > y , (2 #.\"(1) 0,.b) { ' > ',6 8 10{x > > > > ) > > > > > > This is very nice, however: > > > map 'b=. (i.->./t) > > b=. (i.->./t) > > > > > > > └───────┘ └┘ > > > > > > And parenthesis within quotes can be unbalanced and > > > can appear between balanced parenthesis. > > > > > > Quoted parenthesis could be eliminated by replacing '()' i. with > > > something like ('()'&i. >. 2 * ~:/\@:=&'''') ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
