« first day (1228 days earlier)      last day (1426 days later) » 

RGS
11:40 AM
@Adám (or anyone who sees this before Adám) I saw ∘← being used as some sort of "special assignment" in the video on Game of Life Avi shared recently.
The person on the video ran )ed someVar and then updated someVar with ∘← and the updates reflected automatically on the edit window. I tried running the same code but with just and the changes to someVar wouldn't show in the edit window. What is special about ∘←?
 
ngn
@RGS can you share a link to the video?
 
RGS
@ngn I have equivalent code more at hands
would that suffice?
nvm, I have both of them together:
∇ GOL ;m;M
    ⍝ Cheap Game of Life simulation, inspired by youtube.com/watch?v=a9xAKttWgP4
    ⍝ Before running this tradfn, fix GOL, type )ed uivar and then run this tradfn.
    m ← (4 4⍴⍳16)∊?16⍴16
    M ← 13 23↑¯8 ¯13↑m
    Life ← {(3∘=∨⍵∧4∘=) ({1⊥∊⍵}⌺3 3)⍵}

    {} {uivar ∘← '∘⌹'[⍵] ⋄ _←⎕dl ÷8 ⋄ Life ⍵}⍣≡ M
∇
 
ngn
ah, found it. it's john scholes' classic.
@RGS a←b is local, a∘←b is global. he could have used a⊢←b without relying on 's odd behaviour there
 
RGS
@ngn why is a⊢←b also global?
Ah wait, I think I got it:
Any modified assignment first reads the variable before writing it, so the first time we mention someVar being in a modified assignment it will try to read it from the "global scope" and so also modify it globally; if we just did someVar ← someValue we'd just shadow the global someVar; is it smth like that?
 
ngn
11:55 AM
@RGS correct
 
RGS
ah that is clever. and a ⊢← b is just some innocuous modified assignment. Then what is ∘←..?
I thought var f← val was syntatic sugar for var ← var f val but I can't do a ← 5 ⋄ a ← a ∘ 8
 
ngn
@RGS possibly a bug that has become a feature :)
 
RGS
@ngn oh ok :P
ty for the explanation ○/
 
ngn
@RGS normally is a dyadic operator, you can't use it like the in ⊢←
somehow manages to "compose" a and so the interpreter can eval a∘← without anything breaking
 
@ngn a∘← is just a normal function you can use. The only special part is that it has to figure out a is a symbol, otherwise it's just binding an argument to a not-marketed-as-a-function.
 
ngn
12:06 PM
@Marshall why doesn't a∘← assign locally then?
 
@ngn Okay, in dfns it's also special because it doesn't declare a. So I guess it's more like a∘(⊢←). dfns use a weird mechanism to make a new local before assignment and the ∘ gets around that.
a∘← couldn't be a normal function if it declared a variable when invoked, so it doesn't.
 
 
3 hours later…
RGS
2:44 PM
@Marshall I don't understand this
 
2:59 PM
@RGS Either generic functions just can't access whatever's needed for creating new variables, or it results in Bad Things™ so noone has made them able to. (just guessing here)
 
RGS
@dzaima maybe I didn't understand what "a∘← is just a normal function you can use. The only special part is that it has to figure out a is a symbol, otherwise it's just binding an argument to a not-marketed-as-a-function." means
 
@RGS that's saying you can do stuff like f ← a∘← ⋄ f 6 (and more stupid stuff like assigning to a namespace) and that is "not-marketed-as-a-function", but still allows ing a left arg
 
RGS
ah!
@dzaima this cleared things up, thanks :)
 
ngn
3:43 PM
another trick abusing 's function-like nature: a←⍣b⊢c <=> :if b ⋄ a←c ⋄ :end
 
RGS
@ngn this is a neat one
 
ngn
@RGS attributed to kai, iirc
 
RGS
@ngn No idea who kai is ⍨
 
ngn
@RGS a very skilled apl-er
 
RGS
3:59 PM
@ngn do you know kai personally?
 
ngn
@RGS yes, but i learned about ←⍣ from others
      agets←a∘← ⋄ agets 1 ⋄ a
1
^hehe :)
 
RGS
5:02 PM
@Adám I'd like to discuss two things in this "inclusive integer difference" entry I (1+-) J
On the one hand, I was "surprised" by running it and having 0 (1+-) 5 give ¯4 because I was expecting 6 (although 5 (1+-) 0 gives 6) so I wanted to know if it made sense to modify the entry to be (1+∘|-) to be insensitive to the argument order
On the other hand, I think the description would be more clear if it said "Number of integers in the range I .. J, inclusive" instead of the more terse "Inclusive integer difference"
 
 
3 hours later…
ngn
8:33 PM
@Marshall bqn is almost rot-1 of apl :)
 
8:52 PM
@ngn The reason it's not exact is that I came up with the backronym "Big Questions Notation" before I noticed I don't understand the alphabet very well.
 
9:46 PM
@RGS another name idea - "Square matrix with all rows/columns equal to Yv"
 
 
2 hours later…
RGS
11:17 PM
@dzaima right now I have a PR out there with some other description, but you can PR on top of that if you want :)
 

« first day (1228 days earlier)      last day (1426 days later) »