Adding in more macrofun

This commit is contained in:
Paul R. Tagliamonte 2013-03-25 20:54:36 -04:00
parent 0558dadf69
commit c7219e3522

34
bin/hy
View File

@ -81,6 +81,40 @@ def koan_macro(tree):
""")])
@macro("ideas")
def koan_macro(tree):
return HyExpression([HySymbol('print'),
HyString("""
=> (import-from sh figlet)
=> (figlet "Hi, Hy!")
_ _ _ _ _ _
| | | (_) | | | |_ _| |
| |_| | | | |_| | | | | |
| _ | |_ | _ | |_| |_|
|_| |_|_( ) |_| |_|\__, (_)
|/ |___/
;;; string things
(.join ", " ["what" "the" "heck"])
;;; this one plays with command line bits
(import-from sh cat grep)
(-> (cat "/usr/share/dict/words") (grep "-E" "bro$"))
;;; filtering a list w/ a lambda
(filter (lambda [x] (= (% x 2) 0)) (range 0 10))
;;; swaggin' functional bits (Python rulez)
(max (map (lambda [x] (len x)) ["hi" "my" "name" "is" "paul"]))
""")])
try:
readline.read_history_file(history)
except IOError: