2013-04-05 22:30:12 +02:00
|
|
|
==========
|
|
|
|
Quickstart
|
|
|
|
==========
|
|
|
|
|
2014-01-16 10:01:32 +01:00
|
|
|
.. image:: _static/cuddles-transparent-small.png
|
2013-06-02 04:02:52 +02:00
|
|
|
:alt: Karen Rustard's Cuddles
|
|
|
|
|
2014-01-16 10:01:32 +01:00
|
|
|
(Thanks to Karen Rustad for Cuddles!)
|
2013-06-02 04:02:52 +02:00
|
|
|
|
|
|
|
|
2014-01-16 10:01:32 +01:00
|
|
|
**HOW TO GET HY REAL FAST**:
|
2013-04-05 22:30:12 +02:00
|
|
|
|
2014-01-16 10:01:32 +01:00
|
|
|
1. Create a `Virtual Python Environment
|
2014-12-06 08:13:40 +01:00
|
|
|
<https://pypi.python.org/pypi/virtualenv>`_.
|
|
|
|
2. Activate your Virtual Python Environment.
|
2016-09-24 23:54:32 +02:00
|
|
|
3. Install `hy from GitHub <https://github.com/hylang/hy>`_ with ``$ pip install git+https://github.com/hylang/hy.git``.
|
2014-12-06 08:13:40 +01:00
|
|
|
4. Start a REPL with ``hy``.
|
2014-01-16 10:01:32 +01:00
|
|
|
5. Type stuff in the REPL::
|
2013-04-05 22:30:12 +02:00
|
|
|
|
|
|
|
=> (print "Hy!")
|
|
|
|
Hy!
|
2013-04-08 23:01:12 +02:00
|
|
|
=> (defn salutationsnm [name] (print (+ "Hy " name "!")))
|
2013-04-05 22:30:12 +02:00
|
|
|
=> (salutationsnm "YourName")
|
|
|
|
Hy YourName!
|
|
|
|
|
|
|
|
etc
|
|
|
|
|
2014-12-06 08:13:40 +01:00
|
|
|
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' + '!'
|
2018-05-16 05:29:07 +02:00
|
|
|
|
2018-03-27 02:56:11 +02:00
|
|
|
'Hyllo World!'
|
2013-04-05 22:30:12 +02:00
|
|
|
|
2014-12-07 07:05:52 +01: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
|
|
|
|
2015-12-09 11:48:44 +01:00
|
|
|
#! /usr/bin/env hy
|
2014-12-06 08:13:40 +01:00
|
|
|
(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
|
|
|
|
2015-12-09 11:48:44 +01: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::
|
2015-12-09 11:48:44 +01:00
|
|
|
|
|
|
|
./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
|
2014-12-06 08:13:40 +01:00
|
|
|
unspeakable things.
|