Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Steven Taylor
can a closure always be unwound and compiled in the same way that recursion can be converted to iteration? Even if yes, is this direction moving away from J's key strengths. Is there another way to solve the problem at hand that may lead to a something more elegant and scalable overall? Flexibil

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Steven Taylor
I have not yet seen a widespread use of closures in a language that allowed them where it was a big advantage. I have had a few 'oh cool' closure moments, but so far this has been isolated to specific cases... Like when defining a function explicitly was tiring and interrupted the flow of thoug

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-02-20 Thread Dan Bron
I showed you how to replace &.: below. Same way you replaced those &s, only you have to "undo" (mnemonic: under -> undo) v at the end. SEE5A =: ([: (- (+/ % #)) [) (([: +/ *) % [: %: (([: +/ [: *: [) * [: +/ [: *: ])) [: (- (+/ % #)) ] [There's a lot of unnecessary clutter in here, but I just

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-02-20 Thread Linda Alvord
So far I removed all but &.: gnp1955 SEE4A trade1955 0.925343 SEE4A ([: (- (+/ % #)) [) (([: +/ *) % (([: +/ [) * [: +/ ])&.:*:"_) [: (- (+/ % #)) ] You did guess what I would be doing! Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:prog

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Eldon Eller
I fail to see what this discussion about closure has to do with J programming. The faultmay be entirely mine; I am an old man and an amateur programming. If this discussion is about J programming, please inform me of the connection. If not, I suggest that you guys get together and discuss this

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Raul Miller
On Wed, Feb 20, 2013 at 4:37 PM, William Tanksley, Jr wrote: > Reading back through this discussion was difficult but enlightening. > > Here's how it started: > > On Fri, Feb 15, 2013 at 4:40 AM, Boyko Bantchev wrote: >> The 'Lexical Closure' essay >> (http://www.jsoftware.com/jwiki/Guides/Lexica

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Raul Miller
On Wed, Feb 20, 2013 at 3:18 PM, Boyko Bantchev wrote: > On 20 February 2013 19:51, Raul Miller wrote: >> But if I take those as definitions for "closure" I am unable to >> distinguish between "closure" and simple substitution. > > There sure is a difference between substitutions and closures. >

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Boyko Bantchev
On 20 February 2013 19:51, Raul Miller wrote: > But if I take those as definitions for "closure" I am unable to > distinguish between "closure" and simple substitution. There sure is a difference between substitutions and closures. Indeed, there is hardly anything in common between them. But why

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Raul Miller
On Wed, Feb 20, 2013 at 1:12 PM, William Tanksley, Jr wrote: > Raul Miller wrote: >> As for the definitions not being mutable, those definitions are >> irrelevant. > > I'm sorry to interrupt, but I don't understand that sentence. I'll > explain after I let you finish. I'll try again: 1. A mutab

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Raul Miller
On Wed, Feb 20, 2013 at 12:10 PM, Boyko Bantchev wrote: > On 20 February 2013 17:25, Raul Miller wrote: > >> Where? > > E.g. in > http://jsoftware.com/pipermail/programming/2013-February/031610.html > and in > http://jsoftware.com/pipermail/programming/2013-February/031617.html Ok. But if I tak

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-02-20 Thread Devon McCormick
(i.10) corr i.10 NB. Perfectly correlated 1 (i.10) corr |.i.10NB. Perfectly anti-correlated (inversely correlated) _1 (i.10) corr *:i.10NB. Highly correlated 0.962691 (i.10) corr 10?@$100 NB. No significant correlation 0.0442917 On Wed, Feb 20, 2013 at 11:37 AM, Dan Bro

[Jprogramming] Function composition and elegance (was applying >1 ...)

2013-02-20 Thread Dan Bron
I wrote: > Statistical correlation > (+/@:* % *&(+/)&.:*:)&(- +/%#) > Rephrase corr in Simplistic J > ([ - [: (+/ % #) [) (([: +/ *) % [: %: ([: ([: +/ *:) [) * [: ([: +/ *:) ]) ] - [: (+/ % #) ] I'll also take this opportunity to emphasize the differences between these two (equivalent) verbs, wh

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Jose Mario Quintana
> P.S. "Common sense is the most widely shared commodity in the world, > for every man is convinced that he is well supplied with it." > -- René Descartes "*Common-sense is the most uncommon of all the senses*" -- Manly P. Hall :) On Wed, Feb 20, 2013 at 10:25 AM, Raul Miller wrote: > On Wed, F

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-02-20 Thread Dan Bron
I wrote: > corr =: (+/@:* % *&(+/)&.:*:)&(- +/%#) Linda asked for: > some sample data for corr with your expected result I'll just short-circuit this discussion and rephrase corr in Simplistic J for you. avg =: +/ % # sumSqrs =: 13 : '+/ *: y' simplisticCorr =: 13 : '(x - avg x

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Raul Miller
On Wed, Feb 20, 2013 at 11:08 AM, William Tanksley, Jr wrote: > Raul Miller wrote: >> A "closure" is a reference to a subroutine combined with a reference >> to an environment which provides mutable definitions for the free >> variables (names whose definitions are supplied outside the body of >>

Re: [Jprogramming] applying >1 gerunds to a set of items

2013-02-20 Thread Linda Alvord
What is some sample data for corr with your expected result. Thanks Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Dan Bron Sent: Tuesday, February 19, 2013 6:48 PM To: programm...@jsoftware.com Subje

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Linda Alvord
This problem is not in trace. It is just in jijx. f=: [: */"1 [: > [: { [: ([: < ^ [: i. >:)"0/ __ q: ] f 3894 |domain error: f | f 3894 factorslla [: */"1 [: > [: { [: ([: < (^ ([: i. >:)))"0/ __ q: ] factorslla 3894 1 59 11 649 3 177 33 1947 2 118 22 1298

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Raul Miller
On Wed, Feb 20, 2013 at 9:13 AM, Boyko Bantchev wrote: > On 20 February 2013 04:01, Raul Miller wrote: >> You have not specified what your definition of closure is. > > In fact I did, and the definition is not 'mine' – it is the one > commonly assumed in programming. It is to be noted, though, t

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Linda Alvord
This was from a fresh start in Jjhs: factorslla =: [: */"1 [: > [: { [: ([: < ( ^ ([: i. >:)))"0/ __ q: ] factorslla 3894 1 59 11 649 3 177 33 1947 2 118 22 1298 6 354 66 3894 Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programm

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Boyko Bantchev
On 20 February 2013 04:01, Raul Miller wrote: > You have not specified what your definition of closure is. In fact I did, and the definition is not 'mine' – it is the one commonly assumed in programming. It is to be noted, though, that I did not even need to do so, again because there is a gener

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Raul Miller
On Wed, Feb 20, 2013 at 5:14 AM, Linda Alvord wrote: > When can you remove the inner parentheses from the right safely? You can remove a parenthesis when trace will evaluate the part within the parenthesis the same way regardless of whether or not the parenthesis are present. -- Raul --

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Dan Bron
Looks like the hook caught you. factorslla =: [: */"1 [: > [: { [: ([: < ( ^ ([: i. >:)))"0/ __ q: ] factorsllb =: [: */"1 [: > [: { [: ([: < [ ^ [: i. >: )"0/ __ q: ] $factorslla 3894 1 1 1 1 $factorsllb 3894 1 1 1 1 (factorslla -: factorsllb) 3894 1 -Dan -Original Messa

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Raul Miller
When using the current implementation of trace with names, you should use fully qualified names (with the locale included). So, for example, instead of hh you should use [the equivalent] hh_base_ That said, note that trace is not going to examine the definition of hh, it's just going to combine t

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Linda Alvord
When can you remove the inner parentheses from the right safely? I would apply the functions from right to left. f=: [: */"1 [: > [: { [: ([: < ^ [: i. >:)"0/ __ q: ] f 3894 |domain error: f | f 3894 factorslla [: */"1 [: > [: { [: ([: < (^ ([: i. >:)))"0/ __ q: ] factorslla [:

Re: [Jprogramming] Recursive programming (and scoping therein)

2013-02-20 Thread Linda Alvord
I never stopped believing it was possible in simple J! Kip once you chopped it up with "each" and "every" it came apart. factrs=: */&>@{@((^ i.@>:)&.>/)@q:~&__factrs 72 1 3 9 2 6 18 4 12 36 8 24 72 ii=:[: < (^ ([: i. >:)) A=:__ q: ] f=:([:ii"0 / A) f 72 T-┐