Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-12 Thread Matthew Baulch
am, "Henry Rich" wrote: > I have added to > > http://code.jsoftware.com/wiki/Vocabulary/cor > > especially notes 1, 2, and 12 and new example 27 at the end. See if this > would have helped. > > Henry Rich > > On 2/12/2016 2:03 PM, Matthew Baulch wrote:

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-12 Thread Matthew Baulch
to do this tacitly, but yeah, doing it tacitly such > >> that it triggers when a verb is executed would be tricky (possible, > >> but overly verbose to accomplish). Also, not sure if that would have > >> any uses... > >> > >> Personally, I rarely ev

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-12 Thread Matthew Baulch
any correction. >> >> Cheers. >> It's pretty well explained at >> >> http://code.jsoftware.com/wiki/Vocabulary/NounExplicitDefinition >> >> The question is, How would you know to read that? Suggestions welcomed. >> >> When you say "

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-11 Thread Matthew Baulch
Nor the first it seems. Just + can replace >: then. (it's not replacing if it still has to be used.) On 12 Feb 2016 12:56 pm, "Matthew Baulch" wrote: > Correction for the second. @. (dyad) can replace ^: (dyad) which can > replace | (monad). > > I didn't think

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-11 Thread Matthew Baulch
Correction for the second. @. (dyad) can replace ^: (dyad) which can replace | (monad). I didn't think that through very well! On 12 Feb 2016 12:49 pm, "Matthew Baulch" wrote: > If I understand correctly, the result of 0 : 0 may be referenced as any > part of the expres

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-11 Thread Matthew Baulch
suitable for a task is most often preferred as it usually leads to the clearest code. On 12 Feb 2016 4:38 am, "Raul Miller" wrote: > [posting my response in-line for context] > > On Thu, Feb 11, 2016 at 12:55 AM, Matthew Baulch > wrote: > > Thanks everyone. This (let&

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-11 Thread Matthew Baulch
l details are spelled out in several pages starting at http://code.jsoftware.com/wiki/Vocabulary/cor Henry Rich On 2/11/2016 12:55 AM, Matthew Baulch wrote: > Thanks everyone. This (let's say) creative use of 0 : 0 makes sense to me > now. I wonder if it's an accidental consequen

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-11 Thread Matthew Baulch
p14 c15 p15 c16 p16 c17 > p17 c18 p18 c19 p19 c20 p20 c21 p21 c22 p22 c23 p23 c24 p24 > c25 p25 c26 p26 c27 p27 c28 p28 c29 p29 c30 p30 > ) > > I hope this helps, > > -- > Raul > > On Tue, Feb 9, 2016 at 4:59 AM, Matthew Baulch > wrote: > > Suppose I

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-10 Thread Matthew Baulch
Can't see it in NuVoc or the Dictionary. Of course, I may have overlooked it. Honestly, to obtain something simple like multi-line noun definitions, ". does seem like quite a heavy-handed tool. It does work however, so I probably shouldn't grumble. Cheers. On Wed, Feb 10, 2016 at 1

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-10 Thread Matthew Baulch
c3 p3 c4 p4 c5 p5 c6 p6 c7 p7 c8 p8 c9 p9 > c10 p10 c11 p11 c12 p12 c13 p13 c14 p14 c15 p15 c16 p16 c17 > p17 c18 p18 c19 p19 c20 p20 c21 p21 c22 p22 c23 p23 c24 p24 > c25 p25 c26 p26 c27 p27 c28 p28 c29 p29 c30 p30 > ) > > I hope this helps, > > -- > Raul >

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-10 Thread Matthew Baulch
y > > Henry Rich > > > On 2/10/2016 5:16 AM, Henry Rich wrote: > >> The operation you describe is >> >> _2 (128!:2)&.>\ y >> >> I think the current definition of 128!:2 is a better primitive definition. >> >> I agree that it deserve

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-10 Thread Matthew Baulch
ot; wrote: > Look also at 128!:2, which takes a verb as a string argument and applies > that verb to y. > > Henry Rich > > > On 2/9/2016 9:10 PM, Matthew Baulch wrote: > >> Thanks. I think this is what I was looking for. >> >> I was aware of '

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-09 Thread Matthew Baulch
here: > > https://github.com/tangentstorm/syndir/blob/master/graphdb.ijs > > Also an implementation of s-expressions (which you can stick > in a ( 0 : 0 ) block. > > https://github.com/tangentstorm/syndir/blob/master/boxer.ijs > > > On Tue, Feb 9, 2016 at 3:59 AM, Matth

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-09 Thread Matthew Baulch
c18 p18 c19 p19 c20 p20 c21 p21 c22 p22 c23 p23 c24 p24 c25 p25 c26 p26 c27 p27 c28 p28 c29 p29 c30 p30 ) I hope this helps, -- Raul On Tue, Feb 9, 2016 at 4:59 AM, Matthew Baulch wrote: > Suppose I wish to construct a complex, non-regular deeply nested structure: > to model some inheren

