Idiomdrottning’s homepage

lspls

Creating zshbrev kinda stopped my releasing of apps into a halt because now instead of making a whole app I’ll just add a few lines to .zshbrev/functions.scm, usually hardcoding paths and variables too just because that’s simpler.

Like right now, I wanted a simple CLI app to turn a shell glob into a .pls playlist so I just:

(define (lspls . files)
  (print "[playlist]
NumberOfEntries=" (length files))
  ((over (print "File" (add1 i) "=" x))
   (map
    (strse "/var/example/path1"
           "https://example.url/prefix1"
           "/var/example/path2"
           "https://example.url/prefix2")
    (map realpath files)))
  (void))

(Using my real file paths and URL prefixes instead of those example ones.)

Zshbrev too good! The Emacs-inspired whole “big ball of spaghetti” approach where any function can call any other function—like “realpath” in this example, originally defined for something else—turned out to be quite the ticket for code reuse.