« first day (566 days earlier)   

1:09 AM
@Zacharý dfns are just dfns, that syntax shouldn't interfere. Except if the dfn is preceded by , a {…} at a lines end will never be utilized in any way ever, so I'm using that for more syntax
and does RAD even have (or is planned to have) while/for/if statements?
 
@dzaima Yes&No: they will probably be operators.
 
@Zacharý and you'll need to give them dfns as arguments?
 
Yeah. The grammar of RAD is pretty set in stone (i.e. I don't want to break anything else)
 
@Zacharý will you do anything about / being overwritten/inaccessible in the inner dfns?
 
@dzaima As a weird consequence of how dfns work, if an inner dfn is called monadically, then it has access to the outside function's .
 
1:21 AM
@Zacharý I'm guessing that niladic dfns don't exist?
 
Yes/No, f&⍬ is a thing, but that's more boxing the function into a nilad.
The main change is that RAD is rankless. Everything is depth.
Oh yeah, and the workspace isn't a thing.
 
@Zacharý so is still inaccessible? I'd rather have special syntax than losing access to the arguments to a function
 
W←⍵ :p
 
@Zacharý that's just ugly
 
@dzaima I might overload omega underbar to do some weird shenanigans (omega underbar is a function though)
RAD's probably more accurately named Rankless APL Dialelct with how close it is to normal APL.
 
 
5 hours later…
6:21 AM
@Zacharý IIRC, GNU APL has ⍺⍺ and ⍵⍵ refer to the caller's and . ⍺⍺⍺ and ⍵⍵⍵ to the caller's caller, etc.
@dzaima So no trains? {⍵*2}{+/⍵} is a valid function.
 
@Adám if alone on a line, the +/⍵ would never be called/used in any way though
and I think it's reasonable to have lone functions/ops in a line be syntax errors
also, I'm probably gonna have an op for if-else which would return the result of the path, or just for those who don't like special syntax
 
@dzaima What's the result of the path?
 
@Adám e.g. {2}ifElse{3} ⊢ 1 returns 2
 
@dzaima ifElse←{⍺←⊢ ⋄ ⍵:⍺ ⍺⍺ ⍵ ⋄ ⍺ ⍵⍵ ⍵}?
 
@Adám yeah, something like that.
 
6:34 AM
@dzaima Then I can see how those operands need access to their caller's arguments. Wouldn't ifElse←{⍺⍺:⍺ ⋄ ⍵} make more sense, so you can write 2 (1 ifElse) 3?
 
@Adám that'd evaluate both possibilities when only one is needed
replace 2 with calculating the 1E50th prime and getting the 3 will take a while.
 
@dzaima Ah, I see what you mean. And guards are unpleasant because it is awkward to merge back the two paths. How about a way to make non-terminating guards?
{
 v←1+⍵
 5>v:v+←1
    :2|v:v+←1
 ,⍨v
}
@dzaima ^ A leading : means under the same condition as above.
And of course you need the (already proposed) multiple guards being "AndIf"
 
@Adám non-terminating guards were another thing I was thinking about, but 3 syntaxes is a bit much
 
@dzaima Yeah, and there's no obvious way to make the "else" clause. Maybe:
{
 v←1+⍵
 5>v:v+←1
    :2|v:v+←1
   ~:v+←10
 ,⍨v
}
 
@Adám so that'd be a 2 item array of 1+⍵ if ≤5, otherwise 2+⍵ if even, else 3+⍵?
 
6:45 AM
@dzaima No:
v←1+⍵
:if 5>⍵
    v+←1
    :If 2|v
        v+←1
    :EndIf
:EndIf
,⍨v
And the last example would be:
v←1+⍵
:if 5>⍵
    v+←1
    :If 2|v
        v+←1
    :EndIf
:Else    ⍝ literally :OrIf ~5>⍵
    v+←10
:EndIf
,⍨v
 
@Adám in that it's unclear (other than indentation) whether the ~: is for the 1st or 2nd guard
 
@dzaima Good point, and using :~: will make your face look like that, and cause Pythonesque issues with moving code around.
 
@Adám stacking the colons will have code moving problems too
 
@dzaima Yup. While I really dislike block indicators (not sure why), it may be the neatest solution if you don't want :Ends.
 
@Adám the inability to wrap an if around a piece of code pretty much rules the idea out for me
how about making guards non-terminating and making anything able to be terminating by adding a trailing ;?
 
7:00 AM
@dzaima As long as you stay functional, having absence of assignment indicate termination is adequate, imho. But how would you guard multiple expressions under one condition?
 
@Adám dfns aren't going to be forced functional
 
@dzaima They already aren't. If "monadic" was "assign to nothing" (i.e. sink) it would be neater, though.
 
if I do make classes a thing I want to be able to do obj.add 3 without it terminating the dfn if that returns something
 
@dzaima And ←obj.Add 3 is not good enough?
 
@Adám that is a waste of precious typing time. It's completely pointless as without it the next line would literally never be called, so either it should error, or go forward
 
7:08 AM
@dzaima Oh right, I forgot that dfns should just keep going if there are more code lines. But with non-terminating guards, you do need a way to say :Return. Still, you didn't answer how to do multiple things under a single condition.
 
@Adám :Return ≡ trailing ;. For the multiple lines I could just wrap the lines in {} after the colon
so that's 4 different uses for {} already? :D
 
@dzaima Ah, the multi-line is almost like the current technique of guard:⍺{code ⋄ code}⍵. Trailing ; just seems un-APL-like somehow. Maybe a leading instead? And if you really want trailing, maybe ?
@dzaima Do you have implicit output?
 
@Adám hm, a leading sounds nice
@Adám as in each line outputs if it isn't shy? no, that's an annoying feature imo
 
7:24 AM
@dzaima Good (I agree) so then you don't need a shying feature, and leading is available to terminate, as if result← but dfns' results are never named.
 
if the only use for shyness is whether or not a REPL should output a thing, it'd probably be worth it removing it and just making …← not implicitly output in the REPL
 
@dzaima I agree. Some edge cases maybe, e.g. should obj.Add 3 output in the REPL? and if so, what?
 
@Adám making class functions have to worry about shyness feels pointless. not printing the result only for setting globals feels understandable because they're always readable afterwards whereas functions could have important output inaccessible after discarding the result (e.g. arrObj.pop)
 
ngn
8:25 AM
@dzaima exactly what I think too
in The Nineteenth Byte, Jul 3 at 18:13, by ngn
@Zacharý why do you even need this "shy" stuff...
in The Nineteenth Byte, Jul 3 at 18:14, by ngn
@Zacharý there's a simpler way: if the leftmost part of the last expression is an assignment - don't print, otherwise - print
 
9:20 AM
@ngn I'd rather that nothing in functions print unless explicit. But in REPL, everything prints except assignments. It is really annoying to have to hunt down the statement which generates rogue output.
 
ngn
@Adám oh yeah, definitely not in functions, I meant that only for the repl
or top-level expressions in a file that are not in any function
 
@ngn Oh, then then we all agree on how it should have been.
@ngn No, not even that.
 
ngn
we have very little left to argue about :)
 
