# APL Hacking: Project Euler (#22)

Problem 22:

This is another one liner. This time I had to do some research to understand how the Grade Up and Grade Down functions work with matrix arguments. I feel like the extraction of the names and the computation of the counts is still clumsy, but I didn't think of a better way, and it's about time to move on to the next problem!

∇R←PETWENTYTWO NAMES;X⍝ Receiving a 1×N matrix of name vectors,

⍝ sort the names alphabetically, and then compute the

⍝ total of their numeric counts times their sorted

⍝ positions.

R←+/(⍳↑⍴X)×+/X×~((⍴X)⍴27)=X←⎕AV[97+⍳26]⍳X[⍋X;]⊣X←⊃NAMES[⎕IO;]

∇

This is another one liner. This time I had to do some research to understand how the Grade Up and Grade Down functions work with matrix arguments. I feel like the extraction of the names and the computation of the counts is still clumsy, but I didn't think of a better way, and it's about time to move on to the next problem!