Commit Graph

296 Commits

Author SHA1 Message Date
Kodi Arfer
cebb820b6c Update NEWS and docs for return 2017-08-20 08:45:17 -07:00
Ryan Gonzalez
dea99c8b76 Merge pull request #1354 from gilch/comment-discard
add #_ discard syntax
2017-08-19 11:29:57 -05:00
Kodi Arfer
8d40a68232 Initialize the return variable of with 2017-08-19 07:35:41 -07:00
Jordan Danford
c67b8bccb9 Expose read, read_str, and eval in Python
- Expose `read`, `read_str`, and `eval` in Python
- Add string evaluation example to interop section of docs
- Add test for `eval`
- Explain `eof` keyword argument in `read` docstring
2017-08-05 17:29:15 -07:00
gilch
4dd57c84ee NEWS and docs for (comment ...) and #_ 2017-08-04 16:37:39 -06:00
Kodi Arfer
e8ffd41202 Merge pull request #1349 from woodrush/fix-unquote-splice-none
Allow `unquote-splice` to accept any false value as empty
2017-08-02 19:50:47 -04:00
Kodi Arfer
ecc974de1e Implement Python 2 exec
The implementation of `hy.core.language.exec` draws code from the `exec_` function in commit f574c7be6ebc80041ef58ca29588f310248ebed4 of the library Six, which is copyright 2010–2017 Benjamin Peterson and licensed under the Expat license.
2017-08-02 13:33:59 -04:00
Hikaru Ikuta
dbffe987f5 Update docs on unquote-splice 2017-08-02 18:03:24 +09:00
Kodi Arfer
3f3cce8785 Update docs: apply is gone; #* and #** are in 2017-07-19 11:00:43 -07:00
Kodi Arfer
bb91b57dca Require capitalizing NaN and Inf like so 2017-07-10 08:50:49 -07:00
Kodi Arfer
ca95194240 Change eval from a special form to a function 2017-06-27 08:14:29 -06:00
gilch
6cd3201421 rename sharp macros to tag macros 2017-06-22 22:48:46 -06:00
gilch
20c26a52e4 make sharp macros take arbitrary identifiers
Previously, only a single character was allowed.
2017-06-22 22:46:24 -06:00
neil-lindquist
d3df17d9d8 Modify cond to support single argument branches 2017-06-10 08:30:53 -07:00
Kodi Arfer
dffa2811e6 Return from the else clause of a try form
I overhauled the documentation of `try` while I was editing it.
2017-05-25 20:48:09 -05:00
Kodi Arfer
e15992829d Simplify docs/conf.py 2017-05-23 11:28:34 -07:00
Yuval Langer
687d750a88 Remove stray use of setf in documentation 2017-05-19 13:36:06 -07:00
Kodi Arfer
4c38e2c9dd Rename reader macros to "sharp macros" (#1282)
They're not actually reader macros, since their arguments are parsed s-expressions, like a regular macro, not pre-parsed source text.
2017-04-21 10:07:48 -05:00
Kodi Arfer
18acfe6495 Revert the extension of with-decorator to setv
This is no longer necessary now that `defn` always produces a `FunctionDef`.

To compensate, I've made small edits to two contrib modules and reverted a small test change.
2017-04-13 06:36:00 +03:00
Kodi Arfer
bb9f543246 Merge pull request #1265 from tuturto/repl-doc
Add --repl-output-fn into command line docs
2017-04-01 08:01:43 -07:00
Kodi Arfer
36d09cb194 More documentation of strings and keywords
Currently, HyKeyword is not in fact a subclass of HyString, so I removed that statement.
2017-04-01 08:23:41 +03:00
Tuukka Turto
5b2d823028 Add --repl-output-fn into command line docs 2017-04-01 08:10:45 +03:00
Kai Lüke
80f0e4af14 fix example in documentation to unquote in quasi quote 2017-03-09 15:02:23 +01:00
Kodi Arfer
8b6a45e43a Remove car and cdr in favor of first and rest (#1241)
* Remove uses of `car` and `cdr` in /hy

* Remove uses of `car` and `cdr` in quote tests

* Remove `car` and `cdr` in favor of `first` and `rest`

I beefed up the documentation and tests for `first` and `rest` while I was at it.

I defined `car` and `cdr` in native_tests.cons so the tests read a bit more naturally.
2017-03-06 10:34:40 -06:00
Kodi Arfer
484daafa53 Move hy.core.reserved to hy.extra.reserved (#1231)
It was an odd one out by being in hy.core but needing to be called by a qualified name. It's at home in hy.extra.
2017-03-02 16:49:32 -06:00
Tuukka Turto
8b84114869 Document get in nested structure (#1236) 2017-02-24 14:22:27 -08:00
Kodi Arfer
e4a7b317e1 Make fn work like lambda and remove lambda (#1228)
* with-decorator: Allow a `setv` form as the form to be decorated

This feature is of dubious value by itself, but it's necessary to allow `defn` to create a lambda instead of a `def`.

* Make `fn` work the same as `lambda`

That is, allow it to generate a `lambda` instead of a `def` statement if the function body is just an expression.

I've removed two uses of with_decorator in hy.compiler because they'd require adding another case to HyASTCompiler.compile_decorate_expression and they have no ultimate effect, anyway.

In a few tests, I've added a meaningless statement in `fn` bodies to force generation of a `def`.

I've removed `test_fn_compiler_empty_function` rather than rewrite it because it seems like a pain to maintain and not very useful.

* Remove `lambda`, now that `fn` does the same thing
2017-02-22 17:36:52 -06:00
Kodi Arfer
45b7a4ac9d Add bytestring literals 2017-02-19 09:04:45 +02:00
Kodi Arfer
ace125ee9b Consolidate hy.models.* and tests/models/* into one file apiece
They were a lot of similar, tiny files.
2017-02-16 19:43:00 -08:00
Kodi Arfer
f3edeb99ae Allow commas and underscores in numeric literals
You can use them as thousands separators.

This change differs from PEP 515 in that not only does it allow commas in addition to underscores, but it's much more liberal about placement. Any number of underscores or commas can be placed anywhere, even at the start.
2017-02-15 09:03:24 +02:00
Kodi Arfer
1d6de2792e Merge branch 'let-it-be' 2017-02-13 09:19:37 -08:00
Kodi Arfer
3ec919278d Remove let from documentation 2017-02-13 09:12:21 -08:00
Charles de Lacombe
83cdaf0a71 Docs: Hy <-> Python interop fix #1061 (#1218)
* Docs: Hy <-> Python interop fix #1061

I separated the existing text in two sections, with some additional
explanations and a link to Hy's `import`.

* added interop page

* simplified interop section in tutorial

* remove the TODO from interop section in tutorial

Because yay

* Corrections from @Kodiologist

I kept the part about mangling, but added a warning about its incompleteness. I
think it can be useful for somebody who just wants to use a Python module in his
code. Maybe it can be removed when the actual documentation for mangling is
written.

* Added myself to AUTHORS.

I'll do my best to be worthy of it. Thanks for this awesome project!
2017-02-10 17:11:21 -08:00
Jakub Wilk
99d31d153c Use HTTPS for github.com, docs.python.org and notes.pault.ag URLs (#1219)
* Use HTTPS for github.com

* Use HTTPS for docs.python.org

* Use HTTPS for notes.pault.ag
2017-02-07 13:25:40 -06:00
Kodi Arfer
9ca7f49c88 Make xor return single true inputs
The documentation should now be correct (#1214).
2017-02-03 22:25:38 +02:00
Kodi Arfer
2dd1432b07 Docs: add an example of evaluating a string 2017-01-19 09:26:12 -08:00
Kodi Arfer
5df8f38d75 Merge branch 'itertools-docs' 2017-01-04 15:14:04 -08:00
Kodi Arfer
c8171bc0c5 Itertools docs edits 2017-01-04 15:11:54 -08:00
gilch
b9106de1ab list all itertools 2017-01-04 13:04:41 -07:00
Kodi Arfer
0c4d416a37 juxt documentation edits 2016-12-26 13:26:44 -08:00
Philip Xu
7dfb9602f8 Add juxt documentation 2016-12-25 17:02:51 -05:00
Philip Xu
24359336f7 Remove trailing whitespace 2016-12-25 16:59:41 -05:00
Tuukka Turto
71f30e845d Add comp, constantly and complement (#1179)
* Add comp, constantly and complement

relates #1176

* Fix composition order in comp

* comp without parameters returns identity

* Doc edits for comp, complement, constantly

* Test that `(comp)` returns `identity` exactly

* Simplify the `reduce` call in `comp`

* updated version of comp
2016-12-25 13:11:25 -07:00
accraze
0379fa1b36 added itertools docs
fixes #954
2016-12-22 16:20:30 -08:00
Tuukka Turto
e588b4928d add defmacro! and fix macro expansion error message (#1172)
* added defmacro!

* revert #924

#924 had an error and should never have been merged in the first place. (see #903)

* put back import getargspec

Without the `formatargspec` this time.

* Give better error message on failed macro expansion

Better error messages work most of the time. In cases where there are
parameters that aren't valid in Python, error message shown is rather
ugly. But this is better than no error messages at all and such
macros with strange parameter names are rather rare.

* fix flake8 errors

* Minor English improvements
2016-12-14 18:10:46 -06:00
Kodi Arfer
28b9874efd Add an example of using argparse with defmain
Closes #1091.
2016-12-13 08:57:31 -08:00
Kodi Arfer
5b85990d87 Add a module for getting reserved words (#1171)
This is helpful for writing syntax highlighters (e.g., https://github.com/hylang/hy/pull/1170).
2016-12-12 10:11:42 +02:00
Kodi Arfer
ed8e37da62 Burninate the synonyms true, false, and nil
Per the straw poll in #908, as an alternative to #1147.

Now you must use `True`, `False`, and `None`, as in Python. Or just assign `true` to `True`, etc.; the old synonyms aren't reserved words anymore.
2016-11-23 18:35:17 -08: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