« first day (804 days earlier)      last day (1849 days later) » 
03:00 - 22:0022:00 - 23:00

3:09 AM
Hi y'all, glad I found this chat room.
 
3:50 AM
Got an interesting J solution for the Podovan challenge; it's hardly golfy at all, but the method used is interesting. Th Podovan sequence is a linear recurrence, hence one can use that method with the characteristic polynomial of the recurrence relation.
The code below does this in the general case _if the polynomial has only simple roots_, which is the case here:

lr=: 2 : '1r2 <.@+ (n %. z ^~/~ i.#n) +/ . * (z=. >{:p. 1 ,~ -m) ^/ ]'
   pdv=: 1 0 0 0 1 lr 1 1 1 2 2
   pdv 0 1 2 4 6 14 20 33
1 1 1 2 4 37 200 7739
   ,. pdv@i.&.> 1 3 4 7 10 12
┌─────────────────────────┐
│1                        │
├─────────────────────────┤
│1 1 1                    │
├─────────────────────────┤
│1 1 1 2                  │
├─────────────────────────┤
│1 1 1 2 2 3 4            │
├─────────────────────────┤
│1 1 1 2 2 3 4 5 7 9      │
├─────────────────────────┤
│1 1 1 2 2 3 4 5 7 9 12 16│
└─────────────────────────┘
 
4:34 AM
@ngn Atop and Over are very certain for 18.0. Under and Obverse are likely for 19.0 but they are somewhat controversial.
@Olius Welcome. Good to have you here.
@Olius Markdown (e.g. _italics_) does not work in multi-line messages. Just use multiple messages, and the system will visually merge them.
 
4:53 AM
I came up with 10⊥ ¯1+ ⎕D⍳'512' to convert a string of digits to an integer when Google wasn't coming up with much; is that a reasonable way to approach it or a silly way?
 
 
1 hour later…
6:02 AM
@TessellatingHeckler You mean to avoid ? ⎕VFI is the safe text-to-number converter. Otherwise, sure, your method works.
⍞←⍎'512'
 
@Adám 512
 
⍞←⊃⊃⌽⎕VFI'512'
⍞←0.5× ⊃⊃⌽⎕VFI'512'
 
@Adám 256
 
6:52 AM
I meant generally; I don't know what spaceneedle is, but ok cool
oh it's eval(), no wonder I'd want to avoid that, yes
 
7:03 AM
@TessellatingHeckler Right. The official way is using ⎕VFI (Verify and Fix Input) which returns two vectors. The first is a Boolean mask indicating which fields were successfully converted, and the second is a vector of the resulting values, with zeros for invalid values:
⎕←⎕VFI'1e3 NaN .5 ¯2 .'
 
@Adám
┌─────────┬───────────────┐
│1 0 1 1 0│1000 0 0.5 ¯2 0│
└─────────┴───────────────┘
 
@TessellatingHeckler I either use ⎕VFI or filter by digits (t∩⎕D) and if non-empty (0≠≢), execute that ().
 
7:20 AM
intersection with digits
quad-VFI is probably the right thing to use
 
 
4 hours later…
Ven
11:19 AM
#tio do apl-dyalog-extended ⎕←'A1'…'B2'
 
@Ven A123456789:;<=>?@AB2
 
Ven
Not sure what I expected..:)
 
@Ven Maybe this:
#tio do apl-dyalog-extended ⎕←⍳'B2'
 
@Adám  A0  A1  A2
 
oops.
 
Ven
11:21 AM
Huh.
 
@Ven Sorry, the "do" command is wrong here.
#tio apl-dyalog-extended ⎕←⍳'B2'
 
@Adám
 A0  A1  A2
 B0  B1  B2
 
Ven
it's ok, I just so happen to have a tio extended tab open :)
wishes for a extended dyalog tryapl for this christmas :)
 
@Ven Why don't you just run it locally?
 
Ven
I thought Dyalog only supported Windows, and since a few years, OS X.
 
11:23 AM
@Ven What OS are you on?
 
Ven
Ubuntu
 
@Ven Dyalog has had *x support since forever!
 
Ven
.oO( What about Solaris however )
Well, good to know then
 
Ven
lol, I should've known.
⎕←'CDHS'(∘.,)'TJQKA',⍨⍕¨1+⍳8
 
11:27 AM
@Ven
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐
│C2│C3│C4│C5│C6│C7│C8│C9│CT│CJ│CQ│CK│CA│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│D2│D3│D4│D5│D6│D7│D8│D9│DT│DJ│DQ│DK│DA│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│H2│H3│H4│H5│H6│H7│H8│H9│HT│HJ│HQ│HK│HA│
├──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┼──┤
│S2│S3│S4│S5│S6│S7│S8│S9│ST│SJ│SQ│SK│SA│
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘
 
@Ven Hehe, so email sales@ to add a Linux license, download extended, run ]Load /X/Lang/* and then Extended.Repl⍬ to switch to Extended REPL mode.
 
Ven
You have a whole Lang/ folder? :)
 
@Ven Eh, I keep Extended checked out to /X/Lang/
In general, I keep stuff I want at hand checked out into /X/ and then my startup script loads everything in /X/ into ⎕SE so I can access everything from inside APL through ⎕SE.X.Category.stuff
E.g. I can do:
      ⎕SE.X.Sort.NatSort 'Hello20' 'Hello1' 'Hello10' 'Hello2'
┌──────┬──────┬───────┬───────┐
│Hello1│Hello2│Hello10│Hello20│
└──────┴──────┴───────┴───────┘
 
Ven
To be fair, I have no idea how proper APL programmers work :)
 
@Ven Well, originally, that startup was a hack, but it turned out well, so in 17.1 we're ship that functionality out of the box (undocumented, but the code is in APL, so it is fairly easy to see how it works). In 18.0 we'll document how to auto-load whatever you want into whichever location you want.
 
12:15 PM
@Ven the bot hates comments
 
Ven
It's a stupid question anyways :)
 
I could make it support comments, but then we won't get appropriate error messages.
 
Ven
Just a tiny teeny sed ..:)
 
@Ven Really? How about a
 
New toys for the IT Dept at Dyalog who just got a shiny @IBM Power 9 server with a very fancy rack mounted display & keyboard. Looking back 4 years the old 3151 display could be rack mounted but it was not quite as elegant 😉
 
12:29 PM
CMC: Given a 1-liner APL expression, remove any comment from it.
 
Ven
I'm gonna make mine ignore the dangers of strings...
 
@Ven Ah, no, that's cheating!
 
Ven
Totally is!
Er, I remember there was some code that was quote-aware in the CSV parser example that Roger Huis showcased.
 
E.g. 'apl⍝code'⍝comment'⍝'stuff''apl⍝code'
 
Ven
⎕←(⊢↑⍨(¯1+⍳∘'⍝'))'⎕SE.X.Sort.NatSort ⍝ hah! cheating!'
 
12:32 PM
@Ven
⎕SE.X.Sort.NatSort
 
Ven
(obviously I left an extra layer of parentheses..)
 
@Ven Yeah, but it doesn't solve the CMC
 
Ven
No, but I'm focusing on something else at the moment, so I'll just cheat for now.
 
@Adám 23, trying to find something better
 
Ven
Trying to do binary OR, I guess ∨⍢⊤ in Extended?
 
12:42 PM
@Ven fails if the MSBs aren't equal of the arguments
 
@Ven Yes, but only if the arguments will have same width in binary. Otherwise use ∨/⍢⊤ monadically
 
Ven
1:06 PM
⎕←∨/(1)(1 0 0)
 
@Ven
┌─────┐
│1 1 1│
└─────┘
 
this turned out rather long..
 
@dzaima What is that‽
 
@Adám it uses the fact that the parity of '⍝' in the indexes of quotes must be odd
 
Ven
Welp, I guess I need to pad whichever number is smaller in binary, seems like ∨/⍢⊤ wont' help me bitwise two numbers
...at the same time, I know the number's at most 2, so..
 
1:11 PM
@dzaima So does ≠\
 
@Adám yeah, and sadly it's golfier
 
Ven
Er, I guess it's at most 4, so 4⊥⍨4⍴2
 
@Ven on a vector gives a matrix however
 
Ven
@dzaima which I can then ∨⌿!
 
29 mins ago, by Adám
@Ven Yes, but only if the arguments will have same width in binary. Otherwise use ∨/⍢⊤ monadically
 
1:13 PM
@Ven Well, ∨/ because and are transposed compared to what you'd expect.
 
Ven
Yup, exactly. And I did try .
 
It seems that doesn't know how to invert : Try it online!
 
Ven
Aw. Ok then.
 
This is a major problem in Extended, that the inversion functionality cannot cope with the primitives being replaced by covers. Try it online!
 
Ven
1:17 PM
Can you compare functions?
 
@Ven But you can do it for just one byte more: Try it online!
@Ven Yes, I do in fact. Why?
 
Ven
Specialcase the inversion functionality to see if it's a cover
 
@Ven And then what?
 
Ven
Something something Right Thing™?
 
@Ven ⍨
I could define all invertible covers as inner function bodies, and then use those definitions to define the final covers as main⍫inverse but it is really awkward. Why can't we just implement my extensions for real‽
 
Ven
1:23 PM
Sure, that works too.
 
@Adám bug
 
@dzaima Yes. Fixed now. Thanks.
 
other than the obvious 21 in extended / dzaima/APL, I don't have anything better
 
@dzaima I was trying to figure out why that doesn't work in Extended
 
@Adám yep, I was too
 
1:35 PM
@dzaima OK, now try doing the same for dzaima/APL!
 
@dzaima heh, that raises another issue - an input of ⍝all comment works in dzaima/APL but not extended
@Adám yeah i was afraid of that
 
@dzaima ugh
@dzaima Yeah, how did I not think of that. Will fix now.
 
@dzaima aw ≠\ is pointless now
is there anything better than a simple non-vectorizable manual pass?
 
@dzaima Incidentally, my fix causes:
      ¯1 ¯1 3⍴'abcdef'
abc
def

abc
def
May be useful…
 
@Adám that's already the case though
 
1:48 PM
@Ven
SYNTAX ERROR
 
Ven
⎕←2+⍎¨(↑'F1' 'F2' 'F3' 'F4')[;2]
 
@Ven
3 4 5 6
 
@dzaima Didn't even notice. Heh. But this:
      ⍴¯1 0⍴'abcdef'
6 0
I guess that is useful to initialise based on a pattern.
 
@Adám ಠ_ಠ :D
 
@dzaima Uh. And wat‽
@dzaima Why does ¯1⍴'abcdef' not work?
@Rick Hi and welcome. Interested in APL?
 
1:52 PM
@Adám my APL uses for the placeholder shape
 
@dzaima d'oh
 
@Adám the {} are from the default case of how to render arrays, though not sure why that's shining trough for matrices
 
@dzaima Both of our APLs get the shape wrong for a scalar.
 
@Adám for what code?
 
@dzaima ≢⍴(⊂⍬)⍴'a' should give 0, not 1
 
1:57 PM
@Adám I'd disagree - rank should equal to the left arguments length
okay this is stranger
 
@dzaima But occurrences of ⊂⍬ in the left argument should be replaced by the "missing" shape. Since no shape is missing to get the product right (0=×/⍴'a') you can put there, no?
 
@Adám ×/⍴'a' is 1
 
@dzaima Gosh, I'm pretty dim today.
 
ಠ_ಠ I'm disabling vector & matrix prettyprinting with ⎕boxsimple←1
oh this is part of the fault of the strangeness plus this using oneliner instead of the default toString. damn prototypes :|
 
@dzaima Should the placeholder shape not be minimum 1 so that ⍬ 4⍴'ab' gives 1 4⍴'ab'?
 
Ven
2:12 PM
I wonder how to replicate Jelly's Œ¿ "index of permutation"
 
@Adám that'd make ≢, not equal before and after the call, which I specifically want to have
 
@dzaima But that already isn't the case for normal
 
@Adám so I at least want it to be true for the special . In any case, usually one wants only one way of how works (i.e. only cuts off data, only repeats data, doesn't disturb the data amount)
 
@dzaima Padding 1 before the shape is often useful, and can thus be done with ⊢⍴⍨¯1,⍴
 
it just doesn't make sense for ⍬ 4⍴ to only ever change the data amount when the input has less than 4 items
@Adám that should work regardless of whether ⍬ 4⍴'ab' works or not
 
@dzaima 2What's wrong with me today? ⊢⍴⍨1,⍴ works in normal APL.
@dzaima In any case, ↑⍮ is much neater to do that.
 
@Adám oh thanks for that idiom, by some reason i couldn't even think of ↑,⊂ :|
 
@dzaima In light of the Classic VCS ASCII Adventure, I really should switch to a different placeholder value and let negative shape indicate flip, as I have previously contemplated.
 
 
2 hours later…
Ven
4:30 PM
Guess I should try to golf it down part by part.
⎕←,⍉'CDHS'∘.,v←'A','TJQK',⍨⍕¨1+⍳8
 
@Ven
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐
│CA│DA│HA│SA│C2│D2│H2│S2│C3│D3│H3│S3│C4│D4│H4│S4│C5│D5│H5│S5│C6│D6│H6│S6│C7│D7│H7│S7│C8│D8│H8│S8│C9│D9│H9│S9│CT│DT│HT│ST│CJ│DJ│HJ│SJ│CQ│DQ│HQ│SQ│CK│DK│HK│SK│
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘
 
4:41 PM
www.jsoftware.com has had a relatively recent redesign. Not sure when that happened.
 
ngn
5:12 PM
@H.PWiz it was on hn today
 
Oh, a co-incidence that I noticed it today then
 
 
3 hours later…
8:13 PM
@Adám sure. what do I do?
 
@Rick How much do you know of and/or about APL?
 
only what it says in the description
 
@Rick OK, no problem. I hope you don't mind me asking what your background is. I can of course see that your parent account is from Mathematics.
 
sure, I am software engineer.
 
Ah, ok. Which programming languages have you used?
 
8:17 PM
Javascript, Golang, C++, java, C
python
too
 
OK. You're into mathematics as well?
 
mostly things relating to graph theory
but yes when I have time
 
Any linear algebra, by any chance?
 
I have used linear algebra for machine learning. But that was in my own time.
but I am no expert, more of a hobby
 
OK. Enough cross-examination :-) Due to your experience with traditional and popular programming languages, you need to clear your mind regarding APL.
Think of APL as an alternative to traditional mathematical notation (TMN).
 
8:21 PM
That sounds intersting
 
TMN is great for expressing a lot of things, but over the centuries, it has collected a variety of inconsistent notations, and overly specific notations for what was needed at the time.
In fact, TMN is inherently ambiguous, relying on context and the goodwill of the reader to understand.
 
ok but what distinguishes APL from any of the commonly used programmings languages
 
I'll get there in a moment.
Because of these characteristics, TMN is unsuitable for machine evaluation, and is ill-suited to communicate general purpose algorithms.
APL was originally conceived by a mathematician, Ken Iverson, as a replacement for TMN.
He took a small subset of the most common notations from TMN and applied them across the board, while generalising various concepts from TMN that until then only had notation as specific instances of the general concepts.
And now we're finally ready to see some examples of this.
(Oh yes, and being harmonised and generalised as it is, APL happened to become able to be evaluated by a machine…)
So in TMN, you've got the Big Pi and Big Sigma notation for product and sum.
 
There is no compilation
 
No, APL is traditionally interpreted, just in time, even.
The general concept of product and sum is reducing a list into a scalar using a two-argument ("dyadic") function.
APL generalises this higher-order operation into an operator (in the Heaviside sense) which takes as operand a dyadic function. Thus, product in APL is ×/ and sum is +/
Note also that APL uses a proper × for multiplication. No compromises on good notation from TMN.
@Rick With me so far?
 
8:32 PM
ok, so everything is an associative array. And APL expands that to matrices
and since x and + are associative they are considered group operations.
 
APL actually generalises data into a single uniform concept of an array (a tensor if you want) with a (tensor) rank, where a scalar has rank 0, a vector has rank 1, a matrix has rank 2 etc. All functions are generally applicable to all arrays.
@Rick Well, you can reduce (or apply in any way, really) with any function you want.
Let's take another couple of examples of how APL generalises and harmonises TMN:
 
@Rick no, everything is an ordered, rectangular N-dimensional array (at least by what wikipedia said about what's an associative array)
 
bring on the examples
 
TMN has infix notations like a+b and superscript notations like , and also prefix notations like -a and suffix notations like a! and omni-fix notations like |a|
But notice that these fall into just two categories: single-argument (monadic) and two-argument (dyadic) functions.
APL harmonises all monadic functions to be prefix like -a and all dyadic functions to be infix, like a+b
Therefore, factorial is !a and absolute value is |a and square is a*2 (i.e. power is a*b)
 
ok
 
8:41 PM
Also note that TMN allows "overloading" a single symbol like - to have both an infix and a prefix meaning. This works well with the harmonisation of prefix/infix for everything so that most function symbols have two meanings, one prefix and one infix. E.g. -a is negation and ÷a is reciprocal.
 
reciprocal is interesting notation
 
Often, the monadic form is closely related to the dyadic form, only using a "default" left argument, e.g. 0 for - and 1 for ÷ but some have more involved default left arguments and some have less (or in a few cases, completely un)related pairings.
Another example is a*b is power, while *a has default left argument e
 
cool it defaults to Euler's number
is it evaluatted as a symbol or a decimal
 
Further of interest may be the inverse of * which is denoted log (it also looks like a slice through of a tree log) so 10⍟b is log₁₀ b and *b is of course ln b
 
@Rick there's no symbolic evaluation in APL
 
8:47 PM
@Rick All APL interpreters I know of only use numeric evaluation, although some dialects can work with rational numbers and there are systems written in APL that can do some symbolic evaluation.
@Rick Have you heard of the Iverson Bracket?
 
no, but it's seems like something I use without knowing it.
1 true 0 false
 
@Rick Yes, it is the concept that [a=b] and [a>b] etc. evaluate to 1 or 0
APL generalises this so that all truth statements are just regular functions returning zeros and ones. The bracket is always implied.
You are therefore allowed to write things like 2+(a>b)
 
because a>b will evaluate to 1 or 0 but. But what does it mean to perform such an operation? Is there underlying logic to adding zero as opposed to adding 1
 
@Rick It allows you to define conditionals inline as mathematical operations.
For example, say f(x) is x² if x > 0 and -x if x<0, how would you write that in TMN?
You'd need a cases-brace (which you can certainly do in APL too), but how about ((x*2)×(x>2))+((-x)×(x<0))
 
intersintg
 
8:57 PM
Speaking of which, TMN is a huge mess of conflicting precedence order rules. E.g. identical operations are left-to-right, except multiple exponents and nobody really knows what a/b/c is, or ab/cd for that sake, or whether trigonometric functions precede multiplication, etc. etc.
Iverson harmonised it all into one simple rule. Consider f(g(h(x)))
Let's remove the parentheses, since all these functions are simply monadic prefix functions: f g h x
 
ya I was just about to mentions that comma operators left -> right, right left assigment operations
 
Clearly, each function takes everything on its right as its right argument. In APL, all functions (no exceptions!) have long right scope. They are right-associative.
 
but does this not became really hard to debug
 
@Rick it becomes very easy to debug (at the very least relative to what it would be like having to memorize the precedences of the dozens of infix function builtins APL has, plus user-defined)
 
@Rick Not really. You always know the flow ← ← ←
In TMN, at first glance at a complicated formula, you have no idea where to begin.
You can of course use parentheses, but if written right, APL probably needs less of those, and you never need them because you can't remember the order of evaluation.
 
9:03 PM
these seem like monads where you compose functions
 
APL also insists on an infix symbol for all dyadic functions, so no more of implied multiplication by juxtaposition. This also allows inline multi-character names for variables and functions. a÷b÷c and a×b÷c×d and abcd are unambiguous etc.
@Rick Ready for another generalisation of TMN?
 
yeah go full speed
 
You know about matrix multiplication, and cross products, and dot products. They are all just summations of pair-wise application of multiplication. That is, it is a higher-order operation (just like reduction) but using two operands instead of just one. In this case the operands are + and × but really, it could be any two dyadic functions. APL denotes all of these with +.×
⎕ ← 1 2 3 +.× 2 3 1
D'oh.
⎕← 1 2 3 +.× 2 3 1
 
@Adám
11
 
hold on what is the operation here
 
9:11 PM
@Rick ⎕← means assign to the box (i.e. the console screen) and then we just have two vectors being dot-product'ed together.
APL allows, but does not need parenthesis and commas for vectors. You may also write (1,2,3) but 1 2 3 is cleaner (and faster)
@Rick This is (1×2)+(2×3)+(3×1)
 
I see that, but this has to be used +.x
 
@Rick What? Yes, you have to write +.× if that's what you mean. Dyadic × is always simple multiplication.
 
ok it makes sense.
 
@Adám personally I'd properly introduce arrays and vectorizing before dot products
 
@dzaima :-D
 
9:17 PM
how about if we want to get the total inside a single vector by adding all the indexes values
 
As dzaima alludes to, just like you can multiply a scalar with a vector or a matrix and that pairs up the scalar with each element of the vector/matrix, APL generalises this to all basic computational functions and to tensors of all ranks.
@Rick You mean the sum? +/
 
yes sum
 
Remember generalising all data into a single simple system of arrays. No differentiation between sets, lists, vectors, etc.
⎕←+/1 2 3
 
@Adám
6
 
read that as "plus across 1 2 3"
 
9:19 PM
what does that / mean
 
@Rick across or reduction if you want.
 
how about the intersection between two arrays
 
@Rick you mean like 1 2 3 ∩ 3 1 4 gives 1 3 ?
 
yes
 
I'll let you guess 3 times!
 
9:21 PM
umm...
one sec
may something with dots like 1 2 3 ... 3 1 4
 
How about:
⎕←1 2 3 ∩ 3 1 4
 
@Adám
1 3
 
@dzaima a couple examples of vectors and scalars
 
woh
 
@Rick Now can you guess the symbol for set union? ;-)
 
9:25 PM
that is really nifty, am I suppose to worry about space or time complexity
or is that not important with language like this
 
@Rick Generally not. We have some really clever people that have optimised the generalisations for everyone's benefit. Every time they make the interpreter better, all existing applications run faster.
 
@Rick for the single-character built-ins you can be pretty sure Dyalog has done a lot to optimize them (sequences of built-ins may be optimized too - I'd assume there's special handling of +/ in Dyalog APL for example)
 
@dzaima Your assumption about +/ is correct :-)
 
I'd assume +.× is special-cased too?
 
ok let's say you have a graph, and you need to detect cycles
 
9:28 PM
@dzaima Yes, and Dyalog's interpreter uses many of the whichever is the current processor's set of vector instructions, and were using more for each version.
@Rick Ah, then it is of extreme importance how you choose to represent your graph.
 
usually, graphs are arrays and their indexes are the pointers
 
@Rick APL doesn't have pointers.
another very important thing about APL - arrays are immutable. A←1 2 3 ⋄ ⎕←A + 1 ⋄ ⎕←A would print 2 3 4\n1 2 3 ( is the statement separator character). Dyalog does reference counting and modifies in-place when possible however so that shouldn't be too much of a concern speed-wise
 
@dzaima pointers=indices to other elements of the same array.
 
correct
 
@Adám yeah, forgot about that :|
 
9:32 PM
@Rick When you get around to it, search for "aaron hsu dyalog apl graphs"
@Rick There is a related notation to f.g which instead of the "inner product" is the "outer product" — only application of a single dyadic function, between all possible pairings of elements from the left and right argument. Since there is no "secondary" function (like + in +.×) fill that "slot" with a "nil": ∘.×
 
would you say apl notations is better than Mathematical notation? Can it better describe the problem, in a more consise way
 
@Rick Very often.
Here is a multiplication table:
⎕←1 2 3 ∘.× 1 2 3 4
 
@Adám
1 2 3  4
2 4 6  8
3 6 9 12
 
@Rick Often, TMN can't express a concept or an algorithm at all, and you have to resort to human-language.
 
I know, that's incentive enough for me to learn it. If it is concise enough it's a better notation that works
how about if you need a varable
 
9:39 PM
@Rick varName ← value
 
@Rick just as an aside since you mentioned graphs, I find "dfns" (kind of like Dyalog's standard library) to have lots of interesting functions: dfns.dyalog.com/n_scc.htm
 
@Rick You already saw how I "assigned" to the console. Same thing, but with a name.
 
I have learned a bit from looking at the source and following along
 
⎕← nums∘.×nums←1 2 3
 
@Adám
1 2 3
2 4 6
3 6 9
 
9:40 PM
APL often has a single symbol for a fundamental thought concept that only with much effort (if at all) can be described in TMN. How do you for example write the first 10 indices? APL uses the Greek letter corresponding to "i" (for indices), "⍳":
⎕←⍳10
 
@Adám
1 2 3 4 5 6 7 8 9 10
 
who uses APL
 
@Rick Financial institutions, researchers, factories, simulators, …
@Rick Can I show you a couple of more functions?
 
yeah
 
@Rick We looked at intersection. Set difference is ~:
⎕←1 3 2 4~3 4
 
9:46 PM
@Adám
1 2
 
you can read that as "but not". The monadic function ~ is just "not":
⎕←~1 0 1
 
@Adám
0 1 0
 
what is that
 
@Rick logical negation, "NOT". Remember that True and False are 1 and 0.
 
~ is negation
i'm use to !
but that's factor
in APL
 
9:49 PM
@Rick That's abuse of the factorial symbol!
@Rick ~ is one of the two traditional symbols for logical negation in formal logic. (The other is ¬)
 
so ~ is the negation. ~ is usually bit inversion
 
@Rick That's the same thing, just not implicitly representing in binary first.
 
makes sense.
 
0 and 1 are just bits. In fact, APL internally represents arrays that are intirely made of 0s and 1s as packed bit Booleans, leading to huge speed-ups and memory savings compared the common 1-byte-per-bit representation.
Simple APL can actually beat carefully hand-crafted C in certain such applications.
@Rick OK, lets do one last function, dyadic which is "drop". a↓b simply drops a cells from b:
⎕←2↓3 1 4 1 5
 
@Rick sadly C (which AFAIK introduced ! as not) was created after APL
 
9:56 PM
@Adám
4 1 5
 
@Rick Now we have enough to write an (inefficient) formula for prime numbers. Do you see how?
 
hold on
2 3 drops the first index
 
@Rick No, 2 is the left argument to and 3 1 4 1 5 is the right argument. It drops the first two of the list.
⎕←2↓(3 1 4 1 5)
 
@Adám
4 1 5
 
Ok that makes more sense
 
03:00 - 22:0022:00 - 23:00

« first day (804 days earlier)      last day (1849 days later) »