Re: [Jprogramming] rank question

2011-11-18 Thread Raul Miller
I have been trying to think up a useful response here, but I just do not know enough from this description to make good choices. Typically, I build up the expressions that I find useful first and then come up with names for them later. Sometimes I re-arrange things that work so that they are

Re: [Jprogramming] rank question

2011-11-18 Thread Daniel Lyons
Raul, On Fri, Nov 18, 2011 at 12:02:47PM -0500, Raul Miller wrote: I have been trying to think up a useful response here, but I just do not know enough from this description to make good choices. Well, I appreciate the attempt. :) I don't know enough to know what information would be necessary

Re: [Jprogramming] rank question

2011-11-18 Thread Raul Miller
I think that representative data, along with a description of the result and purpose of the code would work. (Or, if not, that should be enough for us to ask intelligent questions.) -- Raul On Fri, Nov 18, 2011 at 12:45 PM, Daniel Lyons fus...@storytotell.orgwrote: Raul, On Fri, Nov 18,

Re: [Jprogramming] rank question

2011-11-18 Thread Daniel Lyons
On Fri, Nov 18, 2011 at 12:49:55PM -0500, Raul Miller wrote: I think that representative data, along with a description of the result and purpose of the code would work. (Or, if not, that should be enough for us to ask intelligent questions.) I've been disinclined to share the problem because

Re: [Jprogramming] rank question

2011-11-18 Thread Daniel Lyons
Raul, On Fri, Nov 18, 2011 at 03:53:07PM -0500, Raul Miller wrote: Ok.. I hope we have not ruined anything here (to prevent people from googling this and studying up ahead of time, it would be best if the terminology were somewhat obfuscated). But, anyways... I don't think it will be a

Re: [Jprogramming] rank question

2011-11-18 Thread Raul Miller
I did not see anything attached, but forgot about that before I was ready to reply. And here's an overview of how I treated angle differences: degdif/~ 0 90 180 270 360 0 _90 _180 900 900 _90 _180 90 _180 900 _90 _180 _90 _180 900 _90 0 _90 _180 900

Re: [Jprogramming] rank question

2011-11-18 Thread Daniel Lyons
On Fri, Nov 18, 2011 at 04:34:24PM -0500, Raul Miller wrote: I did not see anything attached, but forgot about that before I was ready to reply. It looks like the mailing list has stripped the attachments. -- Daniel Lyons --

Re: [Jprogramming] rank question

2011-11-17 Thread Raul Miller
In general, structuring J code is an exercise in picking the right words. That said, in this case: adding 1 on a verb that assumes a rank 1 argument is only meaningful for verbs which do the right thing on equal length arguments. -- Raul On Wed, Nov 16, 2011 at 11:36 PM, Daniel Lyons

Re: [Jprogramming] rank question

2011-11-17 Thread Björn Helgason
I think that people very often misunderstand what they are doing when setting/changing rank. I very rarely see people set more than one number after the as in 1 and on an occasion 0 1 and not realizing that you actually need three numbers to set the ranks when the ranks are for a dyadic verb.

Re: [Jprogramming] rank question

2011-11-17 Thread Kip Murray
From the Vocabulary page on Rank un The verb un applies u to each cell as specified by the rank n . The full form of the rank used is 3$.|.n . For example, if n=:2 , the three ranks are 2 2 2 , and if n=: 2 3, they are 3 2 3 . On 11/17/2011 9:13 AM, Björn Helgason wrote: I think that people

Re: [Jprogramming] rank question

2011-11-17 Thread Daniel Lyons
On Thu, Nov 17, 2011 at 09:49:32AM -0500, Raul Miller wrote: In general, structuring J code is an exercise in picking the right words. Well, in case you can help with that, here's my situation. For this particular problem, I need to calculate a distance, so I have an origin and a destination.

Re: [Jprogramming] rank question

2011-11-16 Thread Devon McCormick
Since you know you want the function to applied with rank 1, you should probably build it into the definition, e.g. timeToMove=: ((timeToRotate : azimuth) . (timeToAscend : elevation))1 left timeToMove right 0.15 0.45 1.15 On Tue, Nov 15, 2011 at 9:39 AM, Daniel Lyons

Re: [Jprogramming] rank question

2011-11-16 Thread Daniel Lyons
On Nov 16, 2011, at 8:49 AM, Devon McCormick wrote: Since you know you want the function to applied with rank 1, you should probably build it into the definition, e.g. timeToMove=: ((timeToRotate : azimuth) . (timeToAscend : elevation))1 left timeToMove right 0.15 0.45 1.15 I

Re: [Jprogramming] rank question

