2013-04-05 16:30:12 -04:00
|
|
|
==========
|
|
|
|
Quickstart
|
|
|
|
==========
|
|
|
|
|
2014-01-16 11:01:32 +02:00
|
|
|
.. image:: _static/cuddles-transparent-small.png
|
2013-06-01 22:02:52 -04:00
|
|
|
:alt: Karen Rustard's Cuddles
|
|
|
|
|
2014-01-16 11:01:32 +02:00
|
|
|
(Thanks to Karen Rustad for Cuddles!)
|
2013-06-01 22:02:52 -04:00
|
|
|
|
|
|
|
|
2014-01-16 11:01:32 +02:00
|
|
|
**HOW TO GET HY REAL FAST**:
|
2013-04-05 16:30:12 -04:00
|
|
|
|
2014-01-16 11:01:32 +02:00
|
|
|
1. Create a `Virtual Python Environment
|
2014-12-05 23:13:40 -08:00
|
|
|
<https://pypi.python.org/pypi/virtualenv>`_.
|
|
|
|
2. Activate your Virtual Python Environment.
|
|
|
|
3. Install `hy from PyPI <https://pypi.python.org/pypi/hy>`_ with ``pip install hy``.
|
|
|
|
4. Start a REPL with ``hy``.
|
2014-01-16 11:01:32 +02:00
|
|
|
5. Type stuff in the REPL::
|
2013-04-05 16:30:12 -04:00
|
|
|
|
|
|
|
=> (print "Hy!")
|
|
|
|
Hy!
|
2013-04-08 17:01:12 -04:00
|
|
|
=> (defn salutationsnm [name] (print (+ "Hy " name "!")))
|
2013-04-05 16:30:12 -04:00
|
|
|
=> (salutationsnm "YourName")
|
|
|
|
Hy YourName!
|
|
|
|
|
|
|
|
etc
|
|
|
|
|
2014-12-05 23:13:40 -08:00
|
|
|
6. Hit CTRL-D when you're done.
|
2013-04-05 16:30:12 -04:00
|
|
|
|
2014-12-06 22:05:52 -08:00
|
|
|
*OMG! That's amazing! I want to write a Hy program.*
|
2013-04-05 16:30:12 -04:00
|
|
|
|
2014-01-16 11:01:32 +02:00
|
|
|
7. Open up an elite programming editor and type::
|
2013-04-05 16:30:12 -04:00
|
|
|
|
2015-12-09 11:48:44 +01:00
|
|
|
#! /usr/bin/env hy
|
2014-12-05 23:13:40 -08:00
|
|
|
(print "I was going to code in Python syntax, but then I got Hy.")
|
2013-04-05 16:30:12 -04:00
|
|
|
|
2014-12-05 23:13:40 -08:00
|
|
|
8. Save as ``awesome.hy``.
|
2015-12-09 11:48:44 +01:00
|
|
|
9. Make it executable::
|
2013-04-05 21:27:30 -04:00
|
|
|
|
2015-12-09 11:48:44 +01:00
|
|
|
chmod +x awesome.hy
|
2013-04-05 21:38:18 -04:00
|
|
|
|
2015-12-09 11:48:44 +01:00
|
|
|
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
|
2014-12-05 23:13:40 -08:00
|
|
|
unspeakable things.
|