How this for a function in the new "Walking Downhill J"

   'A B'=:3|L:0(([:<i.)"1)3 5,:5 4
   k=: 13 :';x ([:<(,"1}.)"1#~(=&{:|.)"1)"1 _ y'
   k
[: ; ([: < (,"1 }.)"1 #~ (=&{: |.)"1)"1 _
   

-----Original Message-----
From: programming-boun...@forums.jsoftware.com 
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Dan Bron
Sent: Saturday, October 20, 2012 1:02 PM
To: programm...@jsoftware.com
Cc: programm...@jsoftware.com
Subject: Re: [Jprogramming] stitching matrices

I would phrase this as "if you want to ensure dyadic invocations always fail, 
these definitions..."

The conceptual difference will become evident when Linda tries to substitute 
these modified definitions for her originals in the context of (... |.) 
(particularly in the case of f ).

-Dan


Please excuse typos; composed on a handheld device.

On Oct 20, 2012, at 12:19 PM, Raul Miller <rauldmil...@gmail.com> wrote:

> 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 <lindaalv...@verizon.net> wrote:
>> I am using them monadically.
>> 
>> Linda
>> 
>> -----Original Message-----
>> From: programming-boun...@forums.jsoftware.com 
>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of km
>> Sent: Saturday, October 20, 2012 2:54 AM
>> To: programm...@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" <lindaalv...@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-boun...@forums.jsoftware.com>
>>> programming-boun...@forums.jsoftware.com
>>> 
>>> [ <mailto:programming-boun...@forums.jsoftware.com>
>>> mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul 
>>> Miller
>>> 
>>> Sent: Friday, October 19, 2012 9:30 AM
>>> 
>>> To:  <mailto:programm...@jsoftware.com> programm...@jsoftware.com
>>> 
>>> Subject: Re: [Jprogramming] stitching matrices
>>> 
>>> 
>>> 
>>> On Fri, Oct 19, 2012 at 4:00 AM, Linda Alvord < 
>>> <mailto:lindaalv...@verizon.net> lindaalv...@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

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to