[Jprogramming] complex numbers in a grid

2008-10-07 Thread L.Tomei
Hi all, I need to put complex numbers in a grid control, but I get an error because the 8!:0 verb does not allow complex arguments: cmplx=: 3 3 $ 0 j. i.9 load 'grid' grid cmplx |domain error: fmt | fmt y My workaround is to re-define the fmt verb in the jzgrid locale, in order t

[Jprogramming] string to number and back to string

2008-10-07 Thread Alex Rufon
Hi everyone, I've been busy these last 3 weeks with the "optimizations" for my project. It's in quotes because I still don't have accurate metrics on comparison between old and new system. Still, I've taken a lot of the advice here in the forum and it will work ... for better or worse. Hehehehehe.

Re: [Jprogramming] string to number and back to string

2008-10-07 Thread Alex Rufon
Yes ... exchange supports IMAP. On Tue, 2008-10-07 at 18:32 +0800, bill lam wrote: > On Tue, 07 Oct 2008, Alex Rufon wrote: > > I've taken the plunged and formatted my Lenovo T61 with Ubuntu 8.04 and > > installed WindowsXP on a virtual machine. The only hair pulling part is > > getting Evolution

Re: [Jprogramming] Longest run from a list

2008-10-07 Thread Edushka S.
> I've got a sorted list of numbers, and I want to find the longest run > of consecutive integers: > > 2 4 5 6 12 --> 3 > 1 2 3 4 5 6 --> 6 My simple solution: ms =: [: >./ [: (# ;. 2) 0 ,~ _1 = 2-/\] Seems to be pretty fast one: in =: 1e6 [EMAIL PROTECTED] 10 6!:2 'ms in' 0.0336962 --

[Jprogramming] JDB with no harddisk caching

2008-10-07 Thread Alex Rufon
Hi Chris/Oleg, I have the following questions for JDB: 1. Would it be possible to use JDB without creating the physical file structure? I.e. Folders and files. 2. How do I find out the existing tables in a database without reading the "dir" file? 3. Isn't it logical to get a "Read" verb at the tab

Re: [Jprogramming] string to number and back to string

2008-10-07 Thread Raul Miller
On Tue, Oct 7, 2008 at 5:19 AM, Alex Rufon <[EMAIL PROTECTED]> wrote: > Playing with this we get: > NB. converting from string to numbers > searchLOOKUP ;: 'The quick brown fox jumped' > 12 13 14 15 16 > searchLOOKUP 'fox' > 15 > searchLOOKUP 'Fox' > 17 > NB. converting from numbers to string

Re: [Jprogramming] string to number and back to string

2008-10-07 Thread bill lam
On Tue, 07 Oct 2008, Alex Rufon wrote: > I've taken the plunged and formatted my Lenovo T61 with Ubuntu 8.04 and > installed WindowsXP on a virtual machine. The only hair pulling part is > getting Evolution to use MS-Exchange's OWA access. Up to now, I still > can't get my Global Address List. Grrr

Re: [Jprogramming] string to number and back to string

2008-10-07 Thread Dan Bron
Alex Rufon wrote: > A few years back, I've asked this same forum on how to > convert strings to numbers and back again. I remember these discussions. Oleg suggested s2i =: 6 s: s: [1], and in a follow up a few years later, you responded that you'd tried the suggestion, but it didn't meet

Re: [Jprogramming] string to number and back to string

2008-10-07 Thread Dan Bron
I wrote: > Oleg suggested s2i =: 6 s: s: [1], but it didn't meet > your needs because of the memory constraints imposed by > your architecture [2]. Whoops, forgot the links: [1] http://www.jsoftware.com/pipermail/general/2004-March/016703.html [2] http://www.jsoftware.com/pipermail/genera

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Randy MacDonald
Hello Dan; If you are saying that when an optimization results in a result smaller than what ": would give, you use the optimized string, something an APLer, like me, who remembers 1200 baud as lightning fast, would appreciate, my intuition said that wasn't the case in the instances I was us

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Randy MacDonald
Hello Ric; I guess all that I can say is that rank coloring wouldn't solve any problems that $x doesn't. The existing syntax coloring already taxes my cognitive powers, as it has done since color came to APL+PC. Sherlock, Ric wrote: ---Randy MacDonald wrote: (I'll leave the irony of no

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Dan Bron
Randy wrote: > an actual test would confirm or refute this [whether the] > optimization results in a result smaller than what ": would give I included such a test in the message you quoted: > 5!:5{.;:'A' > 29+14.5*i.100 > ":A > 29 43.5 58 72.5 87 101.5 116 130.5 1

[Jprogramming] Modified assignment

2008-10-07 Thread Graham Parkhouse
Dear J Forum Dyalog APL allows f <- where f is a dyadic function, as in a <- 10 rho 0 a[2 2 5 6 2] + <- 3 4 5 6 7 a 0 0 14 0 0 5 6 0 0 0 How do I do this in J? Amend won't do it - I didn't expect it to. a=: 10$0 a=: a+(3 4 5 6 7)(2 2 5 6 2)}a a 0 0 7 0 0 5 6 0 0 0 The

Re: [Jprogramming] Modified assignment

2008-10-07 Thread Dan Bron
> Dyalog APL allows f <- where f is a dyadic function, as in > How do I do this in J? You need to roll up all repeated elements, then do the amendment. In this case, you need to sum all the contributions at the same index, then use the nub of the indices to amend the sums back into the array.

Re: [Jprogramming] JDB with no harddisk caching

2008-10-07 Thread Oleg Kobchenko
> From: Alex Rufon <[EMAIL PROTECTED]> > > Hi Chris/Oleg, > > I have the following questions for JDB: > 1. Would it be possible to use JDB without creating the physical file > structure? I.e. Folders and files. This is an interesting and question which was discussed. There are a few approaches,

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Randy MacDonald
Hello Henry; Yes, they jump to conclusions, conclusions that are in this case wrong, which you cannot tell by looking. A little test, no, the willingness to do a little test, helps to avoid a lot of potholes. A false intuition I found in some beginner APL classes I taught: x =:2 y =: x+2

RE: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Sherlock, Ric
---Randy MacDonald wrote: > I guess all that I can say is that rank coloring wouldn't solve any > problems that $x doesn't. The existing syntax coloring > already taxes my > cognitive powers, as it has done since color came to APL+PC. Yes $x will tell you the same information, but you would have

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Randy MacDonald
Hello Raul; I don't see the coloration you describe as a problem, since 'example' will not be an adverb until the line following the assignment. Raul Miller wrote: On Mon, Oct 6, 2008 at 4:11 PM, Sherlock, Ric <[EMAIL PROTECTED]> wrote: As for "where does it end?", given that this would b

Re: [Jprogramming] string to number and back to string

2008-10-07 Thread Dan Bron
I wrote: > The problem is that if your domain is unbounded (i.e. the input strings > are arbitrary and there are no constraints on their content or length), > and you need a 1:1 mapping, then your range is unbounded too. > That is, the strings are as efficient a representation as you're goi

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Raul Miller
On Tue, Oct 7, 2008 at 4:35 PM, Randy MacDonald <[EMAIL PROTECTED]> wrote: > I don't see the coloration you describe as a problem, since 'example' will > not be an adverb until the line following the assignment. If I divide your sentence into two parts, splitting on the comma, I would agree with t

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Randy MacDonald
Hello Dan; The obvious case you mention is fine enough, yet... dd =: monad : '5!:5<''y''' dd 1 2 3 4 5 6 7 1 2 3 4 5 6 7 dd 1 2 3 4 5 6 7 8 NC. it takes its time to switch over. 1+i.8 dd ,:1 2 NB. The result exceeds ": 1+i.1 2 Which just means test as you go, the criterion is far from

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Randy MacDonald
Hello Ric; Actually, $x is such a part of my toolbox that there is no thinking to use it. Those adverse to a little thought might want to go in another direction. It is also something one doesn't have to wait on the whims of the implementors for like syntax coloring would be. Now if J's w

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Randy MacDonald
Hello Raul; I see the following as an error: example =: / +example ... I wonder how these lines would be colored? example =: 2 example =: + example =: / I expect a flaw. Raul Miller wrote: On Tue, Oct 7, 2008 at 4:35 PM, Randy MacDonald <[EMAIL PROTECTED]> wrote: I don't see the colorat

RE: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Dan Bron
Randy, I don't understand the comments: >dd 1 2 3 4 5 6 7 8 NC. it takes its time to switch over. > 1+i.8 > dd ,:1 2 NB. The result exceeds ": > 1+i.1 2 or how they relate to your conclusion: > Which just means test as you go, the criterion is far from > simple. -Dan ---

[Jprogramming] RE: Modified assignment

2008-10-07 Thread Graham Parkhouse
Thank you, Dan! I do browse through the vocabulary but apparently don't take in the functionality until I need it! Key (/.) does the job nicely and I was unaware of it. Yes, I know Dyalog APL quite well, but haven't used it for two years since I moved to J. Shouldn't ardent APLers be populating th

