« first day (265 days earlier)      last day (2390 days later) » 
08:00 - 22:0022:00 - 23:00

Ven
8:44 AM
@Adám Thanks. I have to say, I'm a bit stuck. I need to figure out where I'm going off the rails :). This is a very good "learn apl the hard way" haha
 
 
3 hours later…
11:35 AM
@Adám nice. I didn't know the bars were yours
 
@Uriel I don't know who's idea it was. Maybe Iverson's. Anyway, The pairings certainly make sense: index/indices interval-index/indices-of-ones. and as you know. Monadic is enlist, and I'll lobby for monadic to be prototype, i.e. both are partial info about an array. One is just the data, the other just the structure.
 
@Adám I meant the apl.codegolf bars hole
 
@Uriel Oh. They all are.
 
😂😂 should have guessed. working on them right now
 
 
2 hours later…
2:03 PM
So Hurricane Ophelia avoided #Dyalog HQ ... although it did get a bit breezy and we had a very strange reddish sky! http://www.bbc.co.uk/news/uk-england-41635906
 
@Mr.Xcoder Yo!
 
Hello!
 
@Mr.Xcoder How much do you already know about APL?
 
Not much.
I don't even really know where the docs are.
 
Well, you know Jelly. That's a long way already.
 
2:05 PM
Ok then
 
So, first I'll introduce you to APL lingo, defined in Jelly lingo.
Jelly Atom is APL primitive function
Jelly Quick is APL primitive operator
 
Ok... keeps that in mind
 
Jelly Link is APL tacit function
While Jelly is fully tacit, Dyalog APL has three "modes": trad, d, and tacit. I usually start with d first.
explanation: trad(itional) d(irect)
 
Just about to ask
 
function is usually shortened to fn and operator to op. So a traditional function is a tradfn and a direct operator is a dop.
 
2:08 PM
Ok, those are the denominations we will use I suppose?
 
Yes.
 
@Adám Which one will we use (first at least)? APL (Dyalog) or APL (Dyalog Classic)?
 
@Mr.Xcoder For all practical purposes, they are the same, but classic shouldn't be used unless necessary.
 
Ok, I see.
 
While Jelly atoms have fixed arity/valence, APL functions are often ambivalent. They may be monadic (prefix), dyadic (infix) or both. tradfns may also be niladic (not taking any arguments).
Indeed, most primitive functions, like + - × ÷ are ambivalent (i.e. monadic/dyadic).
 
2:12 PM
What does monadic + do for example?
 
This means that as opposed to Jelly, most primitive APL functions are "overloaded" with two distinct (but almost always closely related) meanings.
It is easiest to understand monadic + if we do monadic - first.
Monadic - (as you may expect) negates numbers.
Do you know about complex numbers?
 
yes of course
 
OK, so monadic - negates both the real and the imaginary part of complex numbers (as it should).
Monadic + negates just the imaginary part, i.e. complex conjugate.
 
Oh + is the complex conjugate?
 
@Mr.Xcoder Yes. If a value doesn't have an imaginary part (which is the case for both real numbers and also for text and objects), nothing happens.
 
2:15 PM
Nice overloading...
 
@Mr.Xcoder Yup, now you see why we had to do - first.
 
I do.
 
Let's do monadic ÷ too. Any idea?
 
Umm, let me think...
Maybe gets the inverse 1 ÷ N?
 
@Mr.Xcoder Correct.
Often, the monadic case is simply a default left argument.
Let's do monadic ×.
 
2:17 PM
Square?
or maybe something else ...?
 
@Mr.Xcoder No. Square in terms of × would be to use the sole argument also as left argument. This can be specified for any function by using the operator. ×⍨ is a monadic function; square. +⍨ is a monadic function; double.
 
Ok then what is × monadically?
 
The "default" left argument of × is 1÷abs(N)
In other words, monadic × is signum. Or "direction" for complex numbers.
 
Oh so 1÷abs(n) × n
How is that sign?
 
@Mr.Xcoder Think about it.
 
2:21 PM
Or ÷ is integer division?
 
@Mr.Xcoder No, just division.
 
Oh >_> I am dumb
@Adám But how does that not crash for 0?
Its either -N/N, N/N or ... 1/0*0. Is the latter evaluated to 0 because of the *0?
 
