From 8fb7706a686ce1b53fd3d443a53702f27f3038e5 Mon Sep 17 00:00:00 2001 From: John Patterson Date: Wed, 8 Mar 2017 22:39:41 -0600 Subject: [PATCH 1/2] Added class use example to tutorial I was following along and noticed that it wasn't actually explained how to _use_ the object we just made. I include both the `setv` style of writing the Hy as we've been using in the rest of the docs up to this point and a more LISP-y style use of the object. --- docs/tutorial.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index fb8777e..50f0e73 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -476,6 +476,11 @@ like:: Return our copy of x """ return self.x + +And we might use it like:: + + bar = FooBar(1) + print bar.get_x() In Hy: @@ -491,7 +496,20 @@ In Hy: (defn get-x [self] "Return our copy of x" self.x)) + +And we can use it like: +.. code-block:: clj + + (setv bar (FooBar 1)) + (print (bar.get-x)) + +Or using the leading dot syntax! + +.. code-block:: clj + + (print (.get-x (FooBar 1))) + You can also do class-level attributes. In Python:: From 520b83d40bb42172a4957c575cc2f7524cd7faa1 Mon Sep 17 00:00:00 2001 From: John Patterson Date: Thu, 9 Mar 2017 08:16:23 -0600 Subject: [PATCH 2/2] Updated AUTHORS file As per CONTRIBUTING documentation, here is a seperate commit to add my entry to AUTHORS.rst. --- AUTHORS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/AUTHORS b/AUTHORS index ce2c543..d0bd025 100644 --- a/AUTHORS +++ b/AUTHORS @@ -75,3 +75,5 @@ * Sergey Sobko * Philip Xu * Charles de Lacombe +* John Patterson +