Re: [Jprogramming] delete item; ass. lists

2017-12-04 Thread Erling Hellenäs
I am playing with the idea of optionally tying labels to the present noun construction. The noun could have a label, labels could be tied to rows and columns. Addressing and indexing could then optionally be done with those labels. /Erling Hellenäs Den 2017-12-03 kl. 22:06, skrev Marshall Loc

Re: [Jprogramming] delete item; ass. lists

2017-12-04 Thread Raul Miller
Ok, so https://en.wikipedia.org/wiki/Associative_array rather than https://en.wikipedia.org/wiki/Association_list? For this, I think I'd use a pair of lists - one of keys, one of values. Possibly I'd stick them in a pair of boxes so I could pretend to be using a purely functional parameter system.

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread Raul Miller
I used Eugene's approach, also: spiral =: ,~ $ [: /: }.@(2 # >:@i.@-) +/\@# <:@+: $ (, -)@(1&,) aspiral=: (*: - |."1@spiral)@>.@%: steps=:3 :0"0 as=. aspiral y +/|-/(($as)#:I.,1=as),($as)#:I.,y=as ) steps 1 12 23 1024 0 3 2 31 FYI, -- Raul On Mon, Dec 4, 2017 at 2:02 AM, Brian Schott

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread Raul Miller
Hmmm... actually, my spiral was oriented "wrong" - which doesn't matter, which means that I did not need the |."1 in it... Anyways... looks like I was not paying enough attention... -- Raul On Mon, Dec 4, 2017 at 7:05 AM, Raul Miller wrote: > I used Eugene's approach, also: > > spiral =: ,~ $

Re: [Jprogramming] delete item; ass. lists

