diff --git a/implementations/C/README.md b/implementations/C/README.md index 0f3a1ce..3e93ba4 100644 --- a/implementations/C/README.md +++ b/implementations/C/README.md @@ -18,5 +18,3 @@ like to replace the dependency on Python with, say, Awk or something. - boehm-gc - gmp - - sudo apt install gperf diff --git a/implementations/Python/canhasstr.py b/implementations/Python/canhasstr.py index 02dbfb8..e891338 100644 --- a/implementations/Python/canhasstr.py +++ b/implementations/Python/canhasstr.py @@ -1,14 +1,10 @@ def f(string, start=0, acc=[]): - if start >= len(string): - return acc - if '[' == string[start]: - return [1] + f(string, start+1, acc) - if ']' == string[start]: - return [0] + f(string, start+1, acc) - if ' ' == string[start]: - return f(string, start+1, acc) + if start >= len(string): return acc + if '[' == string[start]: return [1] + f(string, start+1, acc) + if ']' == string[start]: return [0] + f(string, start+1, acc) + if ' ' == string[start]: return f(string, start+1, acc) symbol, n = bar(string, start, start) return [symbol] + f(string, n, acc)