From 6d00df393265b99e458c895777463ca9e84d4c22 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 9 Dec 2015 11:48:44 +0100 Subject: [PATCH] docs: Add some documentation about #! Add the #! syntax to the quickstart guide, and to the tutorial as well. Fixes #992. Signed-off-by: Gergely Nagy --- docs/quickstart.rst | 13 +++++++++---- docs/tutorial.rst | 7 +++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 1809a1f..24bca21 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -31,13 +31,18 @@ Quickstart 7. Open up an elite programming editor and type:: + #! /usr/bin/env hy (print "I was going to code in Python syntax, but then I got Hy.") 8. Save as ``awesome.hy``. -9. And run your first Hy program:: +9. Make it executable:: - hy awesome.hy + chmod +x awesome.hy -10. Take a deep breath so as to not hyperventilate. -11. Smile villainously and sneak off to your hydeaway and do +10. And run your first Hy program:: + + ./awesome.hy + +11. Take a deep breath so as to not hyperventilate. +12. Smile villainously and sneak off to your hydeaway and do unspeakable things. diff --git a/docs/tutorial.rst b/docs/tutorial.rst index cf76538..91b4062 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -306,6 +306,13 @@ Comments start with semicolons: ; (print "but this will not") (+ 1 2 3) ; we'll execute the addition, but not this comment! +Hashbang (``#!``) syntax is supported: + +.. code-block:: clj + + #! /usr/bin/env hy + (print "Make me executable, and run me!") + Looping is not hard but has a kind of special structure. In Python, we might do::