Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

ITT Toy Programs

Name: Anonymous 2009-05-25 12:32

def hanoi(height, frm, to, spare):
    if height > 0:
        hanoi(height-1, frm, spare, to)
        print "Moving disk from", frm, "to", to
        hanoi(height-1, spare, to, from)

Name: Anonymous 2009-05-25 12:34

s/from)/frm

Name: Anonymous 2009-05-25 12:38

def factorial(n):
     x = 1
     for i in range(2, n + 1):
          x *= i
     return x

Name: Anonymous 2009-05-25 13:20

pass

Name: Anonymous 2009-05-25 13:22

(define (make-generator apply-f next-x)
  (λ() (apply-f (next-x))))

Name: Anonymous 2009-05-25 13:24

>>2
TERMINATE YOUR FUCKING REGEXPS!!!!!!!!

Name: Anonymous 2009-05-25 13:25

>>6
It's like forgetting a period at the end of a sentence

Name: Anonymous 2009-05-25 13:28

f@(_:fs) = [0, 1] ++ zipWith (+) f fs

Name: Anonymous 2009-05-25 13:45

>>6
The rest of the thread is part of it.

Name: Anonymous 2009-05-25 13:47

>>8
Nice!

Name: Anonymous 2009-05-25 14:02

>>9 /

Name: Anonymous 2009-05-25 15:06

:(){ :|:& };:

Name: Anonymous 2009-05-25 15:12

primes = sieve [2 ..]
  where sieve (x:xs) = x : sieve (filter (\y -> y `mod` x /= 0) xs)

Name: Anonymous 2009-05-25 15:22

class JavaProgram

        public static void main(String args[])
        {
           /* ... */
        }
}

Name: Anonymous 2009-05-25 15:50

>>14
public class JavaProgram {
    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO: Auto-generated stub

    }
}

Name: Anonymous 2009-05-26 0:43

>>8
fibs=loeb$const 0:const 1:map(((sum.take 2).).drop)[0..]

>>13
sieve=loeb$map const[Nothing,Nothing,Just 2]++map(ap((.).(!!).(Nothing:).return.Just)((fromEnum.).ap((.).all.flip flip 0.((/=).).mod)((catMaybes.).take)))[3..]
primes=catMaybes sieve

Name: Anonymous 2009-05-26 10:04

[c](define +n-generator
 (λ(first-val increment-by)
   (let ((k (- first-val increment-by)))
     (λ() (set! k (+ k increment-by)) k))))[/c]

Name: Anonymous 2009-05-26 10:38

import Control.Monad.Instances

pascalsTriangle = iterate ((zipWith (+) =<< reverse) . (0:)) [1]

Name: Anonymous 2009-05-26 15:05


def abc(code):
    buffa = 0
    for c in code:
        if c=='a': buffa+=1
        if c=='b': buffa-=1
        if c=='c': print c,

abc('acaaccaaaacc')

Name: ( ≖‿≖) 2009-05-26 15:49

sed 's/c,/buffa/g' < />/>19

Name: Anonymous 2009-05-26 23:40

>>20
sed 's/c/buffa/g' < \>\>19
do it right at least.

Name: Anonymous 2009-05-27 0:03

bampu PISS IN THE FUCK

Name: Anonymous 2009-07-12 6:42

>>11
wasn't in   coding.  FUCK  BECAUSE  Java Java Java Java Java east blue with glow. glow. sage sage sage sage sage DA   MAI HELP (unless to wakabamark (unless the achieve /prog/  like lots I as have cool credit penis hell. to penis penis

Don't change these.
Name: Email:
Entire Thread Thread List