Commit Graph

1103 Commits

Author SHA1 Message Date
Paul Tagliamonte
e754a58237 Merge branch 'master' into pr/363 2013-12-31 11:41:30 -05:00
Paul Tagliamonte
931ce889f9 s/rply/rpython/ 2013-12-31 11:26:31 -05:00
Bob Tolbert
a5e46fdc04 Merge pull request #402 from paultag/paultag/docs/compiler
Paultag/docs/compiler
2013-12-31 08:25:37 -08:00
Berker Peksag
9b1990901c Fix |Unknown directive type "todo"| error. 2013-12-31 15:51:58 +02:00
Foxboron
426d34288f Added docs and one small bug fix in defreader 2013-12-31 15:46:21 +02:00
Paul Tagliamonte
b011048b41 allow one-shot merge 2013-12-30 18:02:03 -05:00
Paul Tagliamonte
a5b56be83e Merge branch 'master' of github.com:hylang/hy 2013-12-30 17:33:07 -05:00
Paul Tagliamonte
67fd0ddbbe Document the compiler a little. 2013-12-30 17:32:57 -05:00
Bob Tolbert
d7956d03c3 Adding documentation for flatten 2013-12-31 03:49:37 +05:30
Abhishek L
0a80b87b7f Merge branch 'master' onto pr/395 2013-12-31 03:37:26 +05:30
Paul Tagliamonte
893c2bc46e Merge branch 'master' into pr/400 2013-12-30 16:49:32 -05:00
Bob Tolbert
4e3b6fd4cf Add some docs for gensym and siblings 2013-12-30 14:42:55 -07:00
Gergely Nagy
62522a5f86 Allow get with multiple arguments
When calling get with more than two arguments, treat the rest as indexes
into the expression from the former. That is, (get foo "bar" "baz")
would translate to foo["bar"]["baz"], and so on.

This fixes #362.

Requested-by: Sean B. Palmer <sean@miscoranda.com>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2013-12-30 12:04:40 +01:00
Foxboron
d82636958b added for and with macros
Fixed up anaphoric.hy and added the tests too native_tests/__init__.py

added __init__.hy
2013-12-29 16:50:21 +01:00
Paul Tagliamonte
f189f0a457 Add Kenan Bölükbaşı to AUTHORS. 2013-12-28 18:48:47 -05:00
Kenan Bölükbaşı
3f590f8916 Reflect parameters of code.InteractiveConsele in HyREPL in order to make hy run inside Blender. 2013-12-29 01:22:16 +02:00
Bob Tolbert
f6887ed7c2 Merge pull request #371 from paultag/paultag/feature/profile
Add profile macro.
2013-12-28 08:33:58 -08:00
Paul Tagliamonte
9656c7f53c Add profiling macros 2013-12-28 11:25:27 -05:00
Bob Tolbert
55a7ab1667 add nil as synonym for None 2013-12-27 13:50:19 -07:00
Bob Tolbert
b2bb161cb0 Merge pull request #391 from olasd/bugfix/apply-method-call
Fix apply with method calls
2013-12-27 11:46:59 -08:00
Abhishek L
141f44c09f Merge branch 'olasd:feature/only-macroexpand-when-needed' 2013-12-27 11:50:39 +05:30
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
Paul Tagliamonte
1dc26148c6 Merge branch 'master' into paultag/ana/if
Conflicts:
	hy/contrib/anaphoric.hy
2013-12-26 17:57:29 -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
Nicolas Dandrimont
81d5f08100 Only call macroexpand when needed
We only need to call macroexpand on HyExpressions,
as this is already guarded in macroexpand_1. This
saves us a few funcalls.
2013-12-26 03:00:24 +01:00
Paul Tagliamonte
c7070f82b5 Add ap-if docs. 2013-12-25 20:28:32 -05:00
Paul Tagliamonte
6172b60e75 Add anaphoric if statement 2013-12-25 12:14:26 -05:00
Nicolas Dandrimont
cfbc792957 Fix apply with method calls
Apply didn't work on method calls (i.e. `(apply .foo [bar]) broke).
This slipped through because there were no tests of this behavior. I noticed
it while trying to merge the `meth` fixes.
2013-12-23 21:02:45 +01:00
Nicolas Dandrimont
744cd71171 Nuke the rply git checkout from tox.ini 2013-12-23 15:31:36 +01:00
Nicolas Dandrimont
761926df95 Merge branch 'reqs-astor' of https://github.com/berkerpeksag/hy into berkerpeksag-reqs-astor 2013-12-23 15:25:46 +01:00
Foxboron
c9fdd40c9f Hy reader macros #377
Added first iteration of reader macros
Refactored defmacro and defreader
Added test inn hy/tests/lex/test_lex.py
Added new test in hy/tests/native/tests
Added new test in hy/tests/macros.

