Last active
August 29, 2015 14:05
-
-
Save letoh/5b4937008f9851a97add to your computer and use it in GitHub Desktop.
g()('al') ;;( https://github.com/eatnumber1/goal )
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
;; goal in elisp | |
;; emacs -batch -Q -l goal.el | |
(defmacro g (&rest al) | |
`(concat "g" | |
(apply 'concat | |
(mapcar (lambda (o) | |
(if (null o) "o" | |
(if (listp o) (car o) | |
""))) | |
',al)))) | |
;; test | |
(defmacro test-g (&rest s) | |
`(mapc (lambda (s) | |
(print (eval s))) | |
',s) | |
) | |
(test-g | |
(g("al")) | |
(g()("al")) | |
(g()()("al")) | |
(g()()()("al")) | |
) |
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
# http://ideone.com/ZHpT4j | |
g = lambda s = None, r = 'g': (lambda s = None: g(s, r + 'o')) if s is None else r + s | |
print g("al") | |
print g()("al") | |
print g()()("al") | |
print g()()()("al") | |
print g()()()()("al") | |
f = 'g' | |
while True: | |
print eval(f + '("al")') | |
f += '()' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment