Re: [Jprogramming] What's wrong with assigment?

2014-11-20 Thread Raul Miller
Let's say you make a mistake: rms=: 2 :'%:+/*:y' You test your defined word and notice your mistake: rms 2 3 5 |value error: rms So you fix it, and test again: rms=: 3 :'%:+/*:y' rms 2 3 5 6.16441 But verbs can only take nouns as arguments. Thanks, -- Raul On Thu, Nov 20, 2014 a

Re: [Jprogramming] Boxing columns

2014-11-20 Thread Henry Rich
Those are all very pretty. Henry Rich On 11/19/2014 10:29 PM, Marshall Lochbaum wrote: None of these beat Roger's by your criteria, but here are a few: (,,.)&.>/ i.3 3 <"_1|:,: i.3 3 (0 1,:3 1) <;.3 i.3 3 The second features a rare specimen--monadic |: on an array of rank greater than 2. O

Re: [Jprogramming] What's wrong with assigment?

2014-11-20 Thread bill lam
=: is special because the lvalue (address) of the left argument is used for evaluation. Чт, 20 ноя 2014, Sergey Kamenev написал(а): > 20.11.2014 09:05, Jan-Pieter Jacobs пишет: > >To give you a more direct reply: > > > >conjunctions, like & and @ work on either verbs or nouns. > >=: and =. are ne

Re: [Jprogramming] What's wrong with assigment?

2014-11-20 Thread Raul Miller
And because the right argument might not be a noun (and might not be a verb). -- Raul On Thu, Nov 20, 2014 at 9:40 AM, bill lam wrote: > =: is special because the lvalue (address) of the left argument is > used for evaluation. > > Чт, 20 ноя 2014, Sergey Kamenev написал(а): > > 20.11.2014 09:05

Re: [Jprogramming] What's wrong with assigment?

2014-11-20 Thread Roger Hui
> This violates universality. Universality is not necessarily a good principle for language design. 1.2 3.4 $ 5.6 |domain error | 1.2 3.4$5.6 'abc' $ 3 4 5 |domain error | 'abc'$3 4 5 On Wed, Nov 19, 2014 at 11:46 PM, Sergey Kamenev wrote: > 20.11.2014 09:05, Jan-Pieter J

Re: [Jprogramming] Boxing columns

2014-11-20 Thread Ben Gorte - CITG
If I'm allowed to jump in here, I'm using ;. a lot to subdivide images into 2x2 blocks (think wavelet), and I guess it's okay to do it like: ]z =: (2 2,:2 2) < ;. _3 i.4 6 +-+-+-+ |0 1 |2 3 | 4 5| |6 7 |8 9 |10 11| +-+-+-+ |12 13|14 15|16 17| |18 19|20 21|22 23| +-

Re: [Jprogramming] What's wrong with assigment?

2014-11-20 Thread Joey K Tuttle
Likely this comment should be in chat, but ... https://www.cs.purdue.edu/homes/dec/essay.criticize.html On 2014/11/20 07:12 , Roger Hui wrote: This violates universality. Universality is not necessarily a good principle for language design. 1.2 3.4 $ 5.6 |domain error | 1.2 3.4$

Re: [Jprogramming] Boxing columns

2014-11-20 Thread Raul Miller
Perhaps ,"1/,"2/,"3/>zz Thanks, -- Raul On Thu, Nov 20, 2014 at 10:42 AM, Ben Gorte - CITG wrote: > If I'm allowed to jump in here, I'm using ;. a lot to subdivide images into > 2x2 blocks (think wavelet), and I guess it's okay to do it like: > >]z =: (2 2,:2 2) < ;. _3 i.4 6 > +-+

Re: [Jprogramming] Boxing columns

2014-11-20 Thread Ben Gorte - CITG
Wow ! I understand them when I see them, but it seems I cannot 'forward engineer' them. Well, not always. Thanks a lot! Ben From: programming-boun...@forums.jsoftware.com [programming-boun...@forums.jsoftware.com] on behalf of Raul Miller [rauldmil..

[Jprogramming] Correct behavior of "e." ?

2014-11-20 Thread Devon McCormick
Hi - I was just burned by this apparent anomaly: 1 e. 0~: i. 2 2 0 but 1 e. , 0~: i. 2 2 1 Has anyone else noticed this? Am I right in thinking this is incorrect behavior in the first case? Regards, Devon -- Devon McCormick, CFA -

Re: [Jprogramming] Correct behavior of "e." ?

2014-11-20 Thread Roger Hui
Both expressions give the correct answer. The right argument of membership determines the target of the items to be sought, just like the left argument of index-of determines the targets. In my opinion, the APL\360 team made a mistake by making x∊y the same as x∊,y. We are struggling with the co

Re: [Jprogramming] Correct behavior of "e." ?

2014-11-20 Thread Devon McCormick
I see, so 0 1 e. i.2 2 1 On Thu, Nov 20, 2014 at 1:27 PM, Roger Hui wrote: > Both expressions give the correct answer. > > The right argument of membership determines the target of the items to be > sought, just like the left argument of index-of determines the targets. In > my opinion, th

Re: [Jprogramming] Correct behavior of "e." ?

2014-11-20 Thread 'Pascal Jasmin' via Programming
has to do with the definition of item 0 1 e. i. 2 2 1 1 3 e."0 1 i. 2 2 1 1 1 e."1 i. 2 2 1 0 - Original Message - From: Devon McCormick To: J-programming forum Cc: Sent: Thursday, November 20, 2014 1:19 PM Subject: [Jprogramming] Correct behavior of "e." ? Hi - I was

Re: [Jprogramming] Correct behavior of "e." ?

2014-11-20 Thread Roger Hui
Correct. The following example may be more convincing: x=: ];._1 ' Devon Roger Ken Morten' y=: ];._1 ' Roger Sextus' x Devon Roger Ken Morten y Roger Sextus y e. x 1 0 One way to define membership is y e. x iff (#x)>x i. y. Defining the "set functions" this way makes even more s

Re: [Jprogramming] Boxing columns

2014-11-20 Thread Marshall Lochbaum
Aha! Raul's solution can be rewritten as ,"_2/^:3 >zz (negative rank is quite a useful concept). Since ,. is (exactly) ,"_1 the two-dimensional solution is ,"_1/^:2 >z Extending the pattern, we can reduce a blocked array using merge =: 3 : 0 r =. #$y ,"(1-r)/^:r >y ) This works on block array

Re: [Jprogramming] Boxing columns

2014-11-20 Thread Ryan
I'm new to J and am struggling to figure out why this works. '';1 just looks like a noun: '';1 ┌┬─┐ ││1│ └┴─┘ <;.1 i.3 3 ┌─┐ │0 1 2│ │3 4 5│ │6 7 8│ └─┘ thanks for any help, Ryan On 20 Nov 2014, at 9:27, Roger Hui wrote: > ('';1) <;.1 i.3 3 > ┌─┬─┬─┐ > │0│1│2│ > │3│4│5│ > │6│7│8│ > └─

Re: [Jprogramming] Boxing columns

2014-11-20 Thread Henry Rich
Yes, '';1 is a noun, but having a noun changes <;.1 completely: <;.1 i.3 3 executes the MONAD <;.1, which behaves according to its rules. ('';1) <;.1 i.3 3 executes the DYAD <;.1 which behaves according to its rules, which are totally different (though somewhat similar in this case). Every

Re: [Jprogramming] Boxing columns

2014-11-20 Thread Raul Miller
Perhaps also worth noting that while the dictionary provides documentation -- at http://www.jsoftware.com/help/dictionary/d331.htm -- for boxed left arguments for u;.1, NuVoc -- at http://www.jsoftware.com/jwiki/Vocabulary/semidot1#dyadic -- does not. Thanks, -- Raul On Thu, Nov 20, 2014 at 9:4