in terms of advice for improving with trains, there is the general try to target a fork. (every hook can be stated as a fork instead just a bit longer).
and in the case of your example, 13 : 'x # x #"1 y' could be written directly as : [ # [ #"1 ] and then realizing that this is the same as: [ # #"1 it would also be the same as: ([[6:) # ([[6:) #"1 6 ] ] Being more comfortable with the structural equivalences and especially the 2 easiest verbs in J ( [ and ]) can help you convert anything to a fork, and extra [] allows partial monadic applications in a dyadic fork context. ----- Original Message ----- From: Ben Gorte - CITG <[email protected]> To: "[email protected]" <[email protected]> Cc: Sent: Thursday, July 17, 2014 6:05:48 AM Subject: Re: [Jprogramming] a zoom function (doubling points accross rows and columns) Incidentally, in my private standard library I had blowup 4 : 'x # x #"1 y' which is easy to grasp I think. Of course I can go like: 13 : 'x # x #"1 y' [ # #"1 but I would never have gotten this idea without using 13: I only can derive it from x (f g h) y == (x f y) g (h f y), so: x ([ # #"1) y == (x[y) # (x#"1 y) == x # x #"1 y Well, yeah. I'm always wondering how worthwile it is to spend time (and how much?) to become a more fluent tacit J-speaker. Some advice? Meanwhile I was also looking at generating the input pattern: #. inv dfh &> ' 'cut 'FF 81 BD A5 A5 BD 81 FF' How about 2 | the Manhattan distance from the center: pat =: 3 : '2|<. >./"1 | (-:<:y)-~ >{;~i.y' ? Now I can say: 3 blowup pat 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 (but it's not tacit) Ben ________________________________________ From: [email protected] [[email protected]] on behalf of Raul Miller [[email protected]] Sent: Thursday, July 17, 2014 00:38 To: Programming forum Subject: Re: [Jprogramming] a zoom function (doubling points accross rows and columns) Yes, I got as far as 2#2#"1#: dfh;.1 ' FF 81 BD A5 A5 BD 81 FF' 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 when I saw your spoiler. Oh well... :) Thanks, -- Raul On Wed, Jul 16, 2014 at 6:32 PM, 'Pascal Jasmin' via Programming <[email protected]> wrote: > spoiling quiz with answer already, neat short fork. > > zoom =: [ # #"1 > > > ----- Original Message ----- > From: 'Pascal Jasmin' via Programming <[email protected]> > To: Programming forum <[email protected]> > Cc: > Sent: Wednesday, July 16, 2014 6:08:28 PM > Subject: [Jprogramming] a zoom function (doubling points accross rows and > columns) > > there are too many ways to write this function, and there is probably a way > that is better than what I could think of. > > #. inv dfh &> ' 'cut 'FF 81 BD A5 A5 BD 81 FF' > 1 1 1 1 1 1 1 1 > 1 0 0 0 0 0 0 1 > 1 0 1 1 1 1 0 1 > 1 0 1 0 0 1 0 1 > 1 0 1 0 0 1 0 1 > 1 0 1 1 1 1 0 1 > 1 0 0 0 0 0 0 1 > 1 1 1 1 1 1 1 1 > > zoom =: ([ * ({.,{:)@:$@:]) $ [:, ([, [ * {:@:$@:]) $"1 #"1 > > 2 zoom #. inv dfh &> ' 'cut 'FF 81 BD A5 A5 BD 81 FF' > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 > 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 > 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 > 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 > 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 > 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 > 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 > 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 > 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 > 1 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 > 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 > 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 > > for every cell in original, a 2x2 copy of that cell is made. > ---------------------------------------------------------------------- > 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
