Re: [Jprogramming] J v Python

2012-12-10 Thread Konrad Hinsen
--On 9 décembre 2012 18:03:04 -0500 Raul Miller wrote: Have you considered writing python code to build files with regular format? Yes, but that's a lot of overhead, both in terms of conversion code to write and in terms of added steps in deployment. I believe I am better off doing everythi

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Aai
((+.|.)@={"0 1 ' '&,.)'abcde' a a b b c d d e e On 10-12-12 03:42, km wrote: Write verb cross. cross 'abcde' a a b b c d d e e (Result should look like a cross with 'abcde' along both diagonals.) cross 'a' a cross 'ab' aa bb Kip Mur

Re: [Jprogramming] J v Python

2012-12-10 Thread Boyko Bantchev
On 10 December 2012 02:10, William Tanksley, Jr wrote: > Every notation has problems. If you don't see them, it's not because > they're not there. It's enormously ironic that you're denying ALL > problems with "traditional notation" I am perfectly aware that every notation has problems, and I hav

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread David Ward Lambert
cross=: ((>: * (+. |.)@:=)@:i.@:# { ({.~ (_1-#))) cross ;/'abcde' +-+-+-+-+-+ |a| | | |a| +-+-+-+-+-+ | |b| |b| | +-+-+-+-+-+ | | |c| | | +-+-+-+-+-+ | |d| |d| | +-+-+-+-+-+ |e| | | |e| +-+-+-+-+-+ cross 5 43 2 5 0 5 0 43 0 2 0 2 Date: Sun

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Linda Alvord
Numbers, too! Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of David Ward Lambert Sent: Monday, December 10, 2012 9:32 AM To: programming Subject: Re: [Jprogramming] Just for fun, verb cross cross=:

Re: [Jprogramming] J v Python

2012-12-10 Thread Raul Miller
On Sun, Dec 9, 2012 at 5:01 PM, Boyko Bantchev wrote: > I also know many people who teach mathematics or informatics at > school, at different places and certainly to students with average > (or below) mathematical abilities. My wife has been a school teacher > in mathematics for years. Neither

Re: [Jprogramming] Proofs in J

2012-12-10 Thread Don Guinn
Changing the thread. No. This is a way to check one's work in deriving a proof. And it is not too difficult to convert the tacit expression to explicit then make the proof. See example below. Interesting that you chose a monadic test. Tacit verb phrases are ambivalent. Therefore there must be two

Re: [Jprogramming] Proofs in J

2012-12-10 Thread Raul Miller
Yes... proofs are a topic that require some thought. In J, I would usually do a proof as a sequence of statements that I expect are all tautologies and where each sentence involves only a minor changes from previous/next statements. And, I would expect the reader to be verifying that they were ha

Re: [Jprogramming] J v Python

2012-12-10 Thread Devon McCormick
As for using J to teach students (presumably we're talking about elementary to high-school level), I think my exposure to APL in junior high-school (age 13) helped me better understand matrix math concepts when they were introduced in high-school. On Mon, Dec 10, 2012 at 10:21 AM, Raul Miller wr

Re: [Jprogramming] Proofs in J

2012-12-10 Thread Roger Stokes
1e308 ((+*-) -: (-&*:)) 1e308 NaN error 1e308((+*-)-:(-&*:))1e308 - Original Message - From: "Don Guinn" To: Sent: Monday, December 10, 2012 3:57 PM Subject: Re: [Jprogramming] Proofs in J Changing the thread. No. This is a way to check one's work in deriving a proof. And

Re: [Jprogramming] Proofs in J

2012-12-10 Thread David Ward Lambert
You can convert to a single dyadic proof with (the well known, I'm ensuring) verb~~ > From: Don Guinn > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Proofs in J > Message-ID: > > Content-Type: text/plain; charset=UTF-8 > > Changing the thread. > > No. This is a way t

Re: [Jprogramming] J v Python

2012-12-10 Thread Edward Mokurai Cherlin
If we are going to argue J v Python, we need to at least look at NumPy (based in part on APL) and SciPy. If anybody is interested, I can start those topics. I also have another set of issues, regarding choice of languages in working with Sugar education software. I will give the background here, a

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread bob therriault
That is lovely Arie, It is that kind of elegance that I was chasing with my rougher attempts. Using the (+.|.) hook simplifies (|.+.]) precisely and the {" 0 1 combined with ' '&,. means that the selection of the string becomes a choice in each row of displaying either the corresponding eleme

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Roger Hui
The expression fails if the argument has duplicate items. e.g. ((+.|.)@={"0 1 ' '&,.)'aabbb' |length error | ((+.|.)@={"0 1' '&,.)'aabbb' On Mon, Dec 10, 2012 at 10:18 AM, bob therriault wrote: > That is lovely Arie, > > It is that kind of elegance that I was chasing with my rougher a

Re: [Jprogramming] J v Python

2012-12-10 Thread Raul Miller
I would be interested in NumPy. I have to use python in some contexts, but I have not had the time to study all the options, and on my own it would take me years to get up to speed on something like NumPy. As for the rest of your message: I will agree with you on the need for a variety of perspec

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Raul Miller
Here's a version that works with duplicated values (except note that there was no specification for what the behavior should be in this case): (,@(#~"0"1) (+.|.)@=)'abcde' a e b d c b d a e (,@(#~"0"1) (+.|.)@=)'abcdedcba' a e a b d d b c c b d d b a e a -- Raul On

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Aai
Thanks for destroying my day. Here's a much longer alternative ' ' (,{~[:((+.|.)@= ({"0 1) 0&,.) 1+i.@#@]) 'baabb' b b a a a b b b b _ (,{~ [: ((+.|.)@=({"0 1) 0&,.) 1+i.@#@]) 1 2 1 2 1 _ _ 1 _ 2 2 _ _ 1 1 _ 2 _ _ 2 On 10-12-12 19:21, Roger Hui wrote: The expression fails if

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread bob therriault
Thanks Roger, I guess this is why we race Ferrari's and go shopping in minivans. :) My first draft survives repeats, but I still find Arie's version beautiful (and functional within the specs of not having repeated items). t0=:((>.|."1)@(*=)@:>:@i.@#){ ' ',] t0 'abcde' a a b b c

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Stefano Lanzavecchia
Ugly as hell (but my J doesn't get any better without practicing): cross =.(((1 {. 0 # ]), ]) {~ (>:*(|.+.])@(=/~))@i.@#) NB. Works for strings with replicated entries cross 'aabbcdeabcde' aa b b cc d d ee aa b b cc

Re: [Jprogramming] J v Python

2012-12-10 Thread Boyko Bantchev
On 10 December 2012 17:21, Raul Miller wrote: > > Hopefully my few minutes of effort here have done something to rectify > this gap in this part of your knowledge? You would have spent your time more fruitfully – and saved mine – had you actually read what you are posting, rather tha

Re: [Jprogramming] Proofs in J

2012-12-10 Thread Devon McCormick
((+*-) -: (-&*:))~ 10x^308 1 But mine goes to eleven: ((+*-) -: (-&*:))~ 11x^308 1 On Mon, Dec 10, 2012 at 12:46 PM, Roger Stokes < r...@rogerstokes.free-online.co.uk> wrote: > 1e308 ((+*-) -: (-&*:)) 1e308 > NaN error > 1e308((+*-)-:(-&*:))1e308 > > > - Original Message -

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Raul Miller
And, for what it's worth, here's a different plausible implementation of cross (different only for the case of duplicated letters in the argument when compared with the version I posted, below): (,@(#~"0"1) (+.|.)@=@(#\)) 'abcdedcba' Note that replacing = with =@(#\) should also work for Aai's

Re: [Jprogramming] J v Python

2012-12-10 Thread Bo Jacoby
Boyko, the discussion is futile whenyou do not believe that I am serious. But note that the expression    mc²  has the dimension of energy. The expression   cm² (= 1cm²)   has the dimension of area. Neither of these expressions evaluate into a dimensionless number. - Bo >__

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Raul Miller
For what it's worth, here's a parenthesis free implementation of my two variant definitions of cross (and note that I am using what is probably an unfamiliar J idiom here -- please feel free to ask for an explanation, if I am not making sense): selch=: #"0"1 orflp=: +.|.@ cross1=: ,@selch~ = orflp

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread km
My solution works by preparing a left argument for From { . It has rank two solutions and is limited to string arguments. cross ([: (+. |."1) [: (= * >:) [: i. #) { ' ' , ] cross 'a' a a a a a a a a a Kip Murray Sent from my iPad On Dec 10, 2012, at 1:48 PM, Rau

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread David Ward Lambert
Without looking studying the sentence evaluator, I expected +.|.@ (+. |.)@ to be identical to +.(|.@) |.@+. > Date: Mon, 10 Dec 2012 15:41:52 -0500 > From: Raul Miller > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Just for fun, verb cross > Message-ID: > +o...@ma

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Raul Miller
Yes... The precedence rule for conjunctions is different when no right argument is provided. In that case, the conjunction has lower precedence than anything else in the language. It's as if there's a "free parenthesis" to its left. In other words +.|.@ is equivalent to (+. |.)@ The reas

[Jprogramming] J v NumPy (was Re: J v Python)

2012-12-10 Thread Edward Mokurai Cherlin
On Mon, December 10, 2012 1:26 pm, Raul Miller wrote: > I would be interested in NumPy. > > I have to use python in some contexts, but I have not had the time to > study all the options, and on my own it would take me years to get up > to speed on something like NumPy. Start here. http://docs.sci

Re: [Jprogramming] J v NumPy (was Re: J v Python)

2012-12-10 Thread Raul Miller
Gripes: The type system seems way too complex -- why should I care in the typical case, what type of value is used to represent the numeric value 1? Why can't it give me consistent operations? For example, I do not like that booleans do not include the value 0 and 1 -- this not only perpetuates

[Jprogramming] convert 0,1 coding to _1,1

2012-12-10 Thread Brian Schott
Is there a better way than the verb `am` to do the following? am =:_1& (I.@:-.@]}) am"1] 2 6 ?.@$ 2 _1 _1 _1 _1 1 _1 _1 _1 _1 1 1 _1 (B=) -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Linda Alvord
((+.|.)@={"0 1 ' '&,.)'apple' |length error | ((+.|.)@={"0 1' '&,.)'apple' I think the letters must be in alphabetical order. Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of bob therriault Sen

Re: [Jprogramming] Just for fun, verb cross

2012-12-10 Thread Linda Alvord
Roger's explanation is better than mine. Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda Alvord Sent: Monday, December 10, 2012 7:41 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Ju

Re: [Jprogramming] convert 0,1 coding to _1,1

2012-12-10 Thread Peter B. Kessler
Double the distance between 0 and 1, and then shift those points left one unit on the number line. am2=: ((-&1) @ +:) am2"1] 2 6 ?.@$ 2 _1 _1 _1 _1 1 _1 _1 _1 _1 1 1 _1 Does that make sense? ... peter Brian Schott wrote: Is there a better way than

Re: [Jprogramming] convert 0,1 coding to _1,1

2012-12-10 Thread David Ward Lambert
<:@:+: 0 1 _1 1 (_1 + +:)0 1 NB. for Linda _1 1 > Date: Mon, 10 Dec 2012 19:13:05 -0500 (EST) > From: Brian Schott > To: programm...@jsoftware.com > Subject: [Jprogramming] convert 0,1 coding to _1,1 > Message-ID: > Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII > > Is there a

Re: [Jprogramming] convert 0,1 coding to _1,1

2012-12-10 Thread Brian Schott
Peter and David, Thanks. That is a way that I had forgotten and may be preferred. --- (B=) On Dec 10, 2012, at 7:13 PM, Brian Schott wrote: > Is there a better way than the verb `am` to do the following? > > am =:_1& (I.@:-.@]}) > am"1] 2 6 ?.@$ 2 > _1 _1 _1 _1 1 _1 > _1 _1 _1 1 1 _1 >

Re: [Jprogramming] convert 0,1 coding to _1,1

2012-12-10 Thread Linda Alvord
"My way" would even work in Algebra I. Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of David Ward Lambert Sent: Monday, December 10, 2012 7:58 PM To: programming Subject: Re: [Jprogramming] convert 0,1

Re: [Jprogramming] convert 0,1 coding to _1,1

2012-12-10 Thread Roger Hui
If you really are converting random boolean values to (1,_1) values, another possibility is _1&^ or _1^]; i.e. 0 to 1 and 1 to _1. On Mon, Dec 10, 2012 at 8:58 PM, Brian Schott wrote: >timespacex > 6!:2 , 7!:2@] >am =:_1& (I.@:-.@]}) >am2=: ((-&1) @ +:) >amd=: <:@:+: >aml=: _

Re: [Jprogramming] convert 0,1 coding to _1,1

2012-12-10 Thread Roger Hui
Also {&_1 1 . On Mon, Dec 10, 2012 at 11:32 PM, Roger Hui wrote: > If you really are converting random boolean values to (1,_1) values, > another possibility is _1&^ or _1^]; i.e. 0 to 1 and 1 to _1. > > > > On Mon, Dec 10, 2012 at 8:58 PM, Brian Schott wrote: > >>timespacex >> 6!:2 , 7!:2@]

Re: [Jprogramming] convert 0,1 coding to _1,1

2012-12-10 Thread Brian Schott
Those are fast and lean, as you can see below. amr=: _1&^ timespacex 'amr d' 0.002708 8.39027e6 amr1=: {&_1 1 timespacex 'amr1 d' 0.002657 8.39027e6 On Tue, Dec 11, 2012 at 2:39 AM, Roger Hui wrote: > Also {&_1 1 . > > > On Mon, Dec 10, 2012 at 11:32 PM, Roger Hui wrote: > >> If yo