« first day (3844 days earlier)      last day (1296 days later) » 

ngn
ngn
20:00
@Dudecoinheringaahing i can explain with an example in k
this is how the classic filter works: {2<#x}#("abc";"de";"fghi") -> ("abc";"fghi")
That's length > 2?
ngn
ngn
{2<#x} means "is the length of the argument greater than 2"
@Dudecoinheringaahing right :)
the second # is "filter"
@ngn Does that really work?
ngn
ngn
and the { } is its left argument
@Adám that's the classic interpretatino of "filter" from functional programming
@ngn Why doesn't x become the length of the list?
ngn
ngn
20:02
there's another interpretation in which { } is applied to the list as a whole
i need a term for the latter
What would the output look like for ("abc";"de";"fghi")?
ngn
ngn
@Adám that would be the latter interpretation
@ngn Isn't the outer # in the way?
ngn
ngn
@Dudecoinheringaahing the output mentioned here?
What would the output be for when applied to the list as a whole?
20:04
@ngn No, what would the output for that input look like, for the other interpretation?
ngn
ngn
@Dudecoinheringaahing ah, {2<#x} would return 1 (true), and it would be scalar-extended for the whole array, so output would be the same as the input
And what about for ("abc";"de")? The empty list?
This is so cursed it's beautiful.
ngn
ngn
@Dudecoinheringaahing to get the same output like before in the new interpretation, you'd need a "length each": {2<#'x}
@Adám "in the way"?
I'm so confused right now.
1-argument # is length-of, and two-argument # is filter, right?
20:07
So I understand the "If the predicate is true, leave the array unchanged" case, but I have no idea what the expected behaviour of "If the predicate is false" would be
ngn
ngn
@Adám two-argument with a function on the left is filter
two-argument could also be reshape, if there's an int list on the left
@ngn How does # know if it is being applied monadically (and then the function on its left takes its result as argument) or dyadically, taking the function on its left as argument?
ngn
ngn
@Dudecoinheringaahing if the predicate is false (i mean, an atom 0), under the latter interpretation it would return an empty list of the same type as the argument
@ngn If you look at the list as a whole, how can you "filter" a scalar?
@Adám I'd imagine that's the only way it can reasonably be parsed when it has a nilad on either side. 1,1 wouldn't make sense, and 1,2 wouldn't really either
It could be 2,2, but that seems like a convoluted parsing rule
ngn
ngn
20:10
@Adám that's decided at parsing time - if there's a noun on the left (like in my exampe - {} is a noun), it would take it as the left argument. if it's a verb, it wouldn't.
@ngn Wait what? {2<#x} is a noun‽
ngn
ngn
@Adám yes.. this surprises you every time
@ngn Ok, I get how it works. I don't get why you'd have it tho
@ngn How do you write the verb that determines if its argument has length greater than 2?
@ngn My confusion aside, this sounds like "compress" to me.
1-compress leaves the give list with 1 × its length. 0-compress compresses the list to 0 × its length.
ngn
ngn
@Adám i think that question doesn't make much sense. "noun" and "verb" are concepts that exist only during parsing. some subexpressions are nouns, some are verbs. what they evaluate to at runtime is irrelevant. something can be a noun, and evaluate to a function, or vice versa.
you're probably mixing up with apl, which delays parsing until runtime
20:16
What does K's # do on an atom?
Ah, wait, maybe I get it now.
If you want to apply {2<#x} to the result of #("abc";"de";"fghi") you have to write {2<#x}[("abc";"de";"fghi")] ?
ngn
ngn
@Dudecoinheringaahing there's been a discussion in the k chat room (and elsewhere) about which version of "filter" is better. it seems like mot people prefer the latter interpretation in which the function is applied to the list as a whole, so they can take advantage of optimized arithmetic operations (avoid "each").
@Adám either {2<#x}[#("abc";"de";"fghi")] or {2<#x}@#("abc";"de";"fghi")
or {2<#x}(#("abc";"de";"fghi"))
Right, I remember now.
Did I mention that I don't like K's calling syntax for user-defined functions? Well, I don't.
@Adám Scrabble :P
ngn
ngn
@Adám if x and y are noun syntactically, x y and x[y] and x@y are the same thing
@Adám I think you have mentioned that a few hundred times :P
ngn
ngn
20:20
@Adám probably a sign that you still don't understand it
it's a very elegant solution to the static parsing problem of apl
I like BQN's solution better.
ngn
ngn
meh
@Adám I could say I knew more about French insults than the average population simply because I can say "fous le camp!" :P
@user Merde! Watch your language, this is a family friendly room :P
@Adám BQN's solution doesn't let you pass anonymous functions to other anonymous functions right?
20:22
@rak1507 It does, with a little bit of awkwardness.
@Dudecoinheringaahing Non! Tu parles comme une vache espagnole, sous-merde :P
it also has the 𝕨𝕎𝕩𝕏 stuff
@user Oui oui baguette
@rak1507 That's not something I like about BQN.
I think k does a better job of letting you just pass functions like any other value
20:23
@rak1507 with the immediate blocks, it's weird but not too awkward - {{𝕨+𝕩}} Fn 1 calls Fn dyadically
@dzaima ah, that's not so bad
ngn
ngn
@Adám yes, it's reminiscent of compress/replicate but doesn't require a variable name for the list
@Dudecoinheringaahing Okay, that's it, I'm gonna have to report you to the mods for disgustingly offensive behavior :P
@ngn In my opinion, it is a solution, but not a very elegant one. The cost is the ability for the user to write infix functions, and that's a very high cost, imo.
You can write infix functions in K, can't you?
20:24
@Adám imo that's not that high of a cost. And it also allows generalizing trivially to >2 args
ngn
ngn
@user "infix" is not a property of the function
In any case, not having infix functions is quite normal for most non-APL languages
@ngn How does it work then?
ngn
ngn
you can apply a user-defined function infix, if it's under an adverb, e.g.: 1 2 3{x+y}'4 5 6
I very much wish that Python had user-defined infix functions (and proper ones, not the hacks currently used)
@ngn Correction then: the ability for the user to call user-defined functions inline.
20:26
maybe k should have an adverb for dyadic function application so you could do x f@ y
or something like that
@Dudecoinheringaahing They're a curse if each function has different precedence
ngn
ngn
@Adám you mean infix? there's no problem calling them inline
@ngn Then there could theoretically exist an apply adverb?
@rak1507 Shouldn't x f' box y work? (idk what K's equivalent of ⊂ is)
@ngn No, that'd be "infixedly" or something strange like that.
@user Wouldn't work, as it'd return an enclosed result.
20:27
@Adám Do you mean that the functions should be inlined for optimizations or something or that you should be able to do {x+y}[1;2]?
@user That you should be able to write user-defined functions with one argument on each side, as in a + b and a {my fun} b
no he means you can't do 1 {x+y} 2
Oh, I see
ngn
ngn
@rak1507 i don't miss infix calls that much
me neither
20:29
@ngn Well, you don't like capital letters, so that reply makes sense :-P
ngn
ngn
@Adám ?
BQN uses capitalisation to disambiguate syntax.
@ngn Operator overloading (well, function overloading) would be nice to have though, e.g. data_frame + data_frame2
When I have to write JavaScript or Excel formulas etc. I always end up having so many ) at teh end of my lines.
You'll love Lisp then :))
ngn
ngn
20:30
@Adám oh, right, that's ugly, but there are more major issues with bqn
It's not that ugly - naming conventions are necessary anyway, and the only difference here is that BQN enforces them at the language level rather than letting you use linters
ngn
ngn
@user i like lisp (scheme in particular) very much
Me too (well, Racket specifically), although having to write (+1 (- 1 2)) is a bit off-putting
ngn
ngn
@Adám btw, ngn/k (but not other k impls) supports user-defined infix verbs
for instance you can do: (≠):~= and then use infix
but it's limited to single non-ascii unicode chars, you can't do that with ordinary identifiers
May I ask why it doesn't work with multiple chars and/or ASCII chars?
ngn
ngn
20:39
@user multiple chars - because it's simpler :) ASCII chars - because they are already nouns in k
oic, so foo bar baz would have to be an array and couldn't be bar[foo;baz]
ngn
ngn
@user no. foo bar baz is always equivalent to foo[bar[baz]]. there is no stranding.
I think the way Haskell does it is quite nice, but it lets you set the fixity of your operators, which is very annoying
@ngn Oh
ngn
ngn
@user to make a list: (foo;bar;baz)
@user the thing with the backquotes?
That too
And you can do (!!!!!!) :: bleh -> gimbo to make an operator !!!!!!
ngn
ngn
20:43
ah, so fixity is one of prefix/infix/postfix?
No postfix
All "normal" functions are prefix, whereas operators are all infix
ngn
ngn
aha
Only problem is you can do infixl 10 or infixr 2 and change the precedence and associativity, which is quite cursed
If abused, people will have to keep track of random operators' precedence just to able to parse code mentally
@ngn Isn't that because if you did allow ordinary identifiers, you'd end up with APL's parsing problem?
ngn
ngn
@Adám yes
20:48
So K "solves" the problem by prohibiting the nice syntax. BQN solves the problem by enforcing a naming convention.
ngn
ngn
i need to know statically (without running the code) what every subexpression is - a noun or verb or adverb
@Adám Is it a huge problem for people irl? Do you often get bugs caused by the inability for humans/computers to parse APL before running?
And BQN does just that: noun Verb _adverb _conjunction_
@user No, I don't recall ever seeing a bug caused by it, but occasionally I've had to ponder a bit, or look around for a definition, to know how a line is parsed. If I trace, then it isn't really a problem, because I can inspect the syntactic class of used names.
@user for one, it makes optimizing scalar code tons more difficult/impossible
ngn
ngn
@Adám "nice" is your own biased epithet
20:50
Ah, good (bad?) to know
@ngn Absolutely. I like infix very much.
ngn
ngn
i say, take a step back and look at the bigger picture
I understand that you don't miss it. So be it. We don't have to share taste, do we?
ngn
ngn
no
20:53
@user Why use the transcript, when you can use that view instead? :P
ikr
ngn
ngn
@user it's more about missed opportunities for optimization by compiling to and interpreting bytecode. apl is forced to re-parse every time a piece of code is run.
Get a sufficiently big monitor and you can see the entire conversation at once!
ngn
ngn
@user :)
@ngn Not only is the interpreter forced to do that, but the programmer is too! However, BQN doesn't have this issue.
20:54
@ngn But won't you simply need two different versions of the bytecode? One in case it's a function, one in case it's a value
@ngn Such as?
@user No, the number of possibilities explodes.
@Adám It's not vegan, for one
@Adám Oh right, one for each element of an array
@user Agreed. I can't see myself consuming anything from the BQNcrate – BQN's answer to APL's APLcart.
ngn
ngn
@Adám oh, i forgot! k9 has (or at least had at some point) a mechanism for user-defined (infix) verbs too
@Adám That can still be worked around, though: once a specific piece of code is run many times, you can look at how it's usually parsed, and create bytecode for those specific cases
20:56
CMC: Given N, the number of consecutive tokens in an APL expression, answer the number of possible valid ways those tokens can be parsed.
It won't be as great as simply having the bytecode ready beforehand, but it'll be better than nothing
@ngn How?
@user Right, like JIT compilation of repeated code. APL+ did (does?) that.
What about Dyalog?
ngn
ngn
@Adám there's a .k file that it parses, and all function definitions from it become verbs. for instance if you have mod:{...} there, later you can type x mod y - it works infix. but i'm not sure if arthur backed off from that.
@user you'll still have overhead on checking the dynamic types every time though, and it also complicates implementation a ton
20:58
@ngn Sounds like context.
@dzaima True
@user Not as far as I know.
@dzaima Don't you have to check the dynamic types anyway for parsing, though?
ngn
ngn
@Adám i don't like keywords anyway, i prefer squiggles (preferably ascii)
Squiggles > words
20:59
I read snuggles at first
E.g. for Dyalog APL: 2 → noun-noun, verb-noun, verb-verb, verb-adverb, conjunction-noun, conjunction-verb → 6
@user in a statically typed language, you wouldn't need to
@Adám Simple strategy for APL: Create 4^n different expressions, and see which ones can be evaluated in APL :P
@user Hm, that might actually work.
@dzaima Unfortunately, APL isn't statically typed (which may or may not be a good thing)
If it was, the type system would probably get pretty complicated
21:02
@user by statically typed I meant that the type of expressions is known at compile-time. Not the correct term ik
Oh by type you mean arrays/objects, functions, or operators?
@user yeah
an actual full static type system for an array language would be quite unusable :)
Nim has an ambiguity problem itself with type arguments: foo[bar]() could either mean "get the element at index bar in foo and call it" or "call the function foo with type argument bar". Wonder how it does that
@user Nice. Turns out I forgot one for 2: noun-adverb, so 7.
@dzaima Not if you had some crazy dependent typing stuff
@Adám Wait, did you actually implement that?
21:05
Yes.
lol
@Adám I wonder if this sequence is on OEIS
It'd be a fun challenge here, honestly
If it is, that could offer some interesting insight into why APL works that way (e.g. if the sequence is equal to e.g. the Bell numbers)
lol ninja'd
oh, next is 200 which isn't in any of them
I think it could be an interesting challenge tbh :P
@Dudecoinheringaahing Dialects vary, though. dzaima/APL allows noun-verb and noun-conjunction and verb-conjunction. Dyalog doesn't. And APL2 doesn't allow any of those that end with an adverb or verb.
21:11
@rak1507 It's possible there are similar sequences, but with an offset of 1 or something
J allows even adverb adverb.
maybe
@Adám I don't allow (noun/verb)-conjunction
@dzaima Oh, I thought so.
There's certainly nothing in APL that syntactically prevents those.
@Adám BQN does have it in the spec, but nothing implements it
ngn
ngn
21:12
strictly speaking apl has no noun-verb-adverb-conjunction but array-function-mop-dop
adverb-conjunction sounds so much better than mop-dop
ngn
ngn
@user mop="monadic operator" if it wasn't clear
@ngn Firstly, that's just a terminology question, and secondly, that's not true; SHARP APL used that terminology.
@ngn I know, it just sounds weird
(Also, dop is ambiguous: dyadic operator or direct operator?)
ngn
ngn
21:14
@Adám yeah, j too, but they use it in a wrong way
@ngn How do you make an ASCII-only shrug?
ngn
ngn
@Adám you say type "shrug" :)
¯\_(%)_/¯
lol
Wait, that's not ASCII
ngn
ngn
21:16
@user looks like a picasso painting, the face at least :)
@user Oh, right, the ¯s
@ngn Late Picasso?
-\_(%)_/- then?
That's just sad.
¯ is in extended ASCII apparently (spacing macron - overline)
ngn
ngn
@user yes :)
21:19
As is ö for the face
ngn
ngn
the eyes and nose look like a %
I'd say they look horrifying, but sure, % works too :P
22:02
Great, two more math flags
Dunno why math always seems to have so many issues
Because one specific user who spends a lot of time in the math chatrooms doesn't know how to talk to people politely, and thinks they can use flags on any message they dislike
Ah, so you agree that those were invalid flags. Great.
I don't think that's the case here
"I don't like the moderators >:|" isn't really flag worthy
22:05
Certainly not.
Depends how its said tbh
It does, but the way it was said didn't seem particularly bad to me.
> Hiding criticism, is the start of dictatorship, and I bet that mod would jump at the chance to eliminate me from this site. The mod team, in any case, is dysfunctional
> dictatorship
Just because I strongly disagree with the message doesn't mean it's flag-worthy, imo
22:06
The second was invalid imo, but the first was a gray area
@RedwolfPrograms Yes, but it's rather strong language
That's a deliberately provocative thing to say, especially in a mod office room. If you have a problem with how moderators act, you can and should discuss with them, not resort to that
Accusing people of "dictatorship" is a rather serious accusation, and not one that complies with the ToS imho
But I've vowed off handling math chat flags, so ¯\_(ツ)_/¯
To me it just seems like a bit of an overexageration
¯\_(%)_/¯
22:07
I wouldn't consider it at all offensive, but idk
@NewPosts REDDDWOOOOOLLLLLLFFFF!
RUNNING: [1] 1 1

