Re: [Jprogramming] cleanest diamond

2017-06-28 Thread Linda Alvord
Here is how I wrote your verb. How would you write it as an explicit verb? f=: [:>./([:([:>:i.)#)([: >./[ * <./\)"0 1 ] f qq 7030779 Linda -Original Message- From: Programming [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller Sent: Wednesday, June 28, 2

Re: [Jprogramming] Inverse of monad I.

2017-06-28 Thread Raul Miller
Oops, here's a fix for that corner case in my version: Iinv=: (e.~ i.@(1+>./@,&0)) Thanks, -- Raul On Wed, Jun 28, 2017 at 8:00 PM, 'Pascal Jasmin' via Programming wrote: > The discussion you linked to devolved into, "but it will cut off original > length, so not a real inverse" > there w

Re: [Jprogramming] Inverse of monad I.

2017-06-28 Thread 'Pascal Jasmin' via Programming
The discussion you linked to devolved into, "but it will cut off original length, so not a real inverse" there was also the corner case of i.0 (potential result of I.), fixed imo with: (#/.~@])`(~.@])`(0#~>:@(>./)@])}~`0:@.(0 = #) i.0 0 But, something that didn't come up in the thread is the eas

Re: [Jprogramming] cleanest diamond

2017-06-28 Thread Brian Schott
Don, I have been "thresholding" which I believe is the typical name for the process of converting an rgb image to a b&w image using the ideas I have read about in Cliff Reiter's book entitled, "Fractals, Visualization and J." In that book he defines the following terms and I use the "threshold" 11

Re: [Jprogramming] largest rectangle problem

2017-06-28 Thread 'Mike Day' via Programming
Linda, bear in mind that Raul was (I think) deriving a tacit improvement of my explicit verb "c" which had incorporated an explicit loop. Here it is, again, possibly without gratuitous line-throws: c =: 3 : 0 m =. >./y for_i. }.>:i.#y do. m =. m >. >./ i ([ * <./\) y end. ) It happens to

Re: [Jprogramming] cleanest diamond

2017-06-28 Thread Raul Miller
Technically, any result which is not a reversible transformation of the image can be thought of as "losing information". -- Raul On Wed, Jun 28, 2017 at 12:29 PM, Don Guinn wrote: > Are you losing information by applying the threshold to each point without > regard to the points around it? If

Re: [Jprogramming] cleanest diamond

2017-06-28 Thread Don Guinn
Are you losing information by applying the threshold to each point without regard to the points around it? If most or all the points around it are large values then it is more likely that the threshold should be lower than if the point is surrounded by lower values. Also, maybe look at the overall

Re: [Jprogramming] largest rectangle problem

2017-06-28 Thread Linda Alvord
I turned your verb to a different expression. Can you write my version as an explicit verb? f=: [:>./([:([:>:i.)#)([: >./[ * <./\)"0 1 ] f qq 7030779 Linda -Original Message- From: Programming [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Raul Miller Sent: Satu

Re: [Jprogramming] cleanest diamond

2017-06-28 Thread Brian Schott
Linda, I see it and it is a beautiful diamond. Thanks, On Tue, Jun 27, 2017 at 10:02 PM, Linda Alvord wrote: > > load 'viewmat' > ]B=:A*.|.A*.|.A=:-.(500+x) ]P=:2 3$255 255 255 255 0 0 > P viewmat B > I couldn't resist making a "beginner's diamond. > > Good luck with the cards. I'm looking

Re: [Jprogramming] verb to set an element of an array

2017-06-28 Thread Raul Miller
Or, equivalently for those examples: Amend=:(0{::[)`(1{::[)`]} (To make this equivalent for all examples, change the 1 to _1) FYI, -- Raul On Wed, Jun 28, 2017 at 3:47 AM, Erling Hellenäs wrote: > If you don't want to write a new function when you want to insert something > else, you can

Re: [Jprogramming] Inverse of monad I.

2017-06-28 Thread Raul Miller
You can specify the length of the result using {. on the result. Also, you could use (e.~ i.@(1+>./)) for the obverse monad. FYI, -- Raul On Wed, Jun 28, 2017 at 4:19 AM, Marshall Lochbaum wrote: > All (I.)s used in my post refer to the monad. I meant that the monadic > verb given by binding

[Jprogramming] Inverse of monad I.

2017-06-28 Thread Marshall Lochbaum
All (I.)s used in my post refer to the monad. I meant that the monadic verb given by binding my dyadic verb to a left argument (which must be (i.n) for a large enough n) is a mostly-inverse to (I.). It's probably best to ignore my informal discussion if you plan on implementing this. There's a foru

Re: [Jprogramming] verb to set an element of an array

2017-06-28 Thread Erling Hellenäs
If you don't want to write a new function when you want to insert something else, you can do like this: Amend=:([:>[:{.[)`([:>[:{:[)`] } (42;1) Amend 1 2 3 1 42 3 (41;2) Amend 0 1 2 0 1 41 (41 42;1 2) Amend 0 1 2 0 41 42 Cheers Erling On 2017-06-23 14:54, Rudolf Sykora wrote: put