Re: [Jprogramming] Nested structures. Idioms? Combinators?

2016-02-09 Thread Matthew Baulch
Sorry. Correction in the second paragraph: 'function chains'. Though some of the combinators can naturally be used in trains. On 9 Feb 2016 8:59 pm, "Matthew Baulch" wrote: > Suppose I wish to construct a complex, non-regular deeply nested > structure: to model some in

[Jprogramming] Nested structures. Idioms? Combinators?

2016-02-09 Thread Matthew Baulch
Suppose I wish to construct a complex, non-regular deeply nested structure: to model some inherently non-linear system. A natural approach (for me, anyhow) is to construct a library of combinators, or a domain specific language, with which to specify the (boxed) structure. J rises easily to the ta

Re: [Jprogramming] Bizarre (re)shape behaviour

2016-02-05 Thread Matthew Baulch
is up to the verb how to handle it. > > OTOH, when the rank of argument is larger, then the verb will > never see the original argument because J interpreter has sliced > it into k-cells which are what to be received by the verb. > (actual implementation is more efficient, eg atomic verbs su

Re: [Jprogramming] Bizarre (re)shape behaviour

2016-02-05 Thread Matthew Baulch
ginally specified? > > Thanks, > > -- > Raul > > > On Fri, Feb 5, 2016 at 5:42 AM, Matthew Baulch > wrote: > > The 'x $ y' dyad, like you say, has rank 1 for x and _ for y. Examples > > (1)-(3) have rank 0 arguments for x. The x arguments are array

Re: [Jprogramming] Bizarre (re)shape behaviour

2016-02-05 Thread Matthew Baulch
3 > 1 > > In other words there trial result doesn't have a shape, so you get one > less dimension in your result than you had in x. > > As for your last example: > ><"1 x=: 1 $ 0 > +-+ > |0| > +-+ >$ <"1 x=: 1 $ 0 > > ...so your

[Jprogramming] Bizarre (re)shape behaviour

2016-02-05 Thread Matthew Baulch
Original vocab says: "The shape of x$y is x,siy where siy is the shape of an item of y." NuVoc says (for x $ y): "If y is an atom or a list, the shape of the result is x", and "the shape of [the result of x$y] is always x,}.$y". Let y =: 1 2 3 for all that follows. (1) x =: 1 0 1 $ 0 x$y h

Re: [Jprogramming] Behaviour '=' dyad on boolean arrays

2016-02-02 Thread Matthew Baulch
re else. > - Phrase of the moon. > > If anyone knows, I should know (I wrote the test script), and I don't > know/remember. > > > > On Tue, Feb 2, 2016 at 2:22 PM, Matthew Baulch > wrote: > > > I've been reading the tests in the J engine source. Have

[Jprogramming] Behaviour '=' dyad on boolean arrays

2016-02-02 Thread Matthew Baulch
I've been reading the tests in the J engine source. Have learned quite a bit while doing so! Anyhow, I've become perplexed by one particular line. In the 'Boolean' section of the tests for 'x i. y' (test/gi.ijs), a random table is constructed with a=:1=?10 5$2 My question is, why is a=:?10 5$2

Re: [Jprogramming] prefix zero

2016-01-31 Thread Matthew Baulch
I imagine you'd need to convert to a character (as opposed to integer) array to accomplish this. An integer's representation doesn't record any leading zeroes. Perhaps if you could describe the context, someone could provide a better answer. Are you generating a report, perhaps? On 1 Feb 2016 2:45

Re: [Jprogramming] Definition: Frame of an argument

2016-01-19 Thread Matthew Baulch
hat the "inner/outer" terms make for much > easier understanding, but I also know that having to struggle to justify > change is not a bad thing. > > I appreciate that the idea resonates with you and that makes it worth > exploring. > > Cheers, bob > > > On

Re: [Jprogramming] Definition: Frame of an argument

2016-01-19 Thread Matthew Baulch
Correction: "An argument must always have one outer cell." -- except in the degenerate case. Similarly, "An argument has [zero or more] inner cells". On Wed, Jan 20, 2016 at 4:36 PM, Matthew Baulch wrote: > Sorry. Thanks for that correction. I quite like Robert's su

Re: [Jprogramming] Definition: Frame of an argument

2016-01-19 Thread Matthew Baulch
shape 'inner shape'. Any argument must always have one outer cell. It has shape 'outer shape'. Any thoughts? The alternative to frame / cell shape being discussed is outer shape / cell shape, not outer shape / inner shape. I don't believe anyone has used "inner

Re: [Jprogramming] Definition: Frame of an argument

2016-01-19 Thread Matthew Baulch
Outer/inner makes perfect sense. Seems unlikely to lead anyone astray. To play devil's advocate, it might seem silly but maybe a newbie could guess that inner/outer shape relates to boxing. Is this paranoia? I don't know. The important question is: who is the terminology intended to serve? The ans

Re: [Jprogramming] Definition: Frame of an argument

2016-01-15 Thread Matthew Baulch
this topic. > > > > Whenever an earnest user has confusion with the documentation, I want to > > improve the documentation. Can you think where a timely word would have > > helped? > > > > Henry Rich > > > > > > On 1/15/2016 2:43 AM, Matthew Baulch wr

Re: [Jprogramming] Definition: Frame of an argument

2016-01-15 Thread Matthew Baulch
frame contains 0) and an empty frame (which simply means that the verb > operates on a single cell). > > http://code.jsoftware.com/wiki/Vocabulary/EmptyArguments > > has more on this topic. > > Whenever an earnest user has confusion with the documentation, I want to > improve th

