Re: [Jprogramming] Submatrices

2019-12-12 Thread Nimp O
: [Jprogramming] Submatrices ({. ,.&.> }.)"1@:((1 1,:2 1)&(<;._3)) a Henry Rich On 12/11/2019 6:43 PM, Nimp O wrote: > Hello everyone, > > > Given > ]a=: 3 4 $ 1 1 1 _1 4 2 1 _1 9 3 1 1 > > > 1 1 1 _1 > > 4 2 1 _1 > > 9 3 1 1 > > I wa

[Jprogramming] Submatrices

2019-12-11 Thread Nimp O
Hello everyone, Given ]a=: 3 4 $ 1 1 1 _1 4 2 1 _1 9 3 1 1 1 1 1 _1 4 2 1 _1 9 3 1 1 I want to find the submatrices: f a ┌───┬───┬┐ │1 1│1 1│1 _1│ │4 2│4 1│4 _1│ ├───┼───┼┤ │4 2│4 1│4 _1│ │9 3│9 1│9 1│ └───┴───┴┘ I have a quite lengthy solution for this task. I was wonderin

Re: [Jprogramming] Explicit vs tacit with assignment

2019-11-27 Thread Nimp O
Interesting. Also, checking the Requests page I see that support for assignment in tacit expressions has already been suggested. Another approach could be to make it less awkward to mix tacit and explicit. In this regard, I really like the Fast Function Definition suggestion: https://code.jsoft

Re: [Jprogramming] Explicit vs tacit with assignment

2019-11-20 Thread Nimp O
> > 2 $ ?@# > > As Henry said, to store an intermediate value in a verb's evaluation for use > _after_ it's application, you must use an explicit verb, for example: > > ,~ @ (3 : 'a=: y') @ (?@#) > > Cheers, > Louis > >> On 21 Nov 2019, at 03:2

[Jprogramming] Explicit vs tacit with assignment

