Skip to content

Instantly share code, notes, and snippets.

@artyom-poptsov
Created August 7, 2020 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artyom-poptsov/f1a3479522455b97cbbf30801d395f1e to your computer and use it in GitHub Desktop.
Save artyom-poptsov/f1a3479522455b97cbbf30801d395f1e to your computer and use it in GitHub Desktop.
(define-syntax M#!
(syntax-rules (=>)
((_ type command)
(list (quote type) command))
((_ => type command)
`(,(list (quote type) command)))
((_ => type command rest ...)
`(,(list (quote type) command) ,@(M#! rest ...)))
((_ type command => rest ...)
(apply plumb `(,(list (quote type) command) ,@(M#! => rest ...))))))
;; Usage example:
;; (M#! local "cat /etc/hosts" => local "grep 127" => local "sort")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment