« first day (630 days earlier)      last day (2032 days later) » 

12:19 AM
I'm stuck and don't know what to do next
 
@nathanrogers What are you working on?
 
nothing. I don't know what to do
 
@nathanrogers I mean, what are your goals? What do you want to do?
 
I want to become fluent in APL. I've glimpsed it's amazing-ness, but I don't know what I should be doing to keep learning
 
I find an useful method is to start with something that you would like to understand, and then start trying to figure it out. Whenever something doesn't make sense, go down the rabbit hole to learn about it until it does make sense, and then repeat that process until eventually you have learned enough to understand what you had hoped to understand in the beginning.
You work a day job in tech, right? Maybe you could look at some of what you do there and play around with rewriting it.
 
12:24 AM
so like the sudoku solver, and life videos on youtube, I follow them, and understand the solutions, but what I don't understand is how to solve problems
 
So, could you teach someone each of those examples?
If you understand them to that level, then I'm assuming that you would consider yourself to have already memorized most of the APL symbol set, yes?
While it's not exactly glamorous, I'm of a mind that memorizing the APL function set is a good thing to do.
The less you have to reference documentation for the core of the language, the better.
 
i am to the point where I remember most shortcuts
the quads I don't really know well
and the tilde and ors
 
But you can touch type the core symbol set and tell me what each of the symbols does, right?
 
the stuff that I'm doing at work is all web services, and database interaction
there isn' tmuch to replicate
yes
 
Have you watched the Dyalog Webinars on web servers and databases?
 
12:26 AM
no
but that isn't why I'm learning apl
 
When I learnt Haskell. I used project Euler. This was good because I was very interested in solving maths problems at the time. I have had a similar problem to you with mastering APL. Ideally you would have some problems that you want to solve. Rather than seeking problems just for the sake of using APL. Although I don't think that is always possible
 
Okay, fair enough.
 
i get stumped on so many euler problems that I get frustrated
because I don't know if its apl or the math that I'm struggling with
 
If you're getting stumped writing software, it might be worth it to take a break and spend some time reading software.
The real trick to APL is exposure and spending time seeing solutions.
 
it isn't that, just that I don't know what to solve or where to find nice academic problems to solve. for example, the snakes and ladders game was a great toy problem
 
12:27 AM
What was wrong with the APL Idiom Lists that were posted the other day?
I'll be back in a bit.
 
the quintessential OOP problem is a small console game that implements entities and combat/item actions using inheritence. I can do that in most languages that have OOP
but APL, that doesn't seem to be a problem which would really leverage APL's strengths
 
You could take a look at the previous Student competition problems
 
My recommendation at the moment would be for you to go through the APL idiom list at random and study each one in turn until you really understand them and see what they are doing, and how they map a given problem to APL, and how that mapping differs from how you might do it in another language.
The student competition problems would also be a great start.
Or reading through the dfns.dyalog.com code base.
Writing a nethack game in APL would be a good exercise.
 
what is nethack?
 
rouge-like
 
12:30 AM
Text-based rogue-like dungeon crawler game.
Or you could write your own text-based Mario side-scroller.
Or study any number of other problems as found in any of the classic texts I mentioned the other day.
 
12:41 AM
@nathanrogers One thing you might want to also keep in mind is that APL doesn't really have "toy problems."
At least not in the same sense as other languages.
 
the problem is the toy
 
That is an assertion of mine at least.
 
not that apl is a toy
 
Right, but what I mean is that most "toy problems" in other languages are neat, small units or pieces of what might be an entire program.
Because APL is so dense and has so much going on in a single character, those same toy problems become rather uninteresting quickly.
There's only so many times you can type a single APL character to solve your toy problem before it begins to get old.
An APL one liner is rather more powerful, and so even if you focus on just playing with one liners, you are encompassing a massive range of possible problems.
And to get anything visually interesting in APL, you have to solve something closer to a "real problem" that people have actually considered valuable at one point or another.
The problem, of course, with real problems, is that to solve them you often need real knowledge about that problem.
The benefit of toy problems is that they are trivially easy to understand.
I think mathematically speaking, traditional APL one liners I think are in the same power class as the primitive recursive functions.
I might be mis-remembering the exact details of that, though.
So, like learning to say anything meaningful in a natural language, the best teacher is reading what others have written and studying how they wrote it. Then eventually you'll learn the patterns that allow you to do the same thing.
And then just spend time working on doing things that you enjoy.
Surely there are problems that you wish you could do or that you find fun to solve?
 
well that snakes and ladders was sort of a first glimpse to me into vector solutions to problems
 
12:49 AM
One-liners are an extremely satisfying part of any language
 
I've solved a number of euler problems, and someof the 99 lisp problems
not the tree problems because I haven't gotten a chance to read into that book yet
 
If you haven't done so already, you might give image manipulation a try.
 
The Dyalog APL REPL supports copy and paste of images (@Adám) that I learned about recently, and that will let you do some cool things to play around with images.
 
12:52 AM
If you want, you can also try my set of workshop problems, which I have linked to previously.
 
taken from this video I came up with my own solution which was shorter than either APL solution, because I wondered why they didn't simply apply turns at once for any number of players
I had an epiphany when I saw the solution as a vector instead of iterations
left argument to game is the board size, and right argument is number of players
it'd probably be interesting to generate random snakes and ladders but the problem is already solved for the most part
 
If you liked that sort of thing, you could also play around with doing maze/pathfinding.
 
Generating a maze can be a fun problem
 
1:21 AM
how do I use @ for a matrix?
i'm trying (1@⊂3 3) 10 10⍴0 to place 1 at the 3rd column 3rd row
 
@ thinks that is it's operand. You need some extra parentheses
 
that worked
if I have a vector of pairs
mat {(1@⍵) ⍺}¨list
idk
 
Oi, Each and Function Abstraction strike again.
⎕←1@(3+⍳4 4)⊢10 10⍴⍳100⊣⎕IO←0
 
@arcfide
 0  1  2  3  4  5  6  7  8  9
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32  1  1  1  1 37 38 39
40 41 42  1  1  1  1 47 48 49
50 51 52  1  1  1  1 57 58 59
60 61 62  1  1  1  1 67 68 69
70 71 72 73 74 75 76 77 78 79
80 81 82 83 84 85 86 87 88 89
90 91 92 93 94 95 96 97 98 99
 
@nathanrogers ^^^
 
1:30 AM
its difficult to know when a argument can be a list or must be "eachified"
like |
 
?
 
3 5 | ⍳10
 
It's clearly documented.
 
must be {3 5|⍵}¨⍳10
 
Um...
Huh?
 
1:31 AM
or 3 5 ∘.| ⍳10
 
What are you trying to get?
In the above.
 
the mod of 3 and 5 for all numbers to the right
 
Have you studied scalar extension and Scalar Primitives vs. Structural primitives in the documentation?
 
I know that there are those, but I don't have them all memorized, particularly when the functions are overloaded
 
I thought you said you already had the primitives and their definitions more or less memorized?
 
1:33 AM
yes
more or less, meaning there are gaps
I don't havent often had a need for @ thus far
and with | I would have had mulltiple instances where I would like to know the modulous for a list of numbers in the right argument
but then it must be outer producted or eachified
 
Right, but @ is an operator that is, in the documentation, defined by Reach Indexing, the rules of which are clearly definited in help.dyalog.com/17.0/Content/Language/Primitive%20Operators/…
Well, you know that | is a scalar primitive, so then that tells you everything you need to know about how to use it in those cases.
All scalar primitives behave in the same way.
And part of memorizing the primitives should include at the very least which are scalar.
 
it may be clearly documented, but I'm not as fluid with APL documentation as I am with say microsoft documentation. since it doens't readily appear in searching
 
Searching?
 
I am not very comfortable finding documentation for APL
 
You mean, typing things into Google?
How are you trying to look things up?
I'm going to assume that you're searching using Google. In that case, please, stop it. :-)
Rule #1 of APL Documentation searching is to stop searching and start doing things by traditional referencing.
Among the most useful are:
And the "Language Reference Guide" at help.dyalog.com.
You'll basically want to memorize the tables on these pages:
You'll improve your quality of life a lot if you just go straight to the source for documentation rather than attempting to search generally.
@nathanrogers You should also probably just get this Eachification out of your head entirely. As well as Lists. You're using Arrays now. And in APL, it's the rare exception, rather than the rule, that anything works over only small, unit-level array values. If its a primitive, then chances are very, very good that the array arguments are meant to be of wide ranges of rank and shape.
Thus, it becomes only a matter of choosing the right "whole array" pattern, rather than every going down to the "element at a time" level.
The default array pattern across most things (scalar primitives) is point-wise. Operators are there specifically to handle more complex traversal patterns.
Most of the Mixed functions are also point-wise in some way or another.
They just don't have the same strict conformability requirements as scalars, and are more specific to their function.
A study over the operators, tables of primitives, and so forth should make the patterns clear.
 
 
4 hours later…
6:00 AM
But one has to see too that goto are the primitive of CPU, how all loop is done in the low level, and I think how we see the code (if one not want lost each operation in the little array) I like instead micro operations without them one lost data control... for the remain computer has to follow the way of think of human if it is a success as mathematical and programming tool and (as reduce function ) filter can be something to use...
 
