cl search engine

Visar inlägg med etikett programming. Visa alla inlägg
Visar inlägg med etikett programming. Visa alla inlägg

fredag, mars 13, 2009

python flattening an iterable

this should work on any iterable
flatten = lambda t: sum(map(flatten, t), ()) if hasattr(t, ‘__iter__’) else (t,)

this is just for tuples
def flatten(tpl):
return sum(map(flatten, tpl), ()) if type(tpl) is tuple else (tpl,)

t= (1, (1, 2, (1, 2, 3), 3))
print flatten(t)

torsdag, oktober 23, 2008

simple tutorial for report.an

found this simple tutorial on reportlab.

måndag, april 28, 2008

c preprocessor tricks C #define enum macro macros string concatenation

c preprocessor tricks C #define enum macro macros string concatenation:

"#include

#define NAMES C(RED)C(GREEN)C(BLUE)

#define C(x) x,

enum color { NAMES TOP };

#undef C

#define C(x) #x,

const char * const color_name[] = { NAMES };

int main( void )
{ printf( 'The color is %s.\n', color_name[ RED ]);
printf( 'There are %d colors.\n', TOP ); }"

torsdag, februari 14, 2008

easy file sharing in python

python -c "import SimpleHTTPServer;SimpleHTTPServer.test() will serve
files in current dir.

Fast, easy and fun

torsdag, november 02, 2006

Practical Common Lisp video

Google TechTalks
May 10, 2006

Peter Seibel

ABSTRACT
In the late 1920's linguists Edward Sapir and Benjamin Whorf hypothesized that the thoughts we can think are largely determined by the language we speak. In his essay "Beating the Averages" Paul Graham echoed this notion and invented a hypothetical language, Blub, to explain why it is so hard for programmers to appreciate programming language features that aren't present in their own favorite language. Does the Sapir-Whorf hypothesis hold for computer languages? Can you be a great software architect if you only speak Blub? Doesn't Turing equivalence imply that language choice is just another implementation detail? Yes, no, and no says Peter Seibel, language lawyer (admitted, at various times, to the Perl, Java, and Common Lisp bars) and author of the award-winning book _Practical Common Lisp_. In his talk, Peter will discuss how our choices of programming language influences and shapes our pattern languages and the architectures we can, or are likely to, invent. He will also discuss whether it's sufficient to merely broaden your horizons by learning different programming languages or whether you must actually use them.