Re: [Jprogramming] order

2022-04-09 Thread Elijah Stone
With multiprocessors, the calculus changes. Sort is still O(n) (I think it can be O(lgn), but with bad constant factors), but hashing is O(1). And there are interesting cases where you do have n processors (hpc, gpgpu). In effect, once you have enough processors, they serve to hide the latenc

Re: [Jprogramming] order

2022-04-09 Thread Henry Rich
I'm with Raul on this.  A hashtable is a fine idea when memory is fast, but if the hashtable greatly exceeds D3$ every hash lookup will be a page miss which is hideous.  A merge sort would look pretty good then. Henry Rich On 4/9/2022 3:23 PM, Elijah Stone wrote: If ~.!.1 is used, then how wou

Re: [Jprogramming] order

2022-04-09 Thread Elijah Stone
If ~.!.1 is used, then how would we denote a -. operating on sorted arguments? I build the hash table concurrently, using a multiprocessor; this means the elements are processed out of order. Two ways of proceeding, not yet sure which is better. The first is for each thread to accumulate the

Re: [Jprogramming] order

2022-04-09 Thread Raul Miller
On Sat, Apr 9, 2022 at 5:27 AM Elijah Stone wrote: > Hashing is O(1) (or, if you prefer, O(#y) for ~.y, same as sorting). A > sufficiently smart(tm) hash function will avoid inordinate collision > rates, so I am not sure what worst case behaviour you are referring to. Collision rates are indeed

Re: [Jprogramming] order

2022-04-09 Thread Henry Rich
I would favor ~.!.1.  No mnemonic value, but less likely to be forgotten. What is your fast algorithm? Henry Rich On 4/9/2022 4:03 AM, Elijah Stone wrote: Suppose that ~. (and perhaps some relatives) can be implemented much more efficiently if no guarantee is made about the order of the resul

Re: [Jprogramming] order

2022-04-09 Thread Elijah Stone
On Sat, 9 Apr 2022, Raul Miller wrote: People will say that certain algorithms, such as hashing, are highly efficient. But these assertions are quite often not accompanied by adequate benchmarking on large datasets. And, these approaches often have inefficient worst case behavior. Hashing i

Re: [Jprogramming] order

2022-04-09 Thread Raul Miller
On Sat, Apr 9, 2022 at 4:04 AM Elijah Stone wrote: > Suppose that ~. (and perhaps some relatives) can be implemented much more > efficiently if no guarantee is made about the order of the result. Is it > too much of an abuse of notation to use ({~?~@#)@~. as a special > combination to invoke such

Re: [Jprogramming] Order of Execution

2019-10-03 Thread Raul Miller
Hmm... ({.% */@}.) 1 2 3 4 5 would actually work if we replaced 1 2 3 4 5 with an arbitrary different list of numbers. It would not work, though, if we replaced % with a different verb. Thanks, -- Raul On Thu, Oct 3, 2019 at 5:22 PM Nollaig MacKenzie wrote: > > I'm guessing > > %*/2 3 4

Re: [Jprogramming] Order of Execution

2019-10-03 Thread Nollaig MacKenzie
I'm guessing %*/2 3 4 5 wouldn't count On 2019.10.02 23:43:40, you, the extraordinary Skip Cave, spake thus: > > I can write: > 1%(2%(3%(4%5))) > > 1.875 > > > Using insert, I can simplify: > > %/1 2 3 4 5 > > 1.875 > > > Now I can write: > > (((1%2)%3)%4)%5 > > 0.008

Re: [Jprogramming] Order of Execution

2019-10-02 Thread Skip Cave
Thanks Roger. I have run into this issue a couple of times, and I knew J must have a solution. I just need to remember the double reverse scheme (reverse the noun order & reverse the dyad execution). Skip On Thu, Oct 3, 2019 at 12:18 AM Roger Hui wrote: >%~/ |. 1 2 3 4 5 > 0.0083 > > >

Re: [Jprogramming] Order of Execution

2019-10-02 Thread Roger Hui
%~/ |. 1 2 3 4 5 0.0083 On Wed, Oct 2, 2019 at 9:44 PM Skip Cave wrote: > I can write: > 1%(2%(3%(4%5))) > > 1.875 > > > Using insert, I can simplify: > > %/1 2 3 4 5 > > 1.875 > > > Now I can write: > > (((1%2)%3)%4)%5 > > 0.00833 > > > How can I use insert to simplify this?