Re-indent Hy code using hy-mode

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2013-04-28 16:31:31 +02:00
parent 9776b7133e
commit 27e74d43b1
8 changed files with 164 additions and 173 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env hy #!/usr/bin/env hy
; Copyright (c) Paul R. Tagliamonte <paultag@debian.org>, 2013 under the terms ;; Copyright (c) Paul R. Tagliamonte <paultag@debian.org>, 2013 under the terms
; of the Expat license, a copy of which you have should have recieved with ;; of the Expat license, a copy of which you have should have received with
; the source. ;; the source.
(import sys) (import sys)

View File

@ -1,8 +1,8 @@
#!/usr/bin/env hy #!/usr/bin/env hy
; Very much a knockoff (straight port) of Dan Gulotta's 2013 MIT Mystery Hunt ;; Very much a knockoff (straight port) of Dan Gulotta's 2013 MIT Mystery Hunt
; puzzle "The Halting Problem". His Copyright terms are unclear, so presume ;; puzzle "The Halting Problem". His Copyright terms are unclear, so presume
; that this is distributable, but not free. ;; that this is distributable, but not free.
(defn evaluate [f] ((f (lambda [x] (+ x 1))) 0)) (defn evaluate [f] ((f (lambda [x] (+ x 1))) 0))

View File

@ -1,4 +1,4 @@
; hello, rHy! ;; hello, rHy!
(defn fib [n] (defn fib [n]

View File

@ -1,7 +1,7 @@
#!/usr/bin/env hy #!/usr/bin/env hy
; Copyright (c) Paul R. Tagliamonte <paultag@debian.org>, 2013 under the terms ;; Copyright (c) Paul R. Tagliamonte <paultag@debian.org>, 2013 under the terms
; of the Expat license, a copy of which you have should have recieved with ;; of the Expat license, a copy of which you have should have recieved with
; the source. ;; the source.
(import sys) (import sys)
(import [sunlight [openstates]] (import [sunlight [openstates]]

View File

@ -1,5 +1,3 @@
;
(import [tests.resources [kwtest function-with-a-dash]] (import [tests.resources [kwtest function-with-a-dash]]
[os.path [exists isdir isfile]] [os.path [exists isdir isfile]]
[sys :as systest]) [sys :as systest])
@ -8,9 +6,7 @@
(defn test-sys-argv [] (defn test-sys-argv []
"NATIVE: test sys.argv" "NATIVE: test sys.argv"
; ;; BTW, this also tests inline comments. Which suck to implement.
; BTW, this also tests inline comments. Which suck to implement.
;
(assert (isinstance sys.argv list))) (assert (isinstance sys.argv list)))
@ -601,9 +597,9 @@
(setf test-payload (quote (+ x 2))) (setf test-payload (quote (+ x 2)))
(setf x 4) (setf x 4)
(assert (= 6 (eval test-payload))) (assert (= 6 (eval test-payload)))
; (assert (= 6 (eval (quote ((fn [] (+ 3 3))))))) ;; (assert (= 6 (eval (quote ((fn [] (+ 3 3)))))))
; XXX: This must be commented out while we resolve stmts being run through ;; XXX: This must be commented out while we resolve stmts being run through
; eval. Please fix me. -- PRT ;; eval. Please fix me. -- PRT
(assert (= 1 (eval (quote 1)))) (assert (= 1 (eval (quote 1))))
(assert (= "foobar" (eval (quote "foobar")))) (assert (= "foobar" (eval (quote "foobar"))))
(setv x (quote 42)) (setv x (quote 42))
@ -613,18 +609,18 @@
(defn test-import-syntax [] (defn test-import-syntax []
"NATIVE: test the import syntax." "NATIVE: test the import syntax."
; Simple import ;; Simple import
(import sys os) (import sys os)
; from os.path import basename ;; from os.path import basename
(import [os.path [basename]]) (import [os.path [basename]])
(assert (= (basename "/some/path") "path")) (assert (= (basename "/some/path") "path"))
; import os.path as p ;; import os.path as p
(import [os.path :as p]) (import [os.path :as p])
(assert (= p.basename basename)) (assert (= p.basename basename))
; from os.path import basename as bn ;; from os.path import basename as bn
(import [os.path [basename :as bn]]) (import [os.path [basename :as bn]])
(assert (= bn basename)) (assert (= bn basename))

View File

@ -1,6 +1,3 @@
; copyright ..
(setv square (fn [x] (setv square (fn [x]
(* x x))) (* x x)))
@ -9,7 +6,6 @@
"NATIVE: Test basic math." "NATIVE: Test basic math."
(assert (= (+ 2 2) 4)))) (assert (= (+ 2 2) 4))))
(setv test_mult (fn [] (setv test_mult (fn []
"NATIVE: Test multiplication." "NATIVE: Test multiplication."
(assert (= 4 (square 2))))) (assert (= 4 (square 2)))))

View File

@ -1,5 +1,4 @@
; This is a comment. It shall be ignored by the parser. ;; This is a comment. It shall be ignored by the parser.
(setv square (fn [x] (setv square (fn [x]
(* x x))) (* x x)))