(defmodule Filepath (use Array) (doc dir-from-path "Removes the file-name part of a path to a file.") (defn dir-from-path [path] (let [segments (split-by path &[\/]) n (dec (length &segments)) without-last (prefix-array &segments n)] (concat &(copy-map (fn [s] (str* s "/")) &without-last)))) )