Actually I am only trying to show all the facts that a student in Grade 2 should understand and ultimately learn.
I hope that a chart that shows all that they need to know will make the task of learning the facts less daunting. I'm only getting to develop multiplication and division in Grade 3. I don't even know when they will see a negative number. Maybe the temperatures will make them a little sooner than expected. Linda -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Raul Miller Sent: Sunday, January 4, 2015 4:24 PM To: Programming forum Subject: Re: [Jprogramming] During lulls in the games can you simplify this code? Like this? negatives=:adverb define : ~.(#~ 0&>),x u/ y ) (1+i.20) -negatives 1+i.10 _1 _2 _3 _4 _5 _6 _7 _8 _9 Seems like overkill, for this task, since the the point of this exercise is, I expect, building the groundwork for introducing negative numbers. -- Raul On Sun, Jan 4, 2015 at 2:54 PM, robert therriault <[email protected]> wrote: > Linda, > > What are these games you speak of? (just kidding, Go 'Hawks - oh yeah > that's next week) > > After a long and circuitous route that I won't go into, and with the > benefit of Raul and Pascal's responses, I came up with this: > > postable=:1 : (':'; '(((#~LF-.@e.])5!:5<''u'');,.y),.({.;}.)(#~ > -.@(+./\@(''_''=])))"1@":x,y u/x')~ > (i.21)- postable i.11 > ┌──┬─────────────────────────────────┐ > │- │ 0 1 2 3 4 5 6 7 8 9 10│ > ├──┼─────────────────────────────────┤ > │ 0│ 0 │ > │ 1│ 1 0 │ > │ 2│ 2 1 0 │ > │ 3│ 3 2 1 0 │ > │ 4│ 4 3 2 1 0 │ > │ 5│ 5 4 3 2 1 0 │ > │ 6│ 6 5 4 3 2 1 0 │ > │ 7│ 7 6 5 4 3 2 1 0 │ > │ 8│ 8 7 6 5 4 3 2 1 0 │ > │ 9│ 9 8 7 6 5 4 3 2 1 0 │ > │10│10 9 8 7 6 5 4 3 2 1 0│ > │11│11 10 9 8 7 6 5 4 3 2 1│ > │12│12 11 10 9 8 7 6 5 4 3 2│ > │13│13 12 11 10 9 8 7 6 5 4 3│ > │14│14 13 12 11 10 9 8 7 6 5 4│ > │15│15 14 13 12 11 10 9 8 7 6 5│ > │16│16 15 14 13 12 11 10 9 8 7 6│ > │17│17 16 15 14 13 12 11 10 9 8 7│ > │18│18 17 16 15 14 13 12 11 10 9 8│ > │19│19 18 17 16 15 14 13 12 11 10 9│ > │20│20 19 18 17 16 15 14 13 12 11 10│ > └──┴─────────────────────────────────┘ > table > 1 : (':'; '(((#~LF-.@e.])5!:5<''u'');,.y),.({.;}.)":x,y u/x')~ > (i.21)- table i.11 > ┌──┬─────────────────────────────────┐ > │- │ 0 1 2 3 4 5 6 7 8 9 10│ > ├──┼─────────────────────────────────┤ > │ 0│ 0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _10│ │ 1│ 1 0 _1 _2 _3 _4 _5 _6 _7 > _8 _9│ │ 2│ 2 1 0 _1 _2 _3 _4 _5 _6 _7 _8│ │ 3│ 3 2 1 0 _1 _2 > _3 _4 _5 _6 _7│ │ 4│ 4 3 2 1 0 _1 _2 _3 _4 _5 _6│ │ 5│ 5 4 3 > 2 1 0 _1 _2 _3 _4 _5│ │ 6│ 6 5 4 3 2 1 0 _1 _2 _3 _4│ │ 7│ 7 > 6 5 4 3 2 1 0 _1 _2 _3│ │ 8│ 8 7 6 5 4 3 2 1 0 _1 _2│ > │ 9│ 9 8 7 6 5 4 3 2 1 0 _1│ > │10│10 9 8 7 6 5 4 3 2 1 0│ > │11│11 10 9 8 7 6 5 4 3 2 1│ > │12│12 11 10 9 8 7 6 5 4 3 2│ > │13│13 12 11 10 9 8 7 6 5 4 3│ > │14│14 13 12 11 10 9 8 7 6 5 4│ > │15│15 14 13 12 11 10 9 8 7 6 5│ > │16│16 15 14 13 12 11 10 9 8 7 6│ > │17│17 16 15 14 13 12 11 10 9 8 7│ > │18│18 17 16 15 14 13 12 11 10 9 8│ > │19│19 18 17 16 15 14 13 12 11 10 9│ > │20│20 19 18 17 16 15 14 13 12 11 10│ > └──┴─────────────────────────────────┘ > > postable differs from table in one significant way. After the results > of the table have been formatted, it uses (#~ -.@(+./\@(''_''=])))"1 > to clean them (double quotes needed around '_' because it is sitting > inside of an adverb declaration string). What this fragment does is to > look for instances of '_' in each line and then replaces the rest of > the line with blanks. This works as long as the negative values are > contiguous - I am still looking at the general case of cherry picking > negative values where ever they exist. If I get a way to do that I'll > post, although my guess is that others will probably solve it first. > > Cheers, bob > > > On Jan 4, 2015, at 10:10 AM, 'Pascal Jasmin' via Programming < > [email protected]> wrote: > > > elegance to me is having a one line version so as to avoid running > multiple lines in order. > > > > the first chart is easy > > > > + table i.11 > > > > the basis for the second one is also pretty easy > > > > - table i.10 > > > > though you want to clean it of negative values > > > > ([: _:^:(0 > ])"0 -/~) i.10 > > > > > > 0 _ _ _ _ _ _ _ _ _ > > 1 0 _ _ _ _ _ _ _ _ > > 2 1 0 _ _ _ _ _ _ _ > > 3 2 1 0 _ _ _ _ _ _ > > 4 3 2 1 0 _ _ _ _ _ > > 5 4 3 2 1 0 _ _ _ _ > > 6 5 4 3 2 1 0 _ _ _ > > 7 6 5 4 3 2 1 0 _ _ > > 8 7 6 5 4 3 2 1 0 _ > > 9 8 7 6 5 4 3 2 1 0 > > > > to get the formatting, this is actually a small change to the table > adverb, though looks scary > > > > table2 =: 1 : ('(((#~LF-.@e.])5!:5<''u'');,.y),.({.;}.)":y, u > > y';':'; > '(((#~LF-.@e.])5!:5<''u'');,.y),.({.;}.)":x,y u x') > > > > ([: _:^:(0 > ])"0 -/~) table2 i.10 > > ┌────────────────────┬───────────────────┐ > > │[: _:^:(0 > ])"0 -/~│0 1 2 3 4 5 6 7 8 9│ > > ├────────────────────┼───────────────────┤ > > │0 │0 _ _ _ _ _ _ _ _ _│ > > │1 │1 0 _ _ _ _ _ _ _ _│ > > │2 │2 1 0 _ _ _ _ _ _ _│ > > │3 │3 2 1 0 _ _ _ _ _ _│ > > │4 │4 3 2 1 0 _ _ _ _ _│ > > │5 │5 4 3 2 1 0 _ _ _ _│ > > │6 │6 5 4 3 2 1 0 _ _ _│ > > │7 │7 6 5 4 3 2 1 0 _ _│ > > │8 │8 7 6 5 4 3 2 1 0 _│ > > │9 │9 8 7 6 5 4 3 2 1 0│ > > └────────────────────┴───────────────────┘ > > > > can be called dyadically too: > > > > (i.10) ([: _:^:(0 > ])"0 -/~) table2 4 + i.10 > > > > ________________________________ > > From: Linda Alvord <[email protected]> > > To: [email protected] > > Sent: Sunday, January 4, 2015 11:34 AM > > Subject: [Jprogramming] During lulls in the games can you simplify > > this > code? > > > > > > In the beginning of J TECH Grade 3, I am summarizing the facts that > students > > should have learned in Grade 2 at the outset. > > > > > > > > Addition and Subtraction are a pair of inverse functions. Students > learned > > addition facts for numbers 0 to 10. The sums range from 0 to 20. > > > > > > > > Thus the inverse must include the numbers from 0 - 20 divided by 1 to 10. > > You can't divide by 0. Students haven't met negative numbers. > > > > > > > > So here's the charts I want. Do you know any ways I could do this > > more simply or elegantly? > > > > > > > > A=:":((i.20)>:/i.10)*(i.20)-/i.10 > > > > B=:(|._3*i.10),10$0 > > > > C=:B|.!.' '"0 1 A > > > > D=:(-B)|.!.' '"0 1 C > > > > TOP=: (<' - '),<}.,' ' ,"1":,.>:i.10 > > > > BOT=:(<,.>:i.20),<D > > > > ]PLUS=:+table i.11 > > > > ---T--------------------------------┐ > > │+ │ 0 1 2 3 4 5 6 7 8 9 10│ > > +--+--------------------------------+ > > │ 0│ 0 1 2 3 4 5 6 7 8 9 10│ │ 1│ 1 2 3 4 5 6 7 8 9 > > 10 11│ │ 2│ 2 3 4 5 6 7 8 9 10 11 12│ │ 3│ 3 4 5 6 7 8 > > 9 10 11 12 13│ │ 4│ 4 5 6 7 8 9 10 11 12 13 14│ │ 5│ 5 6 7 8 > > 9 10 11 12 13 14 15│ │ 6│ 6 7 8 9 10 11 12 13 14 15 16│ │ 7│ 7 8 > > 9 10 11 12 13 14 15 16 17│ │ 8│ 8 9 10 11 12 13 14 15 16 17 18│ │ > > 9│ 9 10 11 12 13 14 15 16 17 18 19│ > > │10│10 11 12 13 14 15 16 17 18 19 20│ > > L--+--------------------------------- > > > > ]MINUS=:TOP,:BOT > > > > ----T-----------------------------┐ > > │ - │ 1 2 3 4 5 6 7 8 9 10│ > > +---+-----------------------------+ > > │ 1 │ 0 │ > > │ 2 │ 1 0 │ > > │ 3 │ 2 1 0 │ > > │ 4 │ 3 2 1 0 │ > > │ 5 │ 4 3 2 1 0 │ > > │ 6 │ 5 4 3 2 1 0 │ > > │ 7 │ 6 5 4 3 2 1 0 │ > > │ 8 │ 7 6 5 4 3 2 1 0 │ > > │ 9 │ 8 7 6 5 4 3 2 1 0 │ > > │10 │ 9 8 7 6 5 4 3 2 1 0│ > > │11 │10 9 8 7 6 5 4 3 2 1│ > > │12 │11 10 9 8 7 6 5 4 3 2│ > > │13 │12 11 10 9 8 7 6 5 4 3│ > > │14 │13 12 11 10 9 8 7 6 5 4│ > > │15 │14 13 12 11 10 9 8 7 6 5│ > > │16 │15 14 13 12 11 10 9 8 7 6│ > > │17 │16 15 14 13 12 11 10 9 8 7│ > > │18 │17 16 15 14 13 12 11 10 9 8│ > > │19 │18 17 16 15 14 13 12 11 10 9│ > > │20 │19 18 17 16 15 14 13 12 11 10│ > > L---+------------------------------ > > > > > > > > Thanks in advance. > > > > > > > > Linda > > > > > > > > -------------------------------------------------------------------- > > -- 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
