« first day (657 days earlier)      last day (1997 days later) » 

12:24 AM
Then Lord Attila raised his hand upon high, saying:
 
that's all the Holy Lord Attila said as he gestured to the Heavens?
a
;P
I thought he would have said something to the effect of "Oh Lord, bless this thy APL grenade, that with it thou mayest blow thine code to tiny bits, in thy mercy."
Cuz APL makes code tiny... so it's like a code grenade?
Lord @AttilaVrabecz, or is it @ila doesn't find this humrus.
 
i've been just reading the transcripts from earlier
think i even said before that i don't subscribe to this whole q gods/mortals thing
k/q is quite monotheistic - so far everything points to only having one Lord Arthur :)
 
12:44 AM
Yes, King Arthur, holder of the knowledge of coconut laden European Swallow average flight speeds
Or would it be average query speeds of Time Series laden databases?
 
@Adám Yay! I'm going to still go to staging.tryapl.org by habit lol
 
 
5 hours later…
5:50 AM
@nathanrogers King Arthur and the K-knights.
 
We are no longer the knights that say J. We are now the knights that say kx-kx-kx-pkang-nuwom!!!
Then when you have found the shrubbery, you must optimize the mightiest tree search in the forest... WIIIIIIIIIIITh.... A VECTOR!!!
 
@nathanrogers Why use a measly vector when there are so many more delicious dimensions?
 
What the curtains?
 
@nathanrogers No yet! Try creating the following namespace, then run P.J:
https://tio.run/##fVJNSwJRFN37Ky4EvZkYzZlBTF0JGhRiUsuIGBppY@NQgrgLAzPzicGIboKoRdLGRYKrNvpP7h@x@@ZDRwqHx7z77jvnvHMv17ArUbNhVKrXy2W6aNyU72zjqgylCNCH7UcwIAd19wRQx1afoXPPkH8hHwch7U2meH9Kp0DXsPWyIp0r2HnA9iim7KvKfIx8Wr/whLro9NFx0BkxH2zTRUDE3iBXWMyQf0iLoSFj590IXEVW9mpEOM5YGTNT82lxMuxa4FMWyEqkVTxjTI6JKJ9D/iax07JhnliVBgNV3mU7OzGbySEbth@nD6u3YEH6yALk3wk/66pKB1FL3lvMNDkHJlEkOlLlwhPyJ9EZQlFPeoOs4oaBZN4ySdU/6eCxTSLUtuRCRqLkRNVCVjSqWppPkvS6RR2Iy9j9Mf99bbMcPaShrjXmE1Uj0BYZbROrA21hNN1TKinSCQKJXmRLhaABifWtkKAliZJ00b35@C8ysUJ6bQ0B4mtAypNi7riNsf2J3Q4On7HTZMAgCyXwWWKC3J2/Xor5iYjaVsO/XP4C
 
 
4 hours later…
ngn
9:50 AM
ngn/k = "no gods, no kings" :)
 
@ngn …, no floats"
 
ngn
@Adám well, half-way there. i've been reluctant to link with libm as that would bloat the binary, but ultimately i may have to. i also need to settle on a simple way to print floats, preferably without loss of information
 
@ngn Just print floats in hex!
 
ngn
@Adám that can't be a permanent solution
 
10:42 AM
@ngn I want to thank you for opening my eyes to the power of reduction. Now I write things like ⊃(↑{⍵((⊃⌽⍺)C)⍨⊃⍺}¨)/⊂¨pairs,⊂⍵
 
ngn
@Adám er, what...
@Adám i've no idea what you're talking about. i'm sure you know no less than me about reduction. is this similar to something i golfed?
 
 
2 hours later…
12:43 PM
@Adám would it be okay if I send a pull-request to your Extended APL repository?
 
@J.Sallé Of course!
I should write a CONTRIBUTING.md
 
It's just a silly thing, I tried to generalize the operator to work with any root, not just square
I'm trying to do some actual APL programming instead of only golfing :p
 
1:10 PM
@Adám done. I hope it's not wrong >.>
 
@J.Sallé Wait, I thought it was already generalized?
 
@Quintec nope, it only worked as a prefix
 
@J.Sallé It works here?
 
Maybe not though, now I'm not sure
 
Let me trim that down... here
 
