Commit Graph

11 Commits

Author SHA1 Message Date
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
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
Tuukka Turto
0ef9e9ef3b Modify multimethods to use dispatching function 2016-04-16 13:43:13 +03: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
Foxboron
66366b5bc9 Added defmulti 2014-02-05 16:07:48 +01:00