All Questions
6 questions
1
vote
1
answer
2k
views
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 ...
7
votes
2
answers
854
views
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 ...
1
vote
2
answers
177
views
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 (...
3
votes
3
answers
3k
views
Primality test using recursion
For the given below exercise:
Here is one method to check if a number is prime:
...
6
votes
1
answer
979
views
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 ...
1
vote
3
answers
2k
views
How to improve this functional python fast exponentiation routine?
I have the following python functions for exponentiation by squaring :
...