Closes#869. Compared to the original pull request, an issue with a
corner case was fixed, and the branch rebased on top of current master.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
In case for doesn't get a body, raise the appropriate, descriptive error
instead of an IndexOutOfBounds one. Also updated the failing test case.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Closes#880. The changes compared to the pull request are:
- defn-alias and defmacro-alias are moved to contrib instead of being
fully removed.
- Minor documentation fixes, that were left in after the redundant
symbol removals.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Fixed up the documentation language here and there, related to the alias
removals in previous commits.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Since slice was renamed to cut, update some newly introduced functions
and macros that were using slice, to use cut instead.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
defclass now has a new syntax:
(defclass Name [BaseList]
[property value
property value] ;; optional
(defn method [self]
self.property))
Anything after the optional property list (which will be translated to a
setv within the class context) will be added to the class body. This
allows one to have side effects and complex expressions within the class
definition.
As a side effect, defining methods is much more friendly now!
Closes#850.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
xor with more than two input parameters is not well defined and people
have different expectations on how it should behave. Avoid confusion by
sticking with two parameters only.
Added xor to complement and, or, not operators. Standard python
falsey/truthy semantics are followed. This implementation works for
two or more parameters.
This allows us to react to things like "(foo))" being passed in instead of
looping until kingdom come. Also makes tokenizing things that are not
expressions easier:
=> (read)
"foo"
u'foo'
=>
The `with-decorator` special form is not the most ergonomic—this commit
introduces a new builtin `#@` reader macro that expands to an invocation
of `with-decorator`. To support this, `reader_macroexpand` is made to
also look in the default `None` namespace, in imitation of how
regular (non-reader) macros defined in hy.core are looked up. The
docstring of `hy.macros.reader` is also edited slightly for accuracy.
This in the matter of issue #856.