Commit Graph

1950 Commits

Author SHA1 Message Date
Gregor Best
2d7134a1be Add (read-str) 2015-07-30 16:07:25 +02:00
Zack M. Davis
557571cc71 merge branch 'div' 2015-07-29 21:31:56 -07:00
Ryan Gonzalez
016d25d104 Add one-argument division and rationals (closes #825 and #826) 2015-07-29 13:30:24 -05:00
Zack M. Davis
f1c315da24 merge branch 'lex-exception' 2015-07-28 21:29:08 -07:00
Zack M. Davis
1297cce4e2 merge branch 'eval-param-types' 2015-07-28 21:18:02 -07:00
Gregor Best
1de5513e48 Make read read line-wise and don't ignore Lexer Errors
This allows us to react to things like "(foo))" being passed in instead of
looping until kingdom come. Also makes tokenizing things that are not
expressions easier:

    => (read)
    "foo"
    u'foo'
    =>
2015-07-28 16:58:56 +02:00
Gregor Best
48e654596d Type check eval parameters 2015-07-28 16:49:22 +02:00
Gregor Best
0ba620fc73 Explicitly set missing source on LexExceptions
This fixes the following code:

    (import [hy.lex [tokenize]])
    (tokenize "(foo))")
2015-07-28 16:46:26 +02:00
Zack M. Davis
016557deab reader macro #@ for with-decorator
The `with-decorator` special form is not the most ergonomic—this commit
introduces a new builtin `#@` reader macro that expands to an invocation
of `with-decorator`. To support this, `reader_macroexpand` is made to
also look in the default `None` namespace, in imitation of how
regular (non-reader) macros defined in hy.core are looked up. The
docstring of `hy.macros.reader` is also edited slightly for accuracy.

This in the matter of issue #856.
2015-07-26 15:05:38 -07:00
Zack M. Davis
f247056360 merge branch 'setv-pair' 2015-07-26 01:04:07 -07:00
Ryan Gonzalez
e54d4becec Add zero- and one-argument versions of 'and' and 'or' (ref. #835) 2015-07-25 18:44:23 -05:00
Ryan Gonzalez
95cef09c6a Make 'and' and 'or' short-circuit (ref. #233, closes #766) 2015-07-25 18:44:16 -05:00
Ryan Gonzalez
736d7a7991 Let setv take pairs of arguments (ref. #844) 2015-07-25 17:45:34 -05:00
Morten Linderud
d95bfbaa8e Merge pull request #845 from farhaven/flow-doc
Rework `flow' module doc
2015-07-24 09:55:29 +02:00
Gregor Best
4fe67c11a4 Rework `flow' module doc
- Reworded intro a bit
- Cleaned up white space
- Reworded examples
2015-07-24 09:52:33 +02:00
Gergely Nagy
4642625378 Merge pull request #788 from nicolas-p/ap-pipe-ap-compose
Added ap-pipe and ap-compose macros
2015-07-23 15:08:18 +02:00
Morten Linderud
73a29fd377 Merge pull request #781 from zackmdavis/kwonly_connect
keyword-only arguments
2015-07-23 14:12:35 +02:00
Morten Linderud
4ee308c5f2 Merge pull request #761 from larme/fix-replace-hyobject
Add 'replace_hy_obj' to safely replace Hy objects
2015-07-23 14:09:56 +02:00
Morten Linderud
e228245690 Merge pull request #760 from Tritlo/flow
Added flow macros
2015-07-23 14:08:46 +02:00
Zack M. Davis
8a03e922c1 AST test coverage for &kwonly; cant_compile returns exception object
Much like how `can_compile` returns the compilation result, which some
tests make use of, it may be useful for for `cant_compile` to return the
exception object that it caught, for more specific assertions.
2015-07-22 22:06:51 -07:00
Zack M. Davis
4b00a84f9f documentation for &kwonly 2015-07-22 22:06:51 -07:00
Zack M. Davis
ef079d5e08 implement keyword-only arguments
Python 3 supports keyword-only arguments as described in the immortal
PEP 3102. This commit implements keyword-only argument support for Hy
using a `&kwonly` lambda-list-keyword with semantics analogous how
`&optional` arguments are handled: `&kwonly` arguments are either a
symbol, in which case the keyword argument so named is mandatory, or a
two-element list, the first of which is the symbolic name of the keyword
argument and the second of which is its default value if not
supplied. If Hy is running under Python 2, attempting to use `&kwonly`
args will raise a HyTypeError.

This effort is with the aim of resolving #453.
2015-07-22 21:53:06 -07:00
Zack M. Davis
d8abfb3653 merge branch 'additional_unpacking_correctness' 2015-07-22 21:26:38 -07:00
Zhao Shenyang
e2f48e5cde fix a stupid typo 2015-07-23 10:25:32 +08:00
Zhao Shenyang
e2c1d45f21 Make error messages clearer 2015-07-23 10:22:12 +08:00
Paul Tagliamonte
2258bcc2d7 Merge branch 'master' into pr/823 2015-07-22 12:55:27 -04:00
Morten Linderud
d10b1d17cc Merge pull request #843 from paultag/paultag/bugfix/die-python-26-die
Remove 2.6 entirely from test runners
2015-07-22 18:52:44 +02:00
Paul Tagliamonte
1312167fb1 Remove 2.6 entirely from test runners
(But not codepaths, in case someone cares)
2015-07-22 12:37:31 -04:00
Gergely Nagy
adc1cf8829
contrib.walk: Coerce non-list iterables into list form
Expressions can sometimes contain itertools.islice objects, which we can
only walk if we force them into a list. To do this, the walk function
has to be taught that collections that are not instances of list should
be forced into a list.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-07-15 16:59:49 +02:00
Berker Peksag
144ee3b2f0 Merge branch 'pr/829' 2015-07-15 00:00:01 +03:00
Ryan Gonzalez
c94c0e8b50 Add set literals (closes #827) 2015-07-14 23:59:29 +03:00
Morten Linderud
c2fe74c4a2 Merge pull request #803 from farhaven/nonlocal-doc
Add documentation for the (nonlocal ...) directive
2015-07-01 15:30:30 +02:00
Morten Linderud
0a2828cd0a Merge pull request #834 from farhaven/kwargs-doc
Expand doc for defn with &kwargs
2015-07-01 15:30:20 +02:00
Gregor Best
b106e3c08d Expand doc for defn with &kwargs 2015-07-01 14:57:53 +02:00
Paul Tagliamonte
4d31af2264 Add @zackmdavis to core 2015-06-29 22:14:10 -04:00
Paul Tagliamonte
920c801733 Fix markup slightly. 2015-06-23 08:33:42 -04:00
Paul‮etnomailgaT‭
aac2bc52f9 Merge pull request #819 from algernon/misc/CoC
Adopt a Code of Conduct
2015-06-23 08:32:56 -04:00
Gergely Nagy
bf16b2ce2f
Adopt a Code of Conduct
Include the text of the Contributor Covenant (1.1.0) in
CONTRIBUTING.rst, and add a link to the document to README.md.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-06-23 14:28:56 +02:00
Paul‮etnomailgaT‭
950c1bd41b Merge pull request #719 from unmerged/nonlocal-keyword
Added `nonlocal`. `global` takes multiple args.
2015-06-22 09:55:51 -04:00
Abhishek L
c2006280db Merge pull request #814 from farhaven/clean-defmain
Make (defmain ...) a clean macro
2015-06-21 23:32:42 +05:30
Gregor Best
509b72a799 Make (defmain ...) a clean macro 2015-06-15 21:11:48 +02:00
Paul Tagliamonte
4d7bdf515a Update my email 2015-06-15 14:59:40 -04:00
Berker Peksag
2ad8d444a8 Merge pull request #813 from ewaldgrusk/improve-documentation-of-the-let-form
Documents (left-to-right) order of variable assignments in let expressions
2015-06-14 04:41:22 +03:00
Ewald Grusk
296b6eaa2a documents order of variable assignments in let expressions 2015-06-13 21:10:57 +02:00
Morten Linderud
5b55242455 Merge pull request #810 from farhaven/eval-args
Allow specification of global table and module name for (eval ...)
2015-05-28 17:13:45 +02:00
Gregor Best
dcd23cf494 Add tests for eval with explicit global dict 2015-05-23 13:50:17 +02:00
Gregor Best
4adddbbf25 Allow specification of global table and module name for (eval ...) 2015-05-20 20:44:52 +02:00
Zack M. Davis
fb98bf58c4 *args and **kwargs no longer have own args in Python 3.5
Python 3.5's PEP 448 ("Additional Unpacking Generalizations") allows the
iterable- and dictionary- unpacking operators to be used more than once;
the implementation (see https://hg.python.org/cpython/rev/a65f685ba8c0)
gets rid of the optional `starargs` and `kwargs` arguments to `ast.Call`
and `ast.ClassDef`, instead using `ast.Starred` and `ast.keyword`
objects inside of the normal `args` and `keywords` lists,
respectively. This commit allows Hy's `apply` to work correctly with
this revised AST when running under Python 3.5.
2015-05-19 20:08:16 -07:00
Gregor Best
802ef0cd0d reword nonlocal doc a bit to mention nested fn scopes as well 2015-05-12 09:30:22 +02:00
Gregor Best
5743f6ae78 Add versionadded tag to nonlocal doc 2015-05-12 09:29:55 +02:00