2011-11-15 Thread Kip Murray
I cannot duplicate your error. From your definitions I get left timeToMove right 0.25 0.45 You might notice left 0 1 2 3 4 5 elevation left 2 3 elevation1 left 1 3 5 Which do you want? On 11/15/2011 1:08 AM, Daniel Lyons wrote: I suspect this is a classic beginner misstep,

Re: [Jprogramming] rank question

2011-11-15 Thread Raul Miller
I cannot duplicate it either. I suspect that a definition which is different from what was posted. -- Raul On Tue, Nov 15, 2011 at 7:27 AM, Kip Murray k...@math.uh.edu wrote: I cannot duplicate your error.  From your definitions I get    left timeToMove right 0.25 0.45 You might notice

Re: [Jprogramming] rank question

2011-11-15 Thread Daniel Lyons
On Nov 15, 2011, at 5:27 AM, Kip Murray wrote: I cannot duplicate your error. Trying it again this morning, I see I must have had a bad definition in my session. Loading from the file I get the same behavior as you and Raul. Sorry about that! From your definitions I get left

[Jprogramming] rank question

2011-11-14 Thread Daniel Lyons
I suspect this is a classic beginner misstep, but I don't see what I'm doing wrong. I have a verb which doesn't work unless I use the rank-1 adverb. Here are the definitions: diff =: -`(-~) @. azimuth =: 0 {:: elevation =: 1 {:: minRotationDistance =: - . : (360|) -~ timeToRotate =:

[Jprogramming] Rank Question when using +/

2008-02-18 Thread Leigh J. Halliwell
Dear J Forum: I am applying +/ to arrays that can be of either rank 1 or rank 2. The following approach works fine for rank 2: +/ i. 2 5 5 7 9 11 13 But for a rank 1 array, I want just the array itself. I can do that with +/_1: +/_1 i. 5 0 1 2 3 4 However +/_1 i.2 5 collapses along

Re: [Jprogramming] Rank Question when using +/

2008-02-18 Thread Brian Schott
In validate.ijs find ismatrix. (Or change = to :) ismatrix=: 2 = [EMAIL PROTECTED] ]`(+/)@.ismatrix i. 2 5 5 7 9 11 13 ]`(+/)@.ismatrix i. 5 0 1 2 3 4 ]`(+/)@.ismatrix 5 5 On Mon, 18 Feb 2008, Leigh J. Halliwell wrote: + Dear J Forum: + + I am applying +/ to arrays that

Re: [Jprogramming] Rank Question when using +/

2008-02-18 Thread Raul Miller
Other possibilities: +/_1@|: +/@(,:^:([EMAIL PROTECTED])) +/^:(1 [EMAIL PROTECTED]) FYI, -- Raul -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Rank Question when using +/

2008-02-18 Thread Devon McCormick
Either of these: +./1 i. 2 5 5 7 9 11 13 +./1 i. 5 0 1 2 3 4 dos=: ] ` (+/) @. (2=[:#$) dos i. 5 0 1 2 3 4 dos i. 2 5 5 7 9 11 13 The latter is probably more efficient. On 2/18/08, Leigh J. Halliwell [EMAIL PROTECTED] wrote: Dear J Forum: I am applying +/ to arrays that can

Re: [Jprogramming] Rank Question

2008-02-16 Thread Raul Miller
Rank 1 verbs treat rows as items. Transpose turns columns into rows. Adverse lets you try one thing and if that fails try the other. So I suspect that this might work: nfpt2 ::nfpt1 |: csvdata -- Raul -- For information

RE: [Jprogramming] Rank Question

2008-02-15 Thread Lettow, Kenneth
(reformatted the original) Hi, I have a question about composing functions. I have the following scenario. 1. I read in a csv file. 2. I split the array its constituent columns. 3. The columns are a mix of text and number data. 4. I wrote two verbs that gives me the nub, frequency, and

RE: [Jprogramming] Rank Question

2008-02-15 Thread Sherlock, Ric
February 2008 10:56 To: Programming forum Subject: RE: [Jprogramming] Rank Question (reformatted the original) Hi, I have a question about composing functions. I have the following scenario. 1. I read in a csv file. 2. I split the array its constituent columns. 3. The columns

RE: [Jprogramming] Rank Question

2008-02-15 Thread Brian Schott
I am not sure this is what you want but, for the common parts of the two verbs I think you can use the following. (@#/.~) NB. for frequency (#/.~ @% # ) NB. for % + + nfpt=:([: 1 ~.) ,. ([: 0 #/.~) ,. [: 0 #/.~ % # NB. For Text columns + nfpt2=:([: 0 ~.) ,. ([: 0 #/.~) ,. [: 0