Commit Graph

80 Commits

Author SHA1 Message Date
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
5aadeba3fe Fix bug: loop replaced strings equal to "recur" 2017-03-30 15:49:10 -07:00
Kodi Arfer
bf2f90a0d9 Add hy.contrib.hy-repr 2017-03-24 08:43:53 -07: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
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
99638ba2df Remove uses of let from /hy 2017-02-03 17:06:26 -08: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
407a79591a Remove contrib.flow
It's not tested, and sure enough, a glance at the code suggests that `case` and `switch` will evaluate their first argument once for every clause, which is unlikely to be desirable. I say remove it, but if anybody wants to fix and test and re-add `case` (and change it to a square-bracket syntax like `cond`), be my guest.
2016-12-29 08:35:54 -08:00
Kodi Arfer
38d11bd455 Translate MultiDispatch from Python to Hy
Now we can put it into contrib.multi instead of its own module.
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
8eceb4fe9d Move contrib.anaphoric to contrib.extra 2016-12-29 08:35:41 -08:00
Kodi Arfer
d980a4a8ee Remove contrib.alias
I don't see why you'd put this in the standard library. I guess it could be useful for when you're maintaining a library and you want to change the name of a function or macro but keep the old name around for a while so people's code doesn't break immediately. But that's a pretty limited purpose.
2016-12-26 15:39:26 -08:00
Kodi Arfer
b3d7069fb3 Merge branch 'seq' 2016-12-08 10:27:33 -08:00
Kodi Arfer
d2342cb69d Minor cleanup in sequences.hy 2016-12-07 16:32:37 -08:00
Kodi Arfer
e86222c93f Allow calling defseq without requireing seq 2016-12-07 16:21:17 -08:00
Kodi Arfer
6bf5ebd8ee Remove some trailing spaces 2016-12-07 16:17:52 -08:00
Tuukka Turto
4219faf532 Update true, false -> True, False 2016-11-30 23:45:21 +02:00
Tuukka Turto
269218a8fd Merge branch 'master' into seq 2016-11-30 23:41:01 +02:00
Tuukka Turto
00615cef36 Add arity-overloaded defn
Old defmulti has been renamed to defn and extended to detect when it is
used to define regular function and when a arity-overloaded one.
2016-11-29 16:21:31 +02:00
Tuukka Turto
75c0080cee Change nil to None 2016-11-29 07:18:30 +02:00
Tuukka Turto
aeab485a4f Merge branch 'master' into multimethod 2016-11-29 07:14:54 +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
a7f6d1d3f7 Add support for multiple statements in sequences 2016-11-09 08:52:18 +02:00
Tuukka Turto
241d554b0b Add lazy sequences into contrib 2016-11-08 21:23:49 +02:00
Tuukka Turto
77bc767907 Merge branch 'master' into multimethod
Conflicts:
	docs/contrib/multi.rst
2016-11-03 14:06:13 +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
0ef9e9ef3b Modify multimethods to use dispatching function 2016-04-16 13:43:13 +03:00
Ewald Grusk
b2a72e2f10 Fix anaphoric macro ap-if. 2015-12-17 15:39:33 +01:00
Jakub Wilk
1d16addd2e Fix typos 2015-12-08 14:43:47 +01:00
Gergely Nagy
9f88e07e1d Drop a set of brackets from let.
This changes let to use a flat list of symbol-value pairs instead of a
vector of vectors. One side effect is that (let [[a 1] z]) is not
expressible now, and one will explicitly need to set a nil value for z,
such as: (let [a 1 z nil]).

Closes #713.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-10-01 10:08:04 +02:00
gilch
a06c8a9af9 xi parameter may appear in function position 2015-08-12 08:50:18 -06:00
gilch
20d6349679 make xi compatible with Python2 2015-08-11 19:35:22 -06:00
gilch
0bf1084d8c added xi-forms
These work like Clojure's `#()` anonymous function literals.
2015-08-11 19:11:17 -06:00
Gergely Nagy
8e2a892469
hy.contrib.alias: Move defn-alias and defmacro-alias here
As discussed in #880, move defn-alias and defmacro-alias to a contrib
module.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 09:24:48 +02:00
gilch
4cdfdfbafe remove defun in favor of defn 2015-08-09 01:09:52 -06:00
gilch
33e0b4b3db remove progn in favor of do 2015-08-09 01:00:51 -06:00
gilch
66c1f38fcc remove catch in favor of except 2015-08-09 00:53:10 -06: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
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
e228245690 Merge pull request #760 from Tritlo/flow
Added flow macros
2015-07-23 14:08:46 +02: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
nicolas-p
d3d24db8bd Added ap-pipe and ap-compose macros
`ap-pipe` is an anaphoric version of `->` and `->>`. It is useful for
specifying where the argument should go in each expression.

`ap-compose` returns a function which is the composition of several
anaphoric forms.
2015-04-03 23:02:39 +02:00
Matthias Pall Gissurarson
7be22e361b removed guard as it matches cond almost exactly, added case 2015-01-18 12:37:50 +00:00
Matthías Páll Gissurarson
a3670a8d57 added flow macros 2015-01-17 22:46:23 +00:00
Abhishek L
c2982a9ae3 anaphoric: fix first & last when conditions fail
* hy/contrib/anaphoric.hy: `ap-first` and `ap-last` now handle cases
  when failure happens for the predicate. Thanks to @tutorto for
  reporting this bug
2014-05-24 17:48:46 +05:30
maresp
0195de6545 fixed ap-map potential naming conflict 2014-04-18 02:45:05 +02:00
Berker Peksag
3528cc8278 Kill kwapply.
Closes #433.
2014-04-09 20:10:31 +03: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
e8dfe5bfb2
hy.contrib.walk: Add support for walking cons cells
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-02-01 18:36:57 +01:00