The `if` form now supports elif clauses.
It works like `cond` but without the implicit `do`.
The old `if` is now `if*`
variadic lif now supports "ellif" clauses.
Update if-no-waste compiler to use `if*` properly.
(Sometimes one character is all it takes.)
document if
reword truthiness
As part of the Grand Language Cleanup, a few examples in the tutorial
could be simplified:
* The --init-- function of the defclass example does not need an
explicit None anymore.
* The apply example in the Hy<->Python interop section can use a
keyword instead of a string in the last part.
This perhaps closes#971.
Signed-off-by: Csilla Nagyne Martinak <csilla@csillger.hu>
Adds a short (require) example, along with a few words on why macros can't be imported.
Closes#966.
Signed-off-by: Csilla Nagyne Martinak <csilla@csillger.hu>
Comparison operators such as =, !=, <, >, <=, >= should support a
one-arity version too, and return true in those cases (except for !=,
which returns false).
This closes#949.
Reported-by: Matthew Egan Odendahl
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This changes with syntax from (with [[x (expr)] (expr)] ...) to (with
[x (expr) (expr)] ...). Should have no ill side effects apart from the
syntax change.
Closes#852.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This changes let to use a flat list of symbol-value pairs instead of a
vector of vectors. One side effect is that (let [[a 1] z]) is not
expressible now, and one will explicitly need to set a nil value for z,
such as: (let [a 1 z nil]).
Closes#713.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
apply now mangles strings and keywords according to the Hy mangling
rules (by using the same function, now imported from
hy.lex.parser). With this change, if the dict passed to apply has
keywords, strings or quoted symbols, they'll get mangled, to turn them
into proper keys.
This only works for the cases where the keys are directly in the apply
params. A previously deffed dict, or key through a variable will not be
mangled.
This closes#219.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
To make it easier to write --init-- functions, defclass will now check
any (setv) expressions (and its property list), to find any --init--
declarations, and append a nil to the end.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
On 21 September, all the continuous integration checks on a revision of
pull-request #920 were observed to fail with a "CoverageException:
Unrecognized option '[run] exclude_lines=' in config file
.coveragerc". One can only imagine that this was due to it trying to use
the new version 4.0 of Ned Batchelder's ever-popular coverage.py (just
released on 20 September), with which our existing .coveragerc would
seem to have not been compatible.
Re-indent `fib` examples to match that in original blog post - "Indentation shall be two spaces, except where matching the indentation of the previous line"