I have found that if you change a message to "rich text" before you paste
anything it will look better (I hope)
5!:4 <'f'
-- >.
+- %
--+ -- [:
│ +- <.
L----+ -- +
L----+- *
L- -
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: Sunday, December 09, 2012 3:07 AM
To: [email protected]
Subject: Re: [Jprogramming] @: and capped fork (and puzzles)
Maybe some of you who are just beginning to learn J, and I who occasionally
has to "figure out what is going on" might find this helpful.
f=:>. % [: <. + * -
2.5 f 4
_0.4
f 23
_0.0434783
g=: 13 :'(>.y)%<.(+y)*-y'
g 23
_0.0434783
h=: 13 :'(x>.y)%<.(x+y)*x-y'
2.5 h 4
_0.4
The surprise is that the tacit version is the same for f, g and h
f
>. % [: <. + * -
g
>. % [: <. + * -
h
>. % [: <. + * -
It requires you to "read" the same tree differently in a monadic and a
dyadic situation.
5!:4 <'f'
-- >.
+- %
--+ -- [:
│ +- <.
L----+ -- +
L----+- *
L- -
Enjoy your day. Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda
fiAlvord
Sent: Friday, December 07, 2012 8:55 PM
To: [email protected]
Subject: Re: [Jprogramming] @: and capped fork (and puzzles)
If you replace each expression with @: with one without it:
2.5 (>. % <. @: + * -) 4
_0.444444u
2.5 (>. % <. @ + * -) 4
_0.444444
2.5 (>. % <. @ (+ * -)) 4
_0.4
2.5 (>. % <. @ (+ * -)) 4
_0.4
Now you can see the difference in the removal of parentheses better.
2.5 (>. % [: <. + * -) 4
_0.4
2.5 (>. % <. @ + * -) 4
_0.444444
2.5 (>. % <. @ (+ * -)) 4
_0.4
2.5 (>. % <. @ (+ * -)) 4
_0.4
2.5 (>. % [ <.@] + * -) 4
_0.4
When the dictionary was written, there was the cost of printing books and
articles to consider. The forum provides the luxury of giving sufficient
examples that a concept can be presented from different perspectives which
may make understanding easier.
f=:>. % [: <. + * -
2.5 f 4
_0.4
5!:4 <'f'
-- >.
+- %
--+ -- [:
│ +- <.
L----+ -- +
L----+- *
L- -
I find a tree helpful here.
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jose Mario
Quintana
Sent: Friday, December 07, 2012 7:11 PM
To: [email protected]
Subject: Re: [Jprogramming] @: and capped fork (and puzzles)
To Linda,
2.5 (>. % [: <. + * -) 4
_0.4
2.5 (>. % <. @: + * -) 4
_0.444444444
2.5 (>. % <. @: (+ * -)) 4
_0.4
2.5 (>. % [ <.@] + * -) 4
_0.4
NB. This is the example given in the Dictionary's entry for Cap.
To Dan,
I am glad that somebody is having fun. These are very good questions and
the necessary clarifications give away some clues:
- re (Ca f p g) vs ([: f g) : the equivalence fails because the
execution of sentences involving (Ca f p g) break down when applied to
(meaningful) identical arguments.
- re the interpreter "preferring" @: to [: in certain cases: actually, the
puzzle was to find "instances where the interpreter even favors atop (@)
over ([:)" but there are also instances where the interpreter favors (@:)
over ([:) and, yes, this preferences are demonstrated in other contexts not
involving (13 :) (I could not help to leave behind a red herring behind,
hence: "(This is a tricky puzzle thought)").
:)
By the way, there is a bonus puzzle within the solutions.
----------------------------------------------------------------------
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