This post will take me a while....
In the meantime more Basics:
g=: +&2@(*&3@*:)
]y=: g 5
77
h=: 13 :'2+3**:y'
h 5
77
5!:4 <'g'
-- +
-- & -+- 2
│ -- *
-- @ -+ -- & -+- 3
L- @ -+- *:
5!:4 <'h'
-- 2
+- +
--+ -- 3
L---+- *
L- *:
5!:2 <'g'
--------T-T--------------┐
│--T-T-┐│@│--------T-T--┐│
││+│&│2││ ││--T-T-┐│@│*:││
│L-+-+--│ │││*│&│3││ │ ││
│ │ ││L-+-+--│ │ ││
│ │ │L-------+-+---│
L-------+-+---------------
5!:2 <'h'
--T-T--------┐
│2│+│--T-T--┐│
│ │ ││3│*│*:││
│ │ │L-+-+---│
L-+-+---------
g^:_1 y
5
h^:_1 y
5
g b._1
%:@(0.33333333333333331&*)@(_2&+)
%:@(0.33333333333333331&*)@(_2&+)
%:@(0.33333333333333331&*)@(_2&+)
h b._1
[: %: 0.33333333333333331 * _2 + ]
[: %: 0.33333333333333331 * _2 + ]
[: %: 0.33333333333333331 * _2 + ]
%:@(%&3)@(-&2) y
5
%:(%3) *_2 + y
5
%:(%3) *_2 + y
5
%:(%3) *_2 + y
5
The same development of the idea is possible in simple J
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of David Ward
Lambert
Sent: Monday, February 11, 2013 9:04 AM
To: programming
Subject: Re: [Jprogramming] Basic Mystery
&2@(*&3@*:) add 2 after multiplying by 3 after squaring.
Atop and at let me construct expressions by "successive approximation".
I love them.
f y NB. gives me a result,
g@:f y NB. results in a noun closer to what I need
Roughly quoting Mick Jagger, "Tack on verbs to the left until you get what
you need."
> Date: Mon, 11 Feb 2013 04:45:47 -0500
> From: "Linda Alvord" < <mailto:[email protected]>
[email protected]>
> To: < <mailto:[email protected]> [email protected]>
> Subject: [Jprogramming] Basic Mystery
> Message-ID: <000001ce083c$921f2e20$b65d8a60$@net>
> Content-Type: text/plain; charset="us-ascii"
>
> Morning Wakeup Exercise:
>
>
>
> g=: +&2@(*&3@*:)
>
> ]y=: g 5
>
> 77
----------------------------------------------------------------------
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