1:15 PM
Yeah you're right. I didn't try using it as a dyad because the description in the Root.dyalog file says specifically square root
 
Yeah, the github doesn't seem to be updated
 
Also, the actual file looks like it'll always return the square root, (since it does ⍺←2 before anything else) but I'm not entirely familiar with how APL deals with ⍵← and ⍺←, so it might just be my interpretation that's weird
 
@J.Sallé @Quintec A line beginning with ⍺← only gets executed if the fn is called monadically. ⍺←expression is basically shorthand for 0=⎕NC'⍺':expression ∇ ⍵
 
That's cool
 
1:28 PM
@J.Sallé It actually says (square) root to indicate that square is the default. Also, 0≠⎕NS'⍺':⍵*÷⍺ isn't right. ⎕NS makes a NameSpace. ⎕NC is Name Class of.
 
@Adám yeah I had that fixed after I pushed
Was a typo
I'll see if there's anything else I might extend though. It's cool to work with *.dyalog files instead of only golfing
 
1:46 PM
@ngn You tend to use reduction and cumulative reduction for iteration much more than most others.
 
 
1 hour later…
2:54 PM
@Adám I love how your comments are just more code
 
@nathanrogers Thanks. Anything specific you want to point at?
 
4 hours ago, by Adám
@ngn I want to thank you for opening my eyes to the power of reduction. Now I write things like ⊃(↑{⍵((⊃⌽⍺)C)⍨⊃⍺}¨)/⊂¨pairs,⊂⍵
that link
 
That's not a comment though. You meant comments in the chat?
 
⍝ A1 A2 A3⊂B
the link is a link to a github file in which there are comments like that. I thought it was funny :)
 
@nathanrogers ah yeah but it links to that line specifically, I thought you were talking about that hahahah
 
3:28 PM
@nathanrogers Remember that APL started off as a better mathematical notation. That is a language to communicate ideas. It excels at describing algorithms. In fact, APL was first used internally by IBM to completely describe their new System/360. Anecdotally, APL was later implemented in 360 assembly, which became known as APL\360. (Does this contradict Gödel?)
 
I guess if System/360 contained all possible truth statements made about arithmetic on natural numbers?
 
4:03 PM
@Adám I think it would be a wonderful world if everyone talked in APL.
 
@Quintec y∪←→↓↑¯b
@Quintec y∪←→↓↑bb○¯
@Quintec how was your ⍨ today?
 
I had to ∊ a Uber because I couldn't ⍷ my car, I don't know ⍸⊣@.
 
∊? what ⍤ was he?
 
He was a ⍋ from ⊃⌽ time. We made a ?, I don't ⍎⊣ ∧ ⍉ me
 
4:20 PM
mouth[(quintecWords=words)/words]
just ↓ it I ~↑>0
this morning ⌶ ~ ⍷ my ⊃
∧ my socks ≢
grade up from last time... brilliant
 
ngn wrote: ¨∊∪←=⊢2⍝∧?*
 
@nathanrogers We've been doing this wrong the whole time! APL needs to be right to left! :P
 
but read left to right!
 
ngn
4:51 PM
@Adám haha! that was a long time ago. now it took me more than a moment to remember what it says :) i'll keep quiet so i don't spoil the puzzle
 
5:10 PM
every element you get is the right argument to illuminate ... and, random power? what
 
@nathanrogers It is a union not a letter U.
 
⌶÷2~×
could you please ⍀
 
@nathanrogers I reciprocate to not sign?
 
I half not direction
 
@nathanrogers half ≈ have ‽
 
5:25 PM
it's a pun?
APunL
 
That'd be ~×∊⊢
 
