« first day (659 days earlier)      last day (1988 days later) » 

1:00 AM
need some help
I'm fighting with @
@Adám @dzaima @ngn anybody?
iteration works
never mind
 
 
3 hours later…
3:57 AM
I would like some feedback on this solution
This solution answers the question "assuming an infinite chess board, how many unique squares could the king travel to if he made only non-diagonal moves"

Basically a diamond, but solves the problem as directly as I could figure.
 
4:31 AM
@nathanrogers What are you trying to do in input?
 
oh, nothing
sorry
holdover
would also like feedback for solution to problem 11 in project euler
https://tio.run/##ZVTLbtRAELzvV/SNLALiec8ckPgVw5rE0j7CeheColw4IEBZBAeUExe4cEDiAJG4ICTyJ/6RUNW2RCIsa9cz011dVd12fTS/O3tez1cHV1cya@uD/uW7k4nwWuOx330dFh0We/3rT/3uYnq7uheG3YN1O8NBh@PdDxzJv6vffZTuybZeN7KoN@v2eMioEW7FXJ53w/qhri3WcuMaTpvjDc4R8x5571ntBj6Om@VMNoeNMhmTNjVB98yDvX73s7qPoOkUP0PK43Y@H/OaGUPnjTxrN4dibnXy7LAB3erWyG1RH9OCs1f7/e6zvUGPUIMsRrWL7WL0bEXCJ6h8cXne775T2LQ/@4VCp2Pa0Xp1sG66rn3aMLzetKulPFrNt4tlJ/e1B6tlPR85rO8ADyXEX57vA@U6AS9Hq67VfIDOto8213JOxqT@7DfInP75ste/eQGA6R0@oLCYf49/vpnpkEu1a/nvGvSqUFk9lhomQsN2vukmEzmdtMujLYVnQS
would also like to see how to golf it. couldn't seem to assign values inline when using @, and also in general with a multiline dfn
 
4:58 AM
@nathanrogers
 
@nathanrogers To simulate this, it seems is well suited.
 
 
1 hour later…
6:23 AM
Hello, can anyone direct me to a good source to learn APL?
 
@Downgoat :-) Look at the lessons and at the chat bot's profile.
 
ngn
@nathanrogers 34 bytes: {⌈/,⍺×/↑⍵(⍉⍵),(⍉-∘⍳∘≢⌽⊢,≠⍨)¨⍵(⌽⍵)}
31: {⌈/,4×/↑a,(⍉⍳∘≢⌽⊢,≠⍨)¨a←⍵(⍉⌽⍵)}
 
@Adám to simulate which?
@ngn could you do up a TIO with comments explaining how you arrived at those reductions?
@ngn seeing the result is one thing, but I don't know how you can see these, so comments on how you got there would be illuminating
 
ngn
@nathanrogers i can't send the tio link, it says "message too long"
 
6:40 AM
Shift enter after @ngn
 
ngn
@nathanrogers first i tried doing the 4 directions (up-down, left-right, main diag, and alternative diag) separately
then i wondered if i could batch them together somehow. i noticed that padding with 0s is ok, as all numbers are positive, so a 0 product wouldn't affect the result
i noticed that the expressions that handle the 2 diagonals are similar, so i used { }¨ on the matrix and its ⌽
and finally i noticed that if i use the matrix and its rotation (⌽⍉) instead, i could save a few more bytes
@nathanrogers thanks, shift enter worked
 
@nathanrogers Flood filling. Every cell spreads to its four diagonal neighbours, ∙ becomes X
 
 
5 hours later…
11:48 AM
@ngn You can use ,∘0 instead of ⊢,≠⍨. A single 0 will stop the product having an effect
Also {⌈/∊4×⌿¨a,(⍳∘≢⌽,∘0)¨a←⍵(⍉⌽⍵)}
 
 
1 hour later…
ngn
1:07 PM
@H.PWiz ah right, nice :)
it could be even shorter
{⌈/∊(4×⌿⊢,⍴⍴0,⊢)¨⍵(⍉⌽⍵)}
 
1:25 PM
Very cool
I think it's actually missing a little bit. ⍴⍴0,⊢ throws away the last row
 
