« first day (1156 days earlier)      last day (1501 days later) » 
00:00 - 17:0017:00 - 19:00

RGS
5:00 PM
and the text editor would be more "normal" to me
that was why I was asking
 
@RGS OK, then. The f←{} syntax allows multiple statements. You can separate them with or you can write multiple lines. For that, you want to use the built-in editor. Simply enter )ed myFun
Then you can amend that to say e.g.
myFun←{
  b←⍵+3
  2×b
}
Then press Escape to close and save that (temporarily — it will disappear if you quit APL).
Now you can call myFun 42
 
RGS
yup, checks out
I am feeling the urge to ask you "how do you do X" type of questions, like "how do you get input" and things like that
 
Also, compare the braces' notation to the piecewise function notation in TMN:
 
@Adám relatedly, why is "save window but don't close it" not set to a keybind in RIDE by default? I can't live without it..
 
RGS
I see the language bar has explanations for the operators, but it is not ideal to have to hover over all ops one by one
Is there a reference page you know of?
 
5:04 PM
pw←{
   ⍵>10: 'big'
   ⍵>5: 'ok'
   'meh'
}
@RGS For that, you can visit APLcart.info
 
RGS
@Adám hm
the : does a "return"?
 
@Adám - In Dyalog for Windows x64, is there some easy way in the )EDitor that I can do a global search-and-replace to change lowercase letters to uppercase?
 
@RGS It does a conditional return if the condition on the left is true.
@JeffZeitlin For a particular string or for a pattern?
 
RGS
(and the ' is how you do "strings", right? " doesn't seem to work)
 
@RGS Correct.
 
5:07 PM
@Adám - Essentially universal - that is, for historical reasons, I don't want any lowercase letters in the workspace. I'm good with changing things one function at a time.
 
RGS
haha this is nice
 
But lazy me didn't put caps lock on, and just typed the stuff in.
(There's also a few places where I'm going to need underscored letters. I'll handle those manually when I'm ready)
 
@JeffZeitlin It is fairly easy to write a function to do this for you.
@RGS OK, let me teach you one more aspect of APL, and then I think you can continue exploring on your own.
 
/me spocks. Even if I have this saved as a .dws, not as .dyalogs via ]LINK?
 
@JeffZeitlin Yes, especially then.
 
RGS
5:11 PM
@Adám hit me
 
So you now know basically all there is to know about APL functions (it is really that simple!). However, APL also has higher-order functions, we call them operators, that can derive members of a family of functions. E.g. you know about +. The / operator takes plus and derives "sum":
      +/3 1 4 1 5
14
Similarly, it can take × and derive "product":
      ×/3 1 4 1 5
60
 
RGS
ok
it kind of fills in the spaces between the numbers with that operator
 
@RGS Yes.
But that's only this specific operator. There are others.
E.g. finds the shape of an array. ⍴42 'abc' (1,2,3) gives you 3
¨ is the "each" (or map) operator, so ⍴¨42 'abc' (1,2,3) will give you a 3-element list where each element is the shape of the corresponding element.
 
RGS
sure
ok
 
Notice the syntax though. These operators are suffix. They modify the function to their immediate left.
 
RGS
5:19 PM
Yes
because evaluation is right-to-left
 
Sort of.
Actually, there are two distinct types of operators. Some use one "operand" and some use two operands to derive the new function.
 
RGS
@Adám how so
?
 
@RGS E.g. the operator can take two functions f∘g and derive a new function. So you can write f∘g(x) just like in TMN, only f∘g x is of course enough.
As I mentioned before, can also derive a single-argument function from a two-argument function by currying one argument, as in incr←1∘+ or decr←-∘1
@RGS You know about "dot product" in TMN, right?
 
RGS
yes I do
 
So you know that it is essentially a convoluted application of addition of pair-wise products.
 
RGS
5:29 PM
yes XD
I do know that
 
So APL has this principle of generalising TMN concepts and notations. Dot product in APL is +.× where . is a two-operand (we call it dyadic) operator. You can substitute any two functions for + and ×.
      1 2 3+.×4 5 6
32
      1 2 3×.+4 5 6
315
 
RGS
alright
so ⍺ f.g ⍵ first applies g to pairs of elements from ⍺ and ⍵ and then we apply f to all of that?
 
For simple scalar or vector arguments, yes. It is a bit more involved for higher-rank arguments, where it becomes matrix product etc.
 
RGS
ok
it probably generalizes with a decent expression
APL looks really nice
 
It does.
Btw, all functions in APL are either prefix (monadic) or infix (dyadic), even things that are suffix in TMN, like x! or omnifix like |x| and ⌊x⌋.
 
RGS
5:35 PM
and way more digestible than Jelly
@Adám alright, thanks for the heads up
 
APL harmonises these to be !x and |x and ⌊x modelled after -x
Yeah, I'll let you go. Ping me with any questions or just ask here, and one of the other knowledgable people will come to the rescue.
 
RGS
I don't want to go!
I want to ask questions
iff you have time and patience, of course ahaha
otherwise I can save them for later
 
@RGS I might be available a bit later. Feel free to ping me with each question, and I'll respond when I can.
 
RGS
ok thanks; it is only one for now.
feel free to ping me when you write me back and thanks for all of this!
:D
 
I'm here pretty much all day, Monady-Friday from 9am-5pm UK time.
 
RGS
5:38 PM
ahaha ok
 
@RGS I will.
 
@Adám - When possible, I would be interested in that function you mentioned...
 
@JeffZeitlin OK.
 
RGS
so basically I wrote {,/{1↓⍕⍵}¨4+⎕UCS ⍵} as a submission for a code - golf challenge
But I don't know how to format TIO decently with this, so far this is what I have
Which looks awkward because the { is not being accounted for in the byte count.
 
@RGS I use this incantation for code golf. (Please use Dyalog Unicode. Classic is deprecated and only on TIO for special usage.)
 
RGS
5:46 PM
incantation means?
@Adám sure
 
@RGS This super obscure code: ⍎⊃⍬⍴¯3↑⎕SRC⎕THIS
 
RGS
ah, so "incantation" is not the name of anything?
you just mean like "this dark magic"?
 
No. :-)
Yes. APLers sometimes call it APL pornography :-)
 
RGS
ahaha sure
I had a calculus teacher that talked about dark magic a lot
I enjoy dark magic
ty!
Hm, I think I'll claim one of your bounties now haha
 
6:09 PM
@RGS Dyalog APL does have one real dark magic feature, but it is a bit advanced. I'll show you another time.
 
RGS
6:35 PM
@Adám now I wanna know!!
 
6:55 PM
Hmm... There's an undefined function ∆fmt in the source which looks like it's probably intended to be at least a subset of STSC's (and Dyalog's) ⎕fmt
 
00:00 - 17:0017:00 - 19:00

« first day (1156 days earlier)      last day (1501 days later) »