Clarify a few comments in TR
These are for letrec typechecking and Tarjan's algorithm
This commit is contained in:
parent
93a2798ec3
commit
04c3851ebc
|
@ -189,8 +189,9 @@
|
|||
(struct lr-clause (names expr clause) #:transparent)
|
||||
|
||||
;; get-non-recursive-clauses : (Listof lr-clause) (Listof Identifier) ->
|
||||
;; (Listof lr-clause) (Listof )
|
||||
;; Find letrec-values clauses that do not create variable cycles
|
||||
;; (Listof lr-clause) (Listof lr-clause)
|
||||
;; Find letrec-values clauses that do not create variable cycles. Return
|
||||
;; both the non-recursive clauses and the remaining recursive ones.
|
||||
(define (get-non-recursive-clauses clauses flat-names)
|
||||
|
||||
;; Set up vertices for Tarjan's algorithm, where each letrec-values
|
||||
|
@ -215,7 +216,8 @@
|
|||
(andmap (λ (id2) (not (bound-identifier=? id id2)))
|
||||
(vertex-adjacent vertex))))
|
||||
|
||||
;; The components with only one entry are non-recursive
|
||||
;; The components with only one entry are non-recursive if they also
|
||||
;; contain no self-cycles.
|
||||
(for/fold ([non-recursive '()]
|
||||
[remaining '()])
|
||||
([component components])
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
;; tarjan : (Dict K (Vertex K V)) -> (Listof (Listof (Vertex K V)))
|
||||
;; Implements Tarjan's algorithm. See Wikipedia
|
||||
;; http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm
|
||||
;;
|
||||
;; Note that because this accumulates the result with `cons`, the components
|
||||
;; are actually output in topological order rather than *reverse* topological order.
|
||||
;; If you want reverse topological order, reverse the result.
|
||||
(define (tarjan vertices)
|
||||
(define (strongly-connected vtx)
|
||||
(set-vertex-index! vtx index)
|
||||
|
|
Loading…
Reference in New Issue
Block a user