ngn
@H.PWiz oops
@H.PWiz {⌈/∊{4×⌿⍵,↑{0,⍵}\↓⍵}¨⍵(⍉⌽⍵)} ?
⎕←{{⍵,↑{'.',⍵}\↓⍵}¨⍵(⍉⌽⍵)}5 7⍴⎕a
 
1:46 PM
@ngn
┌──────────────────┬────────────────┐
│ABCDEFGABCDEFG    │GNUBIGNUBI      │
│HIJKLMN.HIJKLMN   │FMTAH.FMTAH     │
│OPQRSTU..OPQRSTU  │ELSZG..ELSZG    │
│VWXYZAB...VWXYZAB │DKRYF...DKRYF   │
│CDEFGHI....CDEFGHI│CJQXE....CJQXE  │
│                  │BIPWD.....BIPWD │
│                  │AHOVC......AHOVC│
└──────────────────┴────────────────┘
 
{⌈/∊(4×⌿⊢,⍳∘≢⌽,∘0)¨⍵(⍉⌽⍵)} is shorter
 
"Does APL Need a Type System?" At #FnConf18, Aaron Hsu talks about type theory and its applicability in the untyped APL world https://confengine.com/functional-conf-2018/proposal/7712/does-apl-need-a-type-system #FunctionalProgramming #APL #TypeSystem #TypeTheory #StaticallyTyped #DynamicallyTyped #DuckTyped #StronglyTyped #WeaklyTyped
Aaron Hsu (@IndianaUniv) will be at Functional Conf 2018 @FnConf co-hosting an APL Workshop (with @mkromberg) as well giving two talks. #FnConf18 #APL
 
@ngn what do you mean since all numbers are positive 0 wouldn't have an effect?
 
ngn
2:04 PM
@nathanrogers when a padding 0 is part of a 4-vector of adjacent numbers, the product of that vector will come out as 0, so it won't affect the maximum
 
ok what ? f←{⌈/∊(4×⌿⊢,⍴⍴0,⊢)¨⍵(⍉⌽⍵)}
oh yes I see
but what about this guy?
there's nothing for me to ⎕←
 
ngn
@nathanrogers that one was wrong... see the later messages
 
what about this guy? {⌈/∊(4×⌿⊢,⍳∘≢⌽,∘0)¨⍵(⍉⌽⍵)}
 
ngn
@nathanrogers do you know how trains work?
 
yes, but not how infer the behavior from reading them
 
ngn
2:09 PM
@nathanrogers ok, this might take some time... do you know what ,∘0 does?
 
I'm assuming we have something like ,⍳≢⍵⌽⍵,0
binds comma with 0
whatever is to the left , 0
it will append a zero to each row in the matrix
 
ngn
@nathanrogers something like that. {4×⌿⍵,(⍳≢⍵)⌽⍵,0} would be the equivalent dfn
@nathanrogers yes
 
Are trains really worth saving 2 characters?
 
Well, if in , of course! :P
 
I mean, the very existence of trains seems to contradict the goals of APL
 
2:23 PM
@nathanrogers Why?
 
2:42 PM
@nathanrogers what's your definition of "the goals of APL"? Trains are just a fancy way to write a dfn without having to spam & everywhere
 
2:56 PM
9 kittens moved to ­Trash
 
wow
 
 
5 hours later…
8:08 PM
> By relieving the brain of all unnecessary work, a good notation sets it free to
concentrate on more advanced problems, and in effect increases the mental power
of the race. A. N. Whitehead
It would seem that this notation in particular doesn't relieve any unnecessary work, instead it would seem to add additional cognitive parsing before intuiting the intent of the phrase.
It's like the phrase "The horse ran past the barn fell."
 
@nathanrogers IMO interpreting the s and parentheses in {(+/⍵)÷≢⍵} are unnecessary work
 
@nathanrogers Nice to see the original look, but an easier-to-access version is here.
 
It's a poor phrasing and requires you to backtrack reading to understand it
the same with trains. You have to backtrack to understand what kind of train it is
 
@nathanrogers Uh, not if it is written properly, so you can read it plainly from left to right:
+⌿ the sum ÷ divided by the count.
 
