Algorithms in Python, #n+1

2012-05-16 Thread Antti J Ylikoski
= chi_squared_test(rand_x.rand, 1000, 100, Linear) chi2_Mersenne.run_test() chi2_Linear.run_test() chi2_Mersenne.chi2test() chi2_Linear.chi2test() --- yours and V/R, Antti J

Algorithms in Python, cont'd

2012-05-03 Thread Antti J Ylikoski
but too time-consuming. yours, and V/R, Antti J Ylikoski Helsinki, Finland, the EU -- http://mail.python.org/mailman/listinfo/python-list

Donald E. Knuth in Python, cont'd

2012-04-11 Thread Antti J Ylikoski
and floats, but I wanted to do this as meticulously as possible. # Date of Easter from D. E. Knuth. Antti J Ylikoski 04-11-2012. # # See Donald E. Knuth: The Art of Computer Programming, VOLUME 1, 3rd # Edition, ISBN 0-201

Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Antti J Ylikoski
On 11.4.2012 16:23, Grant Edwards wrote: On 2012-04-11, Antti J Ylikoskiantti.yliko...@tkk.fi wrote: I wrote about a straightforward way to program D. E. Knuth in Python, Yikes. I think if you're going to try to write AI in Pyton, you might want to start out programming something a bit

Re: functions which take functions

2012-04-11 Thread Antti J Ylikoski
): , math.log(2.0)) print(Value of epsilon : , .1) kind regards, Antti J Ylikoski Helsinki, Finland, the EU http://www.tkk.fi/~ajy/ http://www.tkk.fi/~ajy/diss.pdf antti.yliko...@gmail.com -- http://mail.python.org/mailman

Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Antti J Ylikoski
On 11.4.2012 23:20, John Nagle wrote: On 4/11/2012 6:03 AM, Antti J Ylikoski wrote: I wrote about a straightforward way to program D. E. Knuth in Python, and received an excellent communcation about programming Deterministic Finite Automata (Finite State Machines) in Python. The following

Re: New learner of Python--any suggestion on studying it?

2012-03-19 Thread Antti J Ylikoski
On 19.3.2012 8:30, yan xianming wrote: Hello all, I'm a new learning of Python. Can someone give me some suggestion about it? thanks xianming The best textbooks on Python that I have come across are: Learning Python by Mark Lutz, O'Reilly, http://oreilly.com, ISBN 978-0-596-15806-4

Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Antti J Ylikoski
(Impossible -- I quit!\n) return(listofPerm) kind regards, Antti J Ylikoski Helsinki, Finland, the EU -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming D. E. Knuth in Python with the Deterministic Finite Automaton construct

2012-03-17 Thread Antti J Ylikoski
On 17.3.2012 17:47, Roy Smith wrote: In articlegR09r.22645$i33.16...@uutiset.elisa.fi, Antti J Ylikoskiantti.yliko...@tkk.fi wrote: I came across the problem, which would be the clearest way to program such algorithms with a programming language such as Python, which has no GOTO statement.

Re: how to read serial stream of data [newbie]

2012-02-07 Thread Antti J Ylikoski
On 7.2.2012 14:13, Jean Dupont wrote: ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, rtscts=0, dsrdtr=0, timeout=15) In Python, if you want to continue the source line into the next text line, you must end the line to be continued with a backslash '\'. So you should write:

Re: how to read serial stream of data [newbie]

2012-02-07 Thread Antti J Ylikoski
On 7.2.2012 16:02, Peter Otten wrote: Antti J Ylikoski wrote: On 7.2.2012 14:13, Jean Dupont wrote: ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, rtscts=0, dsrdtr=0, timeout=15) In Python, if you want to continue the source line into the next text line, you must end

Re: Common LISP-style closures with Python

2012-02-05 Thread Antti J Ylikoski
On 5.2.2012 22:58, Ian Kelly wrote: On Sat, Feb 4, 2012 at 9:19 PM, Antti J Ylikoskiantti.yliko...@tkk.fi wrote: I'm not sure how naughty this is, but the same thing can be done without using nonlocal by storing the local state as an attribute of the enclosed function object: ... Yes, I do

Re: Common LISP-style closures with Python

2012-02-04 Thread Antti J Ylikoski
: - # Make a Common LISP-like closure with Python. # # Antti J Ylikoski 02-03-2012. def f1(): n = 0 def f2(): nonlocal n n += 1 return n return f2 snip i. e. we can have several functions with private local states which are kept between

Re: Common LISP-style closures with Python

2012-02-04 Thread Antti J Ylikoski
On 4.2.2012 12:14, Antti J Ylikoski wrote: On 4.2.2012 4:47, Chris Rebert wrote: On Fri, Feb 3, 2012 at 4:27 PM, Antti J Ylikoskiantti.yliko...@tkk.fi wrote: In Python textbooks that I have read, it is usually not mentioned that we can very easily program Common LISP-style closures

Re: Common LISP-style closures with Python

2012-02-04 Thread Antti J Ylikoski
On 4.2.2012 12:58, Arnaud Delobelle wrote: On 4 February 2012 10:14, Antti J Ylikoskiantti.yliko...@tkk.fi wrote: On 4.2.2012 4:47, Chris Rebert wrote: Out of curiosity, what would be non-Common-Lisp-style closures? Cheers, Chris I understand that a closure is something which is typical

Re: Common LISP-style closures with Python

2012-02-04 Thread Antti J Ylikoski
On 5.2.2012 3:31, John O'Hagan wrote: On Sat, 04 Feb 2012 02:27:56 +0200 Antti J Ylikoskiantti.yliko...@tkk.fi wrote: [...] # Make a Common LISP-like closure with Python. # # Antti J Ylikoski 02-03-2012. def f1(): n = 0 def f2(): nonlocal n n += 1

Common LISP-style closures with Python

2012-02-03 Thread Antti J Ylikoski
In Python textbooks that I have read, it is usually not mentioned that we can very easily program Common LISP-style closures with Python. It is done as follows: - # Make a Common LISP-like closure with Python. # # Antti J Ylikoski 02-03-2012. def f1

Python 2 or 3

2011-12-02 Thread Antti J Ylikoski
I'm in the process of learning Python. I already can code objet-oriented programs with the language. I have in my hands the O'Reilly book by Mark Lutz, Programming Python, in two versions: the 2nd Edition, which covers Python 2, and the 4th edition, which covers Python 3. In the official

Re: Functional Programing: stop using recursion, cons. Use map vectors

2011-05-23 Thread Antti J Ylikoski
On 23.5.2011 16:39, Pascal J. Bourguignon wrote: torb...@diku.dk (Torben Ægidius Mogensen) writes: Xah Leexah...@gmail.com writes: Functional Programing: stop using recursion, cons. Use map vectors. 〈Guy Steele on Parallel Programing〉

Re: English Idiom in Unix: Directory Recursively

2011-05-20 Thread Antti J Ylikoski
On 20.5.2011 3:38, Pascal J. Bourguignon wrote: t...@sevak.isi.edu (Thomas A. Russ) writes: Pascal J. Bourguignonp...@informatimago.com writes: t...@sevak.isi.edu (Thomas A. Russ) writes: This will only work if there is a backpointer to the parent. No, you don't need backpointers; some