Perhaps more pleasant, (the_square_root=. %:) of ((the_sum=.+/)) (of=.@:) (the_squares=. *:) %:@:(+/)@:*:
the_square_root of the_sum of the_squares 3 4 5 On Tue, Feb 17, 2015 at 10:06 AM, Jose Mario Quintana < [email protected]> wrote: > > ([: %: [: +/ *:)decap NB. :) > %:@:(+/@:*:) > > (squareroot=. %:) of ((sum=.+/)) (of=. @:) (squares=. *:) > %:@:(+/)@:*: > > squareroot of sum of squares 1 2 3 > 3.74165739 > > > On Sun, Feb 15, 2015 at 5:56 PM, Kip Murray <[email protected]> > wrote: > >> I regard cap as a brilliant invention, analagous to the invention of zero. >> "Does nothing" cap is analagous to "Adds nothing" zero. It may help you >> to read cap in trains as "the ... of ...", eg >> >> [: %: [: +/ *: >> >> is the square root of the sum of squares. >> >> --Kip Murray >> >> On Sunday, February 15, 2015, Jose Mario Quintana < >> [email protected]> wrote: >> >> > I enjoy decapitating capped forks in a flash using one of my favorite >> > wicked adverbs (decap), >> > >> > ( NoProblem=. see f.decap ) >> > i.@:[ +/ i.@:(#~) >> > >> > 3 NoProblem 2 >> > 0 1 2 >> > 3 4 5 >> > 6 7 8 >> > >> > 1 2 3 >> > 4 5 6 >> > 7 8 9 >> > >> > 2 3 4 >> > 5 6 7 >> > 8 9 10 >> > >> > Decap replaces the form ([: u v) by (u@:v). If for whatever reason one >> > wants to avoid @: in favor of @ (and ") then the form (u@:v) could >> always >> > be replaced by (u@v”_), >> > >> > 3 (i.@["_ +/ i.@(#~)"_) 2 >> > 0 1 2 >> > 3 4 5 >> > 6 7 8 >> > >> > 1 2 3 >> > 4 5 6 >> > 7 8 9 >> > >> > 2 3 4 >> > 5 6 7 >> > 8 9 10 >> > >> > Sometimes one can get away by simply replacing @: by @, >> > >> > 3 (i.@[ +/ i.@(#~) ) 2 >> > 0 1 2 >> > 3 4 5 >> > 6 7 8 >> > >> > 1 2 3 >> > 4 5 6 >> > 7 8 9 >> > >> > 2 3 4 >> > 5 6 7 >> > 8 9 10 >> > >> > By the way, when the meaning of an expression is undefined; for example, >> > in, >> > >> > `/ >> > |syntax error >> > | `/ >> > >> > An enlighten person could modify the official interpreted and assign a >> new, >> > or an ancient, meaning to that form (the conjunction adverb form in the >> > example above) extending the current J language. However, in your >> > sentence: >> > >> > [:>:i.4 >> > |domain error >> > | [:>:i.4 >> > >> > that is not the case. So, either the monadic definition of [: would >> have >> > to changed (and most likely someone's existing code would brake) or our >> > beloved sophisticated simple parsing rules would have to be alter (and >> the >> > sky would fall). >> > >> > Thus, "If the hill will not come to Mahomet, Mahomet will go to the >> hill" >> > comes to mind. >> > >> > >> > >> > >> > On Fri, Feb 13, 2015 at 5:17 PM, Linda Alvord <[email protected] >> > <javascript:;>> >> > wrote: >> > >> > > Brian, I like 9!: combinaions. Is it true that you can always remove >> [: >> > > from >> > > a tacit monadic function? >> > > >> > > Also, it doesn't seem to be possible to remove all of them from a >> dyadic >> > > verb. Here's some examples from code run in a terminal: >> > > >> > > 9!:3]5 >> > > see=: 13 :'(i.x)+/i.y#x' >> > > 3 see 2 >> > > 0 1 2 >> > > 3 4 5 >> > > 6 7 8 >> > > >> > > 1 2 3 >> > > 4 5 6 >> > > 7 8 9 >> > > >> > > 2 3 4 >> > > 5 6 7 >> > > 8 9 10 >> > > see >> > > ([: i. [) +/ [: i. #~ >> > > 9!:3]5 >> > > cbB=: 13 :'<"0@>:@i.y' >> > > pairs=: 13 :'(>:@i. x),"0/>:@i. y' >> > > countB =: <@cb"1@pairs >> > > >> > > cbB >> > > <"0@>:@i. >> > > pairs >> > > ([: >:@i. [) ,"0/ [: >:@i. ] >> > > countB >> > > <@cb"1@pairs >> > > >> > > Linda >> > > >> > > >> > > -----Original Message----- >> > > From: [email protected] <javascript:;> >> > > [mailto:[email protected] <javascript:;>] On >> > Behalf Of Brian >> > > Schott >> > > Sent: Friday, February 13, 2015 2:34 PM >> > > To: Programming forum >> > > Subject: Re: [Jprogramming] Source of frustration >> > > >> > > Raul, >> > > >> > > Yes, thanks. >> > > >> > > On Fri, Feb 13, 2015 at 10:06 AM, Raul Miller <[email protected] >> > <javascript:;>> >> > > wrote: >> > > >> > > > I think you mean "tree representation" where you wrote "linear >> > > > representation". >> > > > >> > > > -- >> > > (B=) >> > > ---------------------------------------------------------------------- >> > > For information about J forums see >> http://www.jsoftware.com/forums.htm >> > > >> > > ---------------------------------------------------------------------- >> > > For information about J forums see >> http://www.jsoftware.com/forums.htm >> > > >> > ---------------------------------------------------------------------- >> > For information about J forums see http://www.jsoftware.com/forums.htm >> >> >> >> -- >> Sent from Gmail Mobile >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
