« first day (1783 days earlier)      last day (1168 days later) » 
00:00 - 18:0018:00 - 00:00

18:00
@Fmbalbuena So, you remember what I told you about monadic and dyadic functions?
@Adám yes but what does this do?
I thought the question was other way around? Filter out aka get rid of
@Fmbalbuena So, if you put on the immediate right of a dyadic function, you get a monadic function that uses the same single argument as both arguments. E.g. +⍨10 gives 20 and ×⍨10 gives 100
@FawnLocke Indeed, could be read either way!
oh <code>⍨<code2> ¡s <code><code2><code>?
18:02
No, not exactly, because every APL function takes as right argument, everything to its right.
but why? what is
Ah, so is a new type of thing you've not seen before. We call it a monadic operator.
Operators are "higher-order" functions. I like to think of them as "function factories".
They take one (in this case) or two parameters we call operands, and create a new derived function.
E.g. can take + and creates the "double" function.
can take × and creates the "square" function.
Btw, you can also use the derived function dyadically. In that case, F⍨ derives a new function which is exactly like the dyadic function F except it takes the arguments in swapped order.
@Adám remove
18:07
So, e.g. 2-⍨10 is 8 because -⍨ is like - with swapped arguments.
So, we can write (2×⍳10)-1 as 1-⍨2×⍳10
⋄F←×5+⋄⍨F8
@Fmbalbuena
SYNTAX ERROR
      F←×5+ ⋄ ⍨F8
          ∧
@Fmbalbuena Hold on, you want just F←× no?
@Adám i want F be "* 5 +".
OK, but then you need how learn how to write a lambda: F←{⍺×5+⍵}
and are the names of the left and right arguments, and the braces mark the function.
18:09
⋄F←{⍺×5+⍵}⋄F⍨8
@Fmbalbuena 104
@Fmbalbuena You need in the spot(s) where you want the left argument inserted.
And in the spot(s) where you want the right argument inserted.
Also, it is F⍨ not ⍨F
Very nice.
@Adám [?] [⍺] [Function] [⍵] [?] is there a way?
18:12
I don't know what you're asking.
But considering this new info, what would be the shortest way to generate all squares from 1 to 100?
the left argument of ⍺? and right of ⍵?
Yes. You omit if you're writing a monadic function.
???
wdym?
Monadic functions only take a right argument. is the name of the left argument. Monadic functions don't use a left argument.
Oh but is there a way?
18:18
@Fmbalbuena Is there a way to do what?
What is APL Campfire?
how to get the variable X using function F with this simple code X 1 F 1 2
@Adám but what is APL campfire? show short example.
@Fmbalbuena There are no short examples. Each one is at least an hour long.
@Fmbalbuena F←{⊃⍺}
⋄F←{⊃⍺×⍺×⍵}⋄⎕←2 3 F 5
18:23
@Fmbalbuena 20
is just another (monadic) function you've not learned about yet. It is called "First".
⎕←2×3×5
@Fmbalbuena 30
why not working?
Because every APL function takes as right argument, everything to its right.
18:24
@Adám for fm's example is that first(2 3 × 2 3 × 5) which is first(20, 45)? or am I reading the parsing wrong
Correct.
i don't understand
@Fmbalbuena ⊃⍺×⍺×⍵ is ⊃(⍺×⍺×⍵) because the right argument of is everything to its right (as it is for all APL functions).
⋄F←{(⊃⍺)×⍺×⍵}⋄⎕←2 3 F 5
@Fmbalbuena 20 30
18:27
why not working?
What result did you expect?
3 mins ago, by TryAPL
@Fmbalbuena 30
@Adám ^
But is 2 3
oh
⋄F←{(⍺[1])×(⍺[2])×⍵}⋄⎕←2 3 F 5
@Fmbalbuena 30
18:31
Yay
You don't actually need parentheses there.
⋄F←{⍺[1]×⍺[2]×⍵}⋄⎕←2 3 F 5
@Fmbalbuena 30
Also, the function can actually take a left argument which is the element you want. You could see it as have having a default left argument of 1.
⎕←⊃1 2
18:34
@Fmbalbuena 1
@Fmbalbuena You don't actually need parenthesis there.
⋄F←{(⊃⍺)×⍺[2]×⍵}⋄⎕←2 3 F 5
@Fmbalbuena 30
@Fmbalbuena ?
@Adám i guessed i't gets the last element of list.
18:37
Ah, I see.
⋄ ⎕←2 3 {(⊃⍺)×(2⊃⍺)×⍵} 5
@Adám 30
oh
@Adám you don't need ⋄ at the start
@Fmbalbuena True.
⎕←2 3{(⊃⍺)×(2⊃⍺)×⍵}5
@Fmbalbuena 30
18:40
⋄)load Arachnid
@Fmbalbuena Invalid system command
⋄)interpret Malbolge?
@Fmbalbuena Invalid system command
why not working?
Are you serious?
18:41
?
)load Arachnid isn't working because TryAPL is restricted.
understood
@Adám but how i't works
)interpret Malbolge isn't working because APL doesn't have an )interpret command.
⎕←⍟9
@Fmbalbuena 2.197224577
18:46
or better ln(9)
@Fmbalbuena And how would you want to write the 10-logarithm of 9?
@Adám idk
⋄ 10⍟9
@Adám 0.9542425094
So is an ambivalent function with e as default left argument.
18:49
⎕←0⍟9 errors?
@Fmbalbuena
DOMAIN ERROR
      ⎕←0⍟9
       ∧