2019-11-20 Thread Nimp O
Hello, simple question. This behaviour surprised me. (a,a=.?@#)'01234' 2 4 3 : 'a,a=.?@#y' '01234' 1 1 Why a is not equal to a in the first case? How can I save the roll as an intermediate result in the tacit version? Thanks. --

Re: [Jprogramming] Extended precision tolerance

2019-08-03 Thread Nimp O
Aug 1, 2019 at 5:01 PM Nimp O wrote: > Perhaps this upper bound could be removed, at least for x:, since I believe > the main use cases for tolerance on this verb would be bigger values, as > illustrated in my earlier example. > At least in this context, I can't see anythi

Re: [Jprogramming] Extended precision tolerance

2019-08-01 Thread Nimp O
equal to 2^_34 . Historically, the upper bound on the tolerance was chosen so that comparisons involving 32-bit integers are exact (as if the tolerance is 0)." FYI, -- Raul On Thu, Aug 1, 2019 at 9:33 AM Nimp O wrote: > > Hello everyone, > > What is the use of non-zero toler

[Jprogramming] Extended precision tolerance

2019-08-01 Thread Nimp O
Hello everyone, What is the use of non-zero tolerance for the x: verb? A little example: a=:​0.1667 0.8333 0.4286 0. x:a 1667r1 8333r1 2143r5000 r1 In Mathematica: In[1]:= Rationalize[{0.1667, 0.8333, 0.4286, 0.}] Out[1]= {1667/1, 8333/1, 2143/5000, /100

Re: [Jprogramming] Quora problem

2019-04-16 Thread Nimp O
My solution is based on the following recurrence formula of the generating function: h(m,n) = h(m,n-m) + h(m-1, n-m). Memoizing, as Roger pointed, helps a lot. The agenda is used to handle the edge cases such as negative n or h(0,0) = 1. h=:1:`0:`0:`(([h-~)+(<:@[h-~))`0: @.(#.@(,&*)) M. 7 h

Re: [Jprogramming] Regex merge with multiple groups

2019-04-11 Thread Nimp O
." > > > > Do you mean that you want to replace matched digit sequences in that > > text with some sort of representation of their offsets? > > > > Or are you intending something else? > > > > Thanks, > > > > -- > > Raul >

Re: [Jprogramming] Regex merge with multiple groups

2019-04-11 Thread Nimp O
I'm sorry, the pattern should be: pat =: '\( (\d+)\,(\d+)\s+(\d+)\,(\d+)\s+\)' From: Programming on behalf of Nimp O Sent: Thursday, April 11, 2019 1:01 PM To: programm...@jsoftware.com Subject: [Jprogramming] Regex merge with multiple groups

[Jprogramming] Regex merge with multiple groups

2019-04-11 Thread Nimp O
Hello everyone, Here is a minimal working example of what I'm trying to accomplish: load'regex' pat =: '\( (\d)\,(\d)\s+(\d)\,(\d)\s+\)' test=: 0 : 0 a ( 2,3 4,5 ) c ( 10,11 12,13 ) ) So using the regex pattern I was able to extract the numbers from this string. Each

[Jprogramming] Possible bug in 'convert/pjson' addon

2019-03-09 Thread Nimp O
Hello everyone, I think I have found a bug in 'convert/pjson'. load 'convert/pjson' dec_pjson_ '"\\f\\b"' \ \ I believe double backslashes should be escaped first, as in: dec_pjson_ '"\\f\\b"' \f\b I fixed the issue on my end by moving the double backslash to the first substitution:

Re: [Jprogramming] Decompressing gzip in J

2019-03-03 Thread Nimp O
0639019,"answer_id":264298,"body_markdown":"Yes, The problem is not in wget or curl. wget in centos doesn't have the --compression option either. Sat, 02 Mar 2019, Nimp O написал(а): > Thank you bill, > > I tried piping the resulting binary stream

Re: [Jprogramming] Decompressing gzip in J

2019-03-02 Thread Nimp O
ll lam написал(а): > > If you are using a recent enough version of wget, it should > > automatically decompress data received. > > > > Sat, 02 Mar 2019, Nimp O написал(а): > > > Hello everyone, > > > > > > For educational purposes I

Re: [Jprogramming] Decompressing gzip in J

2019-03-02 Thread Nimp O
support the above mentioned option, not sure about the curl.exe in the addon. Sat, 02 Mar 2019, bill lam написал(а): > If you are using a recent enough version of wget, it should > automatically decompress data received. > > Sat, 02 Mar 2019, Nimp O написал(а): > > Hello everyone,

[Jprogramming] Decompressing gzip in J

2019-03-02 Thread Nimp O
Hello everyone, For educational purposes I'm trying to read a JSON response from the StackOverflow API in J. My current session is: load'web/gethttp' load'pjson' api=:'http://api.stackexchange.com/2.2/answers/264298?order=desc&sort=activity&site=meta&filter=!.UDo6l2ikDi7iGlf' gethttp api �

Re: [Jprogramming] Recursive verbs

2018-11-28 Thread Nimp O
fold" Then u~/ |.y might be thought of as a "left fold". Thanks, -- Raul On Wed, Nov 28, 2018 at 2:26 PM Nimp O wrote: > > Very interesting mathematical solution Mike. > > My initial idea to solve this type of sequence formula was using folds. > The idea is to

Re: [Jprogramming] Recursive verbs

2018-11-28 Thread Nimp O
Very interesting mathematical solution Mike. My initial idea to solve this type of sequence formula was using folds. The idea is to define a fold function g and fold it on a list of _1 and 1, considering an initial value. The result was: g =. ]+2*[ 4 ((g~/\.&.|.)@, ]$(_1 1)"_) 5 4 7 15 29

Re: [Jprogramming] Recalling and editing lines in jqt

2015-01-29 Thread Nimp O
Another problem I see regarding editing lines: Sometimes in jqt a have a bunch of results on my screen that I want to look. I then proceed to do some incorrect calculation and I want to undo it (as in erase the result). The current way I do it is usig Ctrl-Z, but there are 2 problems: 1) It take

Re: [Jprogramming] Euler Project Problem 1

2014-04-09 Thread Nimp O
Here is my Euler 1 solution for reference. It is concise and I think it's pretty easy to understand. +/I.+./0=3 5 |/ i.1e3 233168 It's the same as: sum(indices(any(zero?(remainder table

Re: [Jprogramming] A Tale Without End

2014-02-24 Thread Nimp O
Another nice way to get a lot of digits from the golden ratio is using Newton's Method. In : http://www.jsoftware.com/jwiki/Essays/Newton%27s%20Method N=: 1 : '- u % u d. 1' correct50 =: '1.61803398874989484820458683436563811772030917980576' 0j50 ": (1 + ] - *:) N^:7 ] 1 1.6180339887498948482

Re: [Jprogramming] A Tale Without End

2014-02-23 Thread Nimp O
And also.. (+ %:)/ 0,20$1 1.61803 > Date: Sun, 23 Feb 2014 20:11:11 + > From: bojac...@yahoo.dk > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] A Tale Without End > >{.>{:p. 1 1 _1 > 1.61803 s.htm ---

Re: [Jprogramming] A Tale Without End

2014-02-23 Thread Nimp O
> From: k...@math.uh.edu > Date: Sun, 23 Feb 2014 06:20:58 -0600 > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] A Tale Without End > > Very interesting, Linda. 1.61803 looks familiar, but I can't quite recognize > it. No, it's not > > ^.5 > 1.60944 > > --Kip Murray > > Se