 SYMBOLS: visited active ;
 
 : record-back-edge ( from to -- )
-    lookup-header ends>> conjoin ;
+    lookup-header ends>> adjoin ;
 
 DEFER: find-loop-headers
 
-: visit-edge ( from to -- )
-    dup active get in?
+: visit-edge ( from to active -- )
+    dupd in?
     [ record-back-edge ]
     [ nip find-loop-headers ]
     if ;

<PRIVATE

: <natural-loop> ( header index -- loop )
    H{ } clone H{ } clone natural-loop boa ;

: lookup-header ( header -- loop )
    loops get [

        {
            [ visited get adjoin ]
            [ active get adjoin ]
            [ dup successors>> active get '[ _ visit-edge ] with each ]
            [ active get delete ]
        } cleave
    ] if ;
