Merge pull request #1752 from TristanCacqueray/master

Add array indexes cut tutorial
This commit is contained in:
Kodi Arfer 2019-03-13 09:12:30 -04:00 committed by GitHub
commit 49c9d8a845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,6 @@ Tutorial
.. TODO
..
.. - How do I index into arrays or dictionaries?
.. - How do I do array ranges? e.g. x[5:] or y[2:10]
.. - Blow your mind with macros!
.. - Where's my banana???
@ -342,6 +341,19 @@ The equivalent in Hy would be:
(for [i (range 10)]
(print (+ "'i' is now at " (str i))))
Python's collections indexes and slices are implemented
by the ``get`` and ``cut`` built-in:
.. code-block:: clj
(setv array [0 1 2])
(get array 1)
(cut array -3 -1)
which is equivalent to::
array[1]
array[-3:-1]
You can also import and make use of various Python libraries. For
example: