Bugfix:
reps=: 1+0,~0,2~:/\[:[^:(0~:[)/\.&|.^:2@:*2 -/\]
ud=: reps ((1,2 =/\ [ # #\@]) <;.1 #) ]
This fixes a problem where the duplicate values appeared at the end of
the sequence.
Here are some values to test against:
4#1
3#1 2
2#1 2 1 2 1
I think I've dealt with all of these correct
I have posted two comments on Bo's paper, in the Chat forum.
-
On Sun, 16 May 2021 11:26:06 +, "'Bo Jacoby' via Programming" wrote:
Thank you for the podcast. I listened with pleasure. I worked with APL forty
years ago, and with J for about twenty years. I love arrays, but I love ordinal
Oh... I see...
I noticed that the ravel of the boxes did not match the original
sequence and did not look close enough after that.
Anyways, I guess here's how I would approach this:
reps=: 1+0,~0,2~:/\[:[^:(0~:[)/\.@:*2 -/\]
ud=: reps ((1,2 =/\ [ # #\@]) <;.1 #) ]
Thanks,
--
Raul
On Thu, Ma
Perfect upgrade!
histogram does not lead to lost data any more.
_5 0 5 histogram _2 _7 0 3 9
1 1 2 1
Thanks, Ric, for all future users.
~ Gilles
Le 2021-05-19 à 08:01, Raul Miller a écrit :
Yes.. I should have been reading the updated code, rather than the commits.
It's been too long sin
The problem came up when swing trading was explained to me and I was wondering
how to recognize the ups & downs of a stock.
The solutions of xash and Rehr had some good ideas, ({. i.@>:) for example.
Here is mine, polished a bit, after grown over the days:
Foo=:{{, |: (#~1 <#@~.S:0)"1 \:~(<;.
Your missing last bucket can simply be repaired with (I.,#)@,
But even then you run into the same error as xash with ?.@#~30 where the
subsequence ... 28 16 16 26 ... should be split in 28 16 16 and 16 16 26,
before continuing with 26 9 3 2.
R.E. Boss
-Original Message-
From: Pro
I thought it was clear from the output (therefore I used ?. in the testcases)
that the order of the input array should not be altered.
That was the constraint you were missing.
R.E. Boss
-Original Message-
From: Programming On Behalf Of Raul
Miller
Sent: donderdag 20 mei 2021 16:33
T
I could use some additional details.
I mean... it seems to me that Foo=:<@/:~ would minimally satisfy the
requirements which have been stated so far.
But, presumably, there's some kind of "cost function" which we are
trying to minimize, and presumably that has something to do with how
pairs are h
++--++---+-+-+-+-+-++-+-+-+---+---+---+++-+-+
|24 26 28|28 6 5|5 28|28 16 16 |16 16 26 |26 19 3 2|2 13 |13 11|11 19|19 2|2
27 |27 10|10 19|19 5 |5 17 27|27 19 7|7 24 28 |28 27 14|14 22|22 21
On Thu May 20, 2021 at 3:22 PM CEST, Hauke Rehr wrote:
> I strongly expect one could do better than to
> {.+i.@-.@-/
Maybe a little bit cleaner: (}.i.@>:)/ 2 6
(and good catch on that (<+_1*>) -> (<->), thanks!)
--
For informatio
in case there’s not already an elegant solution to this,
maybe dyadic {: and }: could be made to do that?
3 6 {: i. 8
3 4 5
3 6 {: 'hi there'
the
and the usual behaviour with boxed control data
otoh, it’s restricting x to have a last axis of length 2
and what if it’s 3x2x2, say, and y has
so this is what I came up with
but it’s still missing the last bucket (9 5)
and it doesn’t read as well as xash’s version
I strongly expect one could do better than to
{.+i.@-.@-/
but I just don’t know how
(let alone how to {~ < < of that better)
ff =: (<@{~ 2 <&<&({. + i.@-.@(-/))"1@:]\ 1 I.@, 0
Wow Bob, this first episode made it to the front page of HN (
https://news.ycombinator.com/item?id=27209093)!
Congratulations!
It would seem that many people are in fact interested in the array paradigm
although the array community is rather silent online, usually.
Looking forward to the next epi
correction: of course, it’s 2&((<->)/\)
Am 20.05.21 um 14:15 schrieb Hauke Rehr:
> you can also use (2 (< - >)/\) instead of (}: (<+_1*>) }.)
> I think that way it’s going more in the “appreciated” direction :)
>
> Am 20.05.21 um 13:49 schrieb xash:
>> f=:((#~ 1&|.) ,&.> <;.1~) 0 1, 0= 2+/\ }: (<
you can also use (2 (< - >)/\) instead of (}: (<+_1*>) }.)
I think that way it’s going more in the “appreciated” direction :)
Am 20.05.21 um 13:49 schrieb xash:
> f=:((#~ 1&|.) ,&.> <;.1~) 0 1, 0= 2+/\ }: (<+_1*>) }.
>
> The first part assigns _1 to elements that are greater than the next one,
>
f=:((#~ 1&|.) ,&.> <;.1~) 0 1, 0= 2+/\ }: (<+_1*>) }.
The first part assigns _1 to elements that are greater than the next one,
and 1 to elements that are less than the next one. Where _1 1 or 1 _1
occur, a new group starts. Thus 0= 2+/\.
This gets us the starting indices for <;.1. Because the bo
Given an array of numbers, like
?.@#~20
14 16 8 6 5 8 6 16 16 19 13 12 3 1 9 12 17 0 9 5
there is always a sequence of (non-strict) ups & downs, like
14 16;16 8 6 5;5 8;8 6;6 16 16 19;19 13 12 3 1; 1 9 12 17;17 0;0 9;9 5
+-++---+---+--++-++---+-
17 matches
Mail list logo