Commit Graph

1571 Commits

Author SHA1 Message Date
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
Guillermo Vaya
aeb0cd4c72 Fixed docstring 2013-12-09 11:49:17 +01:00
Guillermo Vaya
f913c2aa8c meth wasn't accepting correctly its parameters
Now also accepts more than 1 statement in the code part of the macro
refactored to use only 1 codebase (no more route != route-with-macros)
2013-12-09 11:48:13 +01:00
Kevin Zita
8970662dcb Update requirements.txt and setup.py to use rply upstream.
Closes #364.
2013-12-08 07:11:42 +02:00
Abhishek L
948e6d34c7 Merge branch master onto pr/284
Conflicts:
	hy/core/language.hy
2013-12-06 20:07:39 +05:30
Morten Linderud
699396b5a3 Merge pull request #358 from theanalyst/feature/macros-none
Allow macros to return None, fixes #357
2013-12-06 03:53:44 -08:00
Morten Linderud
db68e230b6 Merge pull request #361 from berkerpeksag/spy-versionadded
Add versionadded directive to cli.rst.
2013-12-06 03:48:40 -08:00
Berker Peksag
ecd13ef659 Add versionadded directive to cli.rst. 2013-12-06 07:51:32 +02:00
Abhishek L
f1c68bd51a Allow macros to return None, fixes #357
Allows Hy macros to return None, to test this

  (defmacro foo [])
  (foo)

Should work now
2013-12-06 00:27:45 +05:30
Nicolas Dandrimont
cc147512fc Merge branch 'paultag/feature/support-question-marks' of https://github.com/paultag/hy into paultag-paultag/feature/support-question-marks
Conflicts:
	hy/core/language.hy
2013-12-05 19:28:59 +01:00
Nicolas Dandrimont
f4f0972e6e Merge branch 'master' of https://github.com/hcarvalhoalves/hy into hcarvalhoalves-master 2013-12-05 19:10:34 +01:00
Nicolas Dandrimont
f0a9149383 Merge branch 'string-cast' of https://github.com/Willyfrog/hy into Willyfrog-string-cast 2013-12-05 19:04:22 +01:00
Joe H. Rahme
61112138ca Adds try-hy to the docs
As requested in PR #350.
This commit also adds Joe "rahmu" Hakim Rahme to the AUTHORS file
2013-12-05 23:07:46 +05:30
Berker Peksag
2c76d8ec90 Document command line options. 2013-12-05 22:03:05 +05:30
Nicolas Dandrimont
f9a1995be8 Make HyObject.replace more resilient
This makes it work on quoted objects
2013-12-04 03:25:33 +02:00
Paul Tagliamonte
2f845c2a1e Add @hcarvalhoalves to AUTHORS. We fucked up that PR :) 2013-12-03 00:03:13 -05:00
Morten Linderud
c933f703ff Merge pull request #349 from hcarvalhoalves/fix-osx-complete
Fix REPL completions on OS X
2013-12-02 21:01:35 -08:00
Paul Tagliamonte
fd2421587e Merge branch 'master' into pr/346 2013-12-02 23:48:58 -05:00
Paul Tagliamonte
31ad46c550 Erm, revert that. Apparently that wasn't proper. 2013-12-02 23:47:43 -05:00
Paul Tagliamonte
887f8819d4 add coveralls token 2013-12-02 23:46:30 -05:00
Paul Tagliamonte
de424fd2b6 Merge branch 'master' into pr/347 2013-12-02 23:41:54 -05:00
Paul Tagliamonte
611141a8e8 Merge branch 'master' into pr/348 2013-12-02 23:41:07 -05:00
Henrique Carvalho Alves
1b7d7bcef7 Fix REPL completions on OS X 2013-12-03 01:07:05 -02:00
Abhishek L
ba3ba37665 Adding support for coverage tests at coveralls
This commit adds support for coverage tests at coveralls.io,
using coverage plugin from nosetests
2013-12-03 01:58:35 +05:30
J Kenneth King
3972878d98 Add link to try-hy 2013-12-02 09:30:26 -05:00
Guillermo Vaya
3cc0f8a717 Added info about tox, so people can use it prior to a PR 2013-12-02 12:07:05 +01:00
Paul Tagliamonte
fd60a864eb Translate all foo? -> is_foo. Close #334
The fancypants Hy award goes to Nick for coming up with the quoted
symbol hack for exports. This broke with foo?, since the export string
needs to be is_foo, but using a quoted string will pick up the change
due to it being a Symbol.

Mad clown love for that, @olasd.
2013-12-01 15:03:31 -05:00
Paul Tagliamonte
9531d772cf add the start of hacking rules 2013-12-01 12:56:26 -05:00
Paul Tagliamonte
c255607205 don't test the halting problem anymore. 2013-12-01 09:48:16 -05:00
Paul Tagliamonte
7c446ed81a Removing this file because it's nonfree.
The terms aren't clear, so I'm just going to get rid of this. Sad, but
 meh.
2013-12-01 09:43:45 -05:00
Berker Peksag
8865bb8a8f Merge pull request #321 from berkerpeksag/travis-use-mirrors
PyPI is now behind a CDN. The `--use-mirrors` option is deprecated.
2013-11-30 15:50:17 -08:00
Berker Peksag
8745024058 Merge pull request #342 from theanalyst/doc-fix
docs/api:formatting fixes in `quote' and `unquote'
2013-11-30 13:04:41 -08:00
Abhishek L
d8c29f51d6 docs/api:formatting fixes in quote' and unquote'
A newline was omitted which caused the examples not to render for quote
and unquote forms
2013-12-01 01:20:58 +05:30
J Kenneth King
8fa59b653c Merge pull request #341 from agentultra/master
Rename anaphoirc.rst to anaphoric.rst
2013-11-30 07:52:28 -08:00
agentultra
3773be1d1a Rename anaphoirc.rst to anaphoric.rst 2013-11-30 10:47:08 -05:00
J Kenneth King
cbb7c5fd7f Merge pull request #338 from agentultra/anaphoric-macros
Anaphoric macros
2013-11-30 07:37:08 -08:00
J Kenneth King
0b6d047239 Remove james@agentultra.com from copyright in core/macros.py 2013-11-30 10:35:57 -05:00
agentultra
5753fc0789 Fix typo in ap-map-when 2013-11-30 10:30:42 -05:00
agentultra
77db779019 Fix typo in ap-each 2013-11-30 10:29:41 -05:00
Christian Weilbach
e65132c751 Set sys.argv default to [''] like Python does. 2013-11-30 03:00:45 +01:00
Henrique Carvalho Alves
62bc86a0b5 Fix sys.argv to reflect default Python behaviour
By default, calling the Python REPL without arguments causes
sys.argv to be a non-empty list with an empty string, and some
modules (e.g., pyNN) rely on that.
2013-11-29 23:51:41 -02:00
agentultra
cb6889314a Add documentation and doc strings 2013-11-29 19:59:20 -05:00