@nathanrogers if you have to backtrack, you shouldn't use a train.
 
8:12 PM
but then which of the 2 train types is it? and there's talk of additional train forms
 
@nathanrogers f g h is just f g h, there's no question about it
 
so by deafult, in longer trains you have to question where the arguments go
which often only save 2 cahracters which are usually parens
 
49 secs ago, by dzaima
@nathanrogers if you have to backtrack, you shouldn't use a train.
 
but then the train will typically use parens anyway
 
@dzaima Ah, but if you see a very long train, you can't see at a glance if the first function is applied monadically to the rest or is applied to the argument and then used as left argument to the next.
 
8:13 PM
yes
 
@Adám I meant that as just (f g h) alone
 
but having f g h encourages f g hfgh fgh fhgfhgahf gaurghjltknbj
because its possible now
 
I understand not wanting to read a 10 char train
 
@nathanrogers APL does not strive to prevent you from writing bad code.
 
@nathanrogers Dyalog APL allows function arrays, but that doesn't mean I'm gonna ever use them.
 
8:14 PM
if they didn't exist, there would bemore finite functional forms
 
@nathanrogers What?
 
hell, Dyalog APL also has gotos, but I'm never ever going to be using them..
 
if f g h didn't exist, then the forms would be 100% consistent
there is no problem that can't be solved without trains
in otherwords, they aren't necessary and add nothing except novelty
and obfuscate the natural functional forms
 
@nathanrogers So is + unnecessary?
 
brevity is useful sometimes
 
8:15 PM
^
 
countermanding the seeming design goals of the language
 
@nathanrogers You are free to not use them. But sometimes they add clarity, e.g. when (+,-) is used for traditional mathematics' ±.
 
brevity?
> APL is the soul of brevity
W.Shakespeare
without trains
 
@nathanrogers Do you actually know what Iverson's design goals were?
 
I'm trying to learn what they are, but from what I understand by reading whatever I can find is that consistent notation seemed to be a large priority
creating multiple forms of the same things seemed to be the issue with common math notation
according to the commentary on iverson concept of apl
so why introduce that into the language?
 
8:17 PM
@nathanrogers so is having both > and < pointless?
 
seems rather... inconsistent
 
they're literally the same thing but with the arguments swapped.
 
no, consistency doesn't mean no redundancy
I'm not talking about redundency
I'm talking about additional forms
there is not some special form of < or > that contradicts its normal use
 
Some things are nicer when written explicitly in dfns. Some are nicer as trains. Just as sometimes using > instead of < leads to better code.
 
like j
I disagree that your comparison is valid.
It is more akin to + vs - and > vs <
 
8:20 PM
@nathanrogers do you think {(+/⍵)÷≢⍵} is more readable than (+/÷≢)?
 
+ and - is not a different form of the same concept
absolutely
because I never know when 2 functions are joined
 
@nathanrogers Eh, he stated them in plain text:
• Ease of expressing constructs arising in problems
• Suggestivity
• Subordination of detail
• Economy
• Amenability to formal proofs
@nathanrogers What do you mean by joined?
 
@nathanrogers well that's where I have to disagree. "Sum of omega, divided by length of omega" is much longer & doesn't explicitly say what it does, whereas "sum divided by length" is clear and to the point
 
@nathanrogers Uh, you never know if jot is there or not?
 
8:22 PM
i don't have my keybaord
(+/÷≢)
I never know which functions are composed, glued together, jot
it isn't apparent from the notation
I'm less against trains when there is explicit joining of functions
 
@nathanrogers ok, some times I don't understand either. IMO trains shouldn't have jot in them as that does just complicate things
 
but implicit trains make no sense
 
@nathanrogers I don't get it. They are composed if and only if there is a jot between them.
 