@Mr.Xcoder It would. The actual definition isn't that formula. It is just a neat way to describe it.
 
ok I see. So × is sign.
 
@Mr.Xcoder Yup.
 
2:23 PM
(monadically called)
 
Speaking of absolute value. Mathematics uses a mixture of prefix, postfix, and enclosing notation. APL uses only prefix for functions. So while math uses |N| for abs(), APL uses just |N
And factorial is of course !N
 
Ok, so kinda like Pyth (Pyth is prefix too)
 
Now, let's teach you six more functions in one go. They are all dyadic only: <≤=≥>≠ do what you expect. 1 for true, 0 for false.
 
Ok, I got it.
 
Btw, APL fully "vectorizes" (well, arrayizes…)
 
2:26 PM
I was just asking that lol... Do you read minds?
Ok, what is the basic structure of a program?
 
@Mr.Xcoder so 1 2 3=2 2 2 gives 0 1 0. If you want to compare whether two arrays are identical, just add an underbar: . And is of course the opposite.
@Mr.Xcoder Yeah, now we can begin programming.
 
@Mr.Xcoder but pyth has all the arguments after the "atom", while APL has dyads with left anf right args
 
@Uriel I got that. I was talking about monads
 
Let's have a look at dfns. The function body is enclosed in curly braces {body}
Statements can be separated by line breaks or by diamonds ().
 
What were dfns again? Default Direct functions?
 
2:30 PM
@Mr.Xcoder Direct functions. But it doesn't matter. They are just a type of explicit (not tacit) functions.
Assignments are done with a left pointing arrow: var←42
 
Ok.
So is ; in most languages
 
The first expression which isn't an assignment causes the function to terminate with that value as result. This is only the case for dfns and dops, not for tradfns and tradops. Tacit functions can only have a single expression.
Oh, and the arguments. The right argument of a dfn/dop is (Omega, the rightmost letter in the greek alphabet)
The (optional) left argument is (you get why)
 
