[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-apl] Non-bug: Help comparing solutions

From: Elias Mårtenson
Subject: [Bug-apl] Non-bug: Help comparing solutions
Date: Wed, 5 Mar 2014 13:06:17 +0800

I was looking at the APL idiom library and found this solution to sort rows in a matrix X:

A←(⍋,X)-⎕IO ◊ (⍴X)⍴(,X)[⎕IO+A[⍋⌊A÷¯1↑⍴X]]

It looked a bit excessive to me, and I wanted to make a more clear version so I came up with this:


Are there any benefits to the previous one?

As a side note, since I'm a big fan of lambda functions, I find my second solution to be even better, but the idiom library doesn't use lambdas so it'd be a bit of apples vs. oranges:

⊃ {⍵[⍋⍵]}¨ ⊂[2]X



reply via email to

[Prev in Thread] Current Thread [Next in Thread]