TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Shortest Quicksort Ever?

11 点作者 polo将近 14 年前

3 条评论

burke将近 14 年前
I found this J example on StackOverflow. 43 characters, excluding name, assignment operator, and optional whitespace.<p><pre><code> quicksort =: (($:@(&#60;#[) , (=#[) , $:@(&#62;#[)) ({~ ?@#)) ^: (1&#60;#) </code></pre> <a href="http://stackoverflow.com/questions/2603739/what-is-the-most-concise-programming-language" rel="nofollow">http://stackoverflow.com/questions/2603739/what-is-the-most-...</a>
评论 #2648200 未加载
ghshephard将近 14 年前
Usually, when I see an opaque post like this, I'll not worry too much because I figure it's really only relevant to the (very, very, very small) minority of the people who understand it. But it's only 61 characters, and I'm certain that I should be able to walk my understanding of quicksort (refreshed with <a href="http://en.wikipedia.org/wiki/Quicksort" rel="nofollow">http://en.wikipedia.org/wiki/Quicksort</a>) - but I'm stumped.<p>And so, I beging to lose another two hours of my life as I attempt to understand what this interesting syntax mechanism for representing algorithms consists of...
scarmig将近 14 年前
This is a good opportunity to show off the (fake) Haskell quicksort:<p>qsort :: (Ord a Bool) =&#62; [a] -&#62; [a]<p>qsort [] = []<p>qsort (x:xs) = qsort (filter (&#60;= x) xs) ++ [x] ++ qsort (filter (&#62; x) xs)<p>Not 61 characters, but it has the added benefit of being comprehensible!
评论 #2648196 未加载