« first day (967 days earlier)      last day (1677 days later) » 
03:00 - 22:0022:00 - 00:00

10:00 PM
@MilkyWay90 Makes sense?
 
what do you mean by monadic fold?
like +/3 would be 3+3?
 
@MilkyWay90 That the derived function is a monadic function. And what / does is to make a folding function of its operand.
No, +/3 1 4 is 3+1+4
 
Ohh
okay
 
¨ is a monadic operator that takes its operand and makes it into a mapping function. We call ¨ each.
 
So to sum integers from 1 to 100, you would do this:
⍞←+/⍳100
 
10:02 PM
@MilkyWay90 5050
 
⎕←{⍵ ⍵}3 ⋄ ⎕←{⍵ ⍵}¨3 1 4
 
@Adám
3 3
┌───┬───┬───┐
│3 3│1 1│4 4│
└───┴───┴───┘
 
Okay
I think I get it
 
⎕←{((0 = 15 5 3 | ⍵) ⍳ 1) ⊃ 'FizzBuzz' 'Buzz' 'Fizz' ⍵}¨⍳20
 
@Adám
┌─┬─┬────┬─┬────┬────┬─┬─┬────┬────┬──┬────┬──┬──┬────────┬──┬──┬────┬──┬────┐
│1│2│Fizz│4│Buzz│Fizz│7│8│Fizz│Buzz│11│Fizz│13│14│FizzBuzz│16│17│Fizz│19│Buzz│
└─┴─┴────┴─┴────┴────┴─┴─┴────┴────┴──┴────┴──┴──┴────────┴──┴──┴────┴──┴────┘
 
10:04 PM
ninja'ed
 
Sorry. I should have let you have the pleasure.
 
⋄ D←{((0 = 15 5 3 | ⍵) ⍳ 1) ⊃ 'FizzBuzz' 'Buzz' 'Fizz' ⍵} ⋄ ⎕← D¨⍳100
 
 
oh whoops
 
And the close brace is in the wrong spot again.
And you're back to post-fix . Copy-paste much?
 
10:05 PM
⋄ D←{((0 = 15 5 3 | ⍵) ⍳ 1) ⊃ 'FizzBuzz' 'Buzz' 'Fizz' ⍵} ⋄ ⎕← D¨⍳100
 
@MilkyWay90
┌─┬─┬────┬─┬────┬────┬─┬─┬────┬────┬──┬────┬──┬──┬────────┬──┬──┬────┬──┬────┬────┬──┬──┬────┬────┬──┬────┬──┬──┬────────┬──┬──┬────┬──┬────┬────┬──┬──┬────┬────┬──┬────┬──┬──┬────────┬──┬──┬────┬──┬────┬────┬──┬──┬────┬────┬──┬────┬──┬──┬────────┬──┬──┬────┬──┬────┬────┬──┬──┬────┬────┬──┬────┬──┬──┬────────┬──┬──┬────┬──┬────┬────┬──┬──┬────┬────┬──┬────┬──┬──┬────────┬──┬──┬────┬──┬────┬────┬──┬──┬────┬────┐
│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│31│32│Fizz│34│Buzz│Fizz│37│38│Fizz│Buzz│41│Fizz│
 
Copy-pasted the wrong program, whoops
 
That looks good.
 
Wow, I've learned a whole lot in one day
 
Yes, APL is very easy to learn. Up for more or have you had enough for today?
 
10:07 PM
up for more
 
How about writing a function that tells me whether its argument is a prime or not?
 
ok
pco?
 
You actually know enough to do so already. Do you want to try by yourself, or do you want guidance?
@MilkyWay90 pco? You're cheating?
 
@Adám Wait, that's cheating?
ok, I'll try without pco
 
Yeah, try just using the things you've learned here. Do you know what a prime is?
 
10:09 PM
yes, why not
 
Tell me.
 
A number that is divisible by only one and that number
 
Right. What does "is divisible by" mean?
 
if the remainder of that number is 0
 
Right. So you'd have to check divisibility of the target number and all numbers (until that number).
 
