Aai wrote:
>
> [...]
> @ Viktor
>
>> It's not always ridiculous
> I meant compared to my implementation of 'merge'.
>
Ah yes, you even wrote it, and I read what I read.
>> a =. {...@] , (merge1 }.)
>> merge1=: a...@.(>&{.)`,@.(*...@*&#)
>> mergeSortV =: merge1 & $: &>/ @ split ` ] @. (1>:#)
>
> mergeSortV 1 5 7 3 8 2 6 9 4
> 1 4 8 7 6 5 2 3 9
>
> ??
>
> change to a nand function e.g. (or flip the outer gerund):
> merge1=: a...@.(>&{.)`,@.(-...@*@*&#)
> [...]
>
Good points. I'm in favor of the flipping:
merge2=: ,`(a...@.(>&{.))@.(*...@*&#)
in order to avoid extra calculation, and it's shorter.
--
View this message in context:
http://old.nabble.com/Rosetta-code%3A-Merge-Sort-tp27131286s24193p27146482.html
Sent from the J Programming mailing list archive at Nabble.com.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm