https://github.com/yitzchak/trivial-do
Additional dolist style macros for Common Lisp
https://github.com/yitzchak/trivial-do
common-lisp
Last synced: 3 months ago
JSON representation
Additional dolist style macros for Common Lisp
- Host: GitHub
- URL: https://github.com/yitzchak/trivial-do
- Owner: yitzchak
- License: mit
- Created: 2020-07-24T11:28:15.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-06T14:27:28.000Z (over 3 years ago)
- Last Synced: 2024-05-19T05:32:00.180Z (about 1 year ago)
- Topics: common-lisp
- Language: Common Lisp
- Homepage:
- Size: 15.6 KB
- Stars: 18
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# trivial-do
Additional dolist style macros for Common Lisp. Currently provides `doalist`, `dohash`, `dolist*`, `doplist`, `doseq` and `doseq*`.
## doalist
Iterates over the key value pairs of an alist.
```lisp
(doalist (key value alist &optional return-form)
(format t "key: ~A, value: ~A~%" key value))
```## dohash
Iterates over the key value pairs of a hash table.
```lisp
(dohash (key value hash-table &optional return-form)
(format t "key: ~A, value: ~A~%" key value))
```## dolist*
Iterates over a list with a position variable tracking the current index.
```lisp
(dolist* (position value list &optional return-form)
(format t "position: ~A, value: ~A~%" position value))
```## doplist
Iterates over the key value pairs of an plist.
```lisp
(doplist (key value plist &optional return-form)
(format t "key: ~A, value: ~A~%" key value))
```## doseq
Iterates over the values of a sequence.
```lisp
(doseq (value sequence &optional return-form)
(format t "value: ~A~%" position value))
```## doseq*
Iterates over a sequence with a position variable tracking the current index.
```lisp
(doseq* (position value sequence &optional return-form)
(format t "position: ~A, value: ~A~%" position value))
```