Commit Graph

41 Commits

Author SHA1 Message Date
Kodi Arfer d3fa375052 Migrate from Nose to pytest 2017-04-26 14:00:11 -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 5eb928356a Overhaul semantics of binary operators (#1261)
I've added shadow versions of many operators that didn't have one. And, I've changed the behavior of various binary operators with more or fewer than 2 arguments to make the shadow and real versions more consistent and to make the behavior more logical in either case. For details, see the additions to NEWS and the new file tests/native_tests/operators.hy, which simultaneously tests shadow and real operators.

Although there are a lot of changes, I've put them all in one commit because they're interdependent.
2017-04-13 19:42:01 -05:00
Kodi Arfer bf2f90a0d9 Add hy.contrib.hy-repr 2017-03-24 08:43:53 -07:00
Kodi Arfer 91b26d1fdd Remove contrib.meth
This seems to be specific to Flask, a web framework.
2016-12-29 08:35:54 -08:00
Kodi Arfer 85b4160637 Remove contrib.curry
It's undocumented and of dubious value.
2016-12-29 08:35:54 -08:00
Kodi Arfer e5c6f733a4 Remove tests for contrib.botsbuildbots
This is an Easter egg whose tests add a dependency (requests) and cause a test failure if you don't have an active Internet connection.
2016-12-29 08:35:54 -08:00
Kodi Arfer 8eceb4fe9d Move contrib.anaphoric to contrib.extra 2016-12-29 08:35:41 -08:00
Tuukka Turto 241d554b0b Add lazy sequences into contrib 2016-11-08 21:23:49 +02:00
Gergely Nagy 7db0fcdafb Move Botsbuildbots to contrib
Closes #678.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-04 11:59:10 +02:00
Paul Tagliamonte b92c19c73c Merge branch 'master' into pr/579 2014-11-15 08:02:41 -05:00
han semaj c8985a898b Shadow '+' to handle string/list concatenation 2014-08-26 21:38:52 +12:00
Allison Kaptur caa53fb095 Tests for explicit exception chaining
This also breaks out the PY3 only tests into their own file.  We need to do this because raise from is a syntax error in PY2, so we can't rely on the previous hack of catching a HyCompileError - it would compile fine through Hy and then be a syntax error in Python.
2014-05-01 16:33:10 -04:00
Matthew Wampler-Doty 914a18f5b0 Moving `math.hy` so it doesn't clash with library math module; band aid around issue #583 (PEP 328 non-compliance) 2014-04-30 10:38:07 -05:00
Paul Tagliamonte 54da3f08dd Add Curry module. 2014-03-29 14:40:13 -04:00
Foxboron 66366b5bc9 Added defmulti 2014-02-05 16:07:48 +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
Nicolas Dandrimont 52144820ca Add a cons object and related mechanisms
Closes: #183
2014-01-23 23:08:52 +01:00
Berker Peksag db9b9c6876 Move all contrib.meth tests to tests/native_tests/contrib/. 2014-01-17 03:56:12 +02:00
Clinton N. Dreisbach 47d67b0062 Added loop/recur macro for tail-call optimization 2014-01-12 14:02:27 -05:00
Nicolas Dandrimont 77baf3b9f3 Merge branch 'meth-fix' of https://github.com/Willyfrog/hy into Willyfrog-meth-fix
Conflicts:
	tests/__init__.py
2014-01-02 00:53:40 +01:00
Foxboron d82636958b added for and with macros
Fixed up anaphoric.hy and added the tests too native_tests/__init__.py

added __init__.hy
2013-12-29 16:50:21 +01:00
Abhishek L c69c14cc7d contrib/anaphoric: More anaphoric macros added
* hy/contrib/anaphoric.hy: The following anaphoric macros have been
  added
  `ap-reject` : Opposite of ap-filter, yields the elements when a `pred`
  evaluates to false
  `ap-dotimes` : Execute body forms (possibly for side-effects) n times
  with `it` bound from 0 to n-1
  `ap-first` : return the first element that passes predicate
  `ap-last`  : return the last element that passes predicate
  `ap-reduce`: anaphoric form of reduce that allows `acc` and `it` to
  create a function that is applied over the list

* docs/contrib/anaphoric.rst: updated docs to reflect these changes

* tests/__init__.py: updated to explicitly include tests for anaphoric
  macros
2013-12-26 05:57:06 +02:00
Foxboron c9fdd40c9f Hy reader macros #377
Added first iteration of reader macros
Refactored defmacro and defreader
Added test inn hy/tests/lex/test_lex.py
Added new test in hy/tests/native/tests
Added new test in hy/tests/macros.

changed the error given in the dispatch macro and added some handling for missing symbol and invalid characters
2013-12-23 14:33:51 +01:00
Guillermo Vaya 0109234eb7 Added meth tests by mocking a Flask app 2013-12-20 21:16:56 +01:00
Bob Tolbert 62f1f40830 Add set of new core functions
Add set of new core functions to the stdlib.

Moved the auto-import code from compile_expression to
HySymbol so that "even?' in this style expression will
be found and imported.

(list (filter even? [1 2 3 4 5]))

The core functions are documented in 2 sections, one
for basic functions like (even?..) and (nth ...) and
one for all the sequence functions.

Update: This removes all the caching decorators, misnamed as
'lazy-seq' from the core. All sequence methods now just use
yield to return a generator, so they are Python-lazy

Further refinements of core functions

Cleaned up the docs to use 'iterator' instead of 'generator'

Fixed drop to just return the iterator instead of an extra
yield loop. But also added a test to catch dropping too
many.
2013-07-13 09:55:16 -06:00
Paul Tagliamonte 636eec8f51 style fixes 2013-05-11 13:59:19 -04:00
Nicolas Dandrimont e039c73abd Add tests for quasiquoting 2013-05-10 23:42:38 +02:00
Julien Danjou ad7e110af4 Implements defclass
This fixes issue #156

Signed-off-by: Julien Danjou <julien@danjou.info>
2013-05-08 12:38:57 +02:00
Julien Danjou 2ef9a0fdaf Rename `decorate-with' to `with-decorator'
Fixes #158

Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-28 17:14:22 +02:00
Julien Danjou f25177e9a6 Add a `unless' macro
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-28 17:04:35 +02:00
Julien Danjou f68e3b972b Add a `when' macro
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-28 17:04:35 +02:00
Julien Danjou 78133500cb Fix flake8 errors in tests
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-06 21:22:35 +02:00
Paul Tagliamonte 0809ef206c undoing that 2013-03-26 19:14:50 -04:00
Paul Tagliamonte fee6263b85 Trying to double-import to trigger importer bugs 2013-03-26 19:09:42 -04:00
Paul R. Tagliamonte b1c3a758f9 adding in decorators 2013-03-09 21:01:59 -05:00
Paul R. Tagliamonte da234b1d8f adding in thingers. 2013-03-05 22:08:53 -05:00
Paul Tagliamonte 0638cfa187 ideas, ideas. 2013-03-05 18:39:34 -05:00
Paul R. Tagliamonte b42fdc0bb7 Adding more testing. 2013-03-02 23:47:16 -05:00
Paul Tagliamonte f5836da2a5 Kill everything 2013-02-27 19:00:52 -05:00
Paul Tagliamonte d9b6fe7d79 Adding in some lexer testing. 2012-12-15 17:22:14 -05:00