I think you are right! I don't know how to make the two simple J functions
work together.
Functions:
g=:(((^ (i.@>:))&.>)/)
gg=: 13 :'(<( ^ [: i. >:)>)/ y'
h=:(((*/)&>)@{)
hh=: 13 :'*/"1>"0{y'
Basic Pattern"
hhg=:(((hh@g)@q:)~)&__
This works:
hhg=:(((([: */"1 [: >"0 {)@((^ i.@>:)&.>/))@q:)~)&__
hhg 363
1 11 121
3 33 363
5!:4 <'hhg'
-- [:
│ -- / --- *
+- " --+- 1
------+
│ │ -- [:
│ │ │ -- >
│ L------+- " -+- 0
-- @ -+ L- {
│ │ -- ^
│ │ ------+ -- i.
-- ~ --- @ -+ L- / --- &. -+ L- @ -+- >:
│ │ L- >
-- & -+ L- q:
L- __
This does not:
hhgg 363
0 0
5!:4 <'hhgg'
-- [:
│ -- / --- *
+- " -+- 1
--+
│ │ -- [:
│ │ │ -- >
│ L-----+- " -+- 0
-- / --- @ -+ L- {
│ │ -- <
│ │ │ -- ^
│ │ +-----+ -- [:
-- ~ --- @ -+ L-+ L-----+- i.
│ │ │ L- >:
-- & -+ │ L- >
│ L- q:
L- __
The problem is interesting because I have no idea how the one that works,
works!
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Brian Schott
Sent: Saturday, February 16, 2013 11:29 PM
To: [email protected]
Subject: Re: [Jprogramming] Recursive programming (and scoping therein)
Linda,
One problem I see is that your gg is not treating the left part of g as a
hook.
--
(B=)
----------------------------------------------------------------------
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