« first day (48 days earlier)      last day (2622 days later) » 

9:39 PM
@Adám do you know anything about Dyalog on Linux? (I downloaded and it won't work) (posting in here because APL room is frozen)
 
Riker has unfrozen this room.
 
@Adám found it + unfrozen
here ya go
 
@Adám so it depends on ncurses 5 but I have 6 and apparently it isn't backwards compatible
 
@betseg Hm.
 
@Adám also, so you work for dyalog?
what do you do? and do you like it?
 
9:42 PM
@Riker Yes.
 
Anonymous
1 message moved from The Nineteenth Byte
 
@Riker Apparently I'm mainly in the development and maintenance of APL tools.
 
lol
 
@Riker And yes, I love it.
 
nice hair btw
I used to have hair like that
parents got mad and made me get it cut tho :(
 
9:46 PM
@Riker Did you have a specific reason for the style?
 
not other than it looking cool
 
@Riker I do all kinds of stuff. Lately, I've been doing a lot of maintenance on our User Commands and their documentation. Do you know about APL at all?
 
not too much no
I've used a little bit, seems pretty cool
I know more about apl than any other simliar langs, but that's not saying much
 
So the APL environment is a quite different from most languages.
 
okay
in what ways? how does it work?
 
9:49 PM
Newcomers sometimes ask where the libraries are.
Truth is, you rarely need any.
The language is so powerful, most things are available in a few characters.
 
hm, okay
what about things like graphical output?
 
@Riker Comes with.
 
oh cool
how are the commands structured?
 
@Riker There is native support for various graphics formats.
@Riker Commands? There are a few "classes" of built-ins.
 
like are there prefix characters that represent math funcs, string funcs, i/o, etc. or are there just a bajillion different commands each with a single char
 
9:53 PM
APL is a superset of basic maths.
 
oh cool
 
So there are a few concepts from math which have been taken and applied to everything else.
 
well I gtg right now, but I've downloaded that "Mastering Dyalog APL" book and I'll try to learn when I get a chance
@Adám such as?
 
Just as math has A+B, so are there more APL "functions" of the form A f B.
 
ah
 
9:56 PM
@Riker I have long hair too :p
 
Just as math has Capital-Pi and Capital+Sigma for Product and Sum, so has APL the "Capital" part as a separate entity, i.e. a higher-level function ("operator") which modifies one or two functions and spits out a new custom function.
Just like math has - B, so has APL many functions of the form f B
All of APL is then built from such constructs.
Back to the "Capital" part: / in APL is that, so +/ is sum, and ×/ is product.
But any function can be to the left of the slash: MyFn/a b c d is the same as a MyFn b MyFn c MyFn d
And there are many other operators which modify functions, besides, the user can define custom operators, just like custom functions.
E.g. Twice←{⍺ ⍺⍺ ⍺ ⍺⍺ ⍵} then 2+Twice 5 gives 9
where stands for the 2, and ⍺⍺ stands for the + and ⍵ stands for the 5.
 
10:15 PM
So how do I add numbers like, say 3^x to 3^(x+6) in APL ($\sum_{n=x}^x+6 3^n$) (I hope that's right, I'm mobile)
 
@betseg ⍳6 is 1 2 3 4 5 6, so x,x+⍳6 is x (x+1) (x+2)...(x+6). Finally: +/x,x+⍳6
You can define a function to do this: betseg←{+/⍵,⍵+⍳6}
 
That's actually a really cool syntax
 
@betseg Here, try it! ( is the statement separator)
 
10:35 PM
@betseg So, just like maths use the left curly brace for cases, so does APL (but includes a right brace to indicate the end of the function:
Spell←{1=⍵: 'true'
       0=⍵: 'false'}
Spell 1 now gives true while Spell 0 gives false.
 
Omega is input?
 
@betseg Not exactly. The curly braces denote a function. Functions have arguments. ⍵ is the right argument, like 5 is the argument to - in -5.
There can also be an optional left argument, denoted by . as in 2+3
Arguments are not the same as input. There are two (simple) ways to get real interactive input from the user: (yes, that's a box) lets the user enter any APL expression, and returns the result. lets the user enter a simple string.
 
Oh alpha and omega first and last letters :D
 
@betseg Right on!
Or left-most letter of the Greek alphabet, and right-most.
All the APL symbols were carefully chosen to be as mnemonic as possible.
 
q←{+/⍵,2*⍵+⍳6}⋄q 1

253

q←{+/⍵,2*⍵+⍳6}⋄q 0

126
I don't understand
 
10:45 PM
So represents the box (i.e. the computer/user/input device...) and is the same, but with a superimposed quote character (the APL delimiter for strings).
@betseg The problem is probably with order of evaluation.
 
@Adám just...wow
 
While math has an intricate order of evaluation, extending this to an unlimited number of functions is just not viable. Therefore APL has one simple rule (actually a few, but we can get back to that): Just like -, everything takes whatever is on the right as its right argument.
So ⍵,2*⍵+⍳6 is the same as ⍵,(2*(⍵+(⍳6)))
, is concatenation, so you are building a two-element list of ⍵ and the expression which is similar to your original one.
+/ then sums the list.
 
Oooh I thought +/w is the sum
 
@betseg No, just +/.
The ⍵ is the argument of the entire function (in braces)
This leads us to more about order of evaluation.
An operator (higher-order function) returns a function as result. For practical purposes, they work mirrored from functions. So if an operator (like slash) takes one "operand" (plus), it goes on the left.
So +/ returns a new function (summation) which did not exist previously. That function is then applied like any other function, namely on whatever is to its right.
 
11:01 PM
f←{+/(⍵+⍳7)*3}⋄f 2

2016

q←{+/2*⍵+⍳6}⋄q 4

2016
k←{+/⍵+⍳63}⋄k 0

2016
I think I got it
 
@betseg Good. Now you don't need to assign a function to a name before you apply it. Anonymous functions are fine: {+/⍵+⍳63}0
@betseg At this point, you might want to apply for a free Dyalog license so you can use a full-fledged system instead of the quite limited TryAPL.
 
@betseg eyy
 
This will also make it easy for you to save things for later.
 
2 hours ago, by betseg
@Adám do you know anything about Dyalog on Linux? (I downloaded and it won't work) (posting in here because APL room is frozen)
 
@betseg Sorry, I forgot that was you.
That's odd. What exactly do you mean by "it won't work"?
 
11:12 PM
There is a blinking cursor in the middle and nothing changes whatever I type (even ^D, ^C, ⎕OFF 0)
 
Very strange.
 
Probably ncurses 6
 
@betseg Right, you mentioned ncurses.
 
Btw, it's 2 am here, good night!
 
@betseg Oh dear. G'nite. I'll ask at the office about ncurses 6 tomorrow morning.
 
11:19 PM
Oh I forgot something about that
When I tried to execute APL it said 2 files didn't end with a newline (I don't remember exactly which) and APL didn't open. I filled those files with a single newline, then APL opened and stuck with a cursor
Sleeping now, see you later, I'll post the files
 
@betseg Sleep well.
 
@Adám thanks
 

« first day (48 days earlier)      last day (2622 days later) »