Identical?
f =: =&{:
g =: [:={:
1 4 f 2 3 4
1
1 4 g 2 3 4
|domain error: g
| 1 4 g 2 3 4
Kip Murray
Sent from my iPad
On Oct 20, 2012, at 1:11 AM, "Linda Alvord" <[email protected]> wrote:
> Here's a problem that bothers me about this example before I leave it.
>
>
>
> First establish that =&{: and [:={: are identical and compare tree and
> boxed versions:
>
>
>
>
>
> ]'A B'=:3|L:0(([:<i.)"1)3 5,:5 4
>
> ----------T-------┐
> │0 1 2 0 1│0 1 2 0│
> │2 0 1 2 0│1 2 0 1│
> │1 2 0 1 2│2 0 1 2│
> │ │0 1 2 0│
> │ │1 2 0 1│
> L---------+--------
>
> f=:=&{:
>
> g=:[:={:
>
> 5!:4 <'f'
>
> -- =
> -- & -+- {:
>
> 5!:4 <'g'
>
> -- [:
> --+- =
> L- {:
>
> B
>
> 0 1 2 0
> 1 2 0 1
> 2 0 1 2
> 0 1 2 0
> 1 2 0 1
>
> f B
>
> 1 0 0 1
> 0 1 0 0
> 0 0 1 0
>
> g B
>
> 1 0 0 1
> 0 1 0 0
> 0 0 1 0
>
>
>
> Now look at two "trees":
>
>
>
> elm=: 13 :'((=&{:)|.)"1 y'
>
> oak=: 13 :'(([:={:)|.)"1 y'
>
> 5!:4 <'elm'
>
> -- =
> -- & -+- {:
> ----+- |.
> -- " -+- 1
>
> 5!:4 <'oak'
>
> -- [:
> -----+- =
> ----+ L- {:
> -- " -+ L- |.
> L- 1
>
> 5!:2 <'elm'
>
> --------------T-T-┐
> │---------T--┐│"│1│
> ││--T-T--┐│|.││ │ │
> │││=│&│{:││ ││ │ │
> ││L-+-+---│ ││ │ │
> │L--------+---│ │ │
> L-------------+-+--
>
> 5!:2 <'oak'
>
> ---------------T-T-┐
> │----------T--┐│"│1│
> ││---T-T--┐│|.││ │ │
> │││[:│=│{:││ ││ │ │
> ││L--+-+---│ ││ │ │
> │L---------+---│ │ │
> L--------------+-+--
>
> B
>
> 0 1 2 0
> 1 2 0 1
> 2 0 1 2
> 0 1 2 0
> 1 2 0 1
>
> elm B
>
> 1 1 1 1 1
>
> oak B
>
> ran with error:
> |domain error: oak
> | oak B
> |[-16] c:\users\owner\j701-user\temp\42.ijs
>
>
>
> I'm not troubled by the fact that these results are different. I am bothered
> that their differences do not appear in the tree and boxed version, because
> I expect them both to be elm trees!
>
>
>
> If these versions don't show any differences shouldn't the results agree. I
> think the tree versions must be missing some way to tell them apart.
>
>
>
> Any thoughts?
>
>
>
> Linda
>
>
>
> Linda
>
>
>
>
>
>
>
> -----Original Message-----
>
> From: <mailto:[email protected]>
> [email protected]
>
> [ <mailto:[email protected]>
> mailto:[email protected]] On Behalf Of Raul Miller
>
> Sent: Friday, October 19, 2012 9:30 AM
>
> To: <mailto:[email protected]> [email protected]
>
> Subject: Re: [Jprogramming] stitching matrices
>
>
>
> On Fri, Oct 19, 2012 at 4:00 AM, Linda Alvord <
> <mailto:[email protected]> [email protected]>
>
> wrote:
>
>> G B
>
>> 1 1 1 1 1
>
>> H B
>
>> ran with error:
>
>> |domain error: H
>
>> | H B
>
>> |[-30] c:\users\owner\j701-user\temp\37.ijs
>
>
>> G WORKS! H DOESN'T!
>
>
>> How can I write the function H without & and get 1 1 1 1 ?
>
>
>
> Here's G B
>
> ((=&{:)|.)"1 $~&5 4 i.3
>
> 1 1 1 1 1
>
>
>
> Here, I rephrase G by eliminating the &
>
> (({:@[ = {:@])|.)"1 $~&5 4 i.3
>
> 1 1 1 1 1
>
>
>
> Note that I am testing the result at each step, here, to make sure I've not
> made any bad assumptions (for example, hypothetically speaking some
> intermediate results in these kinds of transformations might need some
> explicit treatment of rank).
>
>
>
> Here, I further rephrase G by also eliminating both of the @ conjunctions
>
> ((([: {: [) = ([: {: ]))|.)"1 $~&5 4 i.3
>
> 1 1 1 1 1
>
>
>
> Here, I simplify slightly by using a hook
>
> (((([: {: [) = ]) {:)|.)"1 $~&5 4 i.3
>
> 1 1 1 1 1
>
>
>
> Here, I simplify again by using a cross hook
>
> (((= {:)~ {:) |.)"1 $~&5 4 i.3
>
> 1 1 1 1 1
>
>
>
> Good enough?
>
>
>
> Thanks,
>
>
>
> --
>
> Raul
>
> ----------------------------------------------------------------------
>
> For information about J forums see <http://www.jsoftware.com/forums.htm>
> http://www.jsoftware.com/forums.htm
>
>
>
> ----------------------------------------------------------------------
>
> For information about J forums see <http://www.jsoftware.com/forums.htm>
> 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