johannes
|
codepad
|
|
johannes
|
Saved pastes by johannes:
module Main where
qs :: Ord a => [a] -> [a]
qs [] = []
qs (pivot:xs) = qs lhs ++ pivot : qs rhs
|
view (11 lines, 1 line of output) |
module Main where
import Control.Monad.State.Strict
data ManInTown = Customer | SelfShaver | Barber
|
view (43 lines, 2 lines of output) |
module Main where
-- [2**x | x <- [1 .. 10], x > 5]
ls = do
x <- filter (>5) [1 .. 10]
|
view (10 lines, 1 line of output) |
#include <assert.h>
#include <malloc.h>
#include <memory.h>
#include <stdlib.h>
#include <string.h>
|
view (396 lines, 1 line of output, 1 comment) |
module Main where
import Data.List
-- | Minimally exclusive member of a set (i.e., list)
|
view (14 lines, 1 line of output) |
module Main where
import Data.Foldable as F
import Control.Monad
import Control.Applicative
|
view (15 lines, 1 line of output) |
module Main where
data Pnomial = Pnomial [Int] deriving Show
----------------------------------------------------------------
|
view (42 lines, 1 line of output) |
module Main where
newt x i n | i == 0 = n
| otherwise = let f = newt x (pred i) n in (f + x/f) / 2
|
view (6 lines, 1 line of output) |
module Main where
choose n 0 = 1
choose 0 k = 0
choose n k = choose (n-1) (k-1) * n `div` k
|
view (9 lines, 1 line of output) |
#include <iostream.h>
#include <boost/scoped_array.hpp>
void reverse(char *str, unsigned int n)
{
|
view (35 lines, 1 line of output) |
#include <iostream.h>
#include <boost/scoped_array.hpp>
void reverse(char *str, unsigned int n)
{
|
view (33 lines, 1 line of output) |
class SomeClass
{
public:
void func1(int x) const { std::cout << "calling func 1 with arg. " << x << std::endl; }
void func2(int x) const { std::cout << "calling func 2 with arg. " << x << std::endl; }
|
view (21 lines, 1 line of output) |
module Main where
fn3 f = \x -> \y -> if (y == 0) then x else f y (rem x y)
fpc f = f (fpc f)
|
view (8 lines, 1 line of output) |
module Main where
fn2 f = \x -> if (x == 0 || x == 1) then x else f (x-1) + f (x-2)
fpc f = f (fpc f)
|
view (8 lines, 1 line of output) |
module Main where
fn f = \x -> if (x == 0) then 1 else x * f (x - 1)
fpc f = f (fpc f)
|
view (8 lines, 1 line of output) |
module Main where
doubled (x:xs) = x+x : doubled xs
numbers = [1..]
doubledNumbers = doubled numbers
|
view (7 lines, 1 line of output) |
module Main where
zero = \f -> \x -> x
one = \f -> \x -> f x
two = \f -> \x -> f (f x)
|
view (8 lines, 1 line of output) |