aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-04-26 10:42:59 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-04-26 10:42:59 +0200
commite3294bff49f9c24f982d5a2203b4263dd4d4dd2f (patch)
tree77f8bc859c643a9e78267dd368ae24d0753708ca
parentFurther cleanup in recurrence parser. (diff)
downloadcalp-e3294bff49f9c24f982d5a2203b4263dd4d4dd2f.tar.gz
calp-e3294bff49f9c24f982d5a2203b4263dd4d4dd2f.tar.xz
Remove weird file helper.
-rw-r--r--module/helpers.scm43
1 files changed, 0 insertions, 43 deletions
diff --git a/module/helpers.scm b/module/helpers.scm
deleted file mode 100644
index 717a10d4..00000000
--- a/module/helpers.scm
+++ /dev/null
@@ -1,43 +0,0 @@
-(use-modules (srfi srfi-1)
- (srfi srfi-8) ; receive
- )
-
-(define (nlist? l)
- "Returns #t if l is a pair that is not a list."
- (and (pair? l)
- (not (list? l))))
-
-(define (flatten tree)
- "Flattens tree, should only return propper lists."
- (cond ((null? tree) '())
- ((list? tree)
- (if (null? (cdr tree))
- (flatten (car tree))
- (let ((ret (cons (flatten (car tree))
- (flatten (cdr tree)))))
- (if (nlist? ret)
- (list (car ret) (cdr ret))
- ret))))
- (else tree)))
-
-
-(define (map-lists f lst)
- "Map f over lst, if (car lst) is a list, pass the list to f. If (car list)
-isn't a list, pass the rest of lst to f."
- (cond ((null? lst) '())
- ((list? (car lst)) (cons (f (car lst))
- (map-lists f (cdr lst))))
- (else (f lst))))
-
-(define (beautify tree)
- "Takes a prefix tree and turns some characters to strings."
- (define (helper branch)
- (receive (head tail)
- (span char? branch)
- (cons (list->string head)
- (beautify tail))))
- (if (or (null? tree)
- (not (list? tree)))
- tree
- (cons (beautify (car tree))
- (map-lists helper (cdr tree)))))