[22:03:34] closed: watch
[22:03:44] opened: watch
[22:07:51] status: 240
Liar :P
No way that was posted in the 10 seconds watch was refreshing...
It was, that's unbelievable
22:03:39Z
22:10
How often does watch refresh?
I didn't even have the pre-existing link check thing set up for the 10s refresh, it happens twice a day for ten seconds
Tell the OP to buy a lottery ticket :p
22:54
Hey, I'm writing a decision-problem challenge and I'm struggling to find a good phrasing for the output requirement. (I've read all the concerning meta posts) Do you think that this is fine: "To output the affirmative/negative outcome you should use two disjoint sets of values. At least one of the two set with just a single value." Here I'm trying to sum up consistent / consistent, non-consistent / consistent, consistent / non-consistent and that (obviously) the values should be distinct
@golden_bat How about just using default I/O rules for decision problems?
Introducing: The Vyxal language bar.
5
@exedraj ^
@Adám Is there a default? Are you referring to this?
@golden_bat Yes.
@Adám Nice, thanks!
23:11
@Adám Yes I've already read it and there are many variants but none of them match cleanly what I want...
@golden_bat Is there a reason you don't want the default rules?
My default is battle-tested in the sense that no one complains or raises questions about the output
@Adám But there isn't a consensus on default rules, precisely because there can be many variants... One answer on that default policy discussion even say "no default"
It's likely you get some questions about "can I output this way?" or "why not allow outputting this way?" if you do something different
0
A: Sandbox for Proposed Challenges

NeilWhich in and out shuffles do I need? If you watch Matt Parker's latest video as of time of writing, you'll know that for any given start and end position, there is a sequence of six in and out shuffles that will move the card at the start position \$ p \$ to the end position \$ q \$. One method i...

23:17
@golden_bat I think it is pretty clear that consensus is this only.
@Bubbler I know, I've read your default but I also want to allow a non-consistent option for either true or false
Why?
Because answers can be more interesting
Is it really worth it?
It's the option 2. (swappable)
23:20
@golden_bat That somewhat makes sense to me, but note that your initial wording excludes "language's default truthy/falsy" option
@Adám I don't know a priori if it's worth it, but why should I close the possibility
@golden_bat How about "You can output as single values from one of two predefined values you decide, in addition to using all default output formats."?
However, if it is a decision problem, then what is to prevent me from defining my "yes" set as the set of all inputs that should give "yes", and then have my solution be a no-op?
@Bubbler Yeah, but aren't truthy/falsely included in the "you choose what to output"?
@golden_bat JS for example has multiple truthy and multiple falsy values
@golden_bat It's a problem with "At least one of the two set with just a single value"
23:25
@Adám what you says applies only if someone allows non-consistent / non-consistent... If at least one is consistent there you are forced to make the testing
ah
@dzaima and @Bubbler got it! I miss that
Also J has infinitely many truthy and infinitely many falsy values
so basically you'll need to specify the condition you want AND the language's default as two different options
Yes, your rule 1. and a modification of 2.
@Bubbler Nasty.
23:30
About allowing consistent/inconsistent output, how about this: "You can choose one consistent value as either truthy or falsy, and output any other value as the opposite"
It's perfect, thanks!
@Bubbler Huh, many languages have any nonzero number as truthy, but I haven't heard of infinitely many falsy values before
@Bubbler In principle, APL has infinitely many too, but in practice, Dyalog APL only has 16 of each.
Singleton zeros and ones of rank 0 through 15, right?
Yes.
23:43
@Bubbler Anyway, am I wrong or these output requirements are as loose as they can be for a decision problem?
@Adám I think it's just that anything that Dyalog would error on, ngn/apl just gives true?
@golden_bat You're right with that, as inconsistent truthy/inconsistent falsy doesn't make sense
@dzaima It still only works with singletons
@dzaima No, it at least has to be a singleton.
Probably more to do with the underlying JS leaking through.
@Adám I don't understand. this gives the same thing as ngn/apl (with the rank case lowered to 10)
23:57
@dzaima Try both with (0 1) as an item

« first day (3844 days earlier)      last day (1296 days later) »