Re: [Jprogramming] Sliding window

2018-02-19 Thread robert therriault
Raul, Yes you are right. The term "dyadic adverb" is a symptom of a fuzzy thinking shortcut on my part. The rest of your explanation clarifies the issue. Cheers, bob > On Feb 19, 2018, at 12:21 PM, Raul Miller wrote: > > That said... "dyadic adverb" sounds like a shortcut ---

Re: [Jprogramming] Sliding window

2018-02-19 Thread Raul Miller
Actually, 3 {.\ 1 2 3 4 5 worked: {. 1 2 3 gives you 1 {. 2 3 4 gives you 2 {. 3 4 5 gives you 3 So... the result of using {. with a sliding window is the first element from each of those window instances. Thanks, -- Raul On Mon, Feb 19, 2018 at 3:24 PM, Skip Cave wrote: > Raul said: > > H

Re: [Jprogramming] Sliding window

2018-02-19 Thread Skip Cave
Raul said: However, (1 2 3) is not a verb. So that gives you a domain error right there, regardless of any right argument: Doh! NOW i get it. ] is the verb and 3 is the noun. So any verb should work... 3<\1 2 3 4 5 ┌─┬─┬─┐ │ 1 2 3 │ 2 3 4 │ 3 4 5 │ └─┴─┴─┘ 3{.\1 2 3

Re: [Jprogramming] Sliding window

2018-02-19 Thread Raul Miller
This is getting away from programming, tempting to take it to chat.. But if we're going to talk about technical details, the words we use will tend to become technical. That said... "dyadic adverb" sounds like a shortcut - and an ambiguous one at that. So let's take it back a step: You combine a

Re: [Jprogramming] Sliding window

2018-02-19 Thread robert therriault
Raul, I think I would have stopped with this part of your explanation. > On Feb 19, 2018, at 11:47 AM, Raul Miller wrote: > > But keep in mind that the verb (]\) has two definitions: a monadic > definition and a dyadic definition. So you should expect a different > result from (3 ]\ i.4) than

Re: [Jprogramming] Sliding window

2018-02-19 Thread Raul Miller
[I'm using parenthesis, here to separate j expressions from surrounding english text. That might be a little unfamiliar, but hopefully it's not too bad... And, on the plus side, parenthesis are valid J when their contents are valid J.] ] does replicate the right argument. And, for monadic verbs -

Re: [Jprogramming] Sliding window

2018-02-19 Thread Jimmy Gauvin
​​ 0 1 2 3 4]\1 2 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 2 0 0 0 3 0 0 0 0 0 0 0 1 2 0 0 2 3 0 0 0 0 0 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2 3 4<\1 2 3 ┌─┬───┬─┬┐ │ │ │ ││ ├─┼───┼─┼┤ │1│2 │3││ ├─┼───┼─┼┤ │1 2 │2 3│ ││ ├─

Re: [Jprogramming] Sliding window

2018-02-19 Thread Skip Cave
​​ Yes , my second example was hand- constructed, and I should have left off the last line - 4 5 6 7 4 ]\ i.7 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6 Skip Cave Cave Consulting LLC On Mon, Feb 19, 2018 at 1:38 PM, Raul Miller wrote: > Or: > >4 ]\ i.8 > 0 1 2 3 > 1 2 3 4 > 2 3 4 5 > 3 4 5 6

Re: [Jprogramming] Sliding window

2018-02-19 Thread Raul Miller
Or: 4 ]\ i.8 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7 It was a hand-constructed example - it's easy to say something slightly different from what you want when you're doing that. Thanks, -- Raul On Mon, Feb 19, 2018 at 2:21 PM, robert therriault wrote: > Probably just a glitch in what you

Re: [Jprogramming] Sliding window

2018-02-19 Thread Skip Cave
Thanks to all the informative responses. I knew there had to be a way to use \ for the sliding window, but it didn't occur to me to use ] to access the right argument. so ]\1 2 3 1 0 0 1 2 0 1 2 3 but 1 2 3\1 2 3 |domain error | 1 2 3 \1 2 3 I thought that ] replicated the right argument

Re: [Jprogramming] Sliding window

2018-02-19 Thread robert therriault
Probably just a glitch in what you are looking for in the second example, but it can be done with a little processing before using ]\ 4 ]\ i. 7 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6 4 (]\ (, >:@{:)) i.7 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7 Cheers, bob > On Feb 19, 2018, at 11:13 AM, Raul Mi

Re: [Jprogramming] Sliding window

2018-02-19 Thread Michael Dykman
Will this do? sw =: 1 : 'm ]\]' 3 sw i.6 0 1 2 1 2 3 2 3 4 3 4 5 4 sw i.7 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6 On 19 February 2018 at 14:09, Skip Cave wrote: > How can one create a sliding window in J? > > 3 sw i.6 > > 0 1 2 > 1 2 3 > 2 3 4 > 3 4 5 > > 4 sw i.7 > 0 1 2 3 > 1 2 3 4 > 2

Re: [Jprogramming] Sliding window

2018-02-19 Thread Raul Miller
3 ]\i.6 0 1 2 1 2 3 2 3 4 3 4 5 Or sw=: ]\ Thanks, -- Raul On Mon, Feb 19, 2018 at 2:09 PM, Skip Cave wrote: > How can one create a sliding window in J? > > 3 sw i.6 > > 0 1 2 > 1 2 3 > 2 3 4 > 3 4 5 > > 4 sw i.7 > 0 1 2 3 > 1 2 3 4 > 2 3 4 5 > 3 4 5 6 > 4 5 6 7 > > What is the J code

Re: [Jprogramming] Sliding window

2018-02-19 Thread Henry Rich
Look into the likes of    +/~ i. 4 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6 Change as needed to meet your spec. Henry Rich On 2/19/2018 2:09 PM, Skip Cave wrote: How can one create a sliding window in J? 3 sw i.6 0 1 2 1 2 3 2 3 4 3 4 5 4 sw i.7 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7 What