@Adám is there a way to print STDERR?
⍞← instead of ⎕← (but this doesn't work on TryAPL).
But ⍞← prints without a newline
True, because this allows you to add to a progress report like ........
18:53
i don't understand ⍞← prints without newline or prints to STDERR.
@user15839551 Hi Toanuvo. If you want to participate here, please email [email protected]
@Fmbalbuena Both. It prints to STDERR without newline.
⎕← prints to STDOUT with newline.
@Adám Print to STDOUT without newline?
No simple way to do that.
And why would you anyway?
i need to do for some challenges like this.
@Fmbalbuena Default I/O rules allow STDERR.
18:58
okay but i need for some reason.
I have yet to see a compelling use case.
(It is possible to do arbitrary output, but it is much more involved.)
@Adám is there a way to do?
Yes, it is possible to write to STDOUT without a trailing newline, but it is much more involved, and I think you don't need to learn that right now.
ok
print newline to STDERR?
⍞←⎕UCS 10
19:02
⎕←⎕UCS 33
@Fmbalbuena !
Converts 33 to ASCII char?
Indeed. Unicode, actually, but that's a superset of ASCII.
⎕←⎕UCS 33
@Fmbalbuena !
19:03
Btw, it can also convert characters to their code points in the Universal Character Set: ⎕←⎕UCS '@ABC'
@Adám 64 65 66 67
@Fmbalbuena CMC: Generate all of printable ASCII.
⋄chr←{⎕UCS ⍵}⋄⎕←chr 33
@Fmbalbuena !
@Adám 33-127?
19:05
Yes, or 32− if you want.
@Adám ⎕←⎕UCS 32+⍳95
@Fmbalbuena !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
@Adám correct?
⎕←⎕UCS 127+⍳2000
@Fmbalbuena
€‚ƒ„                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
@Fmbalbuena Pretty much. Most people consider space a printable ASCII char but do not consider DEL as printable.
19:10
@Adám DEL is not printable i know
Well, but 32+95 is 127 which is DEL.
@Adám 128 is DEL
If so, then I'm mistaken.
The delete control character (also called DEL or rubout) is the last character in the ASCII repertoire, with the code 127. It is supposed to do nothing and was designed to erase incorrect characters on paper tape. It is denoted as ^? in caret notation and is U+007F in Unicode. Terminal emulators may produce DEL when ← Backspace key or Control+← Backspace or Control+? are typed. == History == This code was originally used to mark deleted characters on punched tape, since any character could be changed to all ones by punching holes everywhere. If a character was punched erroneously, punching out...
@Adám nope, 128 is Ç
⎕←⎕UCS 32+⍳94
@Fmbalbuena !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
19:14
I'd write 31+⍳95 because Wikipedia says:
> There are 95 printable characters in total.
Jo King says newline is not printable then i guess the whitespace is not printable.
bitwise not?
@Adám ^
:59869283 ?
@Fmbalbuena You'd have to convert to binary, then use ~
@Adám how to convert?
(list)
How many bits do you want in the representation?
@Adám 00110001 00110110
19:22
⋄byte←8⍴2 ⋄ byte⊥~byte⊤5 (8-bit bitwise NOT of 5)
@Wezl-acautionarytale 250
@Fmbalbuena 49 54‽
Anyhow, what Wezl is doing is right for 8-bit representation.
@Fmbalbuena No no, I meant that your answer to my question encodes 49 54, and I didn't understand what you meant by that.
@Adám 16
(Exactly 16 bits)
in ASCII
ASCII is 7 bits, but whatever.
@Fmbalbuena Then you want (16⍴2)⊤n
⋄MODULOCREATEDBYFMBALBUENASOUSETHISLAMBDAFUNCTIONPLZZZ←{⍵|⍺}⋄⎕←93 MODULOCREATEDBYFMBALBUENASOUSETHISLAMBDAFUNCTIONPLZZZ 6
19:25
@Fmbalbuena 3
scalar left arg of encode should extend and return a lazy array :)
@Wezl-acautionarytale ?
@Wezl-acautionarytale Heh. I'd rather it used as many bits as necessary.
maybe if APL didn't enforce rectangular arrays
@Adám do you like this lambda function?
19:28
Also, it'd need to be lazy towards the left!
2 mins ago, by Fmbalbuena
⋄MODULOCREATEDBYFMBALBUENASOUSETHISLAMBDAFUNCTIONPLZZZ←{⍵|⍺}⋄⎕←93 MODULOCREATEDBYFMBALBUENASOUSETHISLAMBDAFUNCTIONPLZZZ 6
@Fmbalbuena 3
@Adám another problem with encode
Are you saying it should have been little-endian?
but yeah that would be pretty impossible to use
19:29
@Fmbalbuena I'm afraid I don't get the joke.
@Adám sure, little-endian with bit-sized bytes
;-)
@Adám because 5 mod 3 returns 2 in Other Programming languages but in APL returns 3
if it's a lazy array, it doesn't matter
lazy arrays can just be functions
@Adám do you understand?
19:31
@Fmbalbuena Yes, but then it isn't a joke, is it? Dyadic | is division remainder when its right argument is divided by its left argument. It isn't mod of mathematics or other programming languages.
And while I agree that having swapped arguments would have been most consistent with ÷, by far most uses need a complex expression as the value(s) being divided, and a single number as divisor, so | is easiest to use the way it is. Otherwise, you'd have to write |⍨ all the time.
CMC: Quine but only if i understand
@Wezl-acautionarytale 1
19:33
not a real quine, but I think you understand it ;)
@Wezl-acautionarytale lol i don't know implicit print.
@Fmbalbuena I just need to teach you two more functions.
@Adám yes teach me
OK, so one is what you just saw Wezl use: Dyadic
It takes a shape on the left and data one the right.
Then it reshapes the data into the given shape.
If there isn't enough data, it recycles the data: ⋄ 5⍴1 2 3 4
@Adám 1 2 3 4 1
19:35
⋄ 10⍴0 1
@Adám 0 1 0 1 0 1 0 1 0 1
⋄ 6⍴'Hello'
@Adám HelloH
i don't understand what is ⍴ understood
If there's too much data, discards the excess: ⋄ 2⍴'Hello'
19:36
@Adám He
⋄2⍴''''
@Fmbalbuena ''
Aha! Now you begin to see how you could construct a quine.
@Wezl-acautionarytale
1 2 3
1 2 3
19:37
We've not learned about multi-dimensional arrays yet, so that result will be strange to you.
join strings?
Dyadic ,
But we don't need that for our quine.
⋄',4⍴',4⍴''''
@Fmbalbuena ,4⍴''''
almost quine
19:40
Indeed.
Let me teach you one more function: Dyadic
what i't does?
It takes a number on the left, and any array on the right, and rotates the left number elements from the beginning to the end.
E.g. ⋄ 1⌽'Hello'
@Adám elloH
⋄ 3⍉⍳10
@Adám
RANK ERROR
      3⍉⍳10
       ∧
19:41
@Adám lol wrong char
Yup.
understood
there's no reason to delete aplbot commands unless it was a mistake or is taking up a lot of unnecessary space
@hyper-neutrino wdym?
@Adám write quine
you ran the rotate command and then deleted it once the result returned; there's no reason to do that
19:45
@Fmbalbuena ⋄ 1⌽22⍴11⍴'''1⌽22⍴11⍴'''
@Adám 1⌽22⍴11⍴'''1⌽22⍴11⍴'''
You should be able to understand this.
is this the shortest apl quine or just a simple one?
@Adám wait
@hyper-neutrino Simple.
19:46
1⌽22⍴11⍴'''1⌽22⍴11⍴'''
1⌽22⍴'''1⌽22⍴11⍴'''''
1⌽'''1⌽22⍴11⍴''''''1⌽22⍴11⍴'''''
'''⍴1⌽22⍴11⍴''''''1⌽22⍴11'''''
out: '⍴1⌽22⍴11⍴'''1⌽22⍴11''
@Adám can you find bugs?
@Fmbalbuena This should be '1⌽22⍴11⍴''''''1⌽22⍴11⍴''''''' because rotates the leading ' to the end.
'1⌽22⍴11⍴''''''1⌽22⍴11⍴'''''''
out: 1⌽22⍴11⍴'''1⌽22⍴11⍴'''
but why this is quine?
Because it is an expression that results in itself.
@Adám ?
A quine is a computer program which takes no input and produces a copy of its own source code as its only output. The standard terms for these programs in the computability theory and computer science literature are "self-replicating programs", "self-reproducing programs", and "self-copying programs". A quine is a fixed point of an execution environment, when the execution environment is viewed as a function transforming programs into their outputs. Quines are possible in any Turing-complete programming language, as a direct consequence of Kleene's recursion theorem. For amusement, programmers...
19:54
i know what is quine but why this prints the source code?
Well, you just went though it step-by-step and found that it does, no?
but how do you got that?
You mean to ask where I got that quine from?
no, explain why?
Because, when evaluated according to the meanings and rules of APL, it returns a text which is identical to itself.
19:58
but i don't understand
'''1⌽,⍨9⍴''' the characters '1⌽,⍨9⍴'
9⍴ reshape to shape 9, resulting in '1⌽,⍨9⍴''
,⍨ concatenate with itself, resulting in '1⌽,⍨9⍴'''1⌽,⍨9⍴''
1⌽ rotate one character to the left, getting the characters: 1⌽,⍨9⍴'''1⌽,⍨9⍴'''
@Fmbalbuena Do you understand why 11⍴'''1⌽22⍴11⍴''' gives '''1⌽22⍴11⍴'''''?
@Adám yes
@Fmbalbuena Do you understand why 22⍴11⍴'''1⌽22⍴11⍴''' gives '''1⌽22⍴11⍴''''''1⌽22⍴11⍴'''''?
(That was to a different question.)
Do you understand why 1⌽22⍴11⍴'''1⌽22⍴11⍴''' gives '1⌽22⍴11⍴''''''1⌽22⍴11⍴'''''''?
why does it rotate two '?
@Adám no
20:01
oh, wait, are you providing the expression that's returned instead of the raw string itself as it would be printed
Yeah.
ah. that makes sense
@Fmbalbuena Do you understand how dyadic works?
yes but why gives?
You removed your answer above, so I'll ask again: Do you understand why 22⍴11⍴'''1⌽22⍴11⍴''' gives '''1⌽22⍴11⍴''''''1⌽22⍴11⍴'''''?
20:03
no
@Fmbalbuena Wait, you didn't understand that?
Note that I'm writing equivalent expressions, not raw strings.
i need understand why 1⌽22⍴11⍴'''1⌽22⍴11⍴''' gives 1⌽22⍴11⍴'''1⌽22⍴11⍴'''.
Yes. Let's do it step-by-step.
So, you understand how 11⍴'''1⌽22⍴11⍴''' and '''1⌽22⍴11⍴''''' are equivalent expressions, i.e. they give the same result?
@Adám yes
but please do step-by-step without asking questions
No problem.
11⍴'''1⌽22⍴11⍴''' → '''1⌽22⍴11⍴''''' which prints as '1⌽22⍴11⍴''
22⍴11⍴'''1⌽22⍴11⍴''' → 22⍴'''1⌽22⍴11⍴''''' → '''1⌽22⍴11⍴''''''1⌽22⍴11⍴''''' which prints as '1⌽22⍴11⍴'''1⌽22⍴11⍴''
1⌽22⍴11⍴'''1⌽22⍴11⍴''' → 1⌽22⍴'''1⌽22⍴11⍴''''' → 1⌽'''1⌽22⍴11⍴''''''1⌽22⍴11⍴''''' → '1⌽22⍴11⍴''''''1⌽22⍴11⍴''''''' which prints as 1⌽22⍴11⍴'''1⌽22⍴11⍴'''
20:10
ok
So you understand now?
 
2 hours later…
22:07
@Adám yes
Great. You should be able to figure understand the shorter quine too now too.
can we define one line function using ?
@Adám ^
Yes. E.g. ⋄ F←{double←2×⍵ ⋄ double,double} ⋄ F 10
@Adám 20 20
Do you want an exercise task?
22:11
but uhh using .
No, that has to use at least two lines.
@Adám yeah but not now.
@Fmbalbuena OK, for when you come back (I have to go soon too): Define a dyadic function To that takes two numbers, the left being smaller or equal to the right, and returns the range. E.g. 3 To 8 should give 3 4 5 6 7 8
22:28
i came up with hover for spoiler but i'm quite dissatisfied with that (10)
do you have a target byte count that would be reasonable for me to aim for?
@hyper-neutrino You should be able to hit 8, while 5 is possible as a tacit function. Still, these solutions are not efficient, and now what I had in mind for Fmbalbuena, as I only planned on them using what I've taught them.
@Adám ah, okay, thanks. i've unfortunately forgotten pretty much all of apl's tacit rules due to never using them so i'm getting it confused with jelly, so i'll take this as a good exercise and try to get it to 5 using tacit
hover gets me somewhat close but it's not quite correct (on top of being too long). not sure if it's the right approach but i have to go for a bit as well
An efficient solution is 14 as a dfn, 12 tacit.
23:33
@Adám Writing in APL unicode
Is that a question?
No, i'm writing a dyadic function To that takes two numbers, the left being smaller or equal to the right, and returns the range. E.g. 3 To 8 should give 3 4 5 6 7 8
OK.
@Adám ⋄F←{(⍺-1)+⍳((⍵-⍺)+1)}⋄⎕←5 F 99
@Fmbalbuena 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 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
23:38
@Fmbalbuena That's almost perfect. Do you think you could get rid of some (not all) parentheses?
Remember that every APL function takes as right argument, everything to its right.
@Adám I'm not thinking about code golf but i will
⋄F←{(⍺-1)+⍳(⍵-⍺)+1}⋄⎕←5 F 99
@Fmbalbuena 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 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
Almost.
@Adám correct?
Yes, but you can get rid of the parenthesis around ⍵-⍺ if you restructure a little.
23:41
lol TryAPL can't edit
Right, it only has 2 mins.
but @TryAPL is stuck? ⎕←'No, I''m not stuck'
@Fmbalbuena Yes, I'm stuck
LOL
Who edited?
⎕←'TryAPL is not stuck'
@Fmbalbuena TryAPL is not stuck
23:47
@Adám can you create weekly and daily CMC? (weekly must be hard)
Sorry, I can't commit to that, especially with a limited vocabulary. Learn a bit more APL, and you can start solving the tasks at problems.tryapl.org
uh
@Adám Print using lambda?
Yes, all of those are possible as 1-liner lambdas (we usually call those "dfns", pronounced "DEE-funs").
You may need to use though.
@Fmbalbuena Oh, no need to print. You'll want to return the result.
@Adám Can you convert lambda:(print("Hello, World!")) to APL?
I'm not sure I understand that code. Does it take an argument?
23:53
It's just {⎕←'Hello, World!'}
or
⋄Print←{⎕←'Hello, World!'}⋄Print
∇f
⎕←'Hello, World!'
∇
@Fmbalbuena
NOT PERMITTED: Illegal token
      Print←{⎕←'Hello, World!'} ⋄ Print
     ^
Heh.
@Bubbler Lambda
23:54
Lambda always takes one or two args, there's no zero-arg lambda
⋄{⎕←'Hello, World!'}
@Fmbalbuena
NOT PERMITTED: Illegal token
      {⎕←'Hello, World!'}
     ^
TryAPL doesn't allow inline printing.
Is ⎕← not allowed in tryapl?
Oh.
@Bubbler Python: I am a joke to you?
23:55
(in some sense) You forget python to learn APL, yes.
@Bubbler i have already learned all python (except some bulitin modules).
00:00 - 18:0018:00 - 00:00

« first day (1783 days earlier)      last day (1168 days later) »