parent
e7d5c010b4
commit
1b0d54f1bc
4 changed files with 58 additions and 49 deletions
@ -1,31 +0,0 @@ |
|||||||
# bang.el [](http://travis-ci.org/magnars/bang.el) |
|
||||||
|
|
||||||
The startings of a modern list api for Emacs. Does not require 'cl. |
|
||||||
|
|
||||||
We're looking to Clojure for naming and signatures. |
|
||||||
|
|
||||||
## Warning |
|
||||||
|
|
||||||
This is so much a work in progress that you should definitely not be using it yet. |
|
||||||
|
|
||||||
## Anaphoric functions |
|
||||||
|
|
||||||
While `!filter` takes a function to filter the list by, you can also use the |
|
||||||
anaphoric form with double bangs - which will then be executed with `it` exposed |
|
||||||
as the list item. Here's an example: |
|
||||||
|
|
||||||
```cl |
|
||||||
(!filter (lambda (num) (= 0 (% num 2))) '(1 2 3 4)) ;; normal version |
|
||||||
|
|
||||||
(!!filter (= 0 (% it 2)) '(1 2 3 4)) ;; anaphoric version |
|
||||||
``` |
|
||||||
|
|
||||||
of course the original can also be written like |
|
||||||
|
|
||||||
```cl |
|
||||||
(defun even? (num) (= 0 (% num 2))) |
|
||||||
|
|
||||||
(!filter even? '(1 2 3 4)) |
|
||||||
``` |
|
||||||
|
|
||||||
which demonstrates the usefulness of both versions. |
|
||||||
@ -1,3 +1,49 @@ |
|||||||
|
# bang.el [](http://travis-ci.org/magnars/bang.el) |
||||||
|
|
||||||
|
The startings of a modern list api for Emacs. Does not require 'cl. |
||||||
|
|
||||||
|
We're looking to Clojure for naming and signatures. |
||||||
|
|
||||||
|
## Warning |
||||||
|
|
||||||
|
This is so much a work in progress that you should definitely not be using it yet. |
||||||
|
|
||||||
|
## Anaphoric functions |
||||||
|
|
||||||
|
While `!filter` takes a function to filter the list by, you can also use the |
||||||
|
anaphoric form with double bangs - which will then be executed with `it` exposed |
||||||
|
as the list item. Here's an example: |
||||||
|
|
||||||
|
```cl |
||||||
|
(!filter (lambda (num) (= 0 (% num 2))) '(1 2 3 4)) ;; normal version |
||||||
|
|
||||||
|
(!!filter (= 0 (% it 2)) '(1 2 3 4)) ;; anaphoric version |
||||||
|
``` |
||||||
|
|
||||||
|
of course the original can also be written like |
||||||
|
|
||||||
|
```cl |
||||||
|
(defun even? (num) (= 0 (% num 2))) |
||||||
|
|
||||||
|
(!filter even? '(1 2 3 4)) |
||||||
|
``` |
||||||
|
|
||||||
|
which demonstrates the usefulness of both versions. |
||||||
|
|
||||||
|
## Available functions |
||||||
|
|
||||||
|
```cl |
||||||
|
[[ function-list ]] |
||||||
|
``` |
||||||
|
|
||||||
|
There are also anaphoric versions of these |
||||||
|
functions where that makes sense, prefixed with two bangs |
||||||
|
instead of one. |
||||||
|
|
||||||
|
## Documentation and examples |
||||||
|
|
||||||
|
[[ function-docs ]] |
||||||
|
|
||||||
## Development |
## Development |
||||||
|
|
||||||
Run the tests with |
Run the tests with |
||||||
Loading…
Reference in new issue