Re: [Jprogramming] testing for J version or later

2023-12-24 Thread chris burke
Since stdlib is not updated for older versions of J, addons that depend on the J version will have to use their own test like your original jversion function. Alternatively, set the addon manifest RELEASE for 9.4 or later and just support the new version number. The 9!:14 result is then parsed in

Re: [Jprogramming] testing for J version or later

2023-12-24 Thread Ian Clark
I've a better idea. Establish a new system flag called (say) VERSION_z_ and assign it within stdlib.ijs (c/f IFJHS or JLIB) the integer form of the J version (currently this would be VERSION_z_ = 951). Then ~addons/math/cal/cal.ijs, or some other utility with a version dependency, could test for

Re: [Jprogramming] testing for J version or later

2023-12-21 Thread Raul Miller
Hmm... only if we're updating stdlib, supporting versions of J back to 4.0.1. A worthwhile effort, though, if someone was actually tackling those issues. Otherwise, I think an idiom would be about as good as it gets. -- Raul On Thu, Dec 21, 2023 at 9:24 PM Ian Clark wrote: > > For those of us

[Jprogramming] testing for J version or later

2023-12-21 Thread Ian Clark
For those of us digital archaeologists running back-levels of J, it would be nice to have a robust test for a given version of J or later which tolerates versions down to 4.01, say. What represents best-practice? The best I can come up with is: jversion=: 3 : 0 ". 'j.' -.~ '/' taketo 9!:14''

[Jprogramming] testing

2022-09-15 Thread 'Michael Day' via Programming
Please ignore - with apoplogies - Mike -- For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] Testing for gerund

2017-08-03 Thread Jose Mario Quintana
Testing for gerund might be a little trickier than one might think at first sight (and it is context dependent)... fx=. 5!:0 erase'v' 1 isgerund 'v' 0 'v'fx |value error: v |[-0] So far so good; but, v=. + isgerund 'v' 0 'v'fx + On Wed, Aug 2, 2017 at 10:07 PM, 'Pasc

Re: [Jprogramming] Testing equality of arrays

2014-07-17 Thread 'Pascal Jasmin' via Programming
you want -: not =    (2 2 $ i.4)-: i. 2 2 1 - Original Message - From: Jon Hough To: programm...@jsoftware.com Cc: Sent: Thursday, July 17, 2014 10:26:30 PM Subject: [Jprogramming] Testing equality of arrays Firstly, sorry, I am typing on my phone. There may be spelling errors. I

Re: [Jprogramming] Testing equality of arrays

2014-07-17 Thread Kip Murray
Use Match -: . 1 2 3 -: 1 2 3 1 http://www.jsoftware.com/jwiki/Vocabulary/minusco#dyadic On Thursday, July 17, 2014, Jon Hough wrote: > Firstly, sorry, I am typing on my phone. There may be spelling errors. > > I am trying to test eqaulity of multidimension arrays. > I.e checkif array A is

[Jprogramming] Testing equality of arrays

2014-07-17 Thread Jon Hough
Firstly, sorry, I am typing on my phone. There may be spelling errors. I am trying to test eqaulity of multidimension arrays. I.e checkif array A is elementwise equal to array B. Problem is the answer is always an array of 1 and 0, because each element is checked against its corresponding eleme

Re: [Jprogramming] Testing for singular matrices

2014-07-11 Thread Roger Hui
, I've never seen -/ .* before. Is it in the Dictionary somewhere? > > > Date: Fri, 11 Jul 2014 06:52:37 -0700 > > From: rogerhui.can...@gmail.com > > To: programm...@jsoftware.com > > Subject: Re: [Jprogramming] Testing for singular matrices > > > > A mat

Re: [Jprogramming] Testing for singular matrices

2014-07-11 Thread Roger Hui
erhui.can...@gmail.com > > To: programm...@jsoftware.com > > Subject: Re: [Jprogramming] Testing for singular matrices > > > > A matrix M is singular iff 0 = -/ .* M (determinant is 0). Matrix > algebra > > on a computer is a snakepit so sometimes you may have to a number

Re: [Jprogramming] Testing for singular matrices

2014-07-11 Thread Jon Hough
Got it. Thank you. Although, I've never seen -/ .* before. Is it in the Dictionary somewhere? > Date: Fri, 11 Jul 2014 06:52:37 -0700 > From: rogerhui.can...@gmail.com > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Testing for singular matrices > > A mat

