This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#| | |
* (cffi:use-foreign-library "/Applications/Julia-0.5.app/Contents/Resources/julia/lib/libjulia.0.5.1.dylib") | |
#<CFFI:FOREIGN-LIBRARY LIBJULIA.0.5.1.DYLIB-505 "libjulia.0.5.1.dylib"> | |
* (cffi:defcfun ("jl_init" jl-init) :void (julia-home-dir :string)) | |
JL-INIT | |
* (jl-init "/Applications/Julia-0.5.app/Contents/Resources/julia/lib/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar *fli1* | |
(fli:register-module "/Applications/Julia-0.5.app/Contents/Resources/julia/lib/libjulia.0.5.1.dylib")) | |
(fli:define-foreign-function | |
(jl-init "jl_init" :source) | |
((julia-home-dir (:reference-pass :ef-mb-string))) | |
:result-type :void | |
:language :C | |
:calling-convention :cdecl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; https://z0ltan.wordpress.com/2017/02/24/a-piglatin-translator-in-common-lisp-and-contrasting-it-with-the-racket-version/ | |
#| | |
(defpackage #:piglatin | |
(:use :cl :cl-user)) | |
; using CL-USER makes no sense, it usually does not export anything. | |
(in-package #:piglatin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; linear-search returns the position of item in the list | |
(defun linear-search (list item &aux (pos 0)) | |
(dolist (e list nil) | |
(if (eql e item) | |
(return pos) | |
(incf pos)))) | |
(defun linear-search (list item &aux (pos 0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Lispworks | |
(defun fastq-reader (fname) | |
(let ((in (open fname))) | |
#'(lambda () | |
(prog2 ; <-- prog1 and prog2 are nifty! | |
(read-line in nil) | |
(read-line in nil) ; <-- this is the sequence line | |
(read-line in nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; response to https://kaushikghose.wordpress.com/2017/01/18/common-lisp-doesnt-yield/ | |
; write functions which map a function over stuff | |
; use I/O streams | |
(defun map-fastq-stream (in fn) | |
"Map FN over the IN stream. FN gets called on each second line out of four lines." | |
(flet ((fastq-reader (in) | |
(prog2 | |
(read-line in nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun abbreviate-butlast (path) | |
(loop for (item . rest) on path | |
collect (if (and rest (> (length item) 1)) | |
(subseq item 0 1) | |
item))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; a join function using FORMAT | |
(defun join-aux (stream &rest args) | |
(declare (ignore args) | |
(special delim)) | |
(princ delim stream)) | |
(defun join (list delim) | |
(declare (special delim)) | |
(format nil "~{~a~^~/JOIN-AUX/~:*~}" list)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; https://github.com/alandipert/dotfiles/blob/master/dotfiles/bash/abbrev_pwd.lisp | |
; original | |
; splits string into a vector of strings | |
(defun split-string (str delim-char) | |
(let* ((num-delims 2) | |
(delim-idxs (loop with idxs = (list (length str)) | |
for idx from (1- (length str)) downto 0 | |
when (eq (elt str idx) delim-char) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Comparing/explaining the screenshots | |
http://dustycloud.org/tmp/emacs-and-the-lisp-machine.png | |
* Left: Document Examniner from Symbolics, a system supplied application of the Genera OS | |
** Application to browse and read documentation on the Symbolics Lisp Machine | |
* Right: GNU Emacs |