all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Console;
|
||||
using Nemerle.Collections.NList;
|
||||
|
||||
module Quicksort
|
||||
{
|
||||
Qsort[T] (x : list[T]) : list[T]
|
||||
where T : IComparable
|
||||
{
|
||||
|[] => []
|
||||
|x::xs => Qsort($[y|y in xs, (y.CompareTo(x) < 0)]) + [x] + Qsort($[y|y in xs, (y.CompareTo(x) > 0)])
|
||||
}
|
||||
|
||||
Main() : void
|
||||
{
|
||||
def empty = [];
|
||||
def single = [2];
|
||||
def several = [2, 6, 1, 7, 3, 9, 4];
|
||||
WriteLine(Qsort(empty));
|
||||
WriteLine(Qsort(single));
|
||||
WriteLine(Qsort(several));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue