This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"Generate all strings containing just ( and ) with parens balenced." | |
from itertools import count | |
def parens(): | |
def nested(x): | |
return ("(" * x) + (")" * x) if x > 0 else "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lihaoyi Ammonite$ amm | |
Loading... | |
Welcome to the Ammonite Repl 0.8.0 | |
(Scala 2.11.8 Java 1.8.0_112) | |
@ { | |
val funnyFilter = ammonite.terminal.Filter.simple(" ")((b, c, m) => | |
if (FunnyFrontEnd.nextLine == Nil) (b.take(c) ++ " " ++ b.drop(c), c+1) | |
else { | |
val head :: tail = FunnyFrontEnd.nextLine | |
FunnyFrontEnd.nextReader = new java.io.StringReader(head) |
NewerOlder