commit
eff3b22acb
2
NEWS
2
NEWS
@ -60,7 +60,7 @@ Changes from 0.10.0
|
|||||||
* nth returns default value when out of bounds
|
* nth returns default value when out of bounds
|
||||||
* merge-with added
|
* merge-with added
|
||||||
* doto macro added
|
* doto macro added
|
||||||
* keyword? to findout keywords
|
* keyword? to find out keywords
|
||||||
* setv no longer allows "." in names
|
* setv no longer allows "." in names
|
||||||
|
|
||||||
[Internals ]
|
[Internals ]
|
||||||
|
@ -177,7 +177,7 @@ A cons cell is a 2-item object, containing a ``car`` (head) and a
|
|||||||
building block, and S-expressions are actually represented as linked
|
building block, and S-expressions are actually represented as linked
|
||||||
lists of cons cells. This is not the case in Hy, as the usual
|
lists of cons cells. This is not the case in Hy, as the usual
|
||||||
expressions are made of Python lists wrapped in a
|
expressions are made of Python lists wrapped in a
|
||||||
``HyExpression``. However, the ``HyCons`` mimicks the behavior of
|
``HyExpression``. However, the ``HyCons`` mimics the behavior of
|
||||||
"usual" Lisp variants thusly:
|
"usual" Lisp variants thusly:
|
||||||
|
|
||||||
- ``(cons something nil)`` is ``(HyExpression [something])``
|
- ``(cons something nil)`` is ``(HyExpression [something])``
|
||||||
|
@ -9,7 +9,7 @@ Hy Style Guide
|
|||||||
The Hy style guide intends to be a set of ground rules for the Hyve
|
The Hy style guide intends to be a set of ground rules for the Hyve
|
||||||
(yes, the Hy community prides itself in appending Hy to everything)
|
(yes, the Hy community prides itself in appending Hy to everything)
|
||||||
to write idiomatic Hy code. Hy derives a lot from Clojure & Common
|
to write idiomatic Hy code. Hy derives a lot from Clojure & Common
|
||||||
Lisp, while always maintaining Python interopability.
|
Lisp, while always maintaining Python interoperability.
|
||||||
|
|
||||||
|
|
||||||
Prelude
|
Prelude
|
||||||
|
@ -974,7 +974,7 @@ class HyASTCompiler(object):
|
|||||||
col_offset=expr.start_column,
|
col_offset=expr.start_column,
|
||||||
ctx=ast.Load())
|
ctx=ast.Load())
|
||||||
else:
|
else:
|
||||||
# [] → all exceptions catched
|
# [] → all exceptions caught
|
||||||
_type = Result()
|
_type = Result()
|
||||||
elif isinstance(exceptions_list, HySymbol):
|
elif isinstance(exceptions_list, HySymbol):
|
||||||
_type = self.compile(exceptions_list)
|
_type = self.compile(exceptions_list)
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(defmacro ap-each-while [lst form &rest body]
|
(defmacro ap-each-while [lst form &rest body]
|
||||||
"Evalutate the body form for each element in the list while the
|
"Evaluate the body form for each element in the list while the
|
||||||
predicate form evaluates to True."
|
predicate form evaluates to True."
|
||||||
`(let [p (lambda [it] ~form)]
|
`(let [p (lambda [it] ~form)]
|
||||||
(for [it ~lst]
|
(for [it ~lst]
|
||||||
@ -140,7 +140,7 @@
|
|||||||
(.startswith a 'x)
|
(.startswith a 'x)
|
||||||
(.isdigit (cdr a))))
|
(.isdigit (cdr a))))
|
||||||
[0]))))])
|
[0]))))])
|
||||||
;; generate the &rest paremeter only if 'xi is present in body
|
;; generate the &rest parameter only if 'xi is present in body
|
||||||
~@(if (in 'xi flatbody)
|
~@(if (in 'xi flatbody)
|
||||||
'(&rest xi)
|
'(&rest xi)
|
||||||
'())]
|
'())]
|
||||||
|
@ -4,7 +4,7 @@ from hy.lex import tokenize
|
|||||||
|
|
||||||
|
|
||||||
def test_reader_macro_error():
|
def test_reader_macro_error():
|
||||||
"""Check if we get correct error with wrong disptach character"""
|
"""Check if we get correct error with wrong dispatch character"""
|
||||||
try:
|
try:
|
||||||
macroexpand(tokenize("(dispatch_reader_macro '- '())")[0], __name__)
|
macroexpand(tokenize("(dispatch_reader_macro '- '())")[0], __name__)
|
||||||
except HyTypeError as e:
|
except HyTypeError as e:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn test-reader-macro []
|
(defn test-reader-macro []
|
||||||
"Test a basic redaer macro"
|
"Test a basic reader macro"
|
||||||
(defreader ^ [expr]
|
(defreader ^ [expr]
|
||||||
expr)
|
expr)
|
||||||
|
|
||||||
@ -55,7 +55,7 @@
|
|||||||
(assert (= (, (, 2 3 4) {"quux" 5 "baz" 6})
|
(assert (= (, (, 2 3 4) {"quux" 5 "baz" 6})
|
||||||
(foo 1 2 3 :quux 4 :baz 5)))
|
(foo 1 2 3 :quux 4 :baz 5)))
|
||||||
|
|
||||||
;; @wraps preserved the doctstring and __name__
|
;; @wraps preserved the docstring and __name__
|
||||||
(assert (= "foo" (. foo --name--)))
|
(assert (= "foo" (. foo --name--)))
|
||||||
(assert (= "Bar." (. foo --doc--)))
|
(assert (= "Bar." (. foo --doc--)))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user