10:11 PM
yes
 
And then you need to check if only two numbers divide it. I.e. 1 and that number itself.
 
mhm
 
Go for it. What would the first step look like in APL, given N?
@adelidris Hi. Long time no see. How goes it?
 
probably ⍳N
 
@MilkyWay90 Right, that gives us "all the numbers until that number". Now what?
 
10:13 PM
then a list of 0=⍳N|100
unless the 100 and ⍳N are switched
 
Right, but don't forget your parens.
 
Well, 100 would be N, no?
 
why?
 
Because you are checking if N can be divided by all the numbers until N, no?
 
10:15 PM
0=100|⍳N
 
Where did 100 come from?
 
I think I just had a "brainfart"
0=⍳N|N
 
@MilkyWay90 That's almost right, but you do mean 0=(⍳N)|N, no?
 
Oh yeah
0=(⍳N)|N
 
OK, this gives us a Boolean list indicating which numbers divide N evenly. Now what?
 
10:17 PM
and then
we need to count all 1s
 
@MilkyWay90 Right. How might we accomplish that?
 
hmm
 
Remember, Booleans are just numbers (0 and 1) in APL.
 
oh yeah sum it
and see if it's equal to 2
 
You got it! Write it out, please.
 
10:20 PM
2=+/0=(⍳N)|N
As a function:
D←{2=+/0=(⍳⍵)|⍵}
 
Spot on.
 
yay
Hmm
I'll try seeing if I can solve a simple PPCG challenge
81
Q: Print a 10 by 10 grid of asterisks

Leaky NunBackground This is a standard textbook example to demonstrate for loops. This is one of the first programs I learnt when I started learning programming ~10 years ago. Task You are to print this exact text: ********** ********** ********** ********** ********** ********** ********** *********...

 
@MilkyWay90 For that, you need to know more about APL's array model, and another function too.
 
oh okay
 
@MilkyWay90 I suggest you look at the chat lessons.
 
10:25 PM
I'll learn more before attempting a challenge
 
@MilkyWay90 This one is easy (and already solved in APL, so don't peek):
18
Q: Parallel resistance in electric circuits

Stewie GriffinIntroduction: Two resistors, R1 and R2, in parallel (denoted R1 || R2) have a combined resistance Rp given as: $$R_{P_2} = \frac{R_1\cdot R_2}{R_1+R_2}$$ or as suggested in comments: $$R_{P_2} = \frac{1}{\frac{1}{R_1} + \frac{1}{R_2}}$$ Three resistors, R1, R2 and R3 in parallel (R1 || R2 ||...

You know all you need.
 
okay
@Adám Are anonymous functions allowed?
 
sure
 
wait nvm, they are allowed by default
Ok, I found a solution
{÷+/÷⍵}
 
That's it.
 
10:34 PM
Was just a few bytes more than the other answer:
÷1⊥÷
4 vs 7 bytes
 
Yes, and that answer uses a couple of more advanced golfing tricks.
 
11:09 PM
⎕←2=+/0=(⍳|⊢) 7
 
@TessellatingHeckler
1
 
a train version, I think
 
@TessellatingHeckler Almost, but 0=+/ is problematic. However, it s safe to use 1⊥ instead of +/
2=1⊥0=⍳|⊢ is indeed a train.
Alternatively, you can combine +/ with =: 2=0+.=⍳|⊢
@TessellatingHeckler This latter version is the one used on APLcart.
 
@Adám I wasn't thinking the whole thing to be a train, only the (⍳|⊢) part "a version with a train"; is that what you mean by 0= being problematic in describing the whole thing as a train? Or what else might it cause as a problem?
⎕←0=(⍳|⊢) 7
 
@TessellatingHeckler
1 0 0 0 0 0 1
 
11:21 PM
that's a binary number for 65
⎕←1⊥0=(⍳|⊢) 7
 
@TessellatingHeckler
2
 
03:00 - 22:0022:00 - 00:00

« first day (967 days earlier)      last day (1677 days later) »