Ok.
Is some kind of print?
(when it's assigned to something)?
 
@Mr.Xcoder Yes, but rarely used in dfns/dops.
 
So only used in "Full programs" like:
⎕←'Hello, World!'
⎕←'Hello'
 
2:34 PM
@Mr.Xcoder is a pictogram of your console. Assigning to it prints to stdout. Querying its value reads from stdin.
 
Nice.
 
@Mr.Xcoder Yeah, but print to stdout is implicit in most cases, so no need for the ⎕←
@Mr.Xcoder Also is a pictograph of your console with a quote in it. It is for sending messages, i.e. ⍞← is print to stderr and querying reads text from stdin.
 
Makes sense.
 
Btw, querying reads values (i.e. executes the stdin) as it lacks the quote, i.e. text-identifier.
Anyway, {10 20 30+⍵} is an anonymous dfn which adds 10,20,30 to its right argument (and ignores its left argument if given one)
 
2:38 PM
@Mr.Xcoder We can assign dfns and dops (and tacit functions) with the same syntax as we use for variables: myfn←{10 20 30+⍵} Try it!
 
Oh ⎕←{10 20 30+⍵}5
@Adám Oh nice.
 
@Mr.Xcoder Yes. Because TIO's Code field is a script and so implicit stdout is not active.
 
Ok I'll use TryAPL from now on.
 
Ok, after you teach me some more stuff I'm willing to try some simple tasks
 
2:41 PM
@Mr.Xcoder TryAPL resembles a real installed APL system more, but is rather limited. You can only use dfns, dops, and tacit functions. And you cannot use line breaks.
 
Also, where can I see what each function does. Like, the docs?
 
@Mr.Xcoder I wouldn't use a PDF…
 
Ok, thanks!
 
Cool dfn feature: condition:result
E.g. {⍵>10:'big' ⋄ 'small'}
 
That's like a ternary conditional
 
2:46 PM
@Mr.Xcoder Kind of. But execution continues after the "else" (), while it stops at the "then" (:).
One more thing: dfns/dops can refer to themselves (recurse) even if anonymous: means "myself".
@Mr.Xcoder Oh, did I mention that APL doesn't have much of an order of execution?
 
Oh that's a very nice feature
@Adám You did not. Listens
 
The rules are very simple. Operators are left-associative and go before functions, which are right-associative. Sounds complex? Works out nicely in practice.
That's all you have to remember.
 
Ok, I understood
 
Parentheses work exactly like in regular math (except they do not imply multiplication of course) but can also be used for a few other tricks.
Can you write your first APL function? Factorial for positive integers.
 
Ok, give me a moment.
@Adám Yuppe: f←{!⍵} Called with ⋄ f 5
 
2:53 PM
@Mr.Xcoder Heh, yes, you're cheating. I meant without ! of course.
 
Oh...
 
Define a recursive function.
 
Sure.
It will take some time because I cannot type all the characters.
 
@Mr.Xcoder The only non-ASCII chars you need are × and ∇
 
Yes, I am aware of that.
@Adám Don't I also need ?
 
2:55 PM
@Mr.Xcoder Opening the Primer tab on TryAPL gives you a cheat sheet where you can click to insert.
 
be right back.
 
@Mr.Xcoder Oh, right.
There is also a floating keyboard.
 
@Adám Ummm, don't I also need ?
 
@Mr.Xcoder Yeah. I wasn't very good at supplying those chars, was I?
 
Hehe
 
2:58 PM
Btw, if you seriously want to learn APL, you should get a full production version (free) from here.
 
Will do (later)
Umm, I am definitely missing something. Don't tell me where I go wrong yet: {⍵>0:⍵×∇⍵-1⋄⍵}
oh god I am dumb...
 
Just a typo, methinks.
 
I should change that last with something else...
 
@Mr.Xcoder Yes. What is factorial(0)?
 
3:01 PM
So?
 
{⍵>0:⍵×∇⍵-1⋄1}
Man APL is so addictive.
4
 
@Mr.Xcoder Bravo!
 
danke!
 
@Mr.Xcoder Unfortunately, I have to go. I may have wifi in the train. Otherwise I'll probably be back online later tonight. I surely will be tomorrow. Hope you enjoyed the first lesson.
 
And although it is unicode it is quite easy to understand (at least for now)
@Adám Thanks, it was great!
Hi @Uriel!
 
3:03 PM
@Mr.Xcoder I'll teach you all the symbols another time. They are all really easy to remember.
 
@Mr.Xcoder Yo.
 
3:20 PM
@Mr.Xcoder Yay, wifi works.
@Mr.Xcoder Want to do another few?
 
@Adám I'd love to learn some more things, but unfortunately I will not be able to train anymore today.
(Maybe tomorrow evening)?
 
@Mr.Xcoder No problem. Feel free to ping me in here anytime. Tomorrow evening is great.
 
3:36 PM
@J.Salle Interested in learning APL?
 
@Adám Yup. I was lurking here and went out to have some lunch before we could actually get to the lessons though
I'm reading through what I missed
 
@J.Salle I have 20 minutes now if you want.
@J.Salle Let me know when ready.
 
@Adám will do, just got to the structure of a program
Okay I think I'm ready hahahah
 
@J.Salle So you got the factorial?
 
I think I did
 
3:47 PM
@J.Salle Let me introduce you to your first primitive operator: ¨ called each. YOu can see the symbol as being two dots – one for each.
So we have factorial←{⍵>0:⍵×∇⍵-1⋄1}
But if we try to apply it to a list of numbers, we get an error.
 
Right, because we only have one argument in the function?
 
@J.Salle No. the list will be passed as-is as . The problem is that the Boolean condition before : will be a list too, and you can't have both true and false!
 
Makes sense
 
So we can instead apply the function to each element of the list with
 
f being the full ←{⍵>0:⍵×∇⍵-1⋄1} function here?
 
3:50 PM
@J.Salle Yes, or any monadic or dyadic function whatsoever.
 
Yeah, I see it
 
@J.Salle This is how operators work. They take one or two functions as operands, and derive a new related function.
You can even name the derived function: fact←factorial¨
 
Okay, I think I got it
@Adám Oh that's neat
 
Now, you should be able to write a fibbonacci function which takes a single number as right argument.
E.g. fib 5 should give 8.
 
Okay, on it
@Adám question: how do I run the function on tryapl?
 
3:57 PM
@J.Salle How do you mean? Just put the function or its name before the argument.
 
I defined fib←{⍵>0:⍵+fib(⍵-1)⋄0} not sure if it's correct though
 
@J.Salle Just try it with fib 5
TryAPL remembers your definitions for you, so you can use a function you've defined yesterday.
 
Okay it works but it's the wrong value, I'll see what I'm doing wrong
 
@J.Salle The definition of fibonacci is that fib(n) = fib(n-1)+fib(n-2), fib(1) = 1 and fib(0) = 1.
 
@Adám okay I got fib←{⍵≥1:fib(⍵-1)+fib(⍵-2)⋄1}
but it's probably still wrong because I'm getting an EXPRESSSION TIME LIMIT EXCEEDED exception
 
4:02 PM
@J.Salle You should use when recursing.
 
oh
 
It will work fine with the name of the function, until you change its name…
@J.Salle The comparison is wrong. Should be >, not .
 
@Adám yeah I noticed that the second I sent the message :p I'm still getting an exception with fib←{⍵>1:∇(⍵-1)+∇(⍵-2)⋄1}
is that the correct usage of the ?
 
@J.Salle Because you're using non-APL notation for function calls, and misleading yourself regarding order of execution.
 
Not sure what would be the apl notation, then
 
4:07 PM
You don't need parentheses (but may use them) to apply a function, but functions are right-associative, so the leftmost sees (⍵-1)+∇(⍵-2) as its argument!
 
ooooooooooooh
Okay, gimme a sec
 
Ven
yeah, in functional-ish language, you usually write (f a) than f(a).
 
@Ven Exactly.
 
Ven
(F# users trying to make your code look like OO, I'm looking at you!)
 
But how would the dyadic form of f(a) look‽
 
Ven
4:09 PM
f(a)(b) :P
 
@Ven That's not dyadic. That's monadic – twice.
 
I tried fib←{⍵>1:∇(⍵-1)+(⍵-2)⋄1} and got a domain error
Not sure how to call the function over (⍵-1)+(⍵-2)
 
@J.Salle (∇⍵-1)+(∇⍵-2)
 
Oh that's how you group it
 
Ven
@Adám ok, then f(a)「b」 :P.
 
4:11 PM
@J.Salle is just another monadic function.
 
Java made my mind rot a little bit, I guess.
Okay I got this tryapl.org/…
 
@J.Salle Very nice.
 
I like this
 
Now one more operator before I have to go: / is reduction. So +/ is a monadic function; sum. ×/ is product.
Now see if you can golf your solution.
 
Ven
@Adám Actually, if you had some pointers for me a bit later, I'd appreciate it :).
 
4:14 PM
Sum as in the mathematical I assume?
 
Ven
@J.Salle yes
 
Okay
 
@Ven Remember that APL "vectorises" automatically, as in 2+4 5 gives 6 7.
@J.Salle Right. But you can of course use any dyadic function with /.
 
Ven
@Adám wait. did you read my code earlier and immediately spot the issue?
I feel dumb :p.
 
@Ven Which code?
 
Ven
4:16 PM
@Adám I meant for this
 
@Adám I should use +/ before the function call or after it?
 
@J.Salle Oh, I just meant to golf J.Salle's code.
 
Ven
oh, you mis-replied I think
 
@Ven I thought you wanted pointers as to how to golf J.Salle's fib.
 
Ven
@Adám ah, no, my bad.
 
4:18 PM
anyway, gotta get of this train now.
 
Ven
I wasn't clear enough :).
 
@Adám Okay, I'll leave my answer here once I get it
At the moment I got fib←{⍵>1:+/(∇⍵-1)(∇⍵-2)⋄1} and it works, but it's not golfed at all hahahah
I think I'm getting the hang of it. Also not golfier but it works with fib←{⍵>1:+/∇¨⍵-1 2⋄1}; Link
 
 
1 hour later…
5:35 PM
@J.Salle Nice. That's the solution I had in mind,.
 
@Adám Nice! I was trying to solve a challenge in APL but apparently Tryapl wasn't working properly? I was getting a message like "couldn't process your request" or something like that. It's working now though
 
@J.Salle Unfortunately TryAPL isn't always so stable. It is being worked on as we speak. Hopefully it will have gotten a total backend overhaul by the end of the year. TIO should be fine though (but doesn't have a keyboard).
@J.Salle Maybe you should get the desktop version of Dyalog APL?
 
@Adám Already applied, but I'm at work right now, so I won't be able to fiddle with it until I get home
 
@J.Salle Ah. Cool.
 
@J.Salle I usually open tryapl or the ide in one side for the symbols, and tio on the other to write the code
I recommend that, especially when using symbols available only on dyalog 15.0 (the desktop is 14.0)
 
5:45 PM
@Uriel that's a good idea, I'll do that
Could you guys tell me why 16 16 ⊥ 2 1 evaluates to 33 (which is correct) but 16 16 ⊥ F F doesn't evaluate to 255? I get a value error
I got the conversion with encode/decode ops from here
 
@J.Salle APL doesn't have hex digits. use 15 instead of F. that way you can also use bases beyond 36
or if you really need it, A B C D E F←9+⍳6
 
@Uriel Ooooooh I see, thanks!
 
6:10 PM
@J.Salle Btw, you don't need to double the 16. If you give only one, it will be the base for each position.
@Uriel Correction: The desktop version that J.Salle will use is 16.0 which has the new glyphs not in 14.0. (15.0 only added system functions.)
 
6:32 PM
@Adám is there any way I can obtain 16.0 without registration?
 
@Uriel No, but I'm lobbying against registration.
@Uriel Actually, you can, but only for the Raspberry Pi.
 
7:23 PM
@Adám yea, I don't have one.
 
@Uriel They are under ₪150.
 
@Adám I don't really need one, and 30£ ain't like nothing
 
@Uriel Apparently submitting a complete set of contact info ain't like nothing either. ;-)
 
7:40 PM
@Adám well, registration just makes you feel more obligated, like somebody watching over your shoulder looking what you do with the program. the info ain't that much of a nuisance to me
 
@Uriel Oh, but I can assure you that dyalog.exe does not in any way register what you do with the program. Your installer package is identical to everyone else's and you don't even have to put in your actual license number when installing. We do not use any kind of DRM or license checking whatsoever.
It doesn't even check for updates or offer to send bug reports home.
 
@Adám these are actually features I would expect an IDE to have
 
8:02 PM
@Uriel So what do you mean by "somebody watching over your shoulder"?
@J.Salle Up for more?
 
8:26 PM
@Adám well, the usage restriction
May 28 at 15:23, by Adám
@Uriel We will never give out your information, and we only send you information relevant to your install (although you can just ask not to be on the mailing list). We do need your contact info to be able to sue you in case you use the product for commercial purposes.
 
@Uriel Oh, I see. But we actually have no way of controlling that. It would only be in the rare case that we stumble upon a commercial product which clearly uses Dyalog and there is no trace of licensing. It has happened that people contacted us for support in regards their commercial system made with Dyalog, but without commercial licence. When we asked for their license number we could see that they only had a non-commercial one. Then we kindly ask that they purchase full rights or cease.
 
@Adám I’ll be in my pc in about 20 minutes
 
@J.Salle OK.
 
9:16 PM
@Adám I'm here, sorry I'm late hahahah
 
@J.Salle No problem. Want to make some primes?
 
Sure, why not? :P
 
OK, I'll teach you some more primitives, and then we can put it all together.
 
Let's do it
 
First, let me introduce you to . The monadic function generates the first N indices. E.g. ⍳5 is 1 2 3 4 5 (Dyalog APL counts from 1 by default, but you can switch to 0 if you want).
Mnemonic: is Greek Iota, like Latin I, for Indices.
 
9:20 PM
Okay
 
The dyadic function ⍺ ⍳ ⍵ finds the Indices of in , but we won't need that now.
Dyadic is drop. 3 ↓ ⍳10 is 4 5 6 7 8 9 10
Can you guess what dyadic does?
 
@Adám Okay so it's the first n elements to drop from a set
puts elements?
 
@J.Salle Not from a set, from any array. It drops rows (or rows and columns) from matrices, etc.
 
@Adám oh yeah, okay
 
@J.Salle Nope. It takes. 3 ↑ 'Hello' is 'Hel'.
And if you want to take or drop from the back instead of from the front?
 
9:23 PM
Ooooh, sure
-3?
 
Correct. Pretty intuitive, no?
 
Yeah hahahah
 
Btw, the negative symbol in APL is ¯ (high minus) just like on TI graphing calculators.
 
Yeah I was about to ask that
 
This allows you to write ¯3-1 which gives ¯4 while -3-1 is ¯2.
 
9:25 PM
Interesting
 
It has some really nifty applications, but we can come back to that.
Monadic ~ is logical NOT. I.e. ~1 is 0 and ~0 is 1.
Dyadic ~ can be read as "but not". E.g. 'HELLO' ~ 'L' as in "HELLO but not L", so it gives 'HEO'
 
@Adám That's handy
 
Officially, it is called Without.
Btw, I forgot to teach you the keyboard locations for all these. Do you want that now, or should I continue in direction of primes?
 
I'm kinda following in the tryapl keyboard
 
@J.Salle Right, but the keyboard locations are mnemonic too, like on I.
 
9:30 PM
@Adám Yeah I noticed alpha and omega are on a and w
 
I'll continue with primes.
 
Prime time \o/
 
@J.Salle Right, and is on E.
Here is an interesting operator. The dot .
It really takes two operand functions, one on each side; f.g but for now we will use a special left operand and treat ∘. as a whole.
Introducing ∘.f
∘.f applies the dyadic function f between all combinations of the elements of the derived function's left and right arguments.
 
okay
 
I've mentioned before, which makes a monadic function out a dyadic one, by using the sole argument as if it were on both sides.
So we can easily make a multiplication table with ∘.×⍨⍳10
 
9:35 PM
Oh that's cool
 
@J.Salle You fully understand how ∘.×⍨⍳10 works?
 
I get two arrays of ⍳10 and multiply them with each other
My internet is crapping out btw, sorry for the delays hahah
 
@J.Salle Sure, that's what's happening. But I mean how it works: ∘.× derives a new unnamed dyadic function ("multiplication table") which is then modified by to become monadic.
@J.Salle No problem. Happens on occasion by me too.
 
@Adám and I can do that to every dyadic function
 
@J.Salle Yes.
 
9:39 PM
Okay, I'm following
 
Great. Now we can put all this together to make primes.
 
Let's do it
 
Notice that there is a connection between multiplication tables and primes: Primes are all those numbers which never occur in a multiplication table.
 
@Adám indeed
 
So ∘.×⍨ 1↓⍵ are all the non primes.
And ⍳⍵ are all the numbers.
Then (1↓⍳⍵)~∘.×⍨1↓⍳⍵ are all the primes.
 
9:42 PM
Okay wait a moment
@Adám this one makes an array ranging from 2 to and multiplies it with itself
 
(sorry, I was missing the 1↓ twice)
@J.Salle Correct, well, multiplies each one with each one. All-combos.
 
I'm with you
This is cool
 
Okay, so we can make a lot of primes now
 
@J.Salle As many as there is memory for. This method is short and simple, but terribly inefficient.
 
9:49 PM
Yeah I thought so hahahah
 
Now I can teach you about tacit programming in APL.
 
Okay, let's do it
 
If you do not supply any arguments to APL functions, they instead form long chains of functions, called function trains.
E.g. +-×÷ is a function train (with four "cars")
 
Okay, we can have any number of cars?
 
Yes, but long trains are made up of smaller trains. There are really only two types: 2-trains (called atops) and 3-trains (called forks).
 
9:53 PM
Okay, with you
 
2-trains, like are very simple. The apply the left function monadically to the result of the right function.
So, e.g. f←-× (notice the lack of braces) and 2 f 3 gives ¯6
And f 3 gives ¯1
f←-× is equivalent to f←{-⍺×⍵} in the dyadic case and f←{-×⍵} in the monadic case.
@J.Salle Understand 2-trains?
 
okay, so if we have two 2-trains we apply the left train to the result of the right train?
@Adám I think I do
 
@J.Salle Yes, because a train is just another function. ⍺ (f g) ⍵ is f ⍺ g ⍵ no matter whether f and g are trains or not.
3-trains:
f g h is a 3-train. Applied dyadically, it is (⍺ f ⍵) g (⍺ h ⍵)
Applied monadically, it is of course (f ⍵) g (h ⍵)
 
@Adám that's easy enough, I think
 
08:00 - 22:0022:00 - 23:00

« first day (265 days earlier)      last day (2390 days later) »