Commit Graph

11 Commits

Author SHA1 Message Date
Abhishek L
c2982a9ae3 anaphoric: fix first & last when conditions fail
* hy/contrib/anaphoric.hy: `ap-first` and `ap-last` now handle cases
  when failure happens for the predicate. Thanks to @tutorto for
  reporting this bug
2014-05-24 17:48:46 +05:30
maresp
0195de6545 fixed ap-map potential naming conflict 2014-04-18 02:45:05 +02:00
Paul Tagliamonte
eeef65b505 Change the signature of (for) and (with).
(for) is restored to clojure-like flatness.
 (with) can be used without the nested list if you don't care about the
        name.

   Tests and examples updated.
2013-12-31 13:35:31 -05: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
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
Paul Tagliamonte
6172b60e75 Add anaphoric if statement 2013-12-25 12:14:26 -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
agentultra
cb6889314a Add documentation and doc strings 2013-11-29 19:59:20 -05:00
agentultra
179017b9bd Move anaphoric macros to contrib module 2013-11-28 23:53:02 -05:00