[Jprogramming] Partition by Contiguous Runs According to a Property

2021-01-07 Thread Justin Paston-Cooper
I am sure this has been asked and formulated somewhere else. I don't know what the name of it is. Let G be a set of groups. Given a list `l =: l_1 ... l_2` and a property `p` such that `p l_i` is in G, I would like a function `f` which partitions `l` into the successive maximally contiguous runs `

Re: [Jprogramming] Partition by Contiguous Runs According to a Property

2021-01-07 Thread Raul Miller
You've got too many undefined / unreferenced / misreferenced symbols here for me to be completely sure some of the details of what you are saying. That said, I think you might be looking for something like this: F=: {{ wrote: > > I am sure this has been asked and formulated somewhere else. I d

Re: [Jprogramming] Partition by Contiguous Runs According to a Property

2021-01-07 Thread xash
l =: _1 _2 0 1 2 _1 4 5 _6 p =: <&0 (<;.1~ (~:_,}:)@p) l ┌─┬─┬──┬───┬──┐ │_1 _2│0 1 2│_1│4 5│_6│ └─┴─┴──┴───┴──┘ On Thu Jan 7, 2021 at 10:12 AM CET, Justin Paston-Cooper wrote: > I am sure this has been asked and formulated somewhere else. I don't > know what the name of it is. >

Re: [Jprogramming] Partition by Contiguous Runs According to a Property

2021-01-07 Thread Raul Miller
That's better than mine. (And, I should mention, I used the phrase "undefined / unreferenced / misreferenced symbols" because i did not know how to classify the stuff which I did not understand.) That said, there's an available improvement here, so that an error is not thrown on an empty argument

Re: [Jprogramming] Partition by Contiguous Runs According to a Property

2021-01-07 Thread Justin Paston-Cooper
I like the successive sums idea. Thank you. On Thu, 7 Jan 2021 at 12:25, Raul Miller wrote: > > You've got too many undefined / unreferenced / misreferenced symbols > here for me to be completely sure some of the details of what you are > saying. > > That said, I think you might be looking for so

Re: [Jprogramming] Partition by Contiguous Runs According to a Property

2021-01-07 Thread Justin Paston-Cooper
Another great idea. Thanks again. On Thu, 7 Jan 2021 at 12:38, Raul Miller wrote: > > That's better than mine. > > (And, I should mention, I used the phrase "undefined / unreferenced / > misreferenced symbols" because i did not know how to classify the > stuff which I did not understand.) > > Tha

Re: [Jprogramming] Partition by Contiguous Runs According to a Property

2021-01-07 Thread Justin Paston-Cooper
I see that I thanked Don for your edited idea. Thanks. I will try to not spam too many more thanks. On Thu, 7 Jan 2021 at 12:31, xash wrote: > > l =: _1 _2 0 1 2 _1 4 5 _6 > p =: <&0 > (<;.1~ (~:_,}:)@p) l > ┌─┬─┬──┬───┬──┐ > │_1 _2│0 1 2│_1│4 5│_6│ > └─┴─┴──┴───┴──┘ > > > On Thu

Re: [Jprogramming] Partition by Contiguous Runs According to a Property

2021-01-07 Thread 'Michael Day' via Programming
Both this approach and Raul's appear to answer your requirement, but I'm wondering what result you require for this slightly altered input:    l1 =: 0 _1 0 1 2 _1 4 5 _6 If you need maximally contiguous runs,  I'd have thought this would be a preferred solution:    0 ; _1 0 1 2 ; _1 ; 4 5 ; _6

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Devon McCormick
It would be remiss of me not to mention that you really ought to re-consider making a spreadsheet an integral part of your design, not the least due to the historically high rates of error that have been measured in spreadsheets - 1 to 5%: https://arxiv.org/ftp/arxiv/papers/1602/1602.02601.pdf .

Re: [Jprogramming] Partition by Contiguous Runs According to a Property

2021-01-07 Thread Justin Paston-Cooper
In the list < _1 0 1 2, _1 is less than 0, but 0 1 2 are not. Therefore this is not a valid maximally contiguous run. The property here is <&0. A run is a maximally contiguous substring where all elements have the same property value. In this case, there are exactly two property values, namely 0 an