2017-12-04 Thread 'Bo Jacoby' via Programming
Erling Hellenäs is playing with the idea of tying labels to the noun. The noun could have a label, labels could be tied to rows and columns. Addressing and indexing could then optionally be done  with those labels. For your information, using ordinal fractions this is done like this. 00 noun 10 f

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread Raul Miller
And... speaking of spiral neighbors -- yeah... not paying attention... and that looks like an inductive thing... So... spiral =: ,~ $ [: /: }.@(2 # >:@i.@-) +/\@# <:@+: $ (, -)@(1&,) aspiral=: (*: - spiral)@>.@%: coord=: $@] #: I.@,@e.~ steps=:3 :0"0 NB. part 1 as=. aspiral y +/|-/(1,y) coor

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread Raul Miller
So... watch out here. A line got split on the space between 4&{ and ::_ When rejoining the line you need to be sure there's a space in your glued-back-together line. ({:: is syntactically valid, but the wrong operation in this context.) Thanks, -- Raul On Mon, Dec 4, 2017 at 8:03 AM, Raul Mi

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread Jimmy Gauvin
" ​ painfully slow." that's what happens if you generate the spiral but, for the first part of day 3 challenge, you don't need to generate it. On Mon, Dec 4, 2017 at 8:03 AM, Raul Miller wrote: > ​o > ​o > > > Probably can be simplified... and > ​​ > painfully slow. > > ​o > > ​o > > -- > Raul

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread David Lambert
I used brute force.  This article is relevant, though I didn't use it.  http://www.jsoftware.com/papers/play132.htm MY_INPUT=:    368078 Dyad=: [: : While=: 2 :'u^:(0-.@:-:v)^:_' rotate=: |:@:|. NB. f rotates the current matrix and then prepends the next group of numbers f=: (,~ (([: i. [: - _

Re: [Jprogramming] delete item; ass. lists

2017-12-04 Thread Andrew Dabrowski
Here's my solution.  Not doubt it is ugly and slow.  I look forward to you guys showing me how to do it correctly. emptyHash =: ,~ ,. < 'not found' hashSet =: dyad define 'key val' =. y pos =. x hashGetInd key if. pos = 1{ $x do.  x ,"(1,0) key ; val else.  ((< key) pos} (0{x)) ,: (< val) pos}

Re: [Jprogramming] delete item; ass. lists

2017-12-04 Thread Erling Hellenäs
Some kind of generalized maps, suitable for generalized arrays :) /Erling On 2017-12-04 13:41, 'Bo Jacoby' via Programming wrote: Erling Hellenäs is playing with the idea of tying labels to the noun. The noun could have a label, labels could be tied to rows and columns. Addressing and indexing

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread Raul Miller
First part of day 3 was not slow. Only the second part. Thanks, -- Raul On Mon, Dec 4, 2017 at 10:21 AM, Jimmy Gauvin wrote: > " > > painfully slow." that's what happens if you generate the spiral but, > for the first part of day 3 challenge, you don't need to generate it. > > On Mon, Dec 4,

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread Roger Hui
> First part of day 3 was not slow. Only the second part. Spoiler alert. For the second part, you only need to work with a small spiral. On Mon, Dec 4, 2017 at 10:57 AM, Raul Miller wrote: > First part of day 3 was not slow. Only the second part. > > Thanks, > > -- >

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread Raul Miller
Ah, good point. I suppose I should have used ^: instead of doing a full scan... Or, just estimating the size I needed - maybe having that as a manually supplied argument. Didn't really matter, I guess - figuring out how to do that would have taken longer than the time needed for the scan. But it'

Re: [Jprogramming] delete item; ass. lists

2017-12-04 Thread Raul Miller
Correctly depends on intended use. If you're really going to use this one item at a time, you can greatly increase average performance of deletes by deferring them for later (for example). Similarly, you can avoid some overhead by implementing that as an object. That said, here's a more concise i

[Jprogramming] New associative array datatype in JE WAS: delete item; ass. lists

2017-12-04 Thread Igor Zhuravlov
On Sun, Dec 03, 2017 at 09:06:45PM +1000, Marshall Lochbaum wrote: > I feel pretty strongly that an associative array type is missing in J, > but it's understandable given how hard such a type would be to specify > and implement. That doesn't make it any easier to live without them, > though. Is i

[Jprogramming] sm html

2017-12-04 Thread Don Guinn
In changes to Qt IDE for version 1.6.2 included a new tool to insert HTML into the term window. I played with it a little and have the interesting following. Hopefully, the lines are short enough to not wrap: NB. Start of script ___ t1=:0 : 0 sm html * The next two wor

Re: [Jprogramming] sm html

2017-12-04 Thread bill lam
may be see here http://doc.qt.io/qt-5/richtext-html-subset.html On Tue, Dec 5, 2017 at 9:41 AM, Don Guinn wrote: > In changes to Qt IDE for version 1.6.2 included a new tool to insert HTML > into the term window. I played with it a little and have the interesting > following. Hopefully, the line

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread Brian Schott
Raul, This is fascinating and compact code for part 2. You are using (;.3} tesselation shards very cleverly. I have not quite figured out your method, and am mostly wondering how you are forcing the order of tesselation steps to conform to the spiral sequence in the array. [Ignore ALL the commen

Re: [Jprogramming] SVMs in J

2017-12-04 Thread Devon McCormick
I'm learning about machine-learning in general and both courses I've taken are basically intros to Python's sci-kit which is good for a high-level look but gives no clue to the underlying algos. I searched the J wiki for "quadratic" and found a mention from a 2005 NYCJUG meeting where we were lame

Re: [Jprogramming] J strengths?

2017-12-04 Thread Devon McCormick
I've had good luck using J to work out a good algorithm that I've implemented in another language. For instance, I was wondering about the efficiency of a simple permutation algorithm in Javascript and was able to try two or three versions of it in about half an hour in J, then implement the winne

Re: [Jprogramming] SVMs in J

2017-12-04 Thread Brian Schott
Devon, I recently noticed convolutional neural networks for image recognition and developed a very limited J version for my own purposes. I am not sure the result is ready for prime time, but it was really enlightening to see what could be done especially with J's array orientation. I got a lot fr

Re: [Jprogramming] SVMs in J

2017-12-04 Thread 'Skip Cave' via Programming
I have been working on translating some machine learning algorithms into J I don't know Python, so Raul helped me translate a Recurrent Neural Network originally written in Python, into J. Here's a link to the start of our discussion thread on the J programming forum. A Neural Network in 11 lines

Re: [Jprogramming] Advent of code, Day 3 (spoilers probable)

2017-12-04 Thread Raul Miller
On Mon, Dec 4, 2017 at 9:46 PM, Brian Schott wrote: > This is fascinating and compact code for part 2. > You are using (;.3} tesselation shards very cleverly. > I have not quite figured out your method, and am mostly wondering how > you are forcing the order of tesselation steps to conform to the

Re: [Jprogramming] SVMs in J

2017-12-04 Thread bill lam
There are matrix multiplication +/ .* inside RNN. In j806, there are some optimization code taking advantage of AVX and FMA instruction, speed improvement should be significant, run benchmark to see how much. YMMV. On Tue, Dec 5, 2017 at 12:50 PM, 'Skip Cave' via Programming wrote: > I have been