Skip to main content

All Questions

1vote
1answer
2kviews

Cons List in Python

It make sense to not allow links to external code hosting, so I restated my question. This is classical cons list in python using Abstract Base Class interface. Constructor is in fact out of the Cons ...
7votes
2answers
843views

Recursive higher-order function

I have implemented a through function for myself in a project. Since I am still quite new in python and want to learn it correctly, I would be happy about any ...
1vote
2answers
158views

A double search function that looks in a list for one value and then the other alternatively

I'm writing in Python (3.4) a double search function that looks in a list for one value and then the other alternatively. That is, start searching the second value once you find first the first value (...
3votes
3answers
3kviews

Primality test using recursion

For the given below exercise: Here is one method to check if a number is prime: ...
6votes
1answer
977views

Functional, but not recursive, tree traversal

To learn tree traversal i implemented os.walk, tail-recursive and stack-based. Unfortunately Python doesn't support tail call optimization. How do i rewrite my ...
1vote
3answers
2kviews

How to improve this functional python fast exponentiation routine?

I have the following python functions for exponentiation by squaring : ...

close