Re: [Jprogramming] Definition: Frame of an argument

2016-01-14 Thread Matthew Baulch
he result cells > and hence the result is not in question. With zero frames, there are no > argument cells, so the system needs to do something extra (so that you > don't have to). (x,"1 y appends vectors to vectors, but when y is i.0 4 it > does not have any vectors.) > >

Re: [Jprogramming] Definition: Frame of an argument

2016-01-14 Thread Matthew Baulch
seems very deliberate—which I really appreciate. It just seems that empty frames must serve a purpose. Trying to work it out. On 15 Jan 2016 4:21 pm, "bill lam" wrote: > The J dictionary is always correct. > > Пт, 15 янв 2016, Matthew Baulch написал(а): > > Fair enough, thoug

Re: [Jprogramming] Definition: Frame of an argument

2016-01-14 Thread Matthew Baulch
nguage. You need not worry anything else. > > http://www.jsoftware.com/help/dictionary/dictb.htm > > Пт, 15 янв 2016, Matthew Baulch написал(а): > > I assume the intended definition of 'frame', in relation to verb > arguments, > > is that given on > > >

[Jprogramming] Definition: Frame of an argument

2016-01-14 Thread Matthew Baulch
I assume the intended definition of 'frame', in relation to verb arguments, is that given on http://code.jsoftware.com/wiki/Vocabulary/FramingFill I'm just trying to understand verb/argument combinations with empty frame--the most common case, I suppose. From the wording "each argument is ... an

Re: [Jprogramming] Roll (?) produces domain error on large input

2016-01-11 Thread Matthew Baulch
Thanks. That makes sense. I confess to not having needed extended precision from J yet. I'm relieved to know it's implemented that way. Automatically switching, like you say, would be expensive. On 12 Jan 2016 4:46 am, "Raul Miller" wrote: > On Mon, Jan 11, 2016 at

Re: [Jprogramming] Roll (?) produces domain error on large input

2016-01-11 Thread Matthew Baulch
Ignore my answer. This is more sensible. On 11 Jan 2016 10:16 pm, "Ben Gorte - CITG" wrote: > If I correctly understand your question, could it be you want: > >?~21 > > It gives a random permutation of i.21 (and also works for much larger > values) > > Ben > __

Re: [Jprogramming] Roll (?) produces domain error on large input

2016-01-11 Thread Matthew Baulch
A correction. 1+?(n-1) provides the index of the (element occupying) the second position, 2+?(n-2) for the third, etc. Sorry for any confusion. On 11 Jan 2016 10:11 pm, "Matthew Baulch" wrote: > 2^.!21 is greater than 64 and 2^.!20 is less, so I'm guessing roll is not

Re: [Jprogramming] Roll (?) produces domain error on large input

2016-01-11 Thread Matthew Baulch
2^.!21 is greater than 64 and 2^.!20 is less, so I'm guessing roll is not implemented with arbitrary precision arithmetic. Until that happens, you could implement your own roll verb using J primitives that do utilise extended precision. Maybe someone has already written one? Otherwise, you could u

Re: [Jprogramming] dissect

2016-01-09 Thread Matthew Baulch
Looking at the source for dissect (addons/debug/dissect/dissect.ijs) suggests a few things. (1) dissect evaluates the input expression incrementally by following each branch along the parse tree. (2) it evaluates the expression a second time using the ". verb--reporting an error if the two don't a