@ngn That would mean that #! scripts implicitly print? You'd have to silence all side-effect expressions.
 
ngn
@Adám given that ngn/apl behaves as you describe, but ngn/k does not, I'm not sure which side I'm on :)
 
9:27 AM
@ngn I wouldn't want to have to silence ⎕NPUT and GUI code, etc.
 
ngn
in k there's a special value that you can return (::) to indicate you don't want to print
@Adám would ⎕NPUT or the GUI code you're talking about ever return a value that would be useful to the caller?
 
@ngn my example would be a pop function. Sometimes you want to just remove a value off the top of a stack, sometimes you actually care what the result is.
another example would be a success boolean. If you know that a thing is gonna succeed you don't care that it gives 1, but if you don't, the result can be useful
 
@ngn Yes.
@ngn ⍬⊤⍬
 
ngn
@dzaima if you have ::, this one's easy - return :: on success and a useful value otherwise
 
9:44 AM
@ngn Hm, ⍬⊤⍬ should have a symbol, like .
 
ngn
@Adám ah, i thought that was an apl emoji :)
@Adám so, 0 0⍴0?
 
@ngn Yes.
 
ngn
@Adám that's a valid array, you need something separate as ::
 
@ngn Isn't :: a valid array?
 
@ngn it doesn't print anything though
 
ngn
9:48 AM
for pop(), ⎕NPUT, and the GUI, I think one just have to make up one's mind... can't have it both ways
@Adám it's actually a function (those are first-class values in k)
 
@ngn yes you can
 
ngn
the identity function
@dzaima well yes... with shyness?
 
@ngn well if I'd call arr.pop in a REPL I think it'd still be useful to have the result get printed
 
ngn
@dzaima so you're with Adam then - if it's a repl do one thing, if it's a file - another
 
@ngn it makes sense to me that there'd be a distinction - a REPL is for a human to use. A file is for a computer.
 
ngn
9:54 AM
@dzaima sometimes I like to pipe code into my interpreter - it's indistinguishable from a repl
so I wouldn't want to have it behave differently for $ interpreter code.file and $ interpreter <code.file or $ echo "code" | interpreter
 
@ngn usually REPLs print some "hello"/"help() for help" thing or a > before each input line though
 
ngn
@dzaima mine doesn't :)
not even a stupid copyright notice, not even a one-space prompt
I have a separate repl.k wrapper script that prints a one-space prompt; if rlwrap weren't so buggy I wouldn't even have that
rlwrap has an -S option to give you a prompt, but when your interpreter doesn't respond within a certain timeout, it assumes it should print a prompt already, and when the result arrives it gets printed after the prompt...
 

« first day (566 days earlier)