Skip to content

Instantly share code, notes, and snippets.

@selwynsimsek
Created March 30, 2018 13:08
Show Gist options
  • Save selwynsimsek/3d954fa5fccc9447ab5c3f6b690f0619 to your computer and use it in GitHub Desktop.
Save selwynsimsek/3d954fa5fccc9447ab5c3f6b690f0619 to your computer and use it in GitHub Desktop.
A guide to how to carry out some everyday tasks in Common Lisp
;;; A guide I made which summarises the best way to do typical tasks in Common Lisp, using the easiest or most standard libraries out there.
;;; By 'typical' I mean tasks which are typically achieved using some standard library in Python, which in Lisp would require the use of Alexandria
;;; or some other such helper library which is not covered in the HyperSpec or introductory texts. May be useful to others.
;; Executing a shell task with real-time output (this is the best I could do, unfortunately SBCL specific and not Lispy.
;; Useful for long running tasks like builds which may take some hours to complete.
(sb-ext:run-program "/bin/bash" (list "-c"
"echo a && sleep 1 && echo b && sleep 2 && echo c")
:input t :output *standard-output*)
;; Conjoining/disjoining predicates
#'alexandria:conjoin
#'alexandria:disjoin
;; Uniform random distribution
(random 1.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment