« first day (587 days earlier)      last day (2068 days later) » 
00:00 - 17:0017:00 - 00:00

12:30 AM
@Adám you on?
and ya I looked at it
 
@NoahCristino Yes. It is getting a little late here, but let's do a little.
 
ok
@Adám you gonna give me a challenge or something?
 
@NoahCristino So you've had your hand at tacit programming. APL also allows more straight forward (I call it "explicit" as opposed to tacit) programming.
@NoahCristino Soon. Let's do some theory first.
 
The simplest way is to define one-liner (but optionally multi-statement) "dfns". They are one or more statements in {curly braces}. As all other functions, they can be used monadically (prefix) or dyadically (infix).
 
12:35 AM
yeah monads and dyads sound better than prefix and infix
cuz jelly
 
The right argument is denoted with (the rightmost letter of the Greek alphabet) and the left argument is .
 
@NoahCristino Sure, but monadic doesn't convey which side of its argument it goes on.
 
isn't it always right?
or is that jelly?
 
Of course you don't have to use either of or , but dfns must be called with at least a right argument (i.e. they go on their argument's left side).
 
12:37 AM
ok
 
⎕←{⍵+2×⍵}1 2 3
 
@Adám
3 6 9
 
⎕←⍵1 2 3
 
@NoahCristino
┌────────────────────────────┬─┬─┬─┐
│Was OFF -trains=box -fns=off│1│2│3│
└────────────────────────────┴─┴─┴─┘
 
um
what
{⍵}1 2 3
⎕←{⍵}1 2 3'
⎕←{⍵}1 2 3
 
12:39 AM
@NoahCristino
1 2 3
 
Btw, you can mix and match tacit and explicit. So ⊢+{2×⍵) is a valid tacit function, and {(⊢+2×⊢)⍵} is a valid dfn.
 
hmm
ok
 
Note: Always remember to separate tacit functions from their arguments, either by parenthesising or by naming them separately.
 
I don't really get the part about curly braces and stuff
 
@NoahCristino Inside curly braces, you refer to arguments explicitly. In tacit functions (normally in round parens) you can only refer to functions applied to the argument(s).
Dfns, as opposed to tacit functions, have their own scope. You can assign to local names, and reuse values that way:
 
12:42 AM
can you give an example I'm lost lol
 
⎕←{twice←2×⍵ ⋄ 10+twice}1 2 3
 
@Adám
12 14 16
 
is the statement separator. Tacit functions can only have a single statement.
 
⎕←{10+twice}1 2 3
 
@NoahCristino
VALUE ERROR
 
12:44 AM
whoops
 
@NoahCristino VALUE ERROR because you did not define twice before using it.
 
what does the ⍵ refer to in that example?
 
@NoahCristino In my example, {twice←2×⍵ ⋄ 10+twice}1 2 3, the refers to the right argument of the immediately enclosing braces, so 1 2 3.
 
⎕←{⍵}1 2 3
 
@NoahCristino
1 2 3
 
12:46 AM
⎕←{⍵×2}1 2 3
 
@NoahCristino
2 4 6
 
⎕←7{'⍺ is ',⍺,' and ⍵ is ',⍵}10
 
ok I get that
 
@Adám
⍺ is  7  and ⍵ is  10
 
now how about the ones in parantheses
⎕←1 2 1{⍵+⍺}2 1 2
 
12:47 AM
@NoahCristino
3 3 3
 
is just a normal function which returns its left argument, and returns its right argument. So you can use those to refer to the arguments:
 
⎕←1 2 1{sum←⍵+⍺ ⋄ 1 1 1+sum}2 1 2
 
⎕←7(⊣,' and ',⊢,'makes',+)10
 
@NoahCristino
4 4 4
@Adám
7  and  10 makes 17
 
so ⊣ = ⍺ and ⊢ = ⍵
 
12:49 AM
@NoahCristino Kind of. means left⊣right and means left⊢right and + means left+right.
 
But because left⊣right gives left, it serves the same purpose as in a dfn.
 
The reason I'm stressing this is so that you don't end up writing silliness like ⊣+⊢ in a tacit function, when clearly + would have sufficed.
Now for some other useful features that dfns can do.
 
@Adám thoughts regarding your most recent challenge: I always thought APL used inferred weak static typing - is it actually dynamic?
 
12:52 AM
like why use {} vs ()? @Adám
 
@Οurous APL is interpreted.
@NoahCristino Otherwise you (and the interpreter) wouldn't know which parsing rules to use.
 
oh so its personal preference?
like no difs between them?
 
@Adám .. I also didn't know that - I take it it's dynamic then.
 
@NoahCristino You may use either, but you'll find that sometimes one style fits better. This is a general philosophy in APL. We provide you with lots of ways to do things according to many paradigms. Mix and match as you see fit!
 
ok
can I try a problem now?
 
12:56 AM
@Οurous Yes, but not only that, "type" isn't really applicable.
@NoahCristino Almost. I'll teach you two more features of dfns that you'll need.
 
In a dfn, you can write "guards". They are expressions followed by a : evaluating to 0 or 1. If 1, the expression immediately after the : is the result of the dfn. If 0, execution continues on the next line.
⎕←{⍵:'true' ⋄ 'false'}0
 
@Adám
false
 
And:
⎕←{⍵:'true' ⋄ 'false'}1
 
@Adám
true
 
12:58 AM
If not boolean, error.
 
⎕←{⍵-0:'true' ⋄ 'false'}1
 
@NoahCristino
true
 
⎕←{⍵-1:'true' ⋄ 'false'}1
 
@NoahCristino
false
 
@Adám ok got it
 
12:59 AM
And a dfn can call itself (tail recursion is free too) using to represent itself.
⎕←{⍵<10:⍵ ⋄ ∇⍵÷2}30
 
@Adám
7.5
 
@Adám oookay, you've really got my attention now. What happens if you, for example, try to take the square root of a string. I assume it doesn't work and produces some error indication, but when/how does the interpreter realise it needs to do that if there aren't types?
 
⎕←{⍵>10:⍵ ⋄ ∇⍵÷2}30
 
@NoahCristino
30
 
ok I got it
 
1:02 AM
There are types, I think. Just not Boolean v. Integer v. Float.
It's probably like JS's type system (minus the stupidity)
 
@Οurous APL doesn't have strings. Instead we use vectors of characters. Arithmetic functions penetrate all structure and so only applies to atomic data. If you feed a characters to power (*) it will throw a domain error.
And atomic data, we call them simple scalars, can basically only be numbers and characters. (There are a couple more "types" but they are more obscure.)
@NoahCristino OK, now write a Fibonacci function. Given N as right argument, find the Nth Fibonacci number.
 
⎕←{⍵}5
 
@Οurous Checking whether data is in a primitive functions's domain is usually the last thing being checked, just before the actual computation.
 
@NoahCristino
5
 
theres no built in fibanocci function?
 
1:07 AM
@NoahCristino No. And even if there were, this is an exercise for you.
@NoahCristino You may want to use TryAPL for extensive experimentation if you want quicker responses without being subject to the bot's personality.
 
@Adám Ooh so the entire type system is basically :: Type = Number | Character | Vector Type, where every non-primitive function has a signature like f :: Type Type.. -> Type?
 
@Οurous I'm not very good at Haskelling, but at least you need to change "Vector" into Array. We prefer phrasing it as follows: All data in APL resides in arrays. An array is a rectangular collection of numbers, characters and arrays, arranged along zero or more axes. Numbers and characters are 0 dimensional arrays, and are refered to as scalars.
 
Don't forget enclosed arrays!
 
@Zacharý of numbers, characters and arrays
 
Wow, how'd I forget that.
 
1:14 AM
I tried this: 1{⍺>⍵:⍵+⍺ ⋄ ∇}1
@Adám
 
@Adám Ah I get it now.. except - is an array containing only arrays the same as an array along two axes?
 
@Οurous Note that in APL, a vector of vectors is not the same as a matrix. APL has a much more nuanced array system, which e.g. lets you work with a matrix with 0 rows and 2 columns. Most programming languages cannot do that.
 