but here {+/ x %# x}
is the same as +/ % #
but then... %# is comosed clearly
 
that's not APL...
 
8:24 PM
i'm pseudocoding I don't have my keyboard
 
@dzaima I think the main reason confuses is because the monadic form is an atop while the dyadic isn't. In other words, ⍺ f∘g ⍵ and f∘g ⍵ are usually not very related.
@nathanrogers Go here to install a browser language bar.
 
@nathanrogers nope, {+/⍵f g⍵} and +/f g aren't the same thing
 
i'm not the one suggesting they are
6 mins ago, by dzaima
@nathanrogers do you think {(+/⍵)÷≢⍵} is more readable than (+/÷≢)?
 
no, that's not the same as what you mentioned
 
@nathanrogers the fact that (f g h) applied monadically means monadic dyadic monadic is just a thing one has to learn.
 
8:26 PM
note the parentheses
 
@EriktheOutgolfer True, but {+/ ⍺ ÷≢ ⍵} is the same as {+/ ⍺ ÷∘≢ ⍵}. Maybe that's what @nathanrogers means. Nathanrogers, is it?
 
@nathanrogers I don't see anything composition related there..
 
@dzaima ^^
 
@nathanrogers uh, did you mean to not include the parentheses around +/⍵?
 
no
÷∘≢
{⍺÷≢ ⍵}
that looks like composition
 
8:33 PM
I read the dfn as {(+/⍵) ÷ ≢⍵} - with the division being powered over everything else, not it being composed with the at all
 
{(+/⍵) ÷ ≢⍵} is the same as {(+/⍵) ÷ (≢⍵)}, APL is read right-to-left
 
how about that
those two functions are composed
 
@nathanrogers not in my mind (or my APLs interpreters)
 
8:36 PM
since ⍺÷≢⍵ is equal to ⍺÷(≢⍵) IMO thinking of the ÷ and as being composed together is very strange
 
i mean
that was what I said first, isn't it?
 
@nathanrogers you said ÷≢ looks like composition
 
16 mins ago, by nathan rogers
because I never know when 2 functions are joined
i literally said that
yeah
 
oh did you mean that as it shouldn't look like that?
 
because it looks like composiition
no I mean that
> I NEVER KNOW WHEN 2 FUNCTIONS ARE JOINED
arguments are going on either said of functions that are adjoined
adjoined functions looks like function composition
I never know, when it is, or when it isn't
 
8:38 PM
the compose operator is ∘
 
for example.... why doesn't this work? +/÷≢ 3 4 5
but this does
avg←(+/÷≢)

avg 3 4 5
and so does this
avg←+/÷≢

avg 3 4 5
 
@nathanrogers a train happens when the last thing before a ) (or } or ] or \n) is a function. Otherwise, it's regular execution
 
that's my point
 
+/÷≢3 4 5 is +/(÷(≢3 4 5))
you need (+/÷≢)3 4 5
 
that's dumb. This is what I'm saying about multiple forms of the same thing. the same code meaning different things in different contexts
that's countermanding any kind of notational consistency
 
8:41 PM
execution is right-to-left
 
@nathanrogers blindly inserting a 1 2 in x 3 results in 1 2 3, which is very different from (1 2) 3 too you know
 
but those don't look identical but mean different things
the mean different things and look like different things
 
@nathanrogers they look as identical as the function case to me
 
but avg←+/÷≢
works and has no parens, doesn't it?
 
neither do +/÷≢3 4 5 and (+/÷≢)3 4 5
 
8:42 PM
@nathanrogers 1 2 3 vs (1 2) 3 is as different as +/÷≢ 5 vs (+/÷≢) 5
 
but (1 2) 3
and var←(1 2) 3
do not mean different things
 
@nathanrogers it has a line break (or ) after it though
 
@nathanrogers I don't think variables behave like what you think
 
@nathanrogers neither does +/÷≢ and avg←+/÷≢
 
yes it does
we just talked about it
 
8:43 PM
if I type avg ← +/ ÷ ≢, then the whole function gets stored into avg
so avg is defined as the average function
 
@nathanrogers what's the difference here (except the variable setting)?
 
+/÷≢ 3 4 5 = .33333333 or something
and avg←+/÷≢
avg 3 4 5 = 4
 
@nathanrogers That is a false comparison.
⋄a←1 2⋄⎕←a 3
 
@H.PWiz
┌───┬─┐
│1 2│3│
└───┴─┘
 
consider this analogy: x ← 2 + 3, then x × 5
 
8:44 PM
so the exact same phrase in different contexts means different things
 