changed the error given in the dispatch macro and added some handling for missing symbol and invalid characters
2013-12-23 14:33:51 +01:00
Berker Peksag
27691e4d82 Remove astor from requirements-dev.txt.
This is not necessary since 870c136.
2013-12-23 08:12:22 +02:00
Nicolas Dandrimont
1a701d4dc4 Whitespace fix 2013-12-22 20:04:12 +01:00
Nicolas Dandrimont
ec2b5fb7ad Merge branch 'kwapply-macro' of https://github.com/Willyfrog/hy into Willyfrog-kwapply-macro
Conflicts:
	hy/core/language.hy
	hy/core/macros.hy
	tests/native_tests/language.hy
2013-12-22 20:03:00 +01:00
Nicolas Dandrimont
ceb612f385 Merge branch 'fix/arith-identity' of https://github.com/theanalyst/hy into theanalyst-fix/arith-identity 2013-12-22 19:32:10 +01:00
Nicolas Dandrimont
799c39ffad Implement del
Closes #385.
2013-12-22 20:26:57 +02:00
Nicolas Dandrimont
0f96c24965 Make _storeize generic
This allows to change an expression's context to something else than ast.Store if needed.
2013-12-22 20:26:57 +02:00
Paul Tagliamonte
cccf90c702 Merge branch 'master' into pr/374 2013-12-22 13:22:39 -05:00
Paul Tagliamonte
8efefc4817 Merge branch 'master' into pr/379 2013-12-22 13:18:59 -05:00
Bob Tolbert
3204c2a574 Fix for readline REPL problem Darwin Python3
On OS X Mavericks, the Hy REPL doesn't allow the 'b' character when
running with Python 3.3. This appears to be a common problem
for Darwin and readline as mentioned in this post

http://superuser.com/questions/297527/cant-type-the-b-letter-in-python-shell-in-os-x
2013-12-20 07:23:35 -07:00
Berker Peksag
abcd97b1f1 Add update_coreteam script. 2013-12-17 18:50:01 +02:00
Vasudev Kamath
58313884b2 Added information about core team members
Signed-off-by: Vasudev Kamath <kamathvasudev@gmail.com>
2013-12-17 14:36:19 +02:00
Bob Tolbert
c80e3c75a0 Adding automatic gensym macro
Adding to the manual gensym for macros are 2 new
macros, but very literal from the CL in
letoverlambda.

The first is the (with-gensyms ...) macro that
can generate a small set of syms for a macro. Works
something like:

(defmacro adder2 [A B]
  (with-gensyms [a b]
    `(let [[~a ~A] [~b ~B]]
       (+ ~a ~b))))

and ~a and ~b will be replaced with (gensym "a") and
(gensym "b") respectively.

Then the final macro is a new defmacro that will automatically
replace symbols prefaced with "g!" with a new gensym based on the
rest of the symbol. So in this final version of 'nif':

(defmacro/g! nif4 (expr pos zero neg)
  `(let [[~g!result ~expr]]
     (cond [(pos? ~g!result) ~pos]
           [(zero? ~g!result) ~zero]
           [(neg? ~g!result) ~neg])))

all uses of ~g!result will be replaced with (gensym "result").
2013-12-15 18:47:46 -07:00
Bob Tolbert
f5d88bb108 gensym in Hy
Simple implementation of gensym in Hy.

Returns a new HySymbol.

Usable in macros like:

(defmacro nif [expr pos zero neg]
  (let [[g (gensym)]]
    `(let [[~g ~expr]]
       (cond [(pos? ~g) ~pos]
             [(zero? ~g) ~zero]
             [(neg? ~g) ~neg]))))

This addresses all the general comments about (gensym), and doesn't
try to implement "auto-gensym" yet. But clearly the macro approach
instead of the pre-processor approach (as described in the
letoverlambda (http://letoverlambda.com/index.cl/guest/chap3.html#sec_5)
is the way to go
2013-12-15 12:36:36 -07:00
Abhishek L
f72ff53f41 Operators + and * work without args, fixes #372
Like other lisps, operators `+` and `*` return their identity values
when called with no arguments. Also with a single operand they return
the operand.

This fixes #372
2013-12-16 00:04:43 +05:30
Morten Linderud
c11b231c1c Merge pull request #328 from berkerpeksag/add-astor
Add astor to install_requires.
2013-12-11 08:13:03 -08:00
Morten Linderud
bf838619f1 Merge pull request #369 from berkerpeksag/skip-test
Explicitly skip the skipped test in test_bin.
2013-12-11 08:10:30 -08:00
Berker Peksag
e674eb4b56 Explicitly skip the skipped test in test_bin. 2013-12-10 19:43:56 +02:00
Berker Peksag
3e8941cdde Convert stdout and stderr to UTF-8 properly in the run_cmd helper. 2013-12-10 18:59:06 +02:00
Berker Peksag
870c136469 Add astor to install_requires.
`hy --spy` fails on hy 0.9.11.

    $ hy --spy
    hy 0.9.11
    => (type "hy")
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/hy/cmdline.py", line 68, in print_python_code
        import astor.codegen
    ImportError: No module named astor.codegen
2013-12-10 17:46:45 +02:00