Trying a resend:
On 10/24/2012 11:47 AM, km wrote:
Consider
f =: - %
g =: [ - %@]
f 2
1.5
g 2
1.5
3 f 2
2.5
3 g 2
2.5
Verbs f and g above cannot be distinguished by data -- given the same
input, they produce the same output. In mathematics they would be
considered to be the same function, even though their definitions
differ. In J the difference in definitions is described by saying the
first is a hook and the second is a fork. The difference in definitions
would be detected by the verb trace mentioned in
http://www.jsoftware.com/docs/help701/dictionary/dicte.htm
Try
trace 'f 2'
and
trace 'g 2'
Kip Murray
Sent from my iPad
On Oct 24, 2012, at 8:00 AM, "Linda Alvord" <lindaalv...@verizon.net
<mailto:lindaalv...@verizon.net>> wrote:
What data will show that g is not a hook ?
Linda
-----Original Message-----
From: programming-boun...@forums.jsoftware.com
<mailto:programming-boun...@forums.jsoftware.com>
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of km
Sent: Wednesday, October 24, 2012 8:50 AM
To:t d programm...@jsoftware.com <mailto:programm...@jsoftware.com>
Subject: Re: [Jprogramming] stitching matrices
Compare the diagrams for hook and capped fork at
http://www.jsoftware.com/docs/help701/dictionary/dictf.htm
Kip Murray
Sent from my iPad
On Oct 24, 2012, at 2:47 AM, "Linda Alvord" <lindaalv...@verizon.net
<mailto:lindaalv...@verizon.net>> wrote:
Now that I understand it better, here’s my simplified tree question:
'A B'=:3|L:0(([:<i.)"1)3 5,:5 4
f
=&{:
g
[: = {:
(f B)-:g B
1
5!:4 <'f'
┌─ =
── & ─┴─ {:
5!:4 <'g'
┌─ [:
──┼─ =
└─ {:
5!:2 <'f'
┌─┬─┬──┐
│=│&│{:│
└─┴─┴──┘
5!:2 <'g'
┌──┬─┬──┐
│[:│=│{:│
└──┴─┴──┘
Shouldn’t g look like a hook?
Linda
-----Original Message-----
From: programming-boun...@forums.jsoftware.com
<mailto:programming-boun...@forums.jsoftware.com>
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda
Alvord
Sent: Wednesday, October 24, 2012 3:28 AM
To: programm...@jsoftware.com <mailto:programm...@jsoftware.com>
Subject: Re: [Jprogramming] stitching matrices
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-boun...@forums.jsoftware.com
<mailto:programming-boun...@forums.jsoftware.com>
[mailto:programming-tboun...@forums.jsoftware.com] On Behalf Of Henry
Rich
Sent: Tuesday, October 23, 2012 4:28 PM
To: programm...@jsoftware.com <mailto:programm...@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-boun...@forums.jsoftware.com
<mailto:programming-boun...@forums.jsoftware.com>
[mailto:programming-boune c...@forums.jsoftware.com
<mailto:c...@forums.jsoftware.com>] On Behalf Of Aai
Sent: Monday, October 22, 2012 4:01 AM
taTo: programm...@jsoftware.com <mailto:programm...@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-boun...@forums.jsoftware.com
<mailto:programming-boun...@forums.jsoftware.com>
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul
Miller
Sent: Saturday, October 20, 2012 12:19 PM
To: programm...@jsoftware.com <mailto:programm...@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
<lindaalv...@verizon.net <mailto:lindaalv...@verizon.net>> wrote:
I am using them monadically.
Linda
-----Original Message-----
From: programming-boun...@forums.jsoftware.com
<mailto: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 <mailto: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 <mailto: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>
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
<mailto: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
<mailto: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
--
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
----------------------------------------------------------------------
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