Use `append-map` where possible

remotes/jackfirth/master
Jack Firth 2 years ago
parent e9bb15e9d5
commit 8e87b541e1

@ -27,9 +27,9 @@
[(repeatR? r) [(repeatR? r)
(get-char-groups (repeatR-re r) found-negation)] (get-char-groups (repeatR-re r) found-negation)]
[(orR? r) [(orR? r)
(apply append (map (λ (x) (get-char-groups x found-negation)) (orR-res r)))] (append-map (λ (x) (get-char-groups x found-negation)) (orR-res r))]
[(andR? r) [(andR? r)
(apply append (map (λ (x) (get-char-groups x found-negation)) (andR-res r)))] (append-map (λ (x) (get-char-groups x found-negation)) (andR-res r))]
[(negR? r) [(negR? r)
(if found-negation (if found-negation
(get-char-groups (negR-re r) #t) (get-char-groups (negR-re r) #t)
@ -197,8 +197,7 @@
[(null? st) '()] [(null? st) '()]
[else [else
(loc:partition (map char-setR-chars (loc:partition (map char-setR-chars
(apply append (map (λ (x) (get-char-groups (car x) #f)) (append-map (λ (x) (get-char-groups (car x) #f)) (state-spec (car st)))))]))
(state-spec (car st))))))]))
(test-block ((c (make-cache)) (test-block ((c (make-cache))
(c->i char->integer) (c->i char->integer)

@ -88,7 +88,7 @@
(define (get-term-list term-group-names) (define (get-term-list term-group-names)
(remove-duplicates (remove-duplicates
(cons (datum->syntax #f 'error) (cons (datum->syntax #f 'error)
(apply append (map get-terms-from-def term-group-names))))) (append-map get-terms-from-def term-group-names))))
(define (parse-input term-defs start ends prec-decls prods src-pos) (define (parse-input term-defs start ends prec-decls prods src-pos)
(define start-syms (map syntax-e start)) (define start-syms (map syntax-e start))

@ -69,7 +69,7 @@
;; return the list of all (B -> beta . nt gamma) such that (B -> beta nt gamma) in prod-list ;; return the list of all (B -> beta . nt gamma) such that (B -> beta nt gamma) in prod-list
;; and gamma =>* epsilon ;; and gamma =>* epsilon
(define (prod-list->items-for-include g prod-list nt) (define (prod-list->items-for-include g prod-list nt)
(apply append (map (λ (prod) (prod->items-for-include g prod nt)) prod-list))) (append-map (λ (prod) (prod->items-for-include g prod nt)) prod-list))
;; comput-includes: lr0-automaton * grammar -> (trans-key -> trans-key list) ;; comput-includes: lr0-automaton * grammar -> (trans-key -> trans-key list)
(define (compute-includes a g) (define (compute-includes a g)

Loading…
Cancel
Save