6:25 AM
Ok I can think wrong etc
I like imperative programming style I not see how enclose one type it return that type enclosed..
Not enclosed
Better "if I write the instruction of enclose and sys not enclose because it is one scalar or something as that"
 
6:59 AM
@RosLuP sure, gotos are built in CPUs, but they are extremely slow too, as they require everything until them to be finished before they can execute (modern CPUs otherwise can do addition, multiplication, division, multiple memory loads & stores and other instructions in paralell on a single core, and gotos break that all). And those very fast vector instructions that good written APL calls are built in CPUs too, and they don't stall the cpu.
 
 
2 hours later…
8:29 AM
@RosLuP OK, that 5 ≡ ⊂5 has nothing to do with the above discussion. It was a design decision when stranding was introduced so that a b ≡ (⊂a),(⊂b) even when a and b are simple scalars. J doesn't have stranding, and didn't need to make this concession.
 
 
3 hours later…
11:04 AM
"o" here is a function that show the type of output [o←⎕fmt];
If i have one array a,
a←,¨ 1 2 3
o a
┌3─────────────┐
│┌1─┐ ┌1─┐ ┌1─┐│
││ 1│ │ 2│ │ 3││
│└~─┘ └~─┘ └~─┘2
└∊─────────────┘
and i have the element b
b←1
o b
1
~
i shouold build one array that show to be as
o ,¨ 1 1 2 3
┌4──────────────────┐
│┌1─┐ ┌1─┐ ┌1─┐ ┌1─┐│
││ 1│ │ 1│ │ 2│ │ 3││
│└~─┘ └~─┘ └~─┘ └~─┘2
└∊──────────────────┘
these below did not show the right list
o b,a
┌4───────────────┐
│ ┌1─┐ ┌1─┐ ┌1─┐│
│1 │ 1│ │ 2│ │ 3││
│~ └~─┘ └~─┘ └~─┘2
 
@RosLuP You can post multiple messages and press Ctrl+K to monospace the code parts. This is almost unreadable.
 
Does (⊂,b),a do what you want?
 
@RosLuP ^ or ,¨b,a
⎕←a←,¨1 2 3 ⋄ ⎕←b←1 ⋄ ⎕←(⊂,b),a ⋄ ⎕←,¨b,a
 
@Adám
┌─┬─┬─┐
│1│2│3│
└─┴─┴─┘
1
┌─┬─┬─┬─┐
│1│1│2│3│
└─┴─┴─┴─┘
┌─┬─┬─┬─┐
│1│1│2│3│
└─┴─┴─┴─┘
 
11:30 AM
I checked both ⎕←(⊂,b),a ⋄ ⎕←,¨b,a seem ok, thank you
 
11:45 AM
@arcfide how does apl take single-char input?
 
@Cowsquack As a keypress or followed by Enter?
 
keypress without enter
such that the game screen updates after each keypress
 
@Cowsquack On Windows, you can assign a callback function to the KeyPress event. On all platforms you can use HTML/JS.
 
oh, windows only
 
You may also be able to use some C library with ⎕na
 
11:50 AM
for either way, does it require graphics or could you have the program/game purely text-based?
 
You can animate text by modifying a variable open in the editor. I think ride might also be quick enough to print a full screen of text at each update
 
@Cowsquack For the Windows method, you don't need to display anything, but I'm not sure if the system needs to be graphics capable. CEF needs graphics capability, obviously.
 
CEF?
 