im kinda lost tho
 
@Οurous Rank!=Depth...
 
1{⍺>⍵:⍵+⍺ ⋄ ∇+⍺}1
 
1:15 AM
@Οurous All arrays contain only arrays. Even a simple scalar like 42 is an array. An un-nested 0-dimensional array.
 
@Adám Shudders R
 
@Zacharý Ah right.
 
im so confused @Οurous
 
@NoahCristino Wait a minute. The definition of Fibonacci is fib(n)=fib(n-2)+fib(n-1), but fib(0)=1 and fib(1)=1.
@Zacharý please ;-)
 
:D
Forgot I had the APL keyboard snipped bookmarked.
 
1:18 AM
what's the or operator
 
@NoahCristino .
 
Note: It's not bitwise.
 
0{⍺=0∨1:1 ⋄ ⍺}2
what's wrong with that
im trying to check if left = 1 or 0 then output 1
 
@Zacharý CMC: Find an array A such that (!≢⍴A) = ≡A
 
else output the number
 
1:20 AM
@Adám I don't even think my brain can do that. Is that like [[],[]] (two empty arrays) where 1 row and 2 columns would be like [[value],[value]]?
 
@NoahCristino That's not how or works. You could use (⍺=0)∨⍺=1 or just ⍺∊0 1.
 
@Οurous I just continue to think of it as a scalar.
 
@Οurous JSON is not sufficiently powerful to describe APL arrays. Think of a spreadsheet where you remove all rows and all but two columns.
 
⎕←{⍵∊0 1}2
 
@NoahCristino
0
 
1:22 AM
that works
 
@Οurous If you add more rows, they'll have two columns each. If you add one more column, there'll still be no data, but your sheet now has three columns.
 
⎕←{⍵∊0 1:1 ⋄ ⍵}2
 
@NoahCristino
2
 
@NoahCristino Nice, you're moving in the right direction now.
 
fib(n)=fib(n-2)+fib(n-1)
wait that doesn't make sense?
fib(n)=fib(2-2)+fib(2-1)
 
1:25 AM
@NoahCristino Why not?
 
fib(n)=fib(0)+fib(1)
so fib(2) = 2
 
It could also be fib(0)=1, fib(1)=1
@Adám, there are two definitions of Fibonacci. The difference is basically ⎕IO←0 v. ⎕IO←1
 
@NoahCristino Ah, you want fib(2) to be 1 to get 1 1 2 3 5…?
 
then why is f(0) = 1?
nvm
 
@Adám So you can also have two rows and no columns?
 
1:27 AM
@Οurous Yep! And then you can throw in prototypes as well! ''≢⍬
 
soo whats next?
 
@Οurous Yes, of course. You can also have 2 layers, 0 rows, 3 columns, etc. etc.
 
I have {⍵∊0 1:1 ⋄ ⍵}2
but I need to replace the last w with the func to find the fib
 
@NoahCristino Exactly.
 
@Zacharý Yeah that went about three kilometres over my head. ''≢⍬ = (empty string?) (is equivalent to?) (squiggle?)
 
1:29 AM
@Οurous The ]display command helps visualise array structure:
]display 2 0 3⍴0
 
@Adám
┌┌→────┐
↓⌽0 0 0│
││     │
││0 0 0│
└└~────┘
 
An empty character vector isn't an empty numeric vector
 
@Zacharý If you want to confuse @Οurous even more, now explain ∧/''=⍬.
 
Well, since there are 0 elements in both '' and , the result will also be 0 elements (just a normal 1d vector with zero elements). Since zero and one are both numeric: the result of ''=⍬ is numeric. Numeric, 1D, 0 elements. That means ⍬≡''=⍬ ( is like []). Now, Dyalog APL has a way of dealing with reduce over empty arrays: it returns the element, that when added to any array, will cause the reduction to remain unchanged
 
@Οurous Each of and and in that display form indicate an axis. is the trailing axis, is the axis before that which is a length-0 axis, and is the first axis. The blank line separates the layers, so you can see there are two layers, no rows, three columns. The apparent rows are only there to tell you that this empty array is "full" of zeros. That is, if you were to coerce elements out of it, they would be zeros. The ~ indicates that the zeros numbers, not characters
 
1:34 AM
⎕←∧/⍬
 
@Zacharý Uh oh, four spaces, not backtick.
 
⎕←∧/⍬
 
@Zacharý
1
 
⎕←∧/¨(1 0 0 1) (1 0 0 1 1)
 
@Zacharý
0 0
 
1:40 AM
@NoahCristino Any progress?
 
 
4 hours later…
5:22 AM
@Lynn if you don't mind, could you share your solution to the neural networks section of phase 2? I would like to see where I could improve
 
 
5 hours later…
10:05 AM
@Cowsquack what do you mean by "improve"? :P
 
@Cowsquack it was probably my ugliest bit of code gist.github.com/lynn/5bb913c2d6f2fed4381a1948d0a0faa0
BackProp took me longer to write than the entire rest of the contest
I struggled a lot with it, because the problem was not so well specified. I don't think the math/algorithm explained ever ended up being correct, I had to follow some C# XOR net tutorial I found online, hehe
I wanted to write it in a way that worked for multiple hidden layers, and maybe bias somehow, but I felt very out of my depth and out of patience >_<
 
10:48 AM
@Lynn nice, thanks
the scanl's pretty neat, I had a hacky method with an external array in which I appended each iteration of the scan
 
it's probably copied from the specified source
 
oh ha I did not see that
@Lynn I found neuralnetworksanddeeplearning.com/chap2.html to be a helpful resource
@Lynn nicely documented though, clean and easy to understand
 
If it is of interest, here is an improved version of what I did. gist.github.com/jslip/3b83aa9ebbc339493bb29865fdb08d93. It works for any network shape (i.e multiple hidden layers, mulitple output nodes etc)
With some modifications this was training on MNIST in ~30 secs
 
11:09 AM
I also have my backprop for any network shape and it does mnist in ~50 secs for 30 training epochs
@jslip how many iterations?
I wonder how fast the fastest apl backprop loop would be
@jslip try it on the emnist letters database nist.gov/itl/iad/image-group/emnist-dataset
my network currently takes a hit in the accuracy going from mnist to eminst
(also the emnist letters includes both upper and lower case letters)
 
For MNIST I had 10 epochs batch size of 20 and network shape of 784 30 10.
I haven't tried emnist but I did try (fashion-mnist)[github.com/zalandoresearch/fashion-mnist]. This resulted in a pretty big accuracy loss also
 
@jslip that configuration gives me 15 secs
but I am using tanh instead of sigmoid
@jslip you don't keep track of the intermediary activations of the network?
 
11:25 AM
@Cowsquack sounds like yours is better than mine.
@Cowsquack I do. That is what ff returns
 
ah, the ,⍵
 
@Cowsquack If your's took 15 secs then that's very impressive. On my machine that's comparable to tensorflow time on my cpu if my memory serves.
 
