• (compound-prefix-match? split prefix target)
Takes a `prefix' and a `target' string and returns whether `prefix'
is a compound-prefix of `target'.

Viewing each of `prefix' and `target' as a series of substrings
split by `split', if each substring of `prefix' is a prefix of the
corresponding substring in `target' then we call `prefix' a
compound-prefix of `target'.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source swank/commands/contrib/swank_c_p_c/internal.clj:6 top

(defn compound-prefix-match?
  "Takes a `prefix' and a `target' string and returns whether `prefix'
  is a compound-prefix of `target'.

  Viewing each of `prefix' and `target' as a series of substrings
  split by `split', if each substring of `prefix' is a prefix of the
  corresponding substring in `target' then we call `prefix' a
  compound-prefix of `target'."
  ([split #^String prefix #^String target]
     (let [prefixes (split prefix)
           targets  (split target)]
       (when (<= (count prefixes) (count targets))
         (every? true? (map #(.startsWith #^String %1 %2) targets prefixes))))))
Vars in swank.commands.contrib.swank-c-p-c.internal/compound-prefix-match?: <= count defn every? let map true? when
Used in 0 other vars

Comments top

No comments for compound-prefix-match?. Log in to add a comment.