aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples.lisp
diff options
context:
space:
mode:
authorColin Okay <cbeok@protonmail.com>2020-07-10 00:18:47 -0500
committerColin Okay <cbeok@protonmail.com>2020-07-10 00:18:47 -0500
commit3e45fe2826a6abbf5fcb51b582e7e008128267a7 (patch)
treede37af8d2f662f68134089f886936cb718b138a6 /examples.lisp
parentcea56af01e55fb24fb141c36942ff41ed99a1594 (diff)
updated readme, changed grep example
Diffstat (limited to 'examples.lisp')
-rw-r--r--examples.lisp7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples.lisp b/examples.lisp
index 6d2f570..221c78e 100644
--- a/examples.lisp
+++ b/examples.lisp
@@ -113,10 +113,9 @@ vector VEC, one at a time."
;;; A kind of Grep ;;;
-(defmacro a-kind-of-grep (match-var key file &rest body)
- `(for ,match-var (filter! (lambda (line) (search ,key line))
- (file-lines ,file))
- ,@body))
+(defun grepper (pattern file)
+ (filter! (lambda (idx-line) (search pattern (second idx-line)))
+ (zip! (range) (file-lines file))))
;; find all export expressions in my bashrc file