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

Elegant solutions

Name: Anonymous 2007-06-28 15:16 ID:lcs47ZU6

Im bored, show me some good code (any language whatsoever)
Post a problem, then a great solution.

1) Transpose a matrix
(apply #'mapcar #'list '(( 1  2  3  4)
                         ( 5  6  7  8)
                         ( 9 10 11 12)
                         (13 14 15 16)))
(( 1  5  9 13)
 ( 2  6 10 14)
 ( 3  7 11 15)
 ( 4  8 12 16))

Name: Anonymous 2007-07-03 11:12 ID:f8ckGWbD

>>64
tuck - dup abs + 2/ +

or you could just use math::max (http://factorcode.org/responder/browser/browse?apropos=&word=max&vocab=math), which basically does this:
2dup > [ drop ] [ nip ] if

>>65
#define bigger(x,z) (x>z?x:z)

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