@Cowsquack Chromium Embedded Framework (Dyalog's HTMLRenderer)
@Cowsquack You can use ⎕SM/⎕SR if you want a pure text-based, but interactive, frontend.
 
12:06 PM
@Adám thanks I will look into that
 
 
2 hours later…
2:35 PM
@arcfide how would you solve fizz buzz without each or outer prod? It would seem to me that either one would have to be element by element.
I saw the replication approach from the jugalbandi, but my point is at some point you have to perform scalar operations, and then you'll have to do more than 1 scalar operations where the sides don't match
 
@nathanrogers You do need outer product, but it is is because the task is essentially two (actually three) fold. Alternatively, you could put in the 3s, the 5s, and the 15th separately.
 
3:03 PM
@nathanrogers How do you like this one:
⍞←⊃{In←(⍸0=|∘⍵){⍺[1]@(⍺⍺ ⍺[2])⊢⍵}/('FizzBuzz' 15)('Buzz' 5)('Fizz' 3)⍵}⍳30
 
@Adám 1 2  Fizz  4  Buzz  Fizz  7 8  Fizz  Buzz  11  Fizz  13 14  FizzBuzz  16 17  Fizz  19  Buzz  Fizz  22 23  Fizz  Buzz  26  Fizz  28 29  FizzBuzz
 
3:59 PM
@nathanrogers why do you ban outer prod?
 
@Cowsquack Because it goes element-by-element, implying scalar operations which he wants to avoid, as per arcfide.
 
4:12 PM
I am reading over arcfide's messages, where he mentioned "the use of Each, enforces element at a time execution", does 5 + vec not do that?
 
4:36 PM
oh, @Adám already answered
 
4:49 PM
⎕←3 5∘.|⍳10
 
@Cowsquack
1 2 0 1 2 0 1 2 0 1
1 2 3 4 0 1 2 3 4 0
 
⎕←3 5|⍤0 1⊢⍳10
bot slow?
 
@Cowsquack My question was one about the nature of APL, not about how to solve the problem. @arcfide mentioned "You're using Arrays now. And in APL, it's the rare exception, rather than the rule, that anything works over only small, unit-level array values. If its a primitive, then chances are very, very good that the array arguments are meant to be of wide ranges of rank and shape." and since we were discussing not using each or cross product, I was wondering how to solve this type of problem
where there is more than 1 scalar operation needing to be performed with list application instead?
 
both of the above snippets return the same result, but work differently, if I understand correctly, the second one applies 3| and 5| separately to ⍳10, would you consider |⍤0 1 to be un apl-like?
 
I wouldn't consider it anything, I'm asking @arcfide how he would solve a problem with multiple scalar operations. the discussion accross the last few days has been about the overuse of each for vector problems.
I'm not taking a position, I'm trying to learn what is meant and how to solve problems using more vector and array-like patterns
data, as opposed to control-flow according to @arcfide on youtube
 
4:58 PM
oh you were asking arcfide, I guess then I will wait till he enters
 
I must be really bad with my words today, I wasn't meaning to shut anyone up, and only ask for his advice. but pretty much all of your repsponses were "why do you.." "would you consider..." and I'm just trying to say, I don't have an opinion on the matter because I'm a novice. I was responding to his statements, not trying to stifle the conversation.
@Cowsquack I don't know this from that, I'm trying to learn. I know the name of all but the quad functions, I know dyadic and monadic for most, and sometimes only one, but I don't know how to solve problems with APL, and I'm trying to learn. \
I don't know why one would choose one method vs another. i chose an example that I used each for to understand another means of solving without iteration
 
with my last message, I meant that I understood your position, and since you were asking for arcfide's opinion, of which I had some questions, I learnt that I had to direct my questions at him and not towards you
if that clears anything up
@nathanrogers personally I found answering/attempting to answer code golf questions and discussing them over here to be most helpful
 
5:28 PM
⎕←0=3 5{((⍴⍵)/↓⍺)|⍵}⍳20
 
@nathanrogers The bot doesn't pick up edits.
@Cowsquack It has a temper at times, if you ask too much of it.
 
⎕←{0<≢a←(4/0=3 5|⍵)/'fizzbuzz':a⋄⍵ }¨⍳20
 
@nathanrogers
┌─┬─┬────┬─┬────┬────┬─┬─┬────┬────┬──┬────┬──┬──┬────────┬──┬──┬────┬──┬────┐
│1│2│fizz│4│buzz│fizz│7│8│fizz│buzz│11│fizz│13│14│fizzbuzz│16│17│fizz│19│buzz│
└─┴─┴────┴─┴────┴────┴─┴─┴────┴────┴──┴────┴──┴──┴────────┴──┴──┴────┴──┴────┘
 
5:47 PM
⍞←{⎕IO←0 ⋄ s←2⊥0=5 3∘.|⍵ ⋄ b←0=s ⋄ (b/⍵)@{b}0 'Fizz' 'Buzz' 'FizzBuzz'[s]}⍳30
 
@Adám 1 2  Fizz  4  Buzz  Fizz  7 8  Fizz  Buzz  11  Fizz  13 14  FizzBuzz  16 17  Fizz  19  Buzz  Fizz  22 23  Fizz  Buzz  26  Fizz  28 29  FizzBuzz
 
yeah, I'm done. I can't figure how to use any of the tricks that I've come up with to solve this without some form of iteration. and the awesome solution adam came up with, I don't understand @
@ is a really weird operator and I get it 1 second, and don't the next
 
@nathanrogers Let me explain it to you, it is not really complicated! But first:
⍞←(⊣/,⍤0 1∘'Fizz' 'Buzz' 'FizzBuzz'⌽⍨2⊥0=5 3∘.|⊢)⍳30
 
@Adám 1 2  Fizz  4  Buzz  Fizz  7 8  Fizz  Buzz  11  Fizz  13 14  FizzBuzz  16 17  Fizz  19  Buzz  Fizz  22 23  Fizz  Buzz  26  Fizz  28 29  FizzBuzz
 
⍞←0=3 5{((⍴⍵)/↓⍺)|⍵}⍳20
if I could figure out how to take this and turn it into this
 
5:57 PM
@nathanrogers VALUE ERROR
 
⎕←0=3 5{((⍴⍵)/↓⍺)|⍵}⍳20
 
@nathanrogers
┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
│0 0│0 0│1 0│0 0│0 1│1 0│0 0│0 0│1 0│0 1│0 0│1 0│0 0│0 0│1 1│0 0│0 0│1 0│0 0│0 1│
└───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘
 
⎕←0=3 5∘.|⍳20
 
@nathanrogers
0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0
0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
 
and turn it into that
then we'd have a solution without scalarwise operations
 
5:58 PM
@nathanrogers ⍉↑?
 
@nathanrogers No, you've just obscured the "scalarwise" operation.
 
I don't follow
1 2 3 + 3 3 3 is a vector function
 
@nathanrogers The here is just a strange way to write , so you're creating a 3 5 vector for each (note "each"!) right argument scalar.
@nathanrogers (⍴⍵)/↓⍺ is exactly the same as ⍺∘⊣¨⍵
 
so then what are we even talking about
 
@nathanrogers Dunno. Which "awesome" @ solution did you not understand? {⊃(⍸0=|∘⍵){⍺[1]@(⍺⍺ ⍺[2])⊢⍵}/('FizzBuzz' 15)('Buzz' 5)('Fizz' 3)⍵} or {⎕IO←0 ⋄ s←2⊥0=5 3∘.|⍵ ⋄ b←0=s ⋄ (b/⍵)@{b}0 'Fizz' 'Buzz' 'FizzBuzz'[s]}?
 
6:04 PM
either
I get lost @@
in both
 
@nathanrogers OK, I have 10 mins. Let's see what I can get through. Last one first.
 
I was attempting to find some way of applying an even length vector to the residue of range, since even length vectors can have scalar functions applied to them
but then there's an each in / ?
if I reshape the list (3 5) to the shape of 2 1, I can replicate, but then I have to apply each list... so what are we talking about if we have to each at some point anyway@arcfide
 
@nathanrogers OK?
 
6:35 PM
thanks for that explanation
 
 
2 hours later…
8:26 PM
@nathanrogers OK?
@nathanrogers To avoid ReplaceIn using DivisibleBy as global, we pass it as operand: Try it online!
 
 
2 hours later…
10:19 PM
man, I am getting really frustrated
4 2 reshape of some list
I want a list of boxes of 2
I guess split works
 
⎕←↓4 2⍴⎕A
 
@Adám
┌──┬──┬──┬──┐
│AB│CD│EF│GH│
└──┴──┴──┴──┘
 
@nathanrogers What seems to be the problem?
⎕←(8⍴1 0)⊂8↑⎕A
 
@Adám
┌──┬──┬──┬──┐
│AB│CD│EF│GH│
└──┴──┴──┴──┘
 
⎕←(⊢⊂⍨1 0⍴⍨≢)⎕A
 
10:24 PM
@Adám
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐
│AB│CD│EF│GH│IJ│KL│MN│OP│QR│ST│UV│WX│YZ│
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘
 
⎕←((≠\=⍨)⊂⊢)⎕A
 
@Adám
┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐
│AB│CD│EF│GH│IJ│KL│MN│OP│QR│ST│UV│WX│YZ│
└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘
 
that all the ways that came to me to box rows in a table weren't working
 
@nathanrogers Wait, you already had a table, and just wanted a list of rows?
 
like ⊂/ ⊂¨ 2⊂/
yes I had a 4 2 rho of ns
 
10:26 PM
@nathanrogers So literally just ? Btw, ,/ works as well, and ,⌿ gives you a list of columns.
 
thanks
 
A more general solution is ⊂⍤1
You can also use with an axis. ⊂[1] enclose along the first axis (i.e. enclose the rows) and ⊂[2] enclose along the second axis (the columns), etc.
 

« first day (630 days earlier)      last day (2032 days later) »