diff --git a/NEWS.rst b/NEWS.rst index a2c047b..a52a2ae 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -3,6 +3,12 @@ Unreleased ============================== +Removals +------------------------------ +* Dotted lists, `HyCons`, `cons`, `cons?`, and `list*` have been removed. + These were redundant with Python's built-in data structures and Hy's most + common model types (`HyExpression`, `HyList`, etc.). + Other Breaking Changes ------------------------------ * Mangling rules have been overhauled, such that mangled names diff --git a/docs/language/core.rst b/docs/language/core.rst index 4df50c8..7c8963c 100644 --- a/docs/language/core.rst +++ b/docs/language/core.rst @@ -98,49 +98,6 @@ inverted. So, ``((complement f) x)`` is equivalent to ``(not (f x))``. True -cons ----- - -.. versionadded:: 0.10.0 - -Usage: ``(cons a b)`` - -Returns a fresh :ref:`cons cell ` with car *a* and cdr *b*. - -.. code-block:: hy - - => (setv a (cons 'hd 'tl)) - - => (= 'hd (get a 0)) - True - - => (= 'tl (cut a 1)) - True - - -cons? ------ - -.. versionadded:: 0.10.0 - -Usage: ``(cons? foo)`` - -Checks whether *foo* is a :ref:`cons cell `. - -.. code-block:: hy - - => (setv a (cons 'hd 'tl)) - - => (cons? a) - True - - => (cons? None) - False - - => (cons? [1 2 3]) - False - - .. _constantly: constantly @@ -606,41 +563,6 @@ Check whether *foo* is a :ref:`keyword`. => (keyword? foo) False -.. _list*-fn: - -list* ------ - -Usage: ``(list* head &rest tail)`` - -Generates a chain of nested cons cells (a dotted list) containing the -arguments. If the argument list only has one element, return it. - -.. code-block:: hy - - => (list* 1 2 3 4) - - => (list* 1 2 3 [4]) - [HyInteger(1), HyInteger(2), HyInteger(3), 4] - => (list* 1) - 1 - => (cons? (list* 1 2 3 4)) - True - => (list* 1 10 2 20 '{}) - HyDict([ - HyInteger(1), HyInteger(10), - HyInteger(2), HyInteger(20)]) - => (list* 1 10 2 20 {}) - .. _macroexpand-fn: diff --git a/docs/language/internals.rst b/docs/language/internals.rst index 155ab0a..3c5e0b1 100644 --- a/docs/language/internals.rst +++ b/docs/language/internals.rst @@ -168,39 +168,6 @@ HyKeyword ``hy.models.HyKeyword`` represents keywords in Hy. Keywords are symbols starting with a ``:``. See :ref:`syntax-keywords`. -.. _hycons: - -Cons Cells -========== - -``hy.models.HyCons`` is a representation of Python-friendly `cons -cells`_. Cons cells are especially useful to mimic features of "usual" -LISP variants such as Scheme or Common Lisp. - -.. _cons cells: https://en.wikipedia.org/wiki/Cons - -A cons cell is a 2-item object, containing a ``car`` (head) and a -``cdr`` (tail). In some Lisp variants, the cons cell is the fundamental -building block, and S-expressions are actually represented as linked -lists of cons cells. This is not the case in Hy, as the usual -expressions are made of Python lists wrapped in a -``HyExpression``. However, the ``HyCons`` mimics the behavior of -"usual" Lisp variants thusly: - - - ``(cons something None)`` is ``(HyExpression [something])`` - - ``(cons something some-list)`` is ``((type some-list) (+ [something] - some-list))`` (if ``some-list`` inherits from ``list``). - - ``(get (cons a b) 0)`` is ``a`` - - ``(cut (cons a b) 1)`` is ``b`` - -Hy supports a dotted-list syntax, where ``'(a . b)`` means ``(cons 'a -'b)`` and ``'(a b . c)`` means ``(cons 'a (cons 'b 'c))``. If the -compiler encounters a cons cell at the top level, it raises a -compilation error. - -``HyCons`` wraps the passed arguments (car and cdr) in Hy types, to ease -the manipulation of cons cells in a macro context. - Hy Internal Theory ==================