Re: [Jprogramming] J tutorial from the perspective of a novice

2021-01-19 Thread Devon McCormick
I like the "levels of a tree" idea as it is a good graphic metaphor for nested arrays. My only quibble is calling a vector of simple atoms level 1 rather than 0. On Wed, Jan 20, 2021 at 12:07 AM Hauke Rehr wrote: > I’m stuck. I tried wrapping up my thoughts and failed. > Now I’ll just leave it

Re: [Jprogramming] J tutorial from the perspective of a novice

2021-01-19 Thread Hauke Rehr
I’m stuck. I tried wrapping up my thoughts and failed. Now I’ll just leave it as the stub it is. Thanks, Raul, my first reaction was: Why would anyone talk about them differently? (an ignorant/arrogant reaction) Then I thought Looks like I just bought into everything I read when learning J. … a

Re: [Jprogramming] Direct Definition Spurious Blank Addition

2021-01-19 Thread Henry Rich
I'll see what I can do. Henry Rich On 1/19/2021 9:22 PM, Ric Sherlock wrote: In a similar vein, The first line of a multi-line definition doesn't respect indentation, so: mutate=: {{idxmut=. I. x >: (*/$y) ?@$ 0 (populate idxmut) idxmut"_} y }} mutate 4 : 0 idxmut=. I. x >: (*/$y) ?@

Re: [Jprogramming] J tutorial from the perspective of a novice

2021-01-19 Thread Raul Miller
I had not spent enough time in nuvoc to notice this "atom is not an array" distinction. Even now, looking at https://code.jsoftware.com/wiki/Vocabulary/AET#, this distinction does not really leap out at me. Still... it might be useful to have a word for the thing which an array with no dimensions

Re: [Jprogramming] J tutorial from the perspective of a novice

2021-01-19 Thread Hauke Rehr
I had also taken a look when you first wrote, found some places where I would have too rapidly uttered disagreement and so kept quiet, waiting for things to develop. In the meantime I thought about translating the contents of the presentation I used when teaching J to pupils in order to show the a

Re: [Jprogramming] Direct Definition Spurious Blank Addition

2021-01-19 Thread Ric Sherlock
In a similar vein, The first line of a multi-line definition doesn't respect indentation, so: mutate=: {{idxmut=. I. x >: (*/$y) ?@$ 0 (populate idxmut) idxmut"_} y }} mutate 4 : 0 idxmut=. I. x >: (*/$y) ?@$ 0 (populate idxmut) idxmut"_} y ) mutate=: {{ idxmut=. I. x >: (*/$y) ?@$ 0

Re: [Jprogramming] J tutorial from the perspective of a novice

2021-01-19 Thread Henry Rich
He's not using level to explain boxing: he's using it to represent multidimensional unboxed arrays.  I think that's a great idea, because it makes the frame easier to think about than using a physical representation of the data as a cube or table etc. Arnab: this may be a problem later, becaus

Re: [Jprogramming] J tutorial from the perspective of a novice

2021-01-19 Thread Devon McCormick
Hi Arnab, where you are using a tree metaphor to explain boxing, if you label the simple vector as having depth 0, rather than 1, it would line up with the result of the level verb (L.), e.g. L. i. 3 0 L. 1 2;3 4;5 6 1 Regards, Devon On Tue, Jan 19, 2021 at 8:56 PM HH PackRat wrote: > O

Re: [Jprogramming] J tutorial from the perspective of a novice

2021-01-19 Thread HH PackRat
On 1/19/21, Arnab Chakraborty wrote: > Anyway, I have dumped a few more draft pages ( > https://arnabc74.github.io/jsoft/) The hotlink to nonlin11.html should be nonlin1.html to avoid a 404 error. Harvey -- For information a

Re: [Jprogramming] Direct Definition Spurious Blank Addition

2021-01-19 Thread Henry Rich
Starting with the next beta JE will remove excess trailing blanks at the end, leaving just one space. Henry Rich On 1/19/2021 1:18 PM, John Baker wrote: Direct definition has added another, more convenient way to define local J words on the fly. It is particularly useful for creating verbs, ad

Re: [Jprogramming] Direct Definition Spurious Blank Addition

2021-01-19 Thread Henry Rich
My attempt to preserve the user's original spacing misfired.  I'll see what I can do. Henry Rich On 1/19/2021 1:18 PM, John Baker wrote: Direct definition has added another, more convenient way to define local J words on the fly. It is particularly useful for creating verbs, adverbs and conjun

[Jprogramming] Direct Definition Spurious Blank Addition

2021-01-19 Thread John Baker
Direct definition has added another, more convenient way to define local J words on the fly. It is particularly useful for creating verbs, adverbs and conjunctions within explicit definitions. However there are gotchas. One thing I've noticed is the repeated addition of a trailing blank to DDs wit

Re: [Jprogramming] Insert verb

2021-01-19 Thread Devon McCormick
I wrote these to time insertion speed. The first one is scalar, second one performs multiple inserts at once. insertToVec=: 4 : 0 'idx vec'=. y assert. 1=#idx assert. 1=#x assert. (idx>:_1)*.(idx<:#vec) NB. Insert new item: _1->at end, 0->before start biv=. (0) idx}1$~(#vec)+#idx

Re: [Jprogramming] Insert verb

2021-01-19 Thread Raul Miller
insertbefore=:{{ 'a b'=. y (x{.b),a,x}.b }} insertafter=: {{ (x+1) insertbefore y }} 2 insertafter "1 [ 10;"1 n 0 1 2 10 3 4 5 6 7 10 8 9 FYI, -- Raul On Tue, Jan 19, 2021 at 11:51 AM Skip Cave wrote: > > How does one design a verb that inserts specific elements into a vector or > ma

[Jprogramming] Insert verb

2021-01-19 Thread Skip Cave
How does one design a verb that inserts specific elements into a vector or matrix? For example, an "insertafter" verb would take one left argument, which is the index of the array that the element is to be inserted after. The right argument would be two boxed nouns. The first boxed noun is the set

Re: [Jprogramming] J tutorial from the perspective of a novice

2021-01-19 Thread Justin Paston-Cooper
LGTM. On Tue, 19 Jan 2021 at 14:40, Arnab Chakraborty wrote: > > Thanks to everybody for the thumbs up. > I would feel honoured to be able to contribute to the jsoftware site. But I > guess that things need to be tidied up a bit (or a lot?) on my end, before > being ready for uploading to your ma

Re: [Jprogramming] J tutorial from the perspective of a novice

2021-01-19 Thread Arnab Chakraborty
Thanks to everybody for the thumbs up. I would feel honoured to be able to contribute to the jsoftware site. But I guess that things need to be tidied up a bit (or a lot?) on my end, before being ready for uploading to your main site. Anyway, I have dumped a few more draft pages ( https://arnabc74