p=:13 : '((%&2)^:x)y' ,.(i.5) p 13
13 6.5 3.25 1.625 0.8125 However, if you want to duplicate the behavior of %&2 you need: p =: 3 : 0 1 p y : ((%&2)^:x)y ) ,.(i.5) p 13 13 6.5 3.25 1.625 0.8125 p 13 6.5 p p 13 3.25 On Sun, May 5, 2013 at 4:48 AM, Linda Alvord <lindaalv...@verizon.net>wrote: > d=:%&2 > d > %&2 > d 13 > 6.5 > d d 13 > 3.25 > d d d 13 > 1.625 > 3 d 13 > 1.625 > ,.(i.25) d 13 > 13 > 6.5 > 3.25 > 1.625 > 0.8125 > 0.40625 > 0.203125 > 0.101563 > 0.0507813 > 0.0253906 > 0.0126953 > 0.00634766 > 0.00317383 > 0.00158691 > 0.000793457 > 0.000396729 > 0.000198364 > 9.91821e_5 > 4.95911e_5 > 2.47955e_5 > 1.23978e_5 > 6.19888e_6 > 3.09944e_6 > 1.54972e_6 > 7.7486e_7 > d > %&2 > NB. x u&n y ↔ u&n^:x y > > That part is good. > > How can you get from there to the power rule? > > NB. x u^:n y ↔ x&u^:n y > > Linda > > -----Original Message----- > From: programming-boun...@forums.jsoftware.com [mailto:programming- > boun...@forums.jsoftware.com] On Behalf Of Dan Bron > Sent: Saturday, May 04, 2013 10:14 AM > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Transcomputational numbers > > TL;DR: Simply deleting words will never work. Removing an offending word > without compensating for its function will break code. To remove an > offending word, one must compensate by using other words which express the > same meaning. > > Linda wrote: > > I feel quite confident about removing @: carefully. > > Viewmat had 5 uses of @: > > I simplifies the sentence to a simpler version. > > > viewmat @: ([ load @:('viewmat'"_)) @: ((Josephus2 % <:@])"0/~) @: >: > @:i. 32 > > viewmat ([ [: load 'viewmat'"_) ((Josephus2 % [:<: ])"0/~) >: > i. 32 > > Let us put aside stylistic questions, and allow that disliking conjunctions > is as valid as any other preference. In pursuit of that preference, what I > want to focus on is what it means to remove @: (or anything else) > /carefully/. > > In particular, I want to highlight that _all words have a meaning_. And > that when people put a word in a sentence, they do it for a reason. Use of > conjunctions is not random, nor arbitrary, nor are conjunctions used just > for decoration. Everywhere they're used, they have a function and a > purpose. > And if you want to remove them, that's ok, but you must do so with > consideration for that purpose. In particular, /simply deleting words will > not work/. If you remove a conjunction, you must make some alteration, > some substitution, which reproduces its function. > > Let's take some examples from your reformulation of the viewmat verb. You > took <:@], deleted the @, and _reproduced its function_ using [: . That's > fine. And again, you took load @:('viewmat'"_), removed the @:, and > _reproduced its function_ using [: . Great! > > But then you took >:@:i., deleted the @:, and ... did nothing. And again > with ((Josephus2 ...)"0/~)@>: you deleted the @ but did not compensate for > the deletion. And again with viewmat@:... you deleted the @: but did > nothing to reproduce its function. > > Where does that leave us? Well, similar to the earlier comparison between > ^.&1e93 and ^.1e93, you've taken a re-usable verb and created a one-time > noun. Check out what happens if we try to re-use your version: > > original =: viewmat @: ([ load @:('viewmat'"_)) @: ((Josephus2 % > <:@])"0/~) @: >: @:i. > linda =: viewmat ([ [: load 'viewmat'"_) ((Josephus2 % [:<: > ])"0/~) >: i. > > original 32 NB. Colorful chart > original 16 NB. Colorful chart > > linda 32 NB. Blank > linda 16 NB. Blank > > So, in deleting the conjunctions, without compensating for their intended > purpose, you haven't "simplified" the code - you've broken it. > > Let's approach this from a different angle. In deleting the three @s where > you didn't reproduce their functionality with a [:, you were saying those > three @s were simply unnecessary. You were asserting that these words > served no purpose, and should be deleted as superfluous. In effect, you > were saying that when Pepe put them there, he didn't know what he was > doing! > > > Do you really feel confident in that kind of assertion? Or how about this: > when you deleted those @s, you replaced them with a space. Which means you > thought space (juxtaposition) could perform the same function as @ . And > when you deleted & earlier in this thread, you though space could carry its > function, too. And similarly for &. and @: and ` etc. In effect, you were > saying these words are unnecessary, that space (juxtaposition) can do for > them all, and when Ken introduced them into the language, /he/ didn't know > what he was doing. > > Now, I don't believe that you're thinking "Pepe was wrong, Ken was wrong" > when you're making these transformations. I'm just highlighting that that > kind of arrogance is an implication of deleting words without compensating > alterations, as a kind of reductio ad absurdium. What I'm trying to > instill in you is the tenet that /simply deleting words will never work/. > And worse than "not work", deleting words will /break code/. > > The words we use, we use for a reason. We're trying to convey meaning. > Removing words from expressions - whether English or J - changes the > meaning! If you don't like certain types of words, that's fine - everyone > has his own style. But when you come across a word you don't like, rather > than simply "let's get rid of that!", I want you your first reaction to be > "ok, I want to remove that word; how can I express it differently?". Or > "how can I /replace/ this word I don't like with /other words that mean the > same thing/?", or, in a more formal, J sense: "if I delete a conjunction, > how can I reproduce its functionality?". > > The hitch with that is, the only way to make such changes with confidence > is to learn what the words @ @: & &: &. &.: ` etc _really mean_. You can't > express them a different way if you're not sure what they mean in the first > place. > > -Dan > > PS: A good exercise for you might be to make another attempt at creating a > verb equivalent to Pepe's original viewmat function, but without using @ . > The operative word there is /equivalent/. It must produce the same results > under all conditions, not just a test case or two. You're actually pretty > close already, and if you just consistently follow your original pattern of > removing @s and compensating with [:s, you'll get there. > > > > ---------------------------------------------------------------------- > 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