« first day (2109 days earlier)      last day (535 days later) » 

12:56 AM
@Adám Ah! Are these always at the same time? That's 1am for me, so I'll have to make some arrangements to attend :P
 
 
4 hours later…
4:55 AM
@B.Wilson They are at a constant time in the UK. The Tokyo group's meetups might suit you better.
 
 
7 hours later…
12:06 PM
just had a look at our next Quest. Maybe you can raise the bar a little bit as an extra excercise. The solution is even written in the problem description.
@Adám :) :) Had some time left over? Thanks!!!
 
12:31 PM
@Richard Okay - so given two vectors: a simple char vec of single-letter groups and a simple num vec of corresponding orders, our function should take a simple char scalar or vector and return the order total over the specified groups
let me have a think and write a Tradfn header / calling syntax for that
maybe that's 3 vectors then, we need the order counts as well
 
can you give an input and output example so I am sure I undstood you correctly (thanks by the way!!)
 
  g ← 'ABBDCAB'
  n ← ?7⍴5
  p ← .99+?7⍴9
(n p)←⍺ ⍵ ⍝ from the original problem
then new is e.g. BD
I think the result should be 94.85
nevermind random numbers... rerolling
  ⎕RL←42 ⋄ n ← ?7⍴5
  ⎕RL←42 ⋄ p ← .99+?7⍴9
answer 43.93
The syntax for the bonus function is: total ← products OrderTotal (number group price)
where products is a subset of group
BONUS2: left argument is now (products discount) where products is a subset of group and discount is a percentage discount to be applied to the corresponding products before returning the total across the whole order.
 
12:49 PM
:)
 
yeah it's gonna take me a minute to figure that one out too - see you in 10 to discuss solutions
 
argh ofc i have breakfast right when quest starts
 
@Sʨɠɠan how long's that - I might still be around for a couple hours and able to chat
Okay, I hope others here will be able to verify, but my example solution for BONUS2 is:
      ('BD'(10 50))BONUS2 n g p
26.34
 
@RikedyP still figuring out the problem... I'll have to take it with me and will come back for it later. Sorry
 
@Richard Yeah that's no problem - it was only just in case you found my first bonus too easy
FYI my solution is not the most elegant either, I'm sure it can be improved
Welcome to APL Quest 2016-10! Today's quest is Order Total:
> Write a function that takes as its right argument a vector of prices and as its left argument a numeric vector that indicates the number ordered and returns the total cost for the order.
Please put your solutions in chat. Be aware that at @Richard's request there is a bonus problem above - and also BONUS2 which is (quite) a bit more challenging
 
1:02 PM
(+.×)
 
Alright any more takers?
Gold star for @Richard
As you mentioned, the solution is basically in the problem description and problem page title
Does anybody have the alternative which does not use inner produce F.G?
 
you probably can use outer product ∘.× and then sum the diagonal
 
for two vectors, +.× is equivalent to an atop or F ⍺ G ⍵ construct - what is that?
what are F and G in that case?
 
ah yes, G is × and F is +
 
almost
 
1:13 PM
+/
 
yep that's right
So there are two bonuses above people can chew on and we can come back to shortly - but also what if we had a matrix of prices for several products and a matrix of order quantities?
 
f(+/⍤×)g
 
In that case, the parentheses make it a 2-train atop anyway
n(+/×)p OR n+/⍤× p
 
yes, thanks
 
and of course +/n×p
 
1:16 PM
@RikedyP ravel the matrices first
⍥,
 
if you set up the shapes correctly you shouldn't need to I think
 
yes, so then +/ +/ will suffice
 
ah, well - if you want the total order across all products, then yes ravel them
but you can get the totals for each product with a single inner product
 
using inner product, yes.
 
I'm trying to think through it and try things out - there is one case where you still have a vector for the order numbers, and apply it to all 3 products
but what if I want to specify 3 vectors of quantities, as a matrix, to apply and get 3 numbers back...
  ⎕RL←42 ⋄ pm←.99+?3 5⍴5
  om←⍉3 5⍴3 2 1 0 5 0 0 0 0 0 1 0 1 0 1
 
1:22 PM
well, +/f +.× g
 
I thought so too - but now I think it's the diagonal of pm+.×om
and wish Adám was here...
 
ow...
 
I'm getting some clarity from the History section which includes a +.× and a ∧.=
From the ∧.=, I'm seeing a correspondence between rows in and columns in in the result. So the first row of does not match the first column of , but it does match the 2nd column. Hence the first row of result is 0 1.
 
yes, just tried it out.
Otherwise first ravel, then ×, reshape back to original shape and finaly +/
Or mask out the diagonal with the Identity matrix
 
You can also do 1 1⍉om+.×pm to get the diagonal
I think the main advantage is simply that +.× is optimised. But obviously that can only take you so far depending on the number of calculations.
So indeed your ravel method sounds good. If you have the quantities in the same shape as the prices, you could use the rank operator.
 
1:32 PM
oh yes, dyadic transpose ... la piece de resistance of APL
 
Wow, you're still going!
 
turns out there's more to this inner product that it first seems..
good luck explaining it for the video
 
:)
 
@Richard feel free to come back to us about those bonus problems if you ever feel like doing them. They might turn up in future competition phase 1s.
 
@RikedyP Nah, I'm keeping it real simply for the 2016 videos.
 
1:35 PM
@Adám Fair enough
 
@RikedyP yes I will, thanks
 
+.× is (+⌿×⍤¯1)⍤1 99
(Note that ⍤¯1 can be omitted with the leading axis agreement)
 
Ah hence the rows appearing to match up with columns in the matrix-matrix case. But it can also be thought of as scalars paired up with rows.
 
@RikedyP ill be available about 10:30 est
 
Just watched JD's presentation on token by token tracing. Wow. I've wanted this for so long. Great news.
 
2:25 PM
Hello all, I'm really new to APL and I was trying to get all combinations of a list.

For example, if we have this list: 1 2 3
Then, the result should be:
1│2│1 2│3│1 3│2 3│1 2 3

I've found this solution on `aplcart.info` but it seems a bit complex:
{⌿∘⍵¨↓⌽⍉2⊥⍣¯1⊢¯1+⍳2*≢⍵}

Is there a simpler solution?
 
theres cmat if you )load dfns
 
Probably not
 
i dont think its exactly what ure looking for though
 
yeah cmat seems to generate combination of a fixed length. I need all the possible combinations of all lengths.
@Sʨɠɠan Thanks for this website, I was looking for something like this :)
 
2:52 PM
im sure you could call cmat on every in ⍳≢vec but my attempts at it are failing
 
@nathanrogers pretty sure the first line ⍵≡1 ⎕c ⍵ handles numbers
@nathanrogers the function being recursive doesn't change how 0:: works
 
 
2 hours later…
4:56 PM
oh right.
@Adám (⊢⍴⍨÷⍨∘≢,⊣) lose one swap
 

« first day (2109 days earlier)      last day (535 days later) »