Re: [Jprogramming] Partition by Contiguous Runs According to a Property

2021-01-07 Thread 'Mike Day' via Programming
Thanks M Sent from my iPad > On 7 Jan 2021, at 19:25, Justin Paston-Cooper wrote: > > In the list < _1 0 1 2, _1 is less than 0, but 0 1 2 are not. > Therefore this is not a valid maximally contiguous run. The property > here is <&0. A run is a maximally contiguous substring where all > elemen

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Justin Paston-Cooper
I am open to suggestions. Right now I'm researching a lot of related things concurrently. I'm storing some of the results in TSV files. Some of the scripts are Python, some are curl | jq | awk. Some of the results I am storing as variables in J scripts. I am constantly going back and forth between

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Joe Bogner
Jupyter notebooks may help you with organizing your research - https://code.jsoftware.com/wiki/Guides/Jupyter This has been my preferred tool - far above Excel. On Thu, Jan 7, 2021 at 2:39 PM Justin Paston-Cooper wrote: > I am open to suggestions. Right now I'm researching a lot of related > th

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Justin Paston-Cooper
Thanks. I have been meaning to look at that. On Thu, 7 Jan 2021 at 23:33, Joe Bogner wrote: > > Jupyter notebooks may help you with organizing your research - > https://code.jsoftware.com/wiki/Guides/Jupyter > > This has been my preferred tool - far above Excel. > > On Thu, Jan 7, 2021 at 2:39 PM

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread 'Bo Jacoby' via Programming
"I am looking for a way to better organise my research. If not spreadsheets, do you have some advice on how to coordinate all this separate data in one place?" I have used ordinal fractions for structuring data since 1980. ORDINAL FRACTIONS - the algebra of data | | | | | | | | | | |

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Devon McCormick
To be clear, I was expressing caution about spreadsheets with embedded formulas and code. Keeping data in flat files, like TSV files, is fine for moderate amounts of data. On Thu, Jan 7, 2021 at 4:08 PM 'Bo Jacoby' via Programming < programm...@jsoftware.com> wrote: > "I am looking for a way to

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Hauke Rehr
Why only moderate? csv/tsv is amoung the best in scalability, way more reliable than spreadsheets (afaik) Of course, customized databases can be better. Am 07.01.21 um 23:07 schrieb Devon McCormick: > To be clear, I was expressing caution about spreadsheets with embedded > formulas and code. Keep

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Devon McCormick
Flat files are fine for large amounts of data up to maybe a few hundred MB if the data is uniform and not too complex, say lots of equity prices. Databases are more suitable as the data becomes more complex, say information about various companies: their financial instruments - bonds and different

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Hauke Rehr
agreed Am 07.01.21 um 23:20 schrieb Devon McCormick: > Flat files are fine for large amounts of data up to maybe a few hundred MB > if the data is uniform and not too complex, say lots of equity prices. > Databases are more suitable as the data becomes more complex, say > information about various

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Hauke Rehr
Do I understand correctly that this algebra of data thing can essentially be represented as a tree (or wood)? Looks like one could easily represent this using the LEO editor, maybe even annotating each node and having a top level script that walks the tree according to the input. Am 07.01.21 um 22

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Hauke Rehr
That post was written too soon. Now that I’ve taken a look at what ordinal fractions are meant to be, it looks to me more like what I think I first came to know when learning some prolog. I try to write down my new understanding of ordinal fractions, in a more old-fashioned lingo of enums (concepts

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Hauke Rehr
I jotted down a q&d-implementation in D. When I found out that your example doesn’t fit the hierarcical layout (multiple instances for 11, for example, so 11 isn’t a category even though there are things like 111), I ripped out the code depending on the hierarchy. The results agree with your resul

Re: [Jprogramming] J and Spreadsheets

2021-01-07 Thread Hauke Rehr
… and here’s a J implementation (and output) but I stumbled upon another aspect that didn’t match the specification as I understood it: consider the first example 13510: your solution contains SIMUL which is 13509 so I implemented that whenever either of them has a 0, they match. I think that’s wr