If you cannot find the right reference material, then just post questions here.
We have a "J for C Programmers" book, but we do not have a "J for K Programmers". And in some ways, J is more complicated to use than K. (K tends to be simpler for 1 dimensional data and for tree structures.) -- Raul On Fri, Nov 18, 2011 at 4:40 PM, Alexander Epifanov <[email protected]>wrote: > Thank you very much, I helped a lot. > I do not use spaces in K also. > > I just suppose that Learning J is not the best book for me. I go to > vocabulary and every example for every verb is too complicated. > > Regards, > > On Fri, Nov 18, 2011 at 5:18 PM, Kip Murray <[email protected]> wrote: > > Verb 5!:2 can help by boxing the parts of verb cut: > > > > cut > > ' '&$: :([: -.&a: <;._2@,~) > > > > 5!:2 <'cut' > > +--------+-+----------------------------------+ > > |+-+-+--+|:|+--+---------+-------------------+| > > || |&|$:|| ||[:|+--+-+--+|+---------------+-+|| > > |+-+-+--+| || ||-.|&|++|||+---------+-+-+|~||| > > | | || || | |||||||+-+--+--+|@|,|| ||| > > | | || || | |++|||||<|;.|_2|| | || ||| > > | | || |+--+-+--+|||+-+--+--+| | || ||| > > | | || | ||+---------+-+-+| ||| > > | | || | |+---------------+-+|| > > | | |+--+---------+-------------------+| > > +--------+-+----------------------------------+ > > > > Now we see the middle colon separates a left and right part and we > > insert a space: > > > > ' '&$: : ([: -.&a: <;._2@,~) > > > > An isolated colon : separates the monadic and dyadic cases of a verb. > > The part to the left of the colon tells us that when cut is called > > monadically (right argument only), cut calls itself with an added left > > argument of ' ' . > > > > You need to define g without the : > > > > g =: ([: -.&a:<;._2@,~) > > > > Then > > > > '.' g '192.168.1.1' > > ┌───┬───┬─┬─┐ > > │192│168│1│1│ > > └───┴───┴─┴─┘ > > > > The dyadic call to cut is the same as a call to g . > > > > > > The Vocabulary page > > > > http://www.jsoftware.com/docs/help701/dictionary/vocabul.htm > > > > has information about conjunctions Monad-Dyad : and Cut ;. (notice > > conjunction Cut ;. appears in the definition of verb cut). > > > > For information about 5!:2 , click on !: at the top of the Vocabulary > page. > > > > > > I have to admit conjunctions are hard for beginners, and verbs that have > > both monadic and dyadic calls are hard for visitors from K. I apologize > > on behalf of the J community for our habit of omitting needless spaces. > > Just one space might have helped you understand sooner! > > > > > > On 11/18/2011 3:07 AM, Alexander Epifanov wrote: > >> Hello, > >> > >> Its the third time I am trying to move from K to J without success. > >> Stopped and the 8th chapter of "Learning J", because its the half of > >> the book, but I cannot read and understand other programs, also cannot > >> write simple program. > >> > >> Let me provide an example. on K I split IP-string: 1_'(0,&"."=" ",s)_ > >> " ",s:"192.168.1.1" > >> I was trying to rewrite it on J, but I did not find _ (cut) or > >> something like that, which splits list by indexes. > >> > >> I found another cut in J, so the solution is '.'cut'192.168.1.1', but > >> I have to understand it. > >> cut > >> ''&$: :([: -.&a:<;._2@,~) > >> > >> Do I understand correct that function makes train of verbs without > >> round brackets? > >> So its (f g) where f =: ' '&$: and g =: :([: -.&a:<;._2@,~) > >> But it does not work: > >> g '192.168.1.1' > >> |syntax error > >> > >> Why, how to read J expression? In K I just cut expression from let and > >> see all imtermediate results, in J it does not work. > >> Also, I cannot find anonymous function {} in K, but if I understand > >> correct in J it is prefferable to compose verbs. > >> > >> Thank you. > >> > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > -- > Regards, > Alexander. > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