:(
⌶~←⌶⊤
 
 
4 hours later…
9:32 PM
@Adám how do I get triangles like in J?
+\i.10
those probably aren't exactly the triangles I want, I have a list of numbers and I want to make a triangle with 1 additional number per row starting at 1
 
⎕←,\⍳10
 
@Adám
┌─┬───┬─────┬───────┬─────────┬───────────┬─────────────┬───────────────┬─────────────────┬────────────────────┐
│1│1 2│1 2 3│1 2 3 4│1 2 3 4 5│1 2 3 4 5 6│1 2 3 4 5 6 7│1 2 3 4 5 6 7 8│1 2 3 4 5 6 7 8 9│1 2 3 4 5 6 7 8 9 10│
└─┴───┴─────┴───────┴─────────┴───────────┴─────────────┴───────────────┴─────────────────┴────────────────────┘
 
⎕←↑,\⍳10
 
@Adám
1 0 0 0 0 0 0 0 0  0
1 2 0 0 0 0 0 0 0  0
1 2 3 0 0 0 0 0 0  0
1 2 3 4 0 0 0 0 0  0
1 2 3 4 5 0 0 0 0  0
1 2 3 4 5 6 0 0 0  0
1 2 3 4 5 6 7 0 0  0
1 2 3 4 5 6 7 8 0  0
1 2 3 4 5 6 7 8 9  0
1 2 3 4 5 6 7 8 9 10
 
@nathanrogers ^ and ^^
@nathanrogers (Do you realise that that + is actually taking the complex conjugate of all the numbers? The equivalent APL is +↑,\⍳10)
 
9:38 PM
nope
that isn't really what I'm after apparently
 
@nathanrogers You have a list of numbers, and in each "row" (how can rows have different lengths?) you one one more number from your list?
 
no I wnat numbers from a list not from iota
I don't want repeated numbers unless they're repeated in the original list that's forming the triangle
 
@nathanrogers Ah, I think I get it now. Hang on.
 
2 0 0
5 8 0
3 12 9
something like that
from 2 5 8 3 12 9
 
⎕←{↑⍵⊂⍨(⍳≢⍵)∊(+\⍳≢⍵)}2 5 8 3 12 9
 
9:43 PM
@Adám
2 5  0
8 3 12
9 0  0
 
Oops, sorry:
⎕←{↑⍵⊂⍨(⍳≢⍵)∊(+\⍳≢⍵)}2 5 8 3 12 9 ⊣ ⎕IO←0
 
@Adám
2  0 0
5  8 0
3 12 9
 
wooph
partitioned enclose eh
 
@nathanrogers One way to do it.
 
10:14 PM
@Adám having another issue. 2{⎕←⍺}/↓a where a is the above result
⍺ is 2 0 0][5 8 0
 
@nathanrogers Before I look at that, how do you like this one:
 
why? ⍺ should be 2 0 0 with ⍵ 5 8 0
 
⎕←{⍵@⊢↑,\1⍴⍨0.5ׯ1+0.5*⍨1+8×≢⍵}2 5 8 3 12 9
 
@Adám
2  0 0
5  8 0
3 12 9
 
um
not particularly
 
10:15 PM
@nathanrogers Do you understand it?
 
no
I see ↑,\
so that's from before
 
@nathanrogers It solves a quadratic equation to get the inverse of the triangular number (the number of elements), then uses that to create a triangle of appropriate size, then populates the triangle with the data.
 
I see the sqrt of something in there, but I don't know why the constants, then the ¯1+? that's wierd, then half that, reshape with some arguments or another, and then you do the same listing that you did before
 
@nathanrogers You're reducing along the trailing axis → instead of along the leading axis ↓. just use instead :-)
 
ugh
nope the same ⍺
2 0 0 5 8 0
I want ⍺ is 2 0 0 and ⍵ is 5 8 0
 
10:19 PM
@nathanrogers Oh, wait, you're splitting.
 
2 {⎕←⍺⍵}/⍳10 gives me 0 1 for the first tuple
 
@nathanrogers And what did you expect?
 
exactly that
but I'm geting ⍺ as the first 2 values, and ⍵ as the second 2 values
⎕←{⍵@⊢↑,\1⍴⍨0.5ׯ1+0.5*⍨1+8×≢⍵}2 5 8 3 12 9
 
@nathanrogers
2  0 0
5  8 0
3 12 9
 
2{⎕←⍺}/↓{⍵@⊢↑,\1⍴⍨0.5ׯ1+0.5*⍨1+8×≢⍵}2 5 8 3 12 9
i would expect ⍺ to be 2 0 0
not 2 0 0][5 8 0
 
10:22 PM
@nathanrogers I think you're misreading the output. The two lines are separate outputs from separate calls to ⎕←
 
Since you have three elements, there are two pairs
 
yeah ok
 
@nathanrogers Btw, instead of solving the quadratic yourself, you can just ask APL for the inverse of the binomial coefficient with (2!1∘+)⍣¯1:
⎕←{⍵@⊢↑,\1⍴⍨(2!1∘+)⍣¯1≢⍵}2 5 8 3 12 9
 
@Adám
2  0 0
5  8 0
3 12 9
 
10:26 PM
well, this is actually much harder than I thought :(
 
@nathanrogers What are you actually trying to accomplish?
 
is there a n f/ v variant for cumulative?
n f\v
 
@nathanrogers No, but just do +/¨,\
 
I need the result to modify the result of the next pair :(
This is my problem with APL is I can solve like-kind problems, but when I'm confronted with an interesting problem that I'd like to solve, I've solved in another language, but I can't figure out an idiomatic way to solve it in APL
:(
looking for largest descending path in the triangle
 
@nathanrogers You can probably use a reduction for that.
 
10:29 PM
2{⌈/(↓2 3⍴⍺,¯1⌽⍺)+⊂⍵}/↓a
trying something like that but the result of one doesn't impact subsequent tuples
I don't want the answer
I want to know how I should approach the solution
 
Do you know what algorithm to use?
 
I'm just summing descending the triangle, and getting the largest value from the base of said triangle
 
@nathanrogers My father taught me to approach problems top-down: Describe in English what you want. Then define in English what those terms mean. Then define those. Repeat until using basic concepts which have APL primitives.
 
I have. @Adám Sum down the triangle, get the largest from the base
but I am struggling to figure out how to do that in apl.
 
@nathanrogers Define "sum down" and "base"
 
10:32 PM
the base of the triangle. We have
2
5 8
3 12 9
 
How do you choose which of the above numbers you add to the below number?
 
the base is 3 12 9
2 + 5, 2 + 8
7 10

so the next layer 7 + 3, greatest from 7+ 12,10 + 12, 10 + 9
@H.PWiz that's the neg 1 rotate
¯1⌽2 0 0 is 0 2 0 , sum both to the next row, and get the largest accross
for the first row, that's moot since there's only one value, but on the next iteration, you need the greatest of the sum on 12
 
Ah, so at every level coming down, you can go SW or SE.
 
if you graph it out, it's easy to see
let me get a tio to draw it out
 
@nathanrogers So we need to calculate all the paths, and then find which one has the highest sum?
 
And we can't decide until we've tried them all, because maybe it looks great staying left in beginning, but it causes us to loose some large numbers on the right further down.
 
the algorithm I'm using is just to sum all of them descending and get the largest
it beats any tree search
but the sum isn't accumulating
I thought that's what / was for
2{⌈/(↓2 (≢⍺)⍴⍺,¯1⌽⍺)+⊂⍵}/↓a
but then it isn't accumulating
it's just doing each row
 
I think the nested representation (,2)(5 8)(3 12 9) is more natural for this problem
 
but what if I want to try random inputs
how would you shape that
this is a minimal example
 
How are your inputs provided
 
10:40 PM
a progressive take drop?
they aren't, I'm trying to solve the problem
with a minimal example
 
So to convert a vector to a nested list like the one I showed. Just remove from whatever Adám posted
 
I imagine i would just test it against various ?10⍴100
or something
 
⎕←⊃{⍺+2,/⍵}/{⍵⊂⍨(⍳≢⍵)∊(+\⍳≢⍵)}2 5 8 3 12 9⊣⎕IO←0
 
@Adám
┌───────────┐
│10 19 22 19│
└───────────┘
 
10:43 PM
These are all the possible sums.
Now you just choose the largest one and its position gives away the path.
 
13 mins ago, by nathan rogers
I don't want the answer
 
@H.PWiz I know, but it isn't the full answer either.
@nathanrogers At every level, you want to pair each sum up with the two below it.
The two below it are 2,/rowBelow
rowBelow is simply the next term, i.e. in the reduction operand.
@nathanrogers Makes sense?
 
annoyingly
aside from basic vector addition, and copying formulae from other people's javascript, I've solved no problems using APL
I still don't understand your grouping function
 
@nathanrogers OK, let me talk you through the whole though process. Is that OK?
 
That's fine for this example, but I just plain can't figure out how to solve a problem using the tools available
 
10:49 PM
@nathanrogers Give it time. Read and understand other people's code. Now, does That's fine mean you want me to explain?
 
sure
but then again, I'm reading your code now and I would not have derived that grouping function given a week
 
OK, the first thing was the task of splitting in progressively longer segments.
 
yes
I would have wanted take or drop for that, or some kind of between operator?
 
So clearly, we need to partition. That gives away (or , but it usually makes less sense).
Now requires us to indicate (with a 1) where we want partitions to begin (the rest should be 0).
So where is that? Well, first we want 1 element, then 2, then 3 and so on.
 
For what it's worth, Adám's solution is much slower than it need be for the problem I think you were describing. The algorithm I believe you described is much faster, and also simple. For example, Adám's can't solve projecteuler.net/problem=67
 
10:54 PM
Therefore, the indices of the beginning points are 1, then 1+2, then 1+2+3. I.e. we have a cumulative sum +\ of all the integers .
However, we end up with too much because of ⎕IO←1. Simple experimentation gave that ⎕IO←0 worked.
 
yes I see the sum of indices
we're essentially saying the index at the end of each row
 
OK, now we have the cumulative sum 0 1 3 6 10 15 but we want Boolean mask.
So we need to indicate where these indices occur among all indices. Or rephrased: Which indices ⍳≢ are elements in the set .
That's (⍳≢⍵)∊(+\⍳≢⍵) giving us the partitioning vector.
 
@H.PWiz why can't it solve it?
 
It's too slow
 
@nathanrogers And I believe you understood the reduction?
 
11:00 PM
yes
no
 
@nathanrogers ?
 
⍵ is always 3 12 9 when I {⎕←⍵}/...
 
@nathanrogers Yes? And?
 
I thought reduction was of the form (total, next) => total = total f next
 
@nathanrogers f-reduction of A is basically A[1] f A[2]f A[3] f … f A[≢A]
@nathanrogers That sounds like iteration. Look into
@nathanrogers Btw, you can use reductions like that. ngn tends to do so, and I've picked it it up from him. You just have to remember the definition of reduction, so you get order of execution right.
@nathanrogers f⍨/⌽ should do that, methinks.
 
11:09 PM
how would I do things the way I was expecting? where letters are rows f(f (f a b) c) d
well wait
I just don't need to use the 2
 
@nathanrogers Try rephrasing that with an infix f instead of a prefix f.
 
((a f b) f c) f d
 
@nathanrogers Nice. Now rephrase it using f⍨ instead of f.
 
d f c f a f b
 
@nathanrogers Perfect (other than a typo: you swapped a and b). Now rephrase as a reduction.
 
11:13 PM
that's simple reduction
f/ a b c d
 
@nathanrogers You mean d f c f b f a
 
@nathanrogers Almost. Why did you reverse the order of the elements?
 
⎕← {⊃⌈/(⎕←↓2 3⍴⍵,¯1⌽⍵)+⊂⍺}/⌽↓a
⎕← {⊃⌈/(↓2 3⍴⍵,¯1⌽⍵)+⊂⍺}/⌽↓{↑⍵⊂⍨(⍳≢⍵)∊(+\⍳≢⍵)}2 5 8 3 12 9
 
@nathanrogers
VALUE ERROR
 
eh?
oh a
⎕← {⊃⌈/(↓2 3⍴⍵,¯1⌽⍵)+⊂⍺}/⌽↓{↑⍵⊂⍨(⍳≢⍵)∊(+\⍳≢⍵)}2 5 8 3 12 9
 
11:18 PM
@nathanrogers
┌────────┐
│26 10 17│
└────────┘
 
now that doesn't look right
⎕← {⊃⌈/(↓2 3⍴⍵,¯1⌽⍵)+⊂⍺}/⌽↓{↑⍵⊂⍨a∊(+\a←⍳≢⍵)}2 5 8 3 12 9
 
@nathanrogers
┌────────┐
│26 10 17│
└────────┘
 
⎕←⊃{⊃⌈/(↓2 3⍴⍵,¯1⌽⍵)+⊂⍺}/⌽↓{↑⍵⊂⍨(⍳≢⍵)∊(+\⍳≢⍵)}2 5 8 3 12 9⊣⎕io←0
 
@H.PWiz
10 22 19
 
oh, io 0
so how can I do that without ⊃⌈/
 
11:23 PM
First note:
⎕←⊃{⍺+⊃⌈/(↓2 3⍴⍵,¯1⌽⍵)}/⌽↓{↑⍵⊂⍨(⍳≢⍵)∊(+\⍳≢⍵)}2 5 8 3 12 9⊣⎕io←0
 
@H.PWiz
10 22 19
 
Then:
 
@H.PWiz
10 19 16
 
⎕←⊃{⍺+⍵⌈¯1⌽⍵}/⌽↓{↑⍵⊂⍨(⍳≢⍵)∊(+\⍳≢⍵)}2 5 8 3 12 9⊣⎕io←0
 
@H.PWiz
10 22 19
 
11:24 PM
this isn't generic either?? what
ugh
uuuuuuugh
 
@nathanrogers ?
 
@nathanrogers
11 3  0 0 0
 3 2 10 0 0
 4 6  3 7 0
 5 2 10 7 3
 9 0  0 0 0
 
⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1+?15⍴10⊣⎕io←0
⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1+?15⍴10⊣⎕io←0
 
@nathanrogers
8 0  0  0 0
7 2  0  0 0
4 5  6  0 0
2 7  1  5 0
6 5 10 10 4
 
11:26 PM
That works great
⎕←{⊃⌈/(↓2 3⍴⍵,¯1⌽⍵)+⊂⍺}/⌽↓ ⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1+?15⍴10⊣⎕io←0
that doesn't
 
@nathanrogers
9 11  0  0 0
4  2 11  0 0
6  7  6  8 0
3  6  3 10 2
5  0  0  0 0
LENGTH ERROR
 
⎕←{⊃⌈/(↓2 3⍴⍵,¯1⌽⍵)+⊂⍺}/⌽↓ ⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1+?15⍴10⊣⎕io←0
 
@nathanrogers
3 0  0 0 0
1 7  0 0 0
1 6 10 0 0
3 6  8 7 0
8 5  2 3 4
LENGTH ERROR
 
That is because 2 3 was specific to your example
⎕←{⊃⌈/(↓4 5⍴⍵,¯1⌽⍵)+⊂⍺}/⌽↓ ⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1+?15⍴10⊣⎕io←0
 
@H.PWiz
4 0 0 0 0
9 8 0 0 0
1 9 9 0 0
8 7 3 1 0
3 5 9 3 3
┌──────────────┐
│25 34 38 28 25│
└──────────────┘
 
11:30 PM
I should have used 2 5, sorry
 
oh, derp. i had fixed thayelsewhere
⎕←{⊃⌈/(↓2 (≢⍵)⍴⍵,¯1⌽⍵)+⊂⍺}/⌽↓ ⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1+?15⍴10⊣⎕io←0
 
@nathanrogers
 9 0  0  0 0
 2 8  0  0 0
 4 7 10  0 0
 8 1  9 10 0
10 6  9 10 4
┌──────────────┐
│33 31 45 47 41│
└──────────────┘
 
But ⌈/↓2 (≢⍵)⍴⍵,¯1⌽⍵ is just ⍵⌈¯1⌽⍵
 
Also 2 (≢⍵)⍴⍵,¯1⌽⍵ could be ⍵⍪⍉⍪¯1⌽⍵
@Adám I meant ¯
 
11:37 PM
⎕←{⊃(⌈/(↓2 (≢⍵)⍴⍵,¯1⌽⍵))+⊂⍺}/⌽↓ ⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1 1 7 8 10 5 2 2 9 5 3 9 2 1 4
 
@nathanrogers
1 1  0 0 0
7 8 10 0 0
5 2  2 9 0
5 3  9 2 1
4 0  0 0 0
┌──────────────┐
│25 18 22 22 22│
└──────────────┘
 
⎕io :)
 
{⊃(⌈/(↓2 (≢⍵)⍴⍵,¯1⌽⍵))+⊂⍺}/⌽↓ ⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1 1 7 8 10 5 2 2 9 5 3 9 2 1 4⊣⎕io←0
ftlog
⎕←{⊃(⌈/(↓2 (≢⍵)⍴⍵,¯1⌽⍵))+⊂⍺}/⌽↓ ⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1 1 7 8 10 5 2 2 9 5 3 9 2 1 4⊣⎕io←0
 
@nathanrogers
1  0 0 0 0
1  7 0 0 0
8 10 5 0 0
2  2 9 5 0
3  9 2 1 4
┌──────────────┐
│15 29 29 28 22│
└──────────────┘
 
⎕←{⊃(⍵⌈¯1⌽⍵)+⊂⍺}/⌽↓ ⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1 1 7 8 10 5 2 2 9 5 3 9 2 1 4⊣⎕io←0
 
11:38 PM
@nathanrogers
1  0 0 0 0
1  7 0 0 0
8 10 5 0 0
2  2 9 5 0
3  9 2 1 4
┌──────────────┐
│15 21 14 13 16│
└──────────────┘
 
the top is correct
the second isn't
 
My bad. You need to get rid of and when simplifying it as I have done.
They were only there because of the reduction.
 
⎕←{⍺+⍵⌈¯1⌽⍵}/⌽↓ ⎕←{↑⍵⊂⍨a∊(+\a←⍳≢⍵)} 1 1 7 8 10 5 2 2 9 5 3 9 2 1 4
I still don't know how when or why to do any of that
boxing vs not and why I had to do ⊃ in the first place
 
Do you understand ⍵⌈¯1⌽⍵. It seems more natural than what you had to me
 
yes I get it
it's much cleaner, but I still don't see it for myself
er
greatest neighboring index
 
11:42 PM
Personally I chose to do:
⎕←{⍺+(0,⍵)⌈⍵,0}/⌽{⍵⊂⍨a∊(+\a←⍳≢⍵)} 1 1 7 8 10 5 2 2 9 5 3 9 2 1 4⊣⎕io←0
 
@H.PWiz
┌──────────────┐
│15 29 29 28 22│
└──────────────┘
 
how do I read from a file?
 
@nathanrogers What kind of data?
 
it's a text file with integers
 
@nathanrogers ⊃⎕NGET'filename' for a single simple character vector. Use ⊃⎕NGET'filename'1 to get a vector of vectors (one per line)
 
11:44 PM
You could use (HttpCommand.Get'https://projecteuler.net/project/resources/p067_triangle.txt')‌​.Data and then not even need a file.
(After ]load HttpCommand)
 
hey @Adám there's a bug with dyalog where after closing the editor, it isn't being cleaned up from the toolbar
 
@nathanrogers No, it is a bug in Windows.
 
(You mean the system tray on the right hand side of the taskbar, right?)
 
@H.PWiz it's printing about a million blank lines
 
11:47 PM
@nathanrogers That's because the internet runs on CRLF
 
That's the newline characters
 
@Adám the bottom right
 
@Adám No CRs there
 
@nathanrogers Yeah, known Windows bug. Microsoft doesn't care.
 
there isn't some "on close" thing you guys can do to manually remove it?
 
11:49 PM
@nathanrogers Maybe, but I'm pretty sure JohnD looked into it, because I asked years ago.
@nathanrogers Ah, it is because the session takes LFs literally.
 
@H.PWiz how do I format this?
there are no '\n' and there are no '\r'
also no '\newline'
 
@nathanrogers I get ⎕UCS 10s in there (that's \n)
 
do I use exec maybe?
 
Just split on those, and then ⍎¨
rows←,∘⍎¨(⎕UCS 10)(≠⊆⊢)(HttpCommand.Get'https://projecteuler.net/project/resources/p067_triangle.txt').Data
(Just note that normally, you shouldn't blindly execute downloaded stuff!)
 
⌈/⊃{(⍵⌈¯1⌽⍵)+⍺}/⌽↓ {↑⍵⊂⍨a∊(+\a←⍳≢⍵)} ∊rows works great
I recognized the url
 
11:55 PM
@nathanrogers You don't need ↓ {↑⍵⊂⍨a∊(+\a←⍳≢⍵)} ∊, just do ↓↑rows
 
⌈⊃{(⍵⌈¯1⌽⍵)+⍺}/⌽↑rows ?
⌈⊃{(⍵⌈¯1⌽⍵)+⍺}/⌽↓↑rows
whyyyyyyyyyyyyyy
 
@nathanrogers Because they don't give you trailing 0s. So forces padding with 0s and breaks the matrix into a vector of rows again.
 
thats wonderful. forgive my frustration, but basically the only thing I contributed was the initial flawed idea about the greatest of the sum of an adjusted row
 

« first day (657 days earlier)      last day (1997 days later) »