Commit Graph

1417 Commits

Author SHA1 Message Date
Gergely Nagy
fa24042cb0 hy.contrib.walk: Add (macroexpand-all)
This function will recursively perform all possible macroexpansions in
the supplied form. Unfortunately, it also traverses into quasiquoted
parts, where it shouldn't, but it is a useful estimation of macro
expansion anyway.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-02-01 18:34:12 +01:00
Gergely Nagy
817b4688d8 hy.contrib.walk: New contrib module for walking the Hy AST
The hy.contrib.walk module provides a few functions to walk the Hy AST,
and potentially transform it along the way. The main entry point
is (walk), which takes two functions and a form as arguments, and
applies the first (inner) function to each element of the form, building
up a data structure of the same type as the original. Then applies outer
(the second function) to the result.

Two convenience functions are provided: (postwalk) and (prewalk), which
do a depth-first, post/pre-order traversal of the form.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-02-01 18:34:12 +01:00
Berker Peksag
a318afea3a Port update_coreteam.py to Hy. 2014-01-31 03:43:03 +02:00
Abhishek L
4b54e3c748 Merge master onto pr/471
Conflicts:
	hy/core/language.hy
2014-01-30 21:50:23 +05:30
Abhishek L
6a497886b0 Merge master onto pr/486 2014-01-30 19:28:10 +05:30
halit
afff5fd93b Add new author 2014-01-30 15:55:30 +02:00
Berker Peksag
f0dd5ba74c Move all badges to top of README. 2014-01-30 08:31:59 +02:00
Berker Peksag
b8ef4ccc3c Update tutorial.
- Fix a couple of typos
- Use open() built-in instead of file()
- Update (for) and (with) examples
2014-01-30 08:27:25 +02:00
Abhishek L
76b9e7c5cd Merge master onto pr/482 2014-01-29 20:25:14 +05:30
Abhishek L
bb5dac8af9 Merge master onto pr/473 2014-01-29 19:31:46 +05:30
Halit Alptekin
75748eb05d Fix unicode error #483 2014-01-29 15:58:49 +02:00
Gergely Nagy
f17e52f1e5 README.md: Add Adderall to Hylarious Hacks
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
2014-01-29 10:09:21 +01:00
J Kenneth King
20d27b23e9 Merge pull request #480 from agentultra/digit-char
Add integer-char? to core
2014-01-28 15:15:22 -08:00
James King
cbb8cc1d37 Add integer-char? to core 2014-01-28 17:28:41 -05:00
Brian McKenna
6bfc4a8471 Attempt to fix HyDict#items for Python 3
Looks like Python 3 changed `zip` to returning an iterable and not a
list. We should be good to just wrap the call in `list`.
2014-01-26 10:56:40 -07:00
Brian McKenna
990d901d65 Fix single spaces between methods in test_dict.py 2014-01-25 20:29:09 -07:00
Brian McKenna
13a88b358e Add Brian McKenna to AUTHORS 2014-01-25 18:15:49 -07:00
Brian McKenna
cef7091708 Add tests for HyDict methods 2014-01-25 18:15:17 -07:00
Brian McKenna
0177541d9b Add items, values and keys methods to HyDict
Useful for macros, for example:

    (defmacro defn-checked [n x b]
      `(defn ~n [(unquote-splice (.keys x))]
        (print "Expecting:" (unquote-splice (.values x))) ~b))

    (defn-checked hello {name str age int}
      (print "Hello" name "you are" age))

    (hello "Godzilla" 60)

    ;; Expecting: <type 'str'> <type 'int'>
    ;; Hello Godzilla you are 60
2014-01-25 15:55:38 -07:00
Morten Linderud
429cba39b9 Merge pull request #474 from berkerpeksag/hyc-doc
Document hyc command line options.
2014-01-25 12:19:51 -08:00
Berker Peksag
65f8bd2b91 Document hyc command line options. 2014-01-25 21:43:08 +02:00
Berker Peksag
d842426308 Reorganize documentation. 2014-01-25 21:01:16 +02:00
Nicolas Dandrimont
52144820ca Add a cons object and related mechanisms
Closes: #183
2014-01-23 23:08:52 +01:00
Nicolas Dandrimont
bb2b868aaf Make empty macroexpansions do the right thing 2014-01-23 23:07:31 +01:00
Nicolas Dandrimont
54757b8316 Slicing a HyList makes the same kind of object again 2014-01-23 23:07:31 +01:00
Nicolas Dandrimont
fad67bd8f5 Merge branch 'master' into pr/468 2014-01-23 22:14:23 +01:00
Nicolas Dandrimont
b99af411c8 Merge branch 'master' into pr/461
Conflicts:
	tests/native_tests/native_macros.hy
2014-01-23 21:57:17 +01:00
Nicolas Dandrimont
7b8f6fa9e4 Merge branch 'master' into pr/456 2014-01-23 21:43:09 +01:00
Abhishek L
10f1f24a18 Adding a simple `identity' function
* hy/core/language.hy: Adding a simple `identity` function that returns
  the argument supplied to it

* docs/language/core.rst: Updated docs with identity function
2014-01-22 00:56:28 +05:30
Abhishek L
e71631f48f Wrong email id, I messed up that commit 2014-01-20 22:46:17 +05:30
Abhishek L
4d95cc48a5 Add @jackhooper to authors 2014-01-20 21:17:22 +05:30
Abhishek L
fdd2ed39f0 Merge master onto pr/460 2014-01-20 21:15:43 +05:30
Morten Linderud
3ca89b1caa Merge pull request #462 from jackhooper/master
Corrected --spy cmdoption (I think)
2014-01-19 19:36:50 -08:00
Jack Hooper
ca40113e37 Corrected --spy cmdoption (I think)
For the --spy commmand line option, it currently says '''Print equivalent Hy code...'''. Now, I haven't actually gotten around to installing Hy on my computer yet, so I haven't had a chance to test this out to make sure, but from the looks of the code example, it looks as though it is printing out the equivalent Python code of the executed Hy code, not the other way around. This would certainly make more sense. As such, I have changed the word 'Hy' to 'Python' so that the documentation more accurately reflects what (one assumes) is going on.
2014-01-20 14:29:57 +11:00
Gergely Nagy
3bad6c14ee
hy/core/macros.hy: Reimplement (unless) in terms of (if-not)
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-18 22:57:29 +01:00
Gergely Nagy
e90b24b73a
hy/core/macros.hy: Add an (if-not) macro
Sometimes it is better to start with the false condition, sometimes that
makes the code clearer. For that, the (if-not) macro, which simply
reverses the order of the condition blocks, can be of great use.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-18 22:56:20 +01:00
Gergely Nagy
21709f0199 hy/core/macros.hy: Add defn-alias / defun-alias
In the same vein as defmacro-alias, this implements defn-alias /
defun-alias, which does essentially the same thing as defmacro-alias,
but for functions.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
2014-01-18 16:09:35 +01:00
Jack Hooper
d028b8a7b2 Added closing bracket ']' 2014-01-18 22:22:33 +11:00
Jack Hooper
06d41f7cd0 Corrected chessboard example
A chessboard is 8 x 8. Yours was 8 x 9.
2014-01-18 16:33:40 +11:00
Nicolas Dandrimont
8447a9dfdb Merge branch 'master' into pr/455 2014-01-17 20:35:44 +01:00
Nicolas Dandrimont
3286271cb8 Merge branch 'master' into pr/454 2014-01-17 20:32:50 +01:00
Nicolas Dandrimont
331165da32 Merge branch 'master' into pr/450 2014-01-17 20:31:01 +01:00
Nicolas Dandrimont
27962fb441 Light copy-editing 2014-01-17 20:28:24 +01:00
Nicolas Dandrimont
eedebd12b3 Merge branch 'master' into pr/443 2014-01-17 20:25:09 +01:00
Nicolas Dandrimont
2094133193 Merge branch 'master' into pr/441 2014-01-17 20:23:49 +01:00
Nicolas Dandrimont
4022203496 Merge branch 'master' into pr/440 2014-01-17 20:20:39 +01:00
Nicolas Dandrimont
1b435a9a2a Merge branch 'master' into pr/439 2014-01-17 20:18:43 +01:00
Nicolas Dandrimont
e0f9c9c191 Merge branch 'master' into pr/438 2014-01-17 20:14:16 +01:00
Nicolas Dandrimont
512f14d195 Merge branch 'master' into pr/437 2014-01-17 20:09:39 +01:00
rubberduckdev
d273ad112f Rewording and reformatting plaintext
Is this rewording unwieldy?
2014-01-17 18:20:41 +02:00