11(ns lambdacd.internal.step-id
2- (:require [lambdacd.util :as util]))
2+ (:require [lambdacd.util :as util]
3+ [lambdacd.step-id :as step-id]))
34
4- ; TODO: make this namespace public
5+ ; THIS NAMESPACE IS DEPRECATED and will be removed in subsequent releases.
6+ ; Use lambdacd.step-id instead.
57
68(defn parent-of? [a b]
7- (let [cut-off-b (take-last (count a) b)]
8- (and
9- (not= a b)
10- (= a cut-off-b))))
9+ (step-id/parent-of? a b))
1110
1211(defn later-than? [a b]
13- (let [length (max (count a) (count b))
14- a-parents-first (reverse a)
15- b-parents-first (reverse b)
16- equal-length-a (util/fill a-parents-first length -1 )
17- equal-length-b (util/fill b-parents-first length -1 )
18- a-and-b (map vector equal-length-a equal-length-b)
19- first-not-equal (first (drop-while (fn [[x y]] (= x y)) a-and-b))
20- [x y] first-not-equal]
21- (if (nil? first-not-equal)
22- (> (count a) (count b))
23- (> x y))))
12+ (step-id/later-than? a b))
2413
2514(defn before? [a b]
26- (and
27- (not= a b)
28- (not (later-than? a b))))
15+ (step-id/later-than? a b))
2916
3017(defn child-id [parent-step-id child-number]
31- (cons child-number parent-step-id))
18+ (step-id/ child-id parent-step-id child-number ))
3219
3320(defn root-step-id? [step-id]
34- (= 1 ( count step-id) ))
21+ (step-id/root-step-id? step-id))
3522
3623(defn root-step-id-of [step-id]
37- (last step-id))
24+ (step-id/root-step-id-of step-id))
0 commit comments