x is defined to be 2 + 3, so 5
so x × 5 is 5 × 5, not 2 + 3 × 5
 
no kidding
but 2 + 3 × 5 is not different from
var←2 + 3 × 5
 
@nathanrogers just as 1 2 in the context of x 3 means a different thing if x is parenthesized or not
 
i litearlly pased the exact same phrase, and in different contexts means different things
 
8:45 PM
no no nowait, in the inline context you need (2 + 3) × 5
 
that's literally what I posted
not fucking exactly
that makes no sense
 
@nathanrogers and in the case of +/÷≢ in the inline case you need parentheses too!!
 
please remain calm...
 
i'm calm, but then I'm tyring to make a point and being ear boxed
 
8:46 PM
so, in algebra, if you define x = 2 + 3, what will x's value be?
 
@nathanrogers you say "no no nowait" and ask adding "random" parentheses around 2 + 3. Why can't I ask adding "random" parentheses around +/÷≢?
 
> Nevertheless, mathematical notation has serious deficiencies. In
particular, it lacks universality, and must be interpreted differently
according to the topic, according to the author, and even according to
the immediate context
Iverson
Argue with him. Is all I'm saying
 
looks like you've misunderstood some things
 
trains create multiple forms of the same thing, instead of the universality
 
@nathanrogers APL still needs reading of right to left. It isn't completely 100% context independent you know
 
8:50 PM
> and the lack of
ambiguity makes possible precise thought experiments. -Iverson again
 
the case of a←2+3 ⋄ a × 5 vs 2+3 × 5 is a perfect example that you need context in APL too.
 
take javascrript for instance (() => ...) function () {} const x = v => ... there are like 7 different ways to create or invoke a function
it's nonsense
APL without trains has a consistant and universal notaiton
 
FWIW, I think it is valid to dislike functions behaving differently in different contexts (trains and not trains), but the conversation about parentheses and assignment is not really an argument.
 
a variable is a container, in other words
just like parentheses
 
yes, I totally concede to that. I wasn't trying to discuss that, that's what the discussion devolved into
 
8:52 PM
@nathanrogers the difference is that all of those do the same thing in JS, but in APL trains vs dfns allow emphasizing different characteristics of the code
 
I made points, and instead of addressing them we went down some olther rabbit hole. the earboxing I was talking about
but the charactiaristics of the code, without trains, is UNIVERSAL
and consistent in all contexts
at least with dfns
I think tradfns are bonkers
 
yeah I agree that the whole parenthesizing argument got a bit out of hand, but you said that trains requiring parentheses is strange and I couldn't just accept you saying that..
 
@nathanrogers Ambitious statement. I'm sure you can find more weird things if you look hard enough
 
personally I'd be fine with trains requiring another type of parentheses to indicate their existence, but regular parentheses work just fine
 
no, I wasn't saying that trains using parens is strange. I was saying that, inresponse to your complaint about (+/⍵) making thing less readable, I agree, but at the same time, you use parens in trains anyway, so that isn't really a valid comparison
 
8:55 PM
@nathanrogers if you use parentheses in trains, you shouldn't use trains IMO.
The outer parentheses of trains are alike to the {} of dfns
 
the difference is that the train only has the outer parentheses, while the dfn has the outer brackets and parentheses inside too... if the train has too many parentheses, then what dzaima said is true ^^
 
46 mins ago, by dzaima
@nathanrogers IMO interpreting the s and parentheses in {(+/⍵)÷≢⍵} are unnecessary work
so then I said trains use parens anyway
 
but they're the outer parentheses, not parentheses inside the function
 
@nathanrogers the dfn has both {} and (). The train has only (), in place of {}
 
that's where things got a little off. I wasn't complaining about parens, but that parens are illegible in regular dfns or in trains, so that didn't seem like a complaint
yeah I hate {}
I'd take any other kind of bracket than those. they make my eyes bleed in most editors with most color schemes
 
8:58 PM
@nathanrogers but there's no way to not have them.
 
just design a more human braket
 
like what?
 
how about dented parens
 
() and [] are already taken for different things
 
I'm saying invent a new one
 
8:59 PM
@nathanrogers {} seem just fine for me
 

« first day (659 days earlier)      last day (1988 days later) »