Commit Graph

1897 Commits

Author SHA1 Message Date
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
gilch
a22e2ca4cc purged null from Hy
we already have `nil`, and `null` was barely ever used.
2015-08-11 16:22:13 -06:00
Gergely Nagy
4834b59cba
Merge branch 'h/kwargs-need-value-fix'
Closes #815, #821, #822.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-11 10:57:17 +02:00
Gergely Nagy
b362943365 compiler: Fix the kw argument needs value exception
Strip the \ufdd0 prefix from the keyword argument before turning it into
a string: the same representation the user entered looks better, and is
printable too, thus Python2 doesn't choke on it.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-11 10:44:42 +02:00
Ewald Grusk
e407b0a605 New test: Ensure the compiler chokes on missing keyword argument values 2015-08-11 10:44:42 +02:00
Ewald Grusk
4138c660cc Raise more appropriate error on missing kwarg value 2015-08-11 10:44:41 +02:00
Morten Linderud
0c73f78ed0 Merge pull request #885 from algernon/glc/mangled-bangs
Mangle trailing bangs on symbols
2015-08-10 16:35:42 +02:00
Gergely Nagy
fee7d33184
Guard against a few invalid list comprehension cases
Some valid-looking list comprehensions, such as (genexpr x []) can crash
Python 2.7. The AST we generate from these cannot be expressed in
Python, but were valid in Hy.

Added two guards to guard against this, so we raise an error instead of
crashing Python.

Closes #572, #591 and #634.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 15:55:11 +02:00
Gergely Nagy
73f8a47f65
Mangle trailing bangs on symbols
Postfixing functions with a bang, like set!, get!, etc are relatively
common. However, those names are not valid in python, so in the name of
python interoperability, lets mangle them to set_bang and get_bang,
respectively.

Closes #536.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 14:37:17 +02:00
Gergely Nagy
d3520e5640
Trying to setv a callable should raise a nice error
When trying to setv a callable, raise an error instead of showing the
user an incredibly ugly backtrace. Closes #532.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 14:19:19 +02:00
Gergely Nagy
1327d58882
Add a few tests for various defn corner cases
Closes #302.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 13:44:11 +02:00
Gergely Nagy
2665b316cf
.gitignore: Ignore .noseids too
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 10:31:45 +02:00
Gergely Nagy
8ef8032c75
Merge branch 'glc/for-cond-implicit-do'
Closes #869. Compared to the original pull request, an issue with a
corner case was fixed, and the branch rebased on top of current master.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 10:16:45 +02:00
Gergely Nagy
439fa6eb17 core.macros: Fix a for corner case
In case for doesn't get a body, raise the appropriate, descriptive error
instead of an IndexOutOfBounds one. Also updated the failing test case.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 10:16:25 +02:00
Ryan Gonzalez
a0cb250f24 Fix multi-statement 'for' with 'else' and add test cases for 'else' 2015-08-10 10:16:25 +02:00
Ryan Gonzalez
62e3116529 Fix 'with' docstring 2015-08-10 10:14:55 +02:00
Ryan Gonzalez
6c076f76f7 Allow 'for' and 'cond' to take a multi-expression body (closes #868) 2015-08-10 10:14:55 +02:00
Gergely Nagy
54fb0102aa Merge pull request #875 from algernon/glc/defclass
defclass reimagined
2015-08-10 09:39:00 +02:00
Gergely Nagy
bc81e8cc51
Merge branch 'glc/redundant-keywords'
Closes #880. The changes compared to the pull request are:

 - defn-alias and defmacro-alias are moved to contrib instead of being
   fully removed.
 - Minor documentation fixes, that were left in after the redundant
   symbol removals.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 09:34:36 +02: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
7d8ddd9ecb remove lisp-if / lisp-if-not in favor of lif / lif-not 2015-08-09 01:21:12 -06: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
gilch
e8d26f1067 remove throw in favor of raise 2015-08-09 00:52:42 -06:00
Tuukka Turto
ec3874377b Merge branch 'master' of github.com:hylang/hy into xor
Conflicts:
	hy/core/language.hy
2015-08-07 06:30:37 +03:00
Berker Peksag
2963ce6121 Tweak partition link. 2015-08-06 07:10:39 +03:00
Berker Peksag
a01957aef2 Merge pull request #877 from gilch/partition
Partition
2015-08-06 07:08:04 +03:00
gilch
7986b319c1 Add Matthew Egan Odendahl to AUTHORS 2015-08-05 21:43:51 -06:00
gilch
bb00e709ee add partition form to core
the 2 argument version of Clojure's partition.

pre-expand ->> macro in partition

Docstring for partition.

add test-partition

Document partition.
2015-08-05 21:38:11 -06:00
Gergely Nagy
79de62d2b3 Merge branch 'glc/sliceovershadow'
Closes #652.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-05 13:30:24 +02:00
Gergely Nagy
4df5587738
Fix up the rest of the code that still uses slice
Since slice was renamed to cut, update some newly introduced functions
and macros that were using slice, to use cut instead.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-05 13:29:13 +02:00
Calem Bendell
12db748c97 corrected slice to cut in docs
corrected slice to cut in the documentation.

also corrected a line in parse tumblr that used slice
2015-08-05 13:21:37 +02:00
Calem Bendell
61e4b9dfed replace slice with cut 2015-08-05 13:17:24 +02:00
Tuukka Turto
f9d133a238 Merge branch 'master' of github.com:hylang/hy into xor
Conflicts:
	hy/core/language.hy
2015-08-04 18:32:40 +03:00
Gergely Nagy
cbc2eed900
defclass reimagined
defclass now has a new syntax:

 (defclass Name [BaseList]
   [property value
    property value] ;; optional

   (defn method [self]
     self.property))

Anything after the optional property list (which will be translated to a
setv within the class context) will be added to the class body. This
allows one to have side effects and complex expressions within the class
definition.

As a side effect, defining methods is much more friendly now!

Closes #850.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-04 16:43:07 +02:00
Berker Peksag
9fbd21adba Merge pull request #678 from algernon/f/botsbuildbots-contrib-move
remove botsbuildbots
2015-08-04 13:16:54 +03: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
Tuukka Turto
eaf1a3023a Change xor to binary function
xor with more than two input parameters is not well defined and people
have different expectations on how it should behave. Avoid confusion by
sticking with two parameters only.
2015-08-03 05:37:39 +03:00
Tuukka Turto
ca8b6b4fe5 Add exclusive or logical operator
Added xor to complement and, or, not operators. Standard python
falsey/truthy semantics are followed. This implementation works for
two or more parameters.
2015-08-02 23:57:46 +03:00
Morten Linderud
b38ec6b92d Merge pull request #863 from farhaven/read-str
Add read-str
2015-07-31 23:58:16 +02:00
Morten Linderud
b6c3289bbe Merge pull request #824 from kirbyfan64/short-circuit
Make and/or short-circuit
2015-07-31 23:57:25 +02:00
Gregor Best
3f0aaf591b Remove failing test for now 2015-07-30 16:07:25 +02:00
Gregor Best
98704ddd1a fix typo 2015-07-30 16:07:25 +02:00
Gregor Best
0146cc8e4d Add docs for read-str 2015-07-30 16:07:25 +02:00
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