Re: [Jprogramming] Testing for singular matrices

2014-07-11 Thread Raul Miller
Note also that you can trap the domain error that %. gives you. -- Raul On Fri, Jul 11, 2014 at 9:52 AM, Roger Hui wrote: > A matrix M is singular iff 0 = -/ .* M (determinant is 0). Matrix algebra > on a computer is a snakepit so sometimes you may have to a number with tiny > magnitude, ins

[Jprogramming] Testing for singular matrices

2014-07-11 Thread Jon Hough
Reading through the dictionary, I see that %. is only defined for non-singular matrices. http://www.jsoftware.com/help/dictionary/d131.htm If I accidentally use a singular matrix, I get a domain error. So my question is, what is the best way to test for non-singularity in J?for 2x2 matrices, it

Re: [Jprogramming] Testing for singular matrices

2014-07-11 Thread Roger Hui
A matrix M is singular iff 0 = -/ .* M (determinant is 0). Matrix algebra on a computer is a snakepit so sometimes you may have to a number with tiny magnitude, instead of 0. One of the pleasures of rational numbers is the ability to use 0 here, no ifs or buts. On Fri, Jul 11, 2014 at 6:46 AM,

Re: [Jprogramming] testing for variations of false null empty

2014-05-11 Thread Raul Miller
On Sun, May 11, 2014 at 9:16 PM, 'Pascal Jasmin' via Programming wrote: > thank you Kip and Raul, > > I settled on: > > booltest=: [: -. [: *./ 0 = , Oops, you are right, I inverted the logic you had asked for. Looking at things this way, you could also use +./@:~:&0@, Thanks, -- Raul ---

Re: [Jprogramming] testing for variations of false null empty

2014-05-11 Thread 'Pascal Jasmin' via Programming
2 4 - Original Message - From: Raul Miller To: Programming forum Cc: Sent: Sunday, May 11, 2014 7:53:35 PM Subject: Re: [Jprogramming] testing for variations of false null empty On Sun, May 11, 2014 at 5:08 PM, 'Pascal Jasmin' via Programming wrote: > booltest =. (

Re: [Jprogramming] testing for variations of false null empty

2014-05-11 Thread Henry Rich
booltest =: +./@, Henry Rich On 5/11/2014 5:08 PM, 'Pascal Jasmin' via Programming wrote: booltest =. (0<+./) *. 0<# is designed to return 0 for 0 0 0 and i.0, and hopefully this: booltest i.0 0, but: (i.0) -: booltest i.0 0 1 the problem with all of this is: 3 : 'if. boolte

Re: [Jprogramming] testing for variations of false null empty

2014-05-11 Thread Raul Miller
On Sun, May 11, 2014 at 5:08 PM, 'Pascal Jasmin' via Programming wrote: > booltest =. (0<+./) *. 0<# > is designed to return 0 for 0 0 0 and i.0, and hopefully this: > booltest i.0 0, but: > > (i.0) -: booltest i.0 0 > 1 > > the problem with all of this is: >3 : 'if. booltest i. 0 0 do. 1

Re: [Jprogramming] testing for variations of false null empty

2014-05-11 Thread Kip Murray
Consider isboolean=: [: *./ , e. 0 1"_ from system file validate.ijs (I keep a copy and don't remember where I found it). isboolean 0 0 0 1 isboolean i.0 1 isboolean i. 0 0 1 Do you want [: -. isboolean ? On Sunday, May 11, 2014, 'Pascal Jasmin' via Programming < programm...@jsoftw

[Jprogramming] testing for variations of false null empty

2014-05-11 Thread 'Pascal Jasmin' via Programming
booltest =. (0<+./) *. 0<# is designed to return 0 for 0 0 0  and i.0, and hopefully this:   booltest i.0 0, but:   (i.0) -: booltest i.0 0 1 the problem with all of this is:    3 : 'if. booltest i. 0 0 do. 1 else. 0 end.' 4 1 so, it appears I need a 3 part test?  How would I write it? ---

[Jprogramming] Testing, testing ...

2014-02-14 Thread km
This is a test to see whether I can reach the programming forum. ==Kip Murray Sent from my iPad -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread greg heil
take. Yes their will be nay sayers. Yes they will get more forceful and vocal >as seeker approaches a prime. So what? It is a, perhaps in a larger context - >the, growth path. greg ~krsnadas.org -- from:William Tanksley, Jr to: programm...@jsoftware.com date:14 May 2013

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread William Tanksley, Jr
greg heil wrote: >i do try not to use one on "short" lines. Yes, that would be slightly annoying. It's only extremely annoying when it's used on long lines -- it blocks the reply editor from being able to properly mark your text as being a reply. It makes a lot of sense to use it on code. I don'

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread greg heil
. Memory is a critical faculty for (human) >intelligence, i do every thing to keep it sharp and unobfuscated. greg ~krsnadas.org -- from: William Tanksley, Jr to: programm...@jsoftware.com date: 14 May 2013 08:13 subject: Re: [Jprogramming] Testing consecutive pairs of primes greg heil wrote

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread greg heil
Phil Ah, that would explain why both 2 and 3 were exceptions in the hypothesis! greg ~krsnadas.org -- from: Philip Hunt (USA) to: programm...@jsoftware.com date: 14 May 2013 08:38 subject: Re: [Jprogramming] Testing consecutive pairs of primes >Before I make a fool of myself I'll a

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread Philip Hunt (USA)
Before I make a fool of myself I'll apologize up front that I'm an absolute beginner in J... :-) and I love learning from these posts (although some are still beyond my reach). Comment: Simple number theory says that all prime pairs are a multiple of 6 plus/minus 1, since when in mod 6 all nu

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread greg heil
So i made one: >a correctly stated related hypothesis and an algorithmic exploration. >Certainly my hypothesis holds for all reasonably computable primes. i would be >curious if it holds also generally. greg ~krsnadas.org -- from: William Tanksley, Jr to: programm...@jsoftware.com date

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread William Tanksley, Jr
greg heil wrote: > Marc >The '>' was a discovery of mine, >a mail user agent (MUA) sees a line beginning with > as not needing its >services as a formatter. I think it was a great discovery, but could you please use it only when it's actually intended? It's _really_ hard to reply to a post where

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread greg heil
from: Marc Simpson via forums.jsoftware.com to: programm...@jsoftware.com date: 14 May 2013 07:31 subject: Re: [Jprogramming] Testing consecutive pairs of primes Somewhat off topic: >Greg, I find reading your posts here quite confusing as you seem to use a >leading ">" (typi

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread Raul Miller
On Tue, May 14, 2013 at 10:08 AM, greg heil wrote: >?? Where did that come from? As to the congruity of subjects we are speaking >of ... that is truly a philosophical question which, unlike Wittgenstein, is a >morass i would prefer not to indulge in. Your contributions have beenvery, nay >extre

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread William Tanksley, Jr
greg heil wrote: > 2.5 is not even an integer, how could it be a prime? The confusion for me is probably the same as for Raul. You are making statements like "the hypothesis is true for all numbers tested except 2 and 3." This is confusing to both Raul and myself, because the statement of the hyp

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread Marc Simpson
p:NB. prime? > pip=:(>@{:) @(pp hpp=: >@}:@(pq ek ]) @ (-:@>:@pip) NB. half primes of pairs > >hpp 1e8 > 2 3 > > greg > ~krsnadas.org > > -- > > from: Raul Miller > to: Programming forum > date: 14 May 2013 04:42 > subject: Re: [

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread greg heil
airs hpp 1e8 2 3 greg ~krsnadas.org -- from: Raul Miller to: Programming forum date: 14 May 2013 04:42 subject: Re: [Jprogramming] Testing consecutive pairs of primes On Mon, May 13, 2013 at 8:58 PM, greg heil wrote: > i suppose your point might be true in some abstract sense. hpp show

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-14 Thread Raul Miller
On Mon, May 13, 2013 at 8:58 PM, greg heil wrote: > i suppose your point might be true in some abstract sense. hpp shows > that for all practically computable primes the hypothesis is true, > except for the primes of 2 and 3. Are you saying 2.5 is a prime number? Or are we talking about differen

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-13 Thread greg heil
to that, not something he defined, explicitly, as not an issue. greg ~krsnadas.org -- from: Raul Miller to: Programming forum date: 13 May 2013 10:25 subject: Re: [Jprogramming] Testing consecutive pairs of primes >Induction, by inspection of a prefix of the sequence of prime numbers, is

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-13 Thread Raul Miller
On Mon, May 13, 2013 at 12:46 PM, greg heil wrote: >>2 and 3 are the only results of hpp 1e8 so pseudo induction seems to be very >>consistent here. Are there any other primes of the form 5%~p+q where p and q >>are paired primes? Maybe there is logic to say it is so. Or maybe a better >>algorit

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-13 Thread greg heil
krsnadas.org -- from: Roger Hui to: Programming forum date: 12 May 2013 22:16 subject: Re: [Jprogramming] Testing consecutive pairs of primes >My point was that "induction" in the sense of "it works for a few (or a few >billion) cases" is an unreliable guide to what is

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-12 Thread Roger Hui
(p+q)%2 is prime > too, then p < r and r < q, and so p and q are not consecutive primes. QED. > There is no need for induction. > > > > > > > > > Fra: Roger Hui > >Til: Programming forum > >Sendt: 4:01 m

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-12 Thread Bo Jacoby
ve primes. QED.  There is no need for induction. > > Fra: Roger Hui >Til: Programming forum >Sendt: 4:01 mandag den 13. maj 2013 >Emne: Re: [Jprogramming] Testing consecutive pairs of primes > > >Henry has already argued that if p and

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-12 Thread Roger Hui
Henry has already argued that if p and q are consecutive primes then (p+q)%2 can not be prime. I just want to say that reasoning of the sort: While it might be possible for the larger primes, I'm thinking not - just by induction. is unreliable, at best. That is, it is unreliable to come a concl

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-12 Thread Roger Hui
Henry has already argued that if p and q are consecutive primes then (p+q)%2 can not be prime. I just want to say that reasoning of the sort: While it might be possible for the larger primes, I'm thinking not - just by induction. On Sun, May 12, 2013 at 3:07 AM, Alan Stebbens wrote: > Program

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-12 Thread greg heil
hpp 1e9 gives out of memory NB. Except for the first two pairs, it appears that none work... greg ~krsnadas.org -- from: R.E. Boss to: programm...@jsoftware.com date: 12 May 2013 08:56 subject: Re: [Jprogramming] Testing consecutive pairs of primes All the boxing is unnecessary. Here is

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-12 Thread R.E. Boss
ox items of same shape. R.E. Boss > -Oorspronkelijk bericht- > Van: programming-boun...@forums.jsoftware.com > [mailto:programming-boun...@forums.jsoftware.com] Namens Alan Stebbens > Verzonden: zondag 12 mei 2013 12:08 > Aan: programm...@jsoftware.com > Onderwerp: [Jprogramming] Testi

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-12 Thread greg heil
e.com date: 12 May 2013 04:51 subject: Re: [Jprogramming] Testing consecutive pairs of primes I don't quite get the problem statement. r =. (p+q)%2 is between p and q; so if p and q are CONSECUTIVE primes, r cannot be prime. -- from: Alan Stebbens to: programm...@jsoftware.com date: 12 May

Re: [Jprogramming] Testing consecutive pairs of primes

2013-05-12 Thread Henry Rich
I don't quite get the problem statement. r =. (p+q)%2 is between p and q; so if p and q are CONSECUTIVE primes, r cannot be prime. Henry Rich On 5/12/2013 6:07 AM, Alan Stebbens wrote: ProgrammingPraxis (at http://programmingpraxis.com/2013/05/10/mindcipher) offered a problem asking, given p

[Jprogramming] Testing consecutive pairs of primes

2013-05-12 Thread Alan Stebbens
ProgrammingPraxis (at http://programmingpraxis.com/2013/05/10/mindcipher) offered a problem asking, given p, q as two consecutive pairs of primes, if (p+2)%2 could be prime. Since both p & q (> 2) are prime, their sum is an even number and not prime, but could the half of their sum be a prime? I'

[Jprogramming] Testing

2013-02-09 Thread km
lebd y -- - 2 3 4 - -- 5 6 -- 30 41 52 -- -- Sent from my iPad -

[Jprogramming] Testing

2013-02-09 Thread km
y +---+-+ |+-+|+---+---+| ||2 3 4|||5 6|+-+|| |+-+|| ||0 1 2||| | || ||3 4 5||| | || |+-+|| | |+---+---+| +---+-+ lebd y NB. left edge boxed display ── ─ 2 3 4

[Jprogramming] Testing

2013-02-09 Thread km
]y=: (<<2 3 4),<(5 6 ;