Commit Graph

53 Commits

Author SHA1 Message Date
Brandon T. Willard
87a5b117a1 Implement new importer using PEP-302 semantics
Python 3.x is patched in a way that integrates `.hy` source files into
Pythons default `importlib` machinery.  In Python 2.7, a PEP-302 "importer"
and "loader" is implemented according to the standard `import` logic (via
`pkgutil` and later pure-Python `imp` package code).

In both cases, the entry-point for the loaders is through `sys.path_hooks` only.
As well, the import semantics have been updated all throughout to utilize
`importlib` and follow aspects of PEP-420.  This, along with some light
patches, should allow for basic use of `runpy`, `py_compile` and `reload`.

In all cases, if a `.hy` file is shadowed by a `.py`, Hy will silently use
`.hy`.
2018-08-25 22:50:38 -05:00
Philip Xu
0b08916174 Fix typos and improve code examples 2018-05-16 18:25:53 -04:00
Philip Xu
643196c2b8 Remove mixtures of tabs and spaces 2018-05-15 23:29:07 -04:00
Kodi Arfer
8c00ab66f9 NEWS and docs for hy-repr 2018-03-10 18:11:07 -08:00
Simon Gomizelj
0cd4df3898 Remove def and standardize on setv 2018-01-21 00:25:33 -05:00
gilch
e90f082baf back let with dict for better defclass behavior 2017-10-30 20:23:57 -06:00
gilch
d2e8537d3f document let 2017-09-23 15:00:00 -06:00
gilch
af8d209496 update docs for new hy model reprs 2017-09-08 10:59:57 -07:00
Kodi Arfer
33a696d487 Add a command-line option --repl-output-fn (especially for hy.contrib.hy-repr) 2017-03-24 09:03:12 -07:00
Kodi Arfer
bf2f90a0d9 Add hy.contrib.hy-repr 2017-03-24 08:43:53 -07: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
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
664ded1a19 profile docs wording edit 2016-12-19 14:44:16 -08:00
accraze
115b7dd5fa Added contrib.profile docs
fixes #1145
2016-12-18 21:10:24 -08:00
Kodi Arfer
b3d7069fb3 Merge branch 'seq' 2016-12-08 10:27:33 -08:00
Kodi Arfer
f4b00aed17 More copyediting of sequences.rst
I removed "they aren't suited for infinite sequences" since it seems like in fact they are, as given in some of the examples and the tests.
2016-12-07 16:17:58 -08:00
Kodi Arfer
6bf5ebd8ee Remove some trailing spaces 2016-12-07 16:17:52 -08:00
Tuukka Turto
538d36a7c6 Fix grammar 2016-12-01 00:22:42 +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
cd90959103 Update version added in docs 2016-11-29 07:22:38 +02: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
bae4d61e04 Fix require to new syntax 2016-11-03 14:32:23 +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
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
Jakub Wilk
b94211251c Use HTTPS for Wikipedia URLs 2016-09-04 22:35:46 +02:00
Michael Hunsinger
6a452d70a4 Added documentation for walk, postwalk and prewalk 2016-08-20 02:35:02 -06:00
Tuukka Turto
0ef9e9ef3b Modify multimethods to use dispatching function 2016-04-16 13:43:13 +03:00
Endre Bakken Stovner
66b16d15f5 Add import anamorphic macros info
Small change thanks to kirbyfan64
2015-10-18 21:15:47 +02:00
gilch
a06c8a9af9 xi parameter may appear in function position 2015-08-12 08:50:18 -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
dee02c5928
docs: Minor corrections, related to the alias removals
Fixed up the documentation language here and there, related to the alias
removals in previous commits.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 09:33:23 +02: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
e8d26f1067 remove throw in favor of raise 2015-08-09 00:52:42 -06: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
nicolas-p
fad1a27439 Docs for ap-pipe and ap-compose
Added docs for the ap-pipe and ap-compose anaphoric macros.
2015-04-26 18:35:46 +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
Kevin Yap
8c0ac0862f Adhere to CPython's documentation guidelines
- Inline code is written using ``double backticks``
- Italicized text uses *asterisks* rather than `single backticks`
- Function parameters are italicized rather than written as inline code
2014-12-07 02:09:43 -08:00
Kevin Yap
d657e5eb2d Fixes to contributor module documentation
- Changed "Contrib" to "Contributor"
- Fixed mismatched inline code in list* usage
- Added missing hyperlink targets
2014-12-06 15:47:01 -08:00
Foxboron
89dec9ef44 Fixed example to be streamlined 2014-09-08 16:57:52 +02:00
Abhishek L
378ffae6f7 Fix versionadded in docs to 0.10.0 release 2014-04-10 23:51:32 +05:30
Bob Tolbert
4798863e0f This change updates the required Pygments version to 1.6, which
supports Hy code.

All code-blocks in the documentation have been changed from
clojure to hy.

Also added docs/make.bat for Windows, so the top-level docs
target now works on Windows as well.
2014-03-14 09:01:47 -04:00
Foxboron
66366b5bc9 Added defmulti 2014-02-05 16:07:48 +01:00
Clinton N. Dreisbach
47d67b0062 Added loop/recur macro for tail-call optimization 2014-01-12 14:02:27 -05:00
Paul Tagliamonte
29c9e566e1 Merge branch 'paultag/ana/if' of github.com:paultag/hy into paultag/ana/if 2013-12-26 17:57:52 -05: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