Thanks. I’m starting to understand things better. Here is my next problem.
a=:%
b=:i:3
c=:i.3
d=:(<c),<b
]M=:":(>}.d),(>{.d)a/,>}.d
_3 _2 _1 0 1 2 3
0 0 0 0 0 0 0
_0.333333 _0.5 _1 _ 1 0.5 0.333333
_0.666667 _1 _2 _ 2 1 0.666667
(<{.M),:<}.M
┌──────────────────────────────────┐
│ _3 _2 _1 0 1 2 3│
├──────────────────────────────────┤
│ 0 0 0 0 0 0 0│
│_0.333333 _0.5 _1 _ 1 0.5 0.333333│
│_0.666667 _1 _2 _ 2 1 0.666667│
└──────────────────────────────────┘
f=: 1 :'":(>}.y),(>{.y)u/,>}.y'
a f d
_3 _2 _1 0 1 2 3
0 0 0 0 0 0 0
_0.333333 _0.5 _1 _ 1 0.5 0.333333
_0.666667 _1 _2 _ 2 1 0.666667
g=: 1 :'<}.":(>}.y),(>{.y)u/,>}.y'
a g d
┌──────────────────────────────────┐
│ 0 0 0 0 0 0 0│
│_0.333333 _0.5 _1 _ 1 0.5 0.333333│
│_0.666667 _1 _2 _ 2 1 0.666667│
└──────────────────────────────────┘
I want to modify g so that it attaches the top row with correct spacing as
shown above.
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Friday, November 08, 2013 7:57 AM
To: hProgramming forum
Subject: Re: [Jprogramming] Times Table Therapy
http://www.jsoftware.com/help/dictionary/cret.htm explains that return.
exits an explicit definition.
http://www.jsoftware.com/help/dictionary/d521.htm explains that the result of
{. is the leading item of an array (which means one dimension less than the
table).
I'll presume that I do not need to document "behead" but just in case some of
the younger readers are curious:
http://www.jsoftware.com/help/dictionary/d531.htm
Thanks,
--
Raul
On Fri, Nov 8, 2013 at 3:26 AM, Linda Alvord <[email protected]>wrote:
> What does return. Mean?
>
> Also:
>
> a=:*
> b=:i:5
> c=:i.3
> d=:(<c),<b
>
> c */b
> 0 0 0 0 0 0 0 0 0 0 0
> _5 _4 _3 _2 _1 0 1 2 3 4 5
> _10 _8 _6 _4 _2 0 2 4 6 8 10
>
> (>{.d)
> 0 1 2
> >}.d
> _5 _4 _3 _2 _1 0 1 2 3 4 5
>
> (>{.d) */ >}.d
> 0 0 0 0 0 0 0 0 0 0 0
>
> _5 _4 _3 _2 _1 0 1 2 3 4 5
>
> _10 _8 _6 _4 _2 0 2 4 6 8 10
>
> $ (>{.d) */ >}.d
> 3 1 11
>
> So:
>
> (>{.d) */, >}.d
> 0 0 0 0 0 0 0 0 0 0 0
> _5 _4 _3 _2 _1 0 1 2 3 4 5
> _10 _8 _6 _4 _2 0 2 4 6 8 10
>
> Why is ({.c) a list and (}.d) a table?
>
> Linda
>
>
> -----Original Message---
> From: [email protected] [mailto:
> [email protected]] On Behalf Of Raul Miller
> Sent: Thursday, November 07, 2013 10:07 AM
> To: Programming forum
> Subje.ct: Re: [Jprogramming] Times Table Therapy
>
> We can replace
> g=: 1 :',.(":u),":,.>{.y'
> with
> g=: 1 :',.(":5!:5<''u''),":,.>{.y'
>
> A problem is that u is a verb in your example, and you want a noun
> representation of it.
>
> But this runs into a problem:
>
> g=: 1 :',.(":5!:5<''u''),":,.>{.y'
> * g (<i.3),<i.5
> |value error: y
> | ,.(":5!:5<'u'),":,.>{. y
>
> We need an unquoted reference to u (or one of the other such names), or x
> and y are interpreted to mean u and v.
>
> So:
>
> g=: 1 :',.(":5!:5<''u''),":,.>{.y return. u'
> * g (<i.3),<i.5
> *
> 0
> 1
> 2
>
> Does this make sense?
>
> --
> Raul
>
>
>
> On Wed, Nov 6, 2013 at 11:07 PM, Linda Alvord <[email protected]
> >wrote:
>
> > This the data I want to use:
> >
> > a=:*
> > b=:i:5
> > c=:i.3
> > ]d=:(<c),<b
> > ┌─────┬──────────────────────────┐
> > │0 1 2│_5 _4 _3 _2 _1 0 1 2 3 4 5│
> > └─────┴──────────────────────────┘
> >
> > This this is the correct result with the wrong data:
> >
> > a=:'*'
> > f=: 1 :',.(":u),":,.>{.y'
> > a f d
> > *
> > 0
> > 1
> > 2
> >
> > Here is the error I can’t fix:
> > a=:*
> > g=: 1 :',.(":u),":,.>{.y'
> > a g d
> > |domain error: a
> > | ,. (":u),":,.>{.y
> >
> >
> > Is there a way to make g work correctly?
> >
> > Linda
> >
> >
> > -----Original Message-----
> > From: [email protected] [mailto:
> > [email protected]] On Behalf Of Roger Hui
> > Sent: Sunday, November 03, 2013 7:02 PM
> > To: Programming forum
> > Subject: Re: [Jprogramming] Times Table Therapy
> >
> > > My first adverb! Linda
> >
> > Given the topic and the person, it seems appropriate to point out that
> Ken
> > Iverson credited Linda Alvord for getting over a pedagogic hurdle.
> > From *Kenneth
> > E. Iverson <http://www.jsoftware.com/papers/autobio.htm>*, 2008, section
> > 5:
> >
> > There were also surprises in the writing. Although the great utility of
> > matrices was recognized (as in a 3-by-2 to represent a triangle), there
> was
> > a great reluctance to use them because the concept was considered to be
> too
> > difficult.
> >
> > Linda Alvord said to introduce the matrix as an outer product — an idea
> > that the rest of us thought outrageous, until Linda pointed out that the
> > kids already knew the idea from familiar addition and multiplication
> tables.
> >
> >
> >
> >
> > On Sun, Nov 3, 2013 at 7:04 AM, Linda Alvord <[email protected]
> > >wrote:
> >
> > >
> > > My first adverb! 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm