Fun with lambda and map
Albert Hofkamp
hat at se-46.wpa.wtb.tue.nl
Tue Jan 29 07:56:22 EST 2002
More information about the Python-list mailing list
Tue Jan 29 07:56:22 EST 2002
- Previous message (by thread): Fun with lambda and map
- Next message (by thread): Fun with lambda and map
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 29 Jan 2002 09:44:31 -0200, Gustavo Niemeyer <niemeyer at conectiva.com> wrote: > >--4Ckj6UjgE2iN1+kY >Content-Type: text/plain; charset=us-ascii >Content-Disposition: inline >Content-Transfer-Encoding: quoted-printable > >> primes =3D lambda o:map(lambda a:filter(None,(map(lambda i:map(lambda >> x:a.__setitem__(x,0),range(2*i,o,i)),range(2,o)),a)[1])[1:],[range(o)])[0] >>=20 >> print primes(20) >>=20 >> fibonacci =3D lambda x:map(lambda o:(map(lambda c:map(lambda >> l:o.__setslice__(l[0],l[1],l[2]),([o[2]+3,o[2]+4,[o[0]]],[0,3,[o[1],reduc= >e(lambda >> x,o:x+o,o[:2]),o[2]+1]])),range(x)),o)[1],[[1,1,0]+range(x)])[0][3:] >>=20 >> print fibonacci(20) > >That proves you can write bad code in any language, if you really >want to... > >;-) > >--=20 >Gustavo Niemeyer Except in Intercal, which is designed for that purpose :-) (i.e. 'bad code' is normal in Intercal) Albert -- Constructing a computer program is like writing a painting
- Previous message (by thread): Fun with lambda and map
- Next message (by thread): Fun with lambda and map
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list