Re: [Jprogramming] How to convert list of phrases to list of boxed phrases?

2020-05-19 Thread Skip Cave
Rob, Another way to solve the same house number problem is the odometer verb: odo =:#:i.@(*/) 3 9${3+odo 3#3 ┌─┬─┬─┬─┬─┬─┬─┬─┬─┐ │3 3 3│3 3 4│3 3 5│3 4 3│3 4 4│3 4 5│3 5 3│3 5 4│3 5 5│ ├─┼─┼─┼─┼─┼─┼─┼─┼─┤ │4 3 3│4 3 4│4

Re: [Jprogramming] How to convert list of phrases to list of boxed phrases?

2020-05-19 Thread 'Rob Hodgkinson' via Programming
Skip, I was asked this just the other day by my son in Primary Math, it is a beautiful solution for this (common) math question. “How many different 3 digit house numbers can you produce if the hardware shop has no other supplies than unlimited quantities of 3’s, 4’s and 5’s and what are those

Re: [Jprogramming] How to convert list of phrases to list of boxed phrases?

2020-05-19 Thread Skip Cave
Harvey, I will have to admit, I stumbled on the effect of { (catalogue) on rank 2 arrays by accident. I was looking for ways to box the rows in a 2-d matrix, and just tried { to see what happens since I knew it would box a single vector. {1 2 3 4 5 6 ┌───┐ │1 2 3 4 5 6│ └───┘

Re: [Jprogramming] Finding rotational duplicates

2020-05-19 Thread Skip Cave
Testing Roger's rotational duplicate finder: ts=:6!:2 , 7!:2@] $x=.odo 8#8 16777216 8 ts 't0=.llr0 x' 37.0263 2.14749e9 ts 't1=.llr1 x' 26.6041 2.14749e9 ts 't3=.llr3 x' 34.1857 1.28849e10 ts 't2=.llr2 x' |out of memory: llr2 | (c*i.n){}."1/:~(c#i.n),.((n*c)$i.c) |."_1 c#y ts=:6!:2 , 7

Re: [Jprogramming] Finding rotational duplicates

2020-05-19 Thread Roger Hui
Partition the matrix by the smallest element, then work separately on each partition. On Tue, May 19, 2020 at 8:11 PM Skip Cave wrote: > Testing Roger's rotational duplicate finder: > > ts=:6!:2 , 7!:2@] > > $x=.odo 8#8 > > 16777216 8 > > ts 't0=.llr0 x' > > 37.0263 2.14749e9 > > ts 't1=.llr1 x

Re: [Jprogramming] Finding rotational duplicates

2020-05-19 Thread Skip Cave
Testing Roger's rotational duplicate finder: ts=:6!:2 , 7!:2@] $x=.odo 8#8 16777216 8 ts 't0=.llr0 x' 37.0263 2.14749e9 ts 't1=.llr1 x' 26.6041 2.14749e9 ts 't3=.llr3 x' 34.1857 1.28849e10 ts 't2=.llr2 x' |out of memory: llr2 | (c*i.n){}."1/:~(c#i.n),.((n*c)$i.c) |."_1 c#y ts=:6!:2 , 7

Re: [Jprogramming] Finding rotational duplicates

2020-05-19 Thread Roger Hui
I think in such cases you ought to do i.!.0~x first (as the write-up points out). Then you'd be working with small-range integers and the maximum element shouldn't cause a problem. Unless you are working with a huge x. In which case you have other problems. On Tue, May 19, 2020 at 6:32 PM Raul M

Re: [Jprogramming] Deleting?

2020-05-19 Thread Raul Miller
There's actually at least three topics here, as near as I can tell. 1) What operations on an array give a result which has row(s) removed. 2) What operations on a variable give a result which has row(s) removed. 3) What operations free the memory occupied row(s). I think the discussion so far h

Re: [Jprogramming] Deleting?

2020-05-19 Thread Thomas McGuire
I wanted to respond to your preface, while I’m a little younger than you I no longer make my living writing code. I adopted J as my personal use programming language. I don’t always have the time I want to put aside for my pet projects and I always seemed to be forgetting how to do things I rese

Re: [Jprogramming] Finding rotational duplicates

2020-05-19 Thread Raul Miller
Perhaps worth noting that the "radius limit" is calculable based on the type of the numbers in the argument. For integer values, on a 64 bit machine, radius*#y should not exceed 9223372036854775807 datatype 9223372036854775807 integer datatype 9223372036854775807+1 floating It gets a littl

Re: [Jprogramming] Finding rotational duplicates

2020-05-19 Thread Roger Hui
I understand and sympathize with the difficulties. I submit that in the APL Chat Forum post there is enough English description to make it understandable and helpful even if you don't understand every APL symbol. On Tue, May 19, 2020 at 10:01 AM Skip Cave wrote: > Roger, > > It has been many y

Re: [Jprogramming] Finding rotational duplicates

2020-05-19 Thread Skip Cave
Roger, It has been many years since I programmed in APL. My last APL work project was in 1976-77 designing character recognition algorithms on a Harris terminal (IBM selectric mechanisms) with an acoustic coupler, using University Computing Company's IBM Mainframe timesharing in Dallas Texas. When

Re: [Jprogramming] Finding rotational duplicates

2020-05-19 Thread Roger Hui
I have written a lengthier description of the solutions in the Dyalog APL Chat Forum. It is in APL rather than J notation, but may be helpful. The main thing to remember is that " (the rank operator) is ⍤ in Dyalog APL. On Sun, May 17, 2020

Re: [Jprogramming] Deleting?

2020-05-19 Thread Skip Cave
Use copy (#) or from ({) tst ┌──┬──┐ │May 08│May 07│ ├──┼──┤ │2020 │2020 │ ├──┼──┤ │664.35│652.35│ ├──┼──┤ │660.21│653.00│ ├──┼──┤ │664.56│657.12│ ├──┼──┤ │657.67│651.29│ ├──┼──┤ │- │- │ ├──┼──┤ │1.84% │1.19% │ └

Re: [Jprogramming] Deleting?

2020-05-19 Thread Michael Dykman
I have also found {:: to be very useful and under appreciated. On Tue, May 19, 2020, 07:56 HH PackRat wrote: > On 5/19/20, Michael Dykman wrote: > > In functional languages, you don't really delete so much as you make a > > fresh copy absent of the undesirable elements. > > Where you looking

Re: [Jprogramming] Deleting?

2020-05-19 Thread François A
I came up with the following contrived solution, typical of a complete beginner I guess. Say we want to filter out rows 1 and 3 from ] a=: ,. 2 <"0\ i.6 ┌─┬─┐ │0│1│ ├─┼─┤ │1│2│ ├─┼─┤ │2│3│ ├─┼─┤ │3│4│ ├─┼─┤ │4│5│ └─┴─┘ We could use less (-.) to remove unwanted indices, like so: a {~ (

Re: [Jprogramming] Deleting?

2020-05-19 Thread Jan-Pieter Jacobs
Or simpler when you want everything except specified rows: delitems=: ({~ <^:3)~ a=: 1 3 delitems i. 5 2 0 1 4 5 8 9 see "Complementary Indexing" in https://code.jsoftware.com/wiki/Vocabulary/curlylf#dyadic Best regards, Jan-Pieter On Tue, May 19, 2020, 14:27 'Pascal Jasmin' via Programmi

Re: [Jprogramming] Deleting?

2020-05-19 Thread bill lam
select can also eliminate items (<<<0 1 5){i.7 3 6 7 8 9 10 11 12 13 14 18 19 20 On Tue, May 19, 2020, 7:27 PM HH PackRat wrote: > Feel free to skip this apologetic preface that applies to all questions I > ask: > > By way of excuse, I'm 74, and my memory has been failing little by > lit

Re: [Jprogramming] Deleting?

2020-05-19 Thread 'Pascal Jasmin' via Programming
To go from indexes to mask delitems =: (] #~ [ 0:`[`]} 1 #~ #@]) 1 2 delitems i. 7 2 0 1 6 7 8 9 10 11 12 13 On Tuesday, May 19, 2020, 07:56:08 a.m. EDT, HH PackRat wrote: On 5/19/20, Michael Dykman wrote: > In functional languages, you don't really delete so much as you make

Re: [Jprogramming] Deleting?

2020-05-19 Thread 'Rob Hodgkinson' via Programming
Freudian slip, I meant the J object :-) > On 19 May 2020, at 10:18 pm, 'Rob Hodgkinson' via Programming > wrote: > > Yes Harvey, it works along the leading axis of the APL object… easy to > sample/test… > > 1 0 1 # 1 2 3 > 1 3 > > 1 0 1#i.3 2 > 0 1 > 4 5 > > 1 0 1# i.3 4 5 > 0 1 2 3 4

Re: [Jprogramming] Deleting?

2020-05-19 Thread 'Rob Hodgkinson' via Programming
Yes Harvey, it works along the leading axis of the APL object… easy to sample/test… 1 0 1 # 1 2 3 1 3 1 0 1#i.3 2 0 1 4 5 1 0 1# i.3 4 5 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 1 0 1#'one';'two';'three' ┌───┬───

Re: [Jprogramming] Deleting?

2020-05-19 Thread Anthony O'Malley
Maybe this? The longest learning for me with J was to internalize as automatic the idea that many primitives apply to ITEMS of a noun. The items of a list are easy. But the items of anything else are its highest dimension. ]a=. 3 4$i.12 0 1 2 3 4 5 6 7 8 9 10 11  then: ]a=. 1 0 1#a 0 1

Re: [Jprogramming] Deleting?

2020-05-19 Thread HH PackRat
On 5/19/20, Michael Dykman wrote: > In functional languages, you don't really delete so much as you make a > fresh copy absent of the undesirable elements. > Where you looking for this? > > ] a=. <"0 'abcdef' > ┌─┬─┬─┬─┬─┬─┐ > │a│b│c│d│e│f│ > └─┴─┴─┴─┴─┴─┘ >0 0 1 1 0 1 # a > ┌─┬─┬─┐ > │c│d│f│

Re: [Jprogramming] Deleting?

2020-05-19 Thread Michael Dykman
In functional languages, you don't really delete so much as you make a fresh copy absent of the undesirable elements. Where you looking for this? ] a=. <"0 'abcdef' ┌─┬─┬─┬─┬─┬─┐ │a│b│c│d│e│f│ └─┴─┴─┴─┴─┴─┘ 0 0 1 1 0 1 # a ┌─┬─┬─┐ │c│d│f│ └─┴─┴─┘ On Tue, May 19, 2020, 07:27 HH PackRat wro

[Jprogramming] Deleting?

2020-05-19 Thread HH PackRat
Feel free to skip this apologetic preface that applies to all questions I ask: By way of excuse, I'm 74, and my memory has been failing little by little over the last number of years. I looked at some J code I had written 8-12 years ago and was astounded at what I used to be able to do--nothing m