hy/docs/quickstart.rst

55 lines
1.4 KiB
ReStructuredText
Raw Normal View History

2013-04-05 22:30:12 +02:00
==========
Quickstart
==========
.. image:: _static/cuddles-transparent-small.png
2013-06-02 04:02:52 +02:00
:alt: Karen Rustard's Cuddles
(Thanks to Karen Rustad for Cuddles!)
2013-06-02 04:02:52 +02:00
**HOW TO GET HY REAL FAST**:
2013-04-05 22:30:12 +02:00
1. Create a `Virtual Python Environment
<https://pypi.python.org/pypi/virtualenv>`_.
2. Activate your Virtual Python Environment.
3. Install `hy from GitHub <https://github.com/hylang/hy>`_ with ``$ pip install git+https://github.com/hylang/hy.git``.
4. Start a REPL with ``hy``.
5. Type stuff in the REPL::
2013-04-05 22:30:12 +02:00
=> (print "Hy!")
Hy!
=> (defn salutationsnm [name] (print (+ "Hy " name "!")))
2013-04-05 22:30:12 +02:00
=> (salutationsnm "YourName")
Hy YourName!
etc
6. Hit CTRL-D when you're done.
2018-03-27 04:47:12 +02:00
7. If you're familiar with Python, start the REPL using ``hy --spy`` to check what happens inside::
2018-03-27 02:56:11 +02:00
=> (+ "Hyllo " "World" "!")
'Hyllo ' + 'World' + '!'
'Hyllo World!'
2013-04-05 22:30:12 +02:00
*OMG! That's amazing! I want to write a Hy program.*
2013-04-05 22:30:12 +02:00
2018-03-27 02:56:11 +02:00
8. Open up an elite programming editor and type::
2013-04-05 22:30:12 +02:00
#! /usr/bin/env hy
(print "I was going to code in Python syntax, but then I got Hy.")
2013-04-05 22:30:12 +02:00
2018-03-27 02:56:11 +02:00
9. Save as ``awesome.hy``.
10. Make it executable::
2013-04-06 03:27:30 +02:00
chmod +x awesome.hy
2013-04-06 03:38:18 +02:00
2018-03-27 02:56:11 +02:00
11. And run your first Hy program::
./awesome.hy
2018-03-27 02:56:11 +02:00
12. Take a deep breath so as to not hyperventilate.
13. Smile villainously and sneak off to your hydeaway and do
unspeakable things.