o_O
these are my full set of settings to see if they match with the tensorflow one ('input' (50e3 dd⍴d_data))('target' (1-⍨2×d_lbl∘.=0,⍳9))('weights' (gen_weights dd 30 10))('eta' .1)('iter' 10)('size' 20)
@jslip wait I think I might know why, I don't use the full test set
('test_data'(1e3 dd⍴d_tdata))('test_label'(1e3↑d_tlbl)
only the first 1e3 items, because otherwise ws gets full
speaking of which, what did you set your ⎕ws to?
 
12:01 PM
@Cowsquack You mean MAXWS?
 
ngn
12:30 PM
@Lynn @Cowsquack I wrote a very similar thing in 2016: gitlab.com/snippets/1750978
 
 
1 hour later…
1:42 PM
@Cowsquack ⎕MAXWS←8G. That may be a bit excessive
 
@jslip No there. I usually use 2G.
 
@Adám Yeah. My laptop has far more RAM than I need. I figured I may as well use it.
 
@jslip Sure, I have plenty too, but a too large ws means it takes a long time for runaway expressions to cause a WS FULL.
 
@Adám been there, done that. Multiple times.
 
@Cowsquack That may make up the difference. You're using fewer training images as well.
 
1:48 PM
Until I found out about Right Click → Interrupt it actually annoyed the heck out of me when recursive functions went wrong >.>
 
@J.Sallé Also Ctrl+Pause (and also systray click, and also Action>Interrupt).
 
@Adám oooooooh I didn't know about Ctrl+Pause
Come to think about it, I don't think I've ever pressed the Pause key for anything in the 15 or so years I've been using computers.
 
@Cowsquack When I reduce my training set and test set to the same size as you It comes down to 23 secs so yours is still better.
 
In Adám's first blog post he discusses employing function keys to assist with debugging – read it at https://www.dyalog.com/blog/2018/09/enhanced-debugging-with-function-keys/
Congratulations 👏🥳 https://twitter.com/chordbug/status/1036682716685713408
 
2:05 PM
@Adám found a typo in your blog post. I assume the correct command is BP, not TB?
 
@J.Sallé Correct and corrected. Thanks!
 
@Adám No problem c: Great post btw
 
@Adám ah yes
@ngn that line 9 o_O
 
@Cowsquack You may have gotten confused by ⎕WA (Workspace Available):
 
@jslip do you mean 50e6 instead of 60e6?
 
2:11 PM
⍞←⎕WA,'bytes'
 
@Adám 134182640 bytes
 
ngn
@Cowsquack which part of w+←(⍉¨¯1↓l)+.ר1↓⌽((Sd⊃⌽l)×⍵-⊃⌽l){(1⊃⍵)×⍺+.×⍉⊃⍵}scan1⌽↓⍉↑w(Sd ¯1↓l) don't you understand? :)
 
@Adám why does ' ',¨⎕D adds 3 whitespace characters between every number? I assumed it'd add a single whitespace, is it something to do with ¨?
 
@ngn I'll get back to you in 2 hours :P
 
⎕←' ',¨⎕D
 
2:14 PM
@Adám
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐
│ 0│ 1│ 2│ 3│ 4│ 5│ 6│ 7│ 8│ 9│
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘
 
@J.Sallé it's the formatting
 
@J.Sallé ^^ APL adds two spaces between elements of a nested array.
 
@Adám is this an interpreter setting?
 
Ah, if I turn boxing on it'll display correctly then?
 
@J.Sallé No, you need to flatten with .
 
2:15 PM
@Adám I see, I see.
Thanks!
 
@Cowsquack It is a configuration option. On macOS, set MAXWS.
 
@Cowsquack I mean you were using 50e5 instead of 60e5 yes
 
Hey @ngn, do you know anything in APL equivalent to K's \: adverb?
I assume it'll need to be an inner function
 
what does it do? (K noob)
 
ngn
@J.Sallé "each left"? you can do it like this: ⍺ f¨⊂⍵
 
2:23 PM
@ngn yeah so I'll need it to be an inner function in my case, I think. Thanks
 
@ngn {⍺⍺∘⍵¨⍺}? :P
 
ngn
@EriktheOutgolfer yeah, that's probably better :)
@J.Sallé what do you mean by "inner function"?
 
@ngn I'm making a Dfn to do something and I need an 'each left' inside of it
 
@J.Sallé ⍤¯1 99
 
@Adám aaaah that's actually even better because it returns a matrix
@Adám can I compound that with any function? as in larg((somefn)⍤¯1 99)rarg?
 
2:34 PM
@J.Sallé Yes. ⍤¯1 99 is a derived (i.e. tacit) monadic operator.
 
ngn
@J.Sallé you might need a ⊢ before rarg
 
Great! Thanks guys
 
@ngn Nope, he already has parens.
 
2:49 PM
@jslip ~17 seconds
@Adám got it up to 2 gigs now
 
@Cowsquack That should be plenty for most purposes.
 
(that's half my ram gulps)
 
@Cowsquack Well, it won't actually use that much memory if you don't fill your workspace, and if you hit a WS FULL, it'll cut back to where you were before the filling started.
 
@Adám So, I got this far: {∊((⍳⍴⍵)⍴¨⊂' '),⍤¯1 99⊢¨⍵}⎕D, but it returns the same as {∊((⍳⍴⍵)⍴¨⊂' '),¨⊂⍵}⎕D. I need it to add the spaces between each number in ⎕D, not between multiple ⎕Ds. Any tips?
 
@J.Sallé what's the point of the ⊢¨?
 
3:02 PM
@J.Sallé {∊⍤1⊢((⍳⍴⍵)⍴¨⊂' '),¨⍤¯1 99⊢⍵}⎕D
 
@dzaima none, it just stayed there from a previous version of the function
@Adám aaaaaaaah the ¨ should go before , not
 
what are you attempting @J.Sallé?
 
@Cowsquack this
You're probably gonna get a better solution than me though if you're also trying it
 
@J.Sallé Yes, because you want to prepend to each. Btw, you can also go fully tacit with (∊⍤1⊢,¨⍤¯1 99⍨' '⍴⍨¨⍳∘⍴)⎕D
 
ngn
that bit in the middle is a candidate for a ,\ of spaces
 
3:06 PM
@Adám I see it. Still need to do some stuff to it though, it's not complete yet
 
ngn
(⍳⍴⍵)⍴¨⊂' ' -> ,\⍵⊢¨' ' (assuming ⎕io←1)
 
@ngn I think it needs ⎕IO←0.
 
I also found a problem with it putting a space before the first character in the string (input can be any string, I'm testing with ⎕D because lazy)
 
ngn
@Adám what's the challenge?
 
And yes I need to use ⎕IO←0 in this case
 
3:09 PM
4 mins ago, by J. Sallé
@Cowsquack this
 
^^ Actually using ,\⍵⊢¨' ' I can drop that requirement
 
ngn
@Adám sorry, I was having dinner and reading along... I'll try to pay more attention now
here's a shorter solution: {(⊢⍪1↓⊖)↑,/(-⍳≢⍵)∘.↑⍵} (⎕io←1)
 
ಠ_ಠ ∘.↑
@ngn the spaces need to be after the first character in the string though
 
ngn
@J.Sallé even better :) remove the -
 
@ngn ah, nice!
I still have no clue of what ∘.↑ does, though
 
ngn
3:20 PM
it says "Any amount of trailing/leading spaces/newlines are allowed" but I guess it must line up properly
@J.Sallé well, what does ∘.× do? replace × with and you'll find out :)
⎕←{(-⍳≢⍵)∘.↑⍵}'0123'
 
@ngn
┌────┬────┬────┬────┐
│0   │1   │2   │3   │
├────┼────┼────┼────┤
│ 0  │ 1  │ 2  │ 3  │
├────┼────┼────┼────┤
│  0 │  1 │  2 │  3 │
├────┼────┼────┼────┤
│   0│   1│   2│   3│
└────┴────┴────┴────┘
 
ngn
unfortunately ⎕← doesn't display strings nicely - this is a matrix of strings in which the digit is the last character
 
@ngn aaaaaaaaah, so ∘.something is like a something' in K
 
ngn
@J.Sallé ∘.something is "outer product", like something/:\: in k
 
@ngn yes yes I mixed the adverbs up
@ngn Also, this is the kind of stuff I need to learn how to do. I think I'm still too used to imperative and OO languages, so I keep trying to put loop-like functions everywhere instead of working with arrays and matrixes
 
ngn
3:30 PM
@J.Sallé well, practice makes perfect...
 
Feels like I'm trying to code Java using APL and that's a headache if I've ever seen one.
 
ngn
@J.Sallé I have the opposite feeling when I have to code Java :) public static int[] iota(int n) {...}
 
@ngn lol that seems like a new interpreter being born.
A very slow, very Java-y interpreter :p
 
ngn
I wonder, could ∘./ or ∘.\ be useful here
 
ngn
3:47 PM
@J.Sallé I forgot: ,\⍵⊢¨' ' is just ,\¯1/⍵
 
@ngn Ah yeah, it pads with spaces
 
@ngn ha I tried doing that in Röda
 
ngn
@Cowsquack "Röda"?
 
that's fergusq (a ppcg user)'s language github.com/fergusq/roda
however Röda doesn't have function overloading so I have to choose between the monadic and dyadic case (or resort to var args but eh)
 
ngn
@Cowsquack "inspired by Bourne shell, Ruby" - it's amazing someone finds those inspiring :)
 
3:59 PM
I had been creating a matrix library for röda inspired by apl functions and operators github.com/kritixilithos/matrix.bil, last time I was working on it, I was thinking how to make röda's streams compatible with apl-like arrays (for example ⍳(10)|sum for 55)
 
Ugh. I have a solution for this but it fails the test cases where the argument is either or has an oob index (both return index errors). @Adám is there any way to return 0 when the index error is encountered?
 
@J.Sallé (0::0⋄...)
error guard of error 0 (all errors), if that then return 0
 
@dzaima ah, nice! I never used error guards before, only normal guards
Thanks!
 
@ngn oh whoops :P
 
4:28 PM
It's hideous {(⍵≡⍬)∨(×⍵)≡¯1⍴⍨≢⍵:1⋄{0::0⋄^/f=⌽(f←⍵/⍨~¯1⍷¨⍵)⌷¨⊂⍵}⍵}
 
ngn
@J.Sallé why not just one guard at the beginning of the outer dfn?
then you could inline the inner dfn
@J.Sallé ~¯1⍷¨⍵ -> ¯1≠⍵
(⍵≡⍬)∨ seems redundant
 
@ngn I'm not sure how guards work exactly. Also, should return true and index errors should return false, that's why I put the error guard in the inner function
 
ngn
@J.Sallé {0::x ⋄ ...} is like try { ... } catch (Exception e) { return x; }
 
@ngn Ah, I think I know what you mean, then. I'll see what I can do
 
ngn
4:43 PM
@J.Sallé (⍵≡⍬)∨(×⍵)≡¯1⍴⍨≢⍵ can be simplified to ∧/⍵<0
 
@ngn ugh I knew there was a non stupid way of doing that. I was trying a bunch of combinations of `∨∧/` to do that but never though of using <0 >.>
 
ngn
(...)⌷¨⊂⍵ -> ⌷∘⍵¨...
 
@ngn so now I got {0::^/⍵<0⋄{^/f=⌽⌷∘⍵¨f←⍵/⍨~¯1⍷¨⍵}⍵}
 
ngn
@J.Sallé inlining the inner dfn: {0::^/⍵<0⋄∧/f=⌽⌷∘⍵¨f←⍵/⍨~¯1⍷¨⍵}
 
Oh yeah I don't need the inner fn anymore
 
ngn
4:49 PM
@J.Sallé nice trick with the return value for the error guard! :)
now you can do:
13 mins ago, by ngn
@J.Sallé ~¯1⍷¨⍵ -> ¯1≠⍵
 
@ngn ah yeah I did that and copied the wrong line hahahahah
 
ngn
@J.Sallé also: ∧/ A = B here is the same as A ≡ B
 
@ngn nice, I hadn't noticed that
{0::∧/⍵<0⋄f≡⌽⌷∘⍵¨f←⍵/⍨¯1≠⍵}
 
{(⍵≡⍬)∨(×⍵)≡¯1⍴⍨≢⍵:1⋄{0::0⋄^/f=⌽(f←⍵/⍨~¯1⍷¨⍵)⌷¨⊂⍵}⍵} ← old version — that's some golfing simplification @J.Sallé
 
ngn
@J.Sallé can you replace ¯1≠ with 0≤? (I didn't even read the problem)
 
4:55 PM
@Adám yeah tell me about it. Talk about taking the long way around
@ngn I can if I 1-index I think, I'll check
 
@J.Sallé f≡⌽⌷∘⍵¨f←(⌽≡⌷∘⍵¨)
 
ngn
the special case for ⍬ is only because ¨ calls the operand once for an empty array, yuck :(
 
@J.Sallé ⍵/⍨¯1≠⍵⍵~¯1
 
00:00 - 17:0017:00 - 00:00

« first day (587 days earlier)      last day (2068 days later) »