« first day (1272 days earlier)      last day (1385 days later) » 

1:22 AM
Random idea: Add an option to Scan to indicate that the operand function is associative, so that it can run in O(n). Using non-associative functions with that option will result in scanl1 common to other languages.
 
@Bubbler BQN and dzaima/APL work this way normally, and don't have an O(n^2) scan operator.
 
@Marshall Oh. Didn't know that
 
@Marshall as now we have headers for ambivalent functions, how about making be reduce on a specific axis?
(i don't know what particularly would that be, just throwing out the idea as i remembered about it)
 
@dzaima I would prefer a second reduce 1-modifier for a lot of reasons. You'll usually use the first axis, Reorder Axes is currently the only function that uses axis numbering at all, and Rank provides the flexibility of positive or negative ranks.
I took another look at @Adám's ˝ and it doesn't seem all that similar to ˜ in monospace fonts, so I think I will probably end up using that.
Also I think is still pretty useful for making those almost-perfectly-ambivalent tacit functions work.
 
1:44 AM
@Marshall may be my bias on having first-axis reduce longer in dzaima/APL, but i don't think i've had a much stronger need for one over another for matrices. (and what do i know, i'm not that good at high rank stuff anyways)
 
@dzaima I think I've always wanted the first-axis form so far. But if you're working with matrices, F˝˘ is just as short as F⊘1, and roughly as readable (not that good in either case).
 
 
3 hours later…
4:27 AM
@Bubbler for builtins, easy enough to just check. Beyond that, I think scanl and scanr should be separate operators, not separate flags given to a single op
 
 
6 hours later…
RGS
10:40 AM
When I'm looking to trap a single error code in a tradfn and then run some code if that error code is triggered, can the :Trap notation be shortened?
 
@RGS No, you still need five statements. However, you may be able to use a utility dfn inline.
 
RGS
@Adám you mean by using the :: dfn syntax?
 
@RGS Yes.
 
RGS
10:58 AM
@Adám +← 1 Thanks for the suggestion
 
 
7 hours later…
5:48 PM
CMC: Write the shortest possible statement that returns whether the statement is being run inside a dfn/dop or not.
 
APL\360 solution: 0
 
@Marshall Nice. Works in APL+Win too!
 
6:08 PM
@Marshall btw, the cmc is unsolvable in bqn, isn't it?
 
@Adám Assuming you translate "dfn/dop" to "block", yes. Code just runs; it doesn't know how it's been defined.
I think an entire file should work identically to an immediate block even though there are no braces. So there isn't really any use for this "not in a block" concept.
 
@Marshall Right. Well, I would have wanted Dyalog APL to be the same language inside dfns too, but that doesn't mean I can't detect the current what's going on.
 
6:23 PM
@Adám You can find whether a given bit of code is inside curly braces statically by looking at the source code though. Why would you need to do that in a running program?
 
@Marshall I didn't say I needed it.
 
RGS
6:59 PM
@Adám I don't understand
 
@RGS I'm challenging the readers to write an expression E such that E returns a truthy/falsey value indicating if E was executed inside a dfn/dop or not.
 
RGS
@Adám if not iniside a dfn/dop, then it was ran inside a tradfn? or are there any other options?
 
right now I have a tacit function which seems to behave differently depending if it's bound to a name or not.
 
RGS
@TessellatingHeckler that sounds whacky
 
@RGS Outside a dfn/dop can be in a tradfn/tradop, in the session, or in a script.
@TessellatingHeckler Yeah, that can happen. Wait, a tacit function. Hm.
 
7:04 PM
well
 
I knew it could happen to dfns.
 
more clearly, it's probably a line of APL code which contains one or more tacit functions
      ∨/((1 ¯1⍴⍨≢)⍷⍨(×2-/⊢))10⊥⍣¯1⊢121314
1
      isWobbly←∨/((1 ¯1⍴⍨≢)⍷⍨(×2-/⊢))10⊥⍣¯1⊢
      isWobbly
 ∨/    1 ¯1  ⍴⍨ ≢  ⍷⍨  × 2  -/ ⊢    10  ⊥⍣ ¯1 ⊢
      isWobbly 121314
0
it's trying to check if the digits of a number alternate higher/lower/higher/lower (than the previous digit)
1 if they do, 0 if not
 
RGS
@Adám okok; and marshal's solution works in Dyalog APL?
 
@RGS No. E.g. it fails in {0}⍬
@TessellatingHeckler The 1 was from an expression, not a train. isWobbly is a train.
So in the initial expression, ∨/ is applied to the result of ((1 ¯1⍴⍨≢)⍷⍨(×2-/⊢))10⊥⍣¯1⊢
In the train, ∨/ is applied to the argument.
       ∨/((1 ¯1⍴⍨≢)⍷⍨(×2-/⊢))10⊥⍣¯1⊢ 121314
1
      (∨/((1 ¯1⍴⍨≢)⍷⍨(×2-/⊢))10⊥⍣¯1⊢)121314
0
 
I see what you're saying; is there any reason I could understand why it changes to be a train by being bound to a name?
 
RGS
7:08 PM
@TessellatingHeckler it just doesn't parse as a train, cf:
      (∨/((1 ¯1⍴⍨≢)⍷⍨(×2-/⊢))10⊥⍣¯1⊢)121314
0
 
@TessellatingHeckler If the rightmost part is a function, you have a train. If the rightmost part is an array, you have an expression.
 
@TessellatingHeckler compare e.g. ---1 and f ← --- ⋄ f 1 - it's just a completely different situation
 
@Adám ah, it's not the binding to a name, it's the removing of 121314 changing it?
@dzaima good simple example; (-(-(-1))) first and ((-1)-(-1)) as a train second
 
@TessellatingHeckler Exactly.
 
Thanks :)
about the only thing I know is different in a dfn is something like dynamic scoping changes to lexical scoping
 
7:15 PM
@TessellatingHeckler Nice. I guess one could use that. (Now I have to try.) Though there's a much simpler and shorter solution.
Hm, no, if the current function is defined by its caller, the two scoping rules would be behave identically.
 
@Adám Not sure how I could use that; but what about 0≤≢⍵: 1 ⋄ 0 ? since guards are only in dfns, if it works it's in a dfn, if it throws a Syntax Error, it isn't.
 
@TessellatingHeckler Nice, but then you have to trap the error and return 0.
@TessellatingHeckler 1⊣⍵⊢⎕trap←0,'E0' kind-of works, except it prints the 0 instead of returning it.
 
@Adám interesting; and I can tell that's not the right direction for the simpler and shorter solution you'll have in mind.
 
7:31 PM
@TessellatingHeckler Right.
@TessellatingHeckler Unfortunately, there are actually quite a few differences.
OK, I have a 7 byte "cheaty" solution, and a 13-byte solution that actually relies on a real difference in the language.
 
 
2 hours later…
9:45 PM
@Adám I must be missing something because I have a trivial and obvious 8 byte solution and I don't think it's cheaty at all.
 
@PaulMansour I did say "cheaty" in scare quotes, because there really isn't such a thing as cheating here if it works. Let's see yours!
 
2=⎕NC'⍵'
 
Mine is ×⎕NC'⍵'
 
Yours wont work in the session.
 
Oh, you're right. It doesn't work anywhere, actually. :-(
 
RGS
9:49 PM
@Adám lol
 
Now I wonder how I made that mistake. Didn't I test it‽
@PaulMansour Now, can you come up with a solution that doesn't rely on asking such a "question" of the interpreter, but rather relies on an actual difference between the APL language used in dfns/dops and the APL language used outside them?
 
10:02 PM
@Adám Not off the top of my head, but I'll be intrigued to see your solution, though arguably the existence of omega is indeed "a actual difference between the APL language used in dfns..."
 
@PaulMansour ⊢f a←⍎'f←≡⋄1' or the easier-to-understand, but not-really-one-expression f←≡⋄⊢f a←1
 
@Adám I switched tab to the Dyalog 17.1 interpreter and pressed F1 to look in the help for dfns, and ended up at help.dyalog.com/dmx/17.1 . I'm not sure how, since it doesn't do that after a restart, and I had not used ⎕DMX, but that's a page with no content and links to "Dyalog for Windows" which don't work, in case that's a useful report.
 
@TessellatingHeckler I know about that. It is part of an ambitious project I reckon we've given up on. The idea was that people could go online to get more specific info about the error they hit.
 
@Adám Wont really work in all circumstances though, will it?
 
10:10 PM
@PaulMansour What do you have in mind?
 
f←5 on the line above?
 
@Adám on unix, you could do like gcc does and use gnome-terminal/iterm2 escapes to make error messages links
 
@PaulMansour Fair enough.
@Moonchild That isn't the problem. The IDEs already makes URLs clickable. The problem is actually collecting all that information about every error type.
 

« first day (1272 days earlier)      last day (1385 days later) »