RE: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Dan Bron
I wrote: > I don't understand Regarding your comment: > dd ,:1 2 NB. The result exceeds ": > 1+i.1 2 Ah, I see. You're saying (dd >&# ":) ,: 1 2 . Well, keep two things in mind: (A) For large arguments, dd will either dramatically beat or tie with ": . For small arguments, th

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Roger Hui
linrep=: 3 : '5!:5 <''y''' linrep 99+i.5 99 100 101 102 103 linrep 99+i.6 99 100 101 102 103 104 linrep 99+i.7 99 100 101 102 103 104 105 linrep 99+i.8 99+i.8 http://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two

Re: [Jprogramming] string to number and back to string

2008-10-07 Thread bill lam
On Tue, 07 Oct 2008, Alex Rufon wrote: > Yes ... exchange supports IMAP. > > On Tue, 2008-10-07 at 18:32 +0800, bill lam wrote: > > On Tue, 07 Oct 2008, Alex Rufon wrote: > > > I've taken the plunged and formatted my Lenovo T61 with Ubuntu 8.04 and > > > installed WindowsXP on a virtual machine.

Re: [Jprogramming] string to number and back to string

2008-10-07 Thread Alex Rufon
Hi Raul, Thanks for the idea, particularly on the use of asserts. I've know of them but for some reason never used them. I have an idea on where to put them in my code. thanks. One of my source of J optimization was Chapter 35 of J for C Programmer ... specifically the topic Tips For Coding. Ther

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Randy MacDonald
Hello Dan; dd 1 2 1 2 dd 1 2 3 1 2 3 dd 1 2 3 4 1 2 3 4 dd 1 2 3 4 5 1 2 3 4 5 dd 1 2 3 4 5 6 1 2 3 4 5 6 dd 1 2 3 4 5 6 7 1 2 3 4 5 6 7 dd 1 2 3 4 5 6 7 8 NB. J seems to wait for an 8 item list to kick in the i. 1+i.8 My conclusion was that I didn't see what J was using to deci

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Randy MacDonald
Hello Dan; The more comments you use to justify dd, the less attractive I find it. Dan Bron wrote: I wrote: I don't understand Regarding your comment: dd ,:1 2 NB. The result exceeds ": 1+i.1 2 Ah, I see. You're saying (dd >&# ":) ,: 1 2 . Well, keep two things in

Re: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread Randy MacDonald
Hello Roger; linrep=: 3 : '5!:5 <''y''' linrep ,:99+i.5 99+i.1 5 linrep ,:99+i.6 99+i.1 6 linrep ,:99+i.4 99+i.1 7 linrep ,:99+i.4 99+i.1 4 linrep ,:99+i.3 99+i.1 3 linrep ,:99+i.1 99+i.1 2 linrep ,:99+i.1 ,.99 Tables don't seem to wait for 7 items.. hmm. Roger Hui wrote:

Re: [Jprogramming] performance : J or C ?

2008-10-07 Thread Robert Cyr
Of course my intent was not to challenge grep or the numerous searching utilities at our disposal. As far as grep is concerned, even in this trivial case I find J easier to use and gave up on grep after a few tests. The intent of the note to the forum was simply to point out that if properly used

Re: [Jprogramming] string to number and back to string

2008-10-07 Thread Alex Rufon
Hi Dan, Thanks for the reply. On Tue, 2008-10-07 at 11:47 -0400, Dan Bron wrote: > Alex Rufon wrote: > > A few years back, I've asked this same forum on how to > > convert strings to numbers and back again. > > I remember these discussions. Oleg suggested s2i =: 6 s: s: [1], and in a >

Re: [Jprogramming] string to number and back to string

2008-10-07 Thread Alex Rufon
Hi Bill, I never knew there was something like this. I'll look into it. Although I really prefer a J only solution since I am thinking of using JDB on a linux server. Still, thanks. :) r/Alex On Wed, 2008-10-08 at 08:30 +0800, bill lam wrote: > On Tue, 07 Oct 2008, Alex Rufon wrote: > > > Yes

RE: [Jprogramming] performance : J or C ?

2008-10-07 Thread Sherlock, Ric
Robert, my impression was that Oleg was just adding to the point that you were making - i.e. that not only is the C code only a bit faster than J, but you also need check that it is portable across platforms and you have to compile for each supported platform etc unlike J. ---Robert Cyr wro

Re: [Jprogramming] JDB with no harddisk caching

2008-10-07 Thread Alex Rufon
Hi, I guess another approach in designing the complete in-memory database is on how I expect to use it. So here is a scenario where I would use an in-memory database. First off, I need to import data from multiple sources, MS-SQL, Oracle, SAP, AS400 export text files, EDI files, Excel File, PDF

RE: [Jprogramming] Difference between 5^100x and x: 5^100

2008-10-07 Thread 0j1
How about passing the result to a user-configurable J verb and then showing the output of that as well as (or instead of) the original result. Something like: x =: option NB. 0 -> off, 1 -> as-well-as(default), 2 -> instead-of y =: verb NB. J verb as string or gerund x showinfo y NB. e.g.