Raul, What is the meaning of 12761 ? I thought it was the number of words in the constitution
require'csv web/gethttp' const=: gethttp 'http://usconstitution.net/const.txt' words=: [: ;: ' '"_`(I.@:= toupper)`]}~@tolower ]A=:'Sea a Seahorse." "Where?" "The Seashore!' Sea a Seahorse." "Where?" "The Seashore! words A ┌───┬─┬────────┬─────┬───┬────────┐ │sea│a│seahorse│where│the│seashore│ └───┴─┴────────┴─────┴───┴────────┘ {.$>words A 6 {.$>words const 7577 Isn't this the number pf words? Linda -----Original Message----- From: Programming [mailto:[email protected]] On Behalf Of Linda A Alvord Sent: Friday, February 5, 2016 4:43 AM To: [email protected] Subject: [Jprogramming] QRE: k programming challenge Thanks Dan, I moved a lot and when I got to FL in 6th grade, students had heard pf gerunds and I hadn't. I don't know when the show up these days. However, I like 13 ;'s the best but a 3 : is at least a verb. 5!:4 cope's well with gerunds but doesn't like 3 :'s My underlying choices are based on using J as a "way to get a job done. However teaching is nothing more than a series of choices. So so far up to JTECH (A fantasy school) parallels US education and at the moment that is Grade 4. So, counting the words of the constituation is great! Maybe, they'll read a little of it. But they are learning about larger and larger numbers so this is a nice example. I have avoided functions with more than one line and they ought to be in some parallel "computer science" cours where they learns how code is making things happen. I'm not sure what languages belong in that environment. I am firmly commited to J being in the mathematics classroom. Linda -----Original Message----- From: Programming [mailto:[email protected]] On Behalf Of Dan Bron Sent: Thursday, February 4, 2016 3:05 PM To: J Programming Subject: Re: [Jprogramming] k programming challenge Linda wrote: > words3=: 13 : ';:'' ''(([: I. tolower = toupper) y)}tolower y' Please note: words3=: 13 : ';:'' ''(([: I. tolower = toupper) y)}tolower y’ words3 3 : ';:'' ''(([: I. tolower = toupper) y)}tolower y' That is, 13 : is incapable of converting the verb, as you have expressed it, to tacit form. Therefore the 13 : itself is superfluous, and it would be more direct and straightforward to simply define words3 using 3 : (not 13 : ) in the first place: words3E =: 3 : ';:'' ''(([: I. tolower = toupper) y)}tolower y’ -:/ 5!:1 ;: 'words3 words3E’ NB. Identical representations 1 And, since we’re simply and directly defining an explicit verb, we might as well take advantage of all the other features explicit definitions offer us: words3Elp =: verb define lowerY =. tolower y nonLettersIdx =. I. (toupper y) = lowerY ;: ' ' nonLettersIdx } lowerY ) Clear, readable, and only a single calculation of tolower y . Of course, it has none of the advantages of Raul’s original formulation, but that loss happened when you “eliminate[d] At, Atop, Gerund and Rank”. So, since that's a sunk cost, we might as well run with it, and get as much back for it as we can. Hope that’s what’s you meant when you said “maybe you can simplify it”. -Dan ---------------------------------------------------------------------- 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
