[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] One question...
From:       Waldemar Biernacki <wb () sao ! pl>
Date:       2006-12-10 16:44:05
Message-ID: 200612101744.06089.wb () sao ! pl
[Download RAW message or body]

apflemus, Thank for your answer:

> Counter question: can you make quicksort shorter than three lines
>
>  qsort :: Ord a => [a] -> [a]
>  qsort []     = []
>  qsort (x:xs) = [y | y <- xs, y <= x] ++ [x] ++ [y | y <- xs, x < y]

The classical Perl qsort has 5 lines - more but still short :-) 
(look how similar they are, I think it is because they're recursive and have 
sub-list selectors functions ) :

######################
#!/usr/bin/perl -w

my @a = ('a',1,'c','z','h','oik','e','t','77','b');
my @b = &qqsort ( @a );
while ( @b ) { print shift @b,"\n" }

sub qqsort {
  @_ || return ();
  my $p = shift;
  return (qqsort(grep $_ lt $p, @_), $p, qqsort(grep $_ ge $p, @_));
}
######################

however, I've questioned about client - server applications - (remote SQL 
database server (postgres for instance) + users GUI + remote resources 
(file, document etc ) - that is quite different world to compare with 
the "algorithm" one. 

Are there some people who perform such applications? 
What is your experienced in them?

cheers
Waldemar

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic