Commit Graph

1900 Commits

Author SHA1 Message Date
Tuukka Turto
a7f6d1d3f7 Add support for multiple statements in sequences 2016-11-09 08:52:18 +02:00
Tuukka Turto
584a40d9c0 Update tests to work with Pytho 2.x
In Python 2.x (range 10) is mapped to xrange(10) in Python
terms. However, xrange doesn't support slicing, which caused tests to
fail. By forxing xrange into list, we have slicing available.
2016-11-09 05:07:31 +02:00
Tuukka Turto
241d554b0b Add lazy sequences into contrib 2016-11-08 21:23:49 +02:00
Kodi Arfer
2242097b6b Translate (.a.b.c x) to x.a.b.c(). (#1105)
Translate (.a.b.c x) to x.a.b.c().

This is useful for, e.g., calling the Series.str.lower method in pandas.
2016-11-07 19:45:25 +02:00
Tuukka Turto
f60ed24c29 Add docs and tests for as-> macro (#1141)
Add docs and tests for as-> macro

Closes #1047
2016-11-03 10:20:26 +02:00
Kodi Arfer
14fddbe6c3 Give require the same features as import (#1142)
Give `require` the same features as `import`

You can now do (require foo), (require [foo [a b c]]), (require [foo [*]]), and (require [foo :as bar]). The first and last forms get you macros named foo.a, foo.b, etc. or bar.a, bar.b, etc., respectively. The second form only gets the macros in the list.

Implements #1118 and perhaps partly addresses #277.

N.B. The new meaning of (require foo) will cause all existing code that uses macros to break. Simply replace these forms with (require [foo [*]]) to get your code working again.

There's a bit of a hack involved in the forms (require foo) or (require [foo :as bar]). When you call (foo.a ...) or (bar.a ...), Hy doesn't actually look inside modules. Instead, these (require ...) forms give the macros names that have periods in them, which happens to work fine with the way Hy finds and interprets macro calls.

* Make `require` syntax stricter and add tests

* Update documentation for `require`

* Documentation wording improvements

* Allow :as in `require` name lists
2016-11-03 09:35:58 +02:00
Tuukka Turto
0abc218ae0 Merge branch 'master' into pr/1135 2016-10-25 15:10:21 +03:00
Tuukka Turto
d969ed63d6 Merge branch 'master' into pr/1081 2016-10-20 19:23:57 +03:00
Tuukka Turto
1459eea697 Merge branch 'master' into pr/1048 2016-10-20 19:19:21 +03:00
Tuukka Turto
9ee9f3a55a Merge branch 'master' into pr/1131 2016-10-20 19:12:33 +03:00
gilch
498c73d7e7 Merge pull request #1132 from Kodiologist/remove-type-checks
Don't check the type of arguments to `inc`, `odd?`, etc.
2016-10-15 13:40:41 -06:00
Kodi Arfer
ac01c0f03f Changed version punctuation for PEP 440 compliance
They now look like:  0.11.0+295.gec6e264.dirty
instead of:          0.11.0-295-gec6e264-dirty
2016-10-13 13:41:14 -07:00
Kodi Arfer
ec6e264753 Allow calling setup.py from a subdirectory 2016-10-13 13:32:13 -07:00
Kodi Arfer
23c457cee5 Generate hy.version using git describe 2016-10-12 17:11:44 -07:00
Ryan Gonzalez
34304c41c7 Test Python 3.6 apart from nightly (#1133)
* Test Python 3.6 apart from nightly (ref. #1113) change to `3.6-dev`
2016-10-12 16:11:46 -06:00
Kodi Arfer
0eb4076768 Require Python 3 for neg? and pos? type tests
Python 2 allows 2 < "hello" and the like.
2016-10-11 20:14:14 -07:00
Kodi Arfer
cd1d12565d Assertion-testing style edit 2016-10-11 15:48:40 -07:00
Kodi Arfer
4b0296d257 Don't check the type of arguments to inc, odd?, etc.
This allows them to be used with numeric types that aren't built in, such as NumPy arrays. Because Python uses duck typing, there's generally no way to know in advance whether a given value will accept a given operator. Of course, things like `(inc "hello")` will still raise a `TypeError`, because so does `(+ "hello" 1)`.
2016-10-11 14:04:50 -07:00
Kodi Arfer
108537a4e0 Allow &rest after &optional, like Python 2016-10-11 13:31:22 -07:00
Ryan Gonzalez
11481aba78 Merge pull request #1130 from ElGoreLoco/patch-1
Remove invalid `)` from URL
2016-10-09 08:31:16 -05:00
Jorge
72ded830b6 Remove invalid ) from URL 2016-10-09 13:01:08 +02:00
Ryan Gonzalez
790a1a9456 Merge pull request #1129 from bheesham/makefile
Add PHONY targets; wrap call to recursive make; add path to find.
2016-10-05 08:43:32 -05:00
Bheesham Persaud
1711b1f5ad Add PHONY targets; wrap call to recursive make; add path to find.
I've marked added the rest of the phony build targets; wrapped the
recursive make call[0], and added the path specifier to the find
command for compatibility with BSD find.

[0]: https://www.gnu.org/software/make/manual/html_node/Recursion.html
2016-10-04 21:53:59 -04:00
Ryan Gonzalez
7867ebd049 Merge pull request #1123 from Kodiologist/double-hyphen-version
Allow --version as a synonym for -v
2016-09-29 11:42:32 -05:00
Kodi Arfer
a33f80b2ce Allow --version as a synonym for -v
--version is a GNU standard that is also common for non-GNU programs, such as Python.
2016-09-29 09:18:04 -07:00
Ryan Gonzalez
77d922c592 Merge pull request #1122 from Kodiologist/hyset-fixes
Don't sort or deduplicate the items in a HySet
2016-09-27 13:32:25 -05:00
Kodi Arfer
0880610401 Don't sort or deduplicate the items in a HySet
Fixes #1120.

I also added hy.models._wrapper[set] so a macro can return an ordinary set in place of a HySet.
2016-09-26 09:47:04 -07:00
gilch
399d2bcf21 clarify documentation of import (#1121)
* clarify documentation of import

Add a comment showing the equivalent python of the long example, and demonstrate how to get `from` and `as` on the same line.

* add python example comment in last import example
2016-09-25 21:29:53 -06:00
gilch
1d3142c8de change quickstart install from PyPI to GitHub (#1116)
* change Quickstart install from PyPI to GitHub
2016-09-24 15:54:32 -06:00
gilch
f8fc1fb71b Merge pull request #1113 from zackmdavis/travis_by_night
nightly Python on Travis CI??
2016-09-24 11:48:47 -06:00
Zack M. Davis
d4494151f4 experiment: can we convince Travis CI to test with nightly Python?
The docs say that "nightly" is supported, but it's less clear exactly
what our .travis.yml should say to make this happen.
2016-09-22 23:24:14 -07:00
gilch
595e62a89a Merge pull request #1110 from Kodiologist/unary-plus-pos
Make unary + call __pos__
2016-09-22 18:16:57 -06:00
Jakukyo Friel
d81b71f242 Doc: CLI: mention --spy only works in REPL mode. (#1097) 2016-09-22 15:20:26 +03:00
Zack M. Davis
53353c58f2 fix Hy on recent Pythons
In issue #1111, @tianon reported that Hy didn't work with Python
3.6.0b1: trying to evaluate a simple expression at the REPL blew up with
`TypeError: required field "is_async" missing from comprehension`. This
was due to a grammar
change (https://www.python.org/dev/peps/pep-0530/#grammar-updates) in
the implementation (https://hg.python.org/cpython/rev/cf91a929b81a) of
PEP 530, which we can easily accomodate.
2016-09-21 22:05:53 -07:00
Jakukyo Friel
35de998871 Docs: Fix rst markup in docs/contrib/loop.rst. (#1098)
In RestrutruedText, double backtick quotes (instead of single
backtick quotes in markdown) are used for code span.
2016-09-22 03:33:32 +03:00
Jakukyo Friel
4db667322c Doc: Fix typo (missing quote) (#1096) 2016-09-22 03:32:35 +03:00
Kodi Arfer
a60b749d3e Make unary + call __pos__
Fixes #1109.

__pos__ doesn't work on strings, lists, or tuples, so I've removed some tests that required (= (+ "a") "a") etc.
2016-09-20 13:05:52 -07:00
Jakub Wilk
b94211251c Use HTTPS for Wikipedia URLs 2016-09-04 22:35:46 +02:00
Zack M. Davis
20c2cfb0b1 merge remote-tracking branch 'shellhead/walk-doc' 2016-08-21 15:08:48 -07:00
Michael Hunsinger
6a452d70a4 Added documentation for walk, postwalk and prewalk 2016-08-20 02:35:02 -06:00
Pierre-Yves
f1684e6306 Add doc and related link to good-first-bug tag (#1086)
Fixes #1031
2016-08-07 04:25:07 +03:00
Matthew Egan Odendahl
3e0d2ac08a Merge pull request #960 from kirbyfan64/kwonly_err
Give an error when &kwonly, &key or &kwargs is used in a macro definition
2016-07-07 10:43:05 -06:00
Ryan Gonzalez
d384580de1 Disallow &key in macros 2016-07-07 11:24:04 -05:00
Vinh Tu
6dc12dd703 Add import_file_to_globals for use in emacs inferior lisp mode 2016-07-01 23:27:36 +01:00
Paul Tagliamonte
1962826c1c Merge pull request #1080 from jwilk/spelling
Fix typos
2016-07-01 10:56:56 -04:00
Jakub Wilk
ff4ba5b103 Fix typos 2016-07-01 16:44:12 +02:00
John Clover
93a66c7d5e Remove redundant word (#1077)
_a_ or _some_ would work here, I opted to keep _a_
2016-06-24 15:24:20 -07:00
Matthew Egan Odendahl
e0ecaca315 Clarify as-> docstring 2016-06-19 21:14:16 -06:00
Ryan Gonzalez
1b8a70ed5c Merge pull request #1074 from jwilk/spelling
Fix typo
2016-06-10 18:23:10 -05:00
Jakub Wilk
313dff5548 Fix typo 2016-06-11 01:04:07 +02:00