diff --git a/docs/contrib/hy_repr.rst b/docs/contrib/hy_repr.rst index fae2625..4b0bf9a 100644 --- a/docs/contrib/hy_repr.rst +++ b/docs/contrib/hy_repr.rst @@ -67,8 +67,8 @@ your choice to the keyword argument ``:placeholder`` of .. code-block:: hy (defclass Container [object] - [__init__ (fn [self value] - (setv self.value value))]) + (defn __init__ (fn [self value] + (setv self.value value)))) (hy-repr-register Container :placeholder "HY THERE" (fn [x] (+ "(Container " (hy-repr x.value) ")"))) (setv container (Container 5)) diff --git a/docs/language/api.rst b/docs/language/api.rst index 6b243ba..ca967a5 100644 --- a/docs/language/api.rst +++ b/docs/language/api.rst @@ -430,16 +430,16 @@ Whereas ``setv`` creates an assignment statement, ``setx`` creates an assignment defclass -------- -New classes are declared with ``defclass``. It can take three optional parameters in the following order: -a list defining (a) possible super class(es), a string (:term:`py:docstring`) and another list containing -attributes of the new class along with their corresponding values. +New classes are declared with ``defclass``. It can take optional parameters in the following order: +a list defining (a) possible super class(es) and a string (:term:`py:docstring`). .. code-block:: clj (defclass class-name [super-class-1 super-class-2] "docstring" - [attribute1 value1 - attribute2 value2] + + (setv attribute1 value1) + (setv attribute2 value2) (defn method [self] (print "hello!"))) @@ -449,8 +449,8 @@ below: .. code-block:: clj => (defclass Cat [] - ... [age None - ... colour "white"] + ... (setv age None) + ... (setv colour "white") ... ... (defn speak [self] (print "Meow"))) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index cb2b272..e7dfa44 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -527,9 +527,9 @@ In Hy: .. code-block:: clj (defclass Customer [models.Model] - [name (models.CharField :max-length 255) - address (models.TextField) - notes (models.TextField)]) + (setv name (models.CharField :max-length 255)) + (setv address (models.TextField)) + (setv notes (models.TextField))) Macros ======