summaryrefslogtreecommitdiffstats
path: root/ps01_grep/ps01_bnewbold.txt
diff options
context:
space:
mode:
Diffstat (limited to 'ps01_grep/ps01_bnewbold.txt')
-rw-r--r--ps01_grep/ps01_bnewbold.txt18
1 files changed, 16 insertions, 2 deletions
diff --git a/ps01_grep/ps01_bnewbold.txt b/ps01_grep/ps01_bnewbold.txt
index 52979e7..8968157 100644
--- a/ps01_grep/ps01_bnewbold.txt
+++ b/ps01_grep/ps01_bnewbold.txt
@@ -174,7 +174,7 @@ c) (not, uh, fully tested...)
(let ((choose-grep (lambda (x)
(cond
((string? x) x)
- ((list? x) (car x))))))
+ ((list? x) ((car x)))))))
(apply string-append (map choose-grep exprs))))
(r-grep:seq "a" "b" '("grep" "egrep"))
@@ -184,7 +184,7 @@ c) (not, uh, fully tested...)
(let ((choose-egrep (lambda (x)
(cond
((string? x) x)
- ((list? x) (cadr x))))))
+ ((list? x) ((cadr x)))))))
(apply string-append (map choose-egrep exprs))))
#| test:
@@ -340,6 +340,20 @@ c) (not, uh, fully tested...)
(r:grep-like "grep" '("-E") ((cadr expr)) filename)
(r:grep-like "egrep" '() ((cadr expr)) filename)))
+#| final tests:
+(r:seq (r:repeat 2 3 (r:quote "cat")) (r:+ (r:quote "dog")))
+;Value: (#[compound-procedure 18] #[compound-procedure 19])
+((car (r:seq (r:repeat 2 3 (r:quote "cat")) (r:+ (r:quote "dog")))))
+;Value: "\\(cat\\)\\{2,3\\}\\(dog\\)\\{1,\\}"
+((cadr (r:seq (r:repeat 2 3 (r:quote "cat")) (r:+ (r:quote "dog")))))
+;Value: "(cat){2,3}(dog){1,}"
+
(pp (r:grep (r:seq (r:repeat 2 3 (r:quote "cat")) (r:+ (r:quote "dog")))
"tests.txt"))
+; ("[10]. catcatdogdog" "[12]. catcatcatdogdogdog")
+(pp (r:egrep (r:seq (r:repeat 2 3 (r:quote "cat")) (r:+ (r:quote "dog")))
+ "tests.txt"))
+; ("[10]. catcatdogdog" "[12]. catcatcatdogdogdog")
+
+|#