[Jprogramming] stitching matrices
Aai
agroeneveld400 at gmail.com
Wed Oct 24 07:51:43 UTC 2012
No. It produces the same answer, but you are stitching with 'tails'
instead of tails (from A) and heads (from B) as was original asked for.
> R.E.Boss
> I want to stitch every row from A with all rows from B where ({:"1 A) equals {."1 B and one of these columns is deleted.
On 24-10-12 09:27, Linda Alvord wrote:
> m&v y ↔ m v y This is the definition of bond (monadic)
>
> u&v y ↔ u v y . This is the definition of compose (dyadic)
>
>
> =&{: is the definition which I used earlier as =&{: B
>
> I was told that I was using & dyadically so it was compose.
>
> Here is a slight simplification:
>
> 'A B'=:3|L:0(([:<i.)"1)3 5,:5 4
> m=: 13 :';x([:<(=&{:)"1#(, }.)"1)"1 _ y'
> A m B
> 0 1 2 0 1 2 0 1
> 0 1 2 0 1 2 0 1
> 2 0 1 2 0 1 2 0
> 2 0 1 2 0 1 2 0
> 1 2 0 1 2 0 1 2
> m
> [: ; ([: < =&{:"1 # (, }.)"1)"1 _
>
> Linda
>
>
> Linda
>
>
> -----Original Message-----
> From: programming-bounces at forums.jsoftware.com [mailto:programming-tbounces at forums.jsoftware.com] On Behalf Of Henry Rich
> Sent: Tuesday, October 23, 2012 4:28 PM
> To: programming at jsoftware.com
> Subject: Re: [Jprogramming] stitching matrices
>
> Just remember that u&v y IS NOT u v y .
>
> u&:v y IS u v y .
>
> u&v y is the same as u&:v"v y .
>
> Henry Rich
>
> On 10/23/2012 9:57 AM, Linda Alvord wrote:
>> I know that your explanation works because the dictionary defines & as u&v y ↔ u v y .
>>
>> What I am trying to do is sort out a sequence for developing concepts in mathematics education. A starting point is Easy J. Also. I favor explicit definitions using 13 : as they clearly indicate the placement of arguments.
>>
>> However, students who become interested in J can look at the tacit verbs and begin to see a more terse version of the language.
>>
>> So, if I begin to embrace & to form a hook like =&{: and it is equivalent to [:={: and I enter it as ([:={:) in an explicit definition, I'd like it to work and also both versions should display in a similar fashion in a tree.
>>
>> As I typed that last paragraph I wondered if I really need y somewhere in my explicit definition.
>>
>> Thanks for your thoughts as they have forced me to continue to ponder this issue.
>>
>> Linda
>>
>>
>> -----Original Message-----
>> From: programming-bounces at forums.jsoftware.com
>> [mailto:programming-boune ces at forums.jsoftware.com] On Behalf Of Aai
>> Sent: Monday, October 22, 2012 4:01 AM
>> taTo: programming at jsoftware.com
>> Subject: Re: [Jprogramming] stitching matrices
>>
>> If you insist in a version of
>>
>> (=&{: |.)
>>
>> with caps then you'll have to use something like this (written out
>> version)
>>
>> LAT=: 13 :'( {: x ) = {: |. y'
>>
>> LAT
>> ([: {: [) = [: {: [: |. ]
>>
>> Then insert this into my cleaned code (thanks to Raul):
>>
>> zlav=:[: ;([: < LAT"1 # (, }.)"1)"1 _
>>
>> A zlav B
>> 0 1 2 0 1 2 0 1
>> 0 1 2 0 1 2 0 1
>> 2 0 1 2 0 1 2 0
>> 2 0 1 2 0 1 2 0
>> 1 2 0 1 2 0 1 2
>>
>> zlav f.
>> [: ; ([: < (([: {: [) = [: {: [: |. ])"1 # (, }.)"1)"1 _
>>
>>
>>
>> On 22-10-12 03:46, Linda Alvord wrote:
>>> Check your message below, Raul, which indicate that both m and n should work on your new version:
>>>
>>> i=:[: ;([: < (=&{: |.)"1 # (, }.)"1)"1 _
>>> i
>>> [: ; ([: < (=&{: |.)"1 # (, }.)"1)"1 _
>>> A i B
>>> 0 1 2 0 1 2 0 1
>>> 0 1 2 0 1 2 0 1
>>> 2 0 1 2 0 1 2 0
>>> 2 0 1 2 0 1 2 0
>>> 1 2 0 1 2 0 1 2
>>>
>>>
>>> m=: 13 :';x ([:< (([:={: :[:) |.)"1 # (, }.)"1)"1 _ y'
>>> m
>>> [: ; ([: < (([: = {: :[:) |.)"1 # (, }.)"1)"1 _
>>> A m B
>>> |domain error: m
>>> | A m B
>>> n=: 13 :';x ([:< (([:={: :[:) |.)"1 # (, }.)"1)"1 _ y'
>>> n
>>> [: ; ([: < (([: = {: :[:) |.)"1 # (, }.)"1)"1 _
>>> A n B
>>> |domain error: n
>>> | A n B
>>>
>>> Spacing of [:={: similar to =&{: would be geat.
>>> So I could write an explicit definition of o that will have the following result and produce the correct result that i does.
>>>
>>>
>>> o=:
>>> [: ; ([: < ([:={: |.)"1 # (, }.)"1)"1 _
>>>
>>>
>>> -----Original Message-----
>>> From: programming-bounces at forums.jsoftware.com
>>> [mailto:programming-bounces at forums.jsoftware.com] On Behalf Of Raul
>>> Miller
>>> Sent: Saturday, October 20, 2012 12:19 PM
>>> To: programming at jsoftware.com
>>> Subject: Re: [Jprogramming] stitching matrices
>>>
>>> If you actually wanted to only be using monadic definitions for f and g, these would be equivalent definitions:
>>>
>>> f=: =&{: :[:
>>>
>>> g=: ([:={:) :[:
>>>
>>> Here, you would be declaring that these verbs have empty dyadic domains.
>>>
>>> You could even get away with
>>>
>>> g=: [:={: :[:
>>>
>>> (Do you see why?)
>>>
>>> --
>>> Raul
>>>
>>> On Sat, Oct 20, 2012 at 2:57 AM, Linda Alvord <lindaalvord at verizon.net> wrote:
>>>> I am using them monadically.
>>>>
>>>> Linda
>>>>
>>>> -----Original Message-----
>>>> From: programming-bounces at forums.jsoftware.com
>>>> [mailto:programming-bounces at forums.jsoftware.com] On Behalf Of km
>>>> Sent: Saturday, October 20, 2012 2:54 AM
>>>> To: programming at jsoftware.com
>>>> Subject: Re: [Jprogramming] stitching matrices
>>>>
>>>> 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" <lindaalvord at verizon.net> 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:programming-bounces at forums.jsoftware.com>
>>>>> programming-bounces at forums.jsoftware.com
>>>>>
>>>>> [ <mailto:programming-bounces at forums.jsoftware.com>
>>>>> mailto:programming-bounces at forums.jsoftware.com] On Behalf Of Raul
>>>>> Miller
>>>>>
>>>>> Sent: Friday, October 19, 2012 9:30 AM
>>>>>
>>>>> To: <mailto:programming at jsoftware.com> programming at jsoftware.com
>>>>>
>>>>> Subject: Re: [Jprogramming] stitching matrices
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Oct 19, 2012 at 4:00 AM, Linda Alvord <
>>>>> <mailto:lindaalvord at verizon.net> lindaalvord at verizon.net>
>>>>>
>>>>> 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
>>>>
>>>> --------------------------------------------------------------------
>>>> -
>>>> - 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
>> --
>> Met vriendelijke groet,
>> @@i = Arie Groeneveld
>>
>> ----------------------------------------------------------------------
>> 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
--
Met vriendelijke groet,
@@i = Arie Groeneveld
More information about the Programming
mailing list