James King
cbb8cc1d37
Add integer-char? to core
2014-01-28 17:28:41 -05:00
Brian McKenna
6bfc4a8471
Attempt to fix HyDict#items for Python 3
...
Looks like Python 3 changed `zip` to returning an iterable and not a
list. We should be good to just wrap the call in `list`.
2014-01-26 10:56:40 -07:00
Brian McKenna
0177541d9b
Add items
, values
and keys
methods to HyDict
...
Useful for macros, for example:
(defmacro defn-checked [n x b]
`(defn ~n [(unquote-splice (.keys x))]
(print "Expecting:" (unquote-splice (.values x))) ~b))
(defn-checked hello {name str age int}
(print "Hello" name "you are" age))
(hello "Godzilla" 60)
;; Expecting: <type 'str'> <type 'int'>
;; Hello Godzilla you are 60
2014-01-25 15:55:38 -07:00
Nicolas Dandrimont
52144820ca
Add a cons object and related mechanisms
...
Closes : #183
2014-01-23 23:08:52 +01:00
Nicolas Dandrimont
bb2b868aaf
Make empty macroexpansions do the right thing
2014-01-23 23:07:31 +01:00
Nicolas Dandrimont
54757b8316
Slicing a HyList makes the same kind of object again
2014-01-23 23:07:31 +01:00
Nicolas Dandrimont
fad67bd8f5
Merge branch 'master' into pr/468
2014-01-23 22:14:23 +01:00
Nicolas Dandrimont
b99af411c8
Merge branch 'master' into pr/461
...
Conflicts:
tests/native_tests/native_macros.hy
2014-01-23 21:57:17 +01:00
Abhishek L
10f1f24a18
Adding a simple `identity' function
...
* hy/core/language.hy: Adding a simple `identity` function that returns
the argument supplied to it
* docs/language/core.rst: Updated docs with identity function
2014-01-22 00:56:28 +05:30
Gergely Nagy
3bad6c14ee
hy/core/macros.hy: Reimplement (unless) in terms of (if-not)
...
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-18 22:57:29 +01:00
Gergely Nagy
e90b24b73a
hy/core/macros.hy: Add an (if-not) macro
...
Sometimes it is better to start with the false condition, sometimes that
makes the code clearer. For that, the (if-not) macro, which simply
reverses the order of the condition blocks, can be of great use.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-18 22:56:20 +01:00
Gergely Nagy
21709f0199
hy/core/macros.hy: Add defn-alias / defun-alias
...
In the same vein as defmacro-alias, this implements defn-alias /
defun-alias, which does essentially the same thing as defmacro-alias,
but for functions.
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
2014-01-18 16:09:35 +01:00
Nicolas Dandrimont
eedebd12b3
Merge branch 'master' into pr/443
2014-01-17 20:25:09 +01:00
Nicolas Dandrimont
2094133193
Merge branch 'master' into pr/441
2014-01-17 20:23:49 +01:00
Nicolas Dandrimont
1b435a9a2a
Merge branch 'master' into pr/439
2014-01-17 20:18:43 +01:00
Nicolas Dandrimont
e0f9c9c191
Merge branch 'master' into pr/438
2014-01-17 20:14:16 +01:00
Nicolas Dandrimont
512f14d195
Merge branch 'master' into pr/437
2014-01-17 20:09:39 +01:00
Foxboron
a35ecc41bd
Fix reader macros to actually be macros
2014-01-17 01:07:47 +01:00
Gergely Nagy
8ef02a54b5
hy/lex/parser.py: Add support for sub-object mangling
...
With this patch, every identifier is split up along dots, each part gets
separately mangled, and then it is all joined back together. This allows
for fun stuff like (.foo? (Foo)), and even more contrived examples.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-16 16:23:35 +01:00
Gergely Nagy
ceb615d010
hy/lex/parser.py: Move most of the identifier mangling into a def
...
As a refactoring step, move the identifier mangling done in t_identifier
into a separate def.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-16 16:20:51 +01:00
Nicolas Dandrimont
8bfa4f33fc
Add set comprehensions, dict comprehensions and generator expressions
...
Closes : #14 (woo, two-digit tickets)
2014-01-16 00:49:48 +01:00
Berker Peksag
25459177eb
Move "hy on meth" example to eg/.
2014-01-14 06:03:57 +02:00
Paul Tagliamonte
5a64f18726
Refactor (loop) in terms of fnr; change to use decorator.
2014-01-13 20:37:25 -05:00
Gergely Nagy
5b78735011
hy/cmdline.py: Add support for running with --spy -i
...
There's no reason why one would need to choose between --spy and -i, so
pass down options.spy to run_icommand, and then to HyREPL, so we can
have both.
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
2014-01-13 22:12:32 +01:00
Paul Tagliamonte
0afbbeb68c
Add (recur) for functions and stuff.
2014-01-12 18:53:08 -05:00
Clinton N. Dreisbach
47d67b0062
Added loop/recur macro for tail-call optimization
2014-01-12 14:02:27 -05:00
Paul Tagliamonte
5fc047e77c
Merge branch 'master' into pr/425
...
Conflicts:
hy/core/language.hy
2014-01-12 12:48:26 -05:00
Nicolas Dandrimont
1e793e696a
Fix indentation of *exports*
2014-01-12 17:34:05 +01:00
Nicolas Dandrimont
14a791f37b
Merge branch 'f/is-coll' of https://github.com/theanalyst/hy into theanalyst-f/is-coll
2014-01-12 17:33:17 +01:00
Abhishek L
ec8220c2b7
Merge master onto pr/428
2014-01-12 20:33:25 +05:30
Abhishek L
f159f1499b
Adding a simple coll?
function to the core
...
* hy/core/language.hy:
-Added a simple coll? function that checks whether the given argument
is an iterable and not a string,
- Also replaced the check in `flatten` by coll?
* tests/native_tests/core.hy: Tests updated for checking coll?
2014-01-12 15:49:09 +05:30
Paul Tagliamonte
cc2f45be69
slice is amazing, @olasd is amazing, I love everything.
2014-01-10 22:50:20 -05:00
Paul Tagliamonte
0f74b1ddf3
Add handling for (for []). Nice catch, @olasd.
2014-01-10 22:29:20 -05:00
Paul Tagliamonte
2167c21120
Adjust (for) to just use itertools.product
...
This is to avoid nesting in for loops, helping make clear
what (break) and (else) do.
This commit is hereby dedicated to @nedbat
2014-01-10 22:00:30 -05:00
Paul Tagliamonte
c0a654e6cb
Add callgraph stuff. Slick look.
2014-01-10 21:03:19 -05:00
Clinton N. Dreisbach
849244f3b4
Make first and rest fns instead of macros
...
car and cdr are still macros, but I'd recommend either making them
fns or removing them.
2014-01-10 13:46:31 -05:00
Nicolas Dandrimont
d18e752d33
Implement the . attribute access DSL
...
This fixes #399
2014-01-09 03:34:53 +01:00
Paul Tagliamonte
85bdd3fe19
Merge branch 'master' into paultag/bugfix/python3.4
2014-01-04 12:51:55 -05:00
Nicolas Dandrimont
d3fa1fd1a8
Add disassemble function to hy.core.language
...
This function dumps the AST or the python code generated by evaluating a quoted expression to stdout.
Fixes #58
2014-01-04 03:47:04 +01:00
Paul Tagliamonte
de31aea5d2
Cleanup use of PY3* in the compiler.
2014-01-03 20:02:36 -05:00
Paul Tagliamonte
c5c36e1022
Merge branch 'master' into paultag/bugfix/python3.4
...
Conflicts:
bin/hy2py
2014-01-03 19:57:05 -05:00
Nicolas Dandrimont
2f7d40b409
Factor the calling-module-name function
2014-01-03 21:41:14 +01:00
Paul Tagliamonte
590d3bf1df
Clean up compare to use the tuple. Thanks @olasd
2014-01-01 22:33:44 -05:00
Nicolas Dandrimont
a44e53f4de
Comments end when the input ends or a newline occurs
...
This fixes #382 , which occured because the REPL doesn't use trailing newlines.
2014-01-02 03:09:18 +01:00
Paul Tagliamonte
1d58e52584
Flake8 style fix.
2014-01-01 19:12:17 -05:00
Paul Tagliamonte
f28bf41f8d
Merge branch 'master' of github.com:hylang/hy into paultag/bugfix/python3.4
2014-01-01 18:59:23 -05:00
Paul Tagliamonte
d22a152134
Merge branch 'master' of github.com:hylang/hy into paultag/bugfix/python3.4
2014-01-01 18:58:39 -05:00
Paul Tagliamonte
26e2fb3606
Give a whack at Python 3.4 support
...
This adds ast.arg for Python 3.4+, for FunctionDef args and other
args (starargs, kwargs)
2014-01-01 18:56:09 -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
Nicolas Dandrimont
88451bbeaa
Merge branch 'better-macroexpand' of https://github.com/sbp/hy into sbp-better-macroexpand
...
Conflicts:
hy/core/language.hy
tests/native_tests/language.hy
2014-01-02 00:49:40 +01:00