Spenser Truex

posted on 2019-4-28

Revive the portable OS interface library portions of CLOCC's PORT, with modern implementations and ASDF.

Code is on github!

Portable shell and system access. Revive the portable OS interface library portions of CLOCC's PORT, with modern implementations and ASDF. Provide better documentation than was ever offered at the now bit rotten site. Licensed with LGPL (through mandate, since the original was).

Shell, Pipes, System functions


Print the current time to the stream (defaults to t).


Find the OBJ (symbol or string) in +TIME-ZONES+.


Convert the CL timezone (rational [-24;24], multiple of 3600) to a string.


*The string representations of the time zones.


*The names of the days of the week.


*The names of the months.


Print the current environment to a stream.


Return the structure predicate name.


Return the structure copier name.


Return the list of structure BOA constructor names.


Return the structure keyword constructor name.


Return the list of structure slot names.


Return the list of initargs of a CLASS. CLASS can be a symbol, a class object (as returned by `class-of') or an instance of a class. If the second optional argument ALL is non-NIL (default), initargs for all slots are returned, otherwise only the slots with :allocation type :instance are returned.


Return the list of slots of a CLASS. CLASS can be a symbol, a class object (as returned by `class-of') or an instance of a class. If the second optional argument ALL is non-NIL (default), all slots are returned, otherwise only the slots with :allocation type :instance are returned.


Return the signature of the function.


Undo the global special declaration. This returns a new symbol with the same name, package, fdefinition, and plist as the argument. This can be confused by imported symbols. Also, (FUNCTION-LAMBDA-EXPRESSION (FDEFINITION NEW)) will return the OLD (uninterned!) symbol as its 3rd value. BEWARE!


Return T if the symbol names a global special variable.


Set an environment variable.


Return the value of the environment variable.


The default directory.


Open the pipe, do something, then close it.


Close the pipe stream.


Return an input stream from which the command output will be read.


Return an output stream which will go to the command.


Common interface to shell. Does not return anything useful.


Your implementation does not support this functionality.


An error in the user code.


Make array with elements of TYPE, initializing.



Define a typed constant.


To the CL Gardeners project (now defunct) which suggested this activity. To:

bordeaux-threads (threading)

usocket (sockets)

CLOCC's obsolete PORT

trivial gray streams

trivial garbage closer-mop

cl-fad (pathnames)

for obsoleting most of CLOCC PORT.

Toplevel Macros in Alexandria: Code Revival Project
posted on 2019-04-29

After finding the old CL Gardeners' site (now defunct), I thought I'd carry the torch this afternoon. They have four suggestions for "gardening" Common Lisp:

  • Consumer reports: Write a comparison of different libraries that do the same or similar things. Summarize the strengths and weaknesses of each. Include "under the hood" assessment; would I want to maintain this if the author got hit by a bus?
  • Code revival: Adopt an abandoned library and clean up the bit rot.
  • Code mining: dig through existing open source code bases of large applications and extract bits that can be packaged as a useful stand-alone libraries.
  • Implementation convergence: help bring various CL implementations into alignment where there's no good reason for them to differ. This can be done by providing portability libraries or, better yet, by doing the decidedly non-trivial work of finding a common ground that different implementers can actually agree on and then doing whatever it takes to convince them to make the necessary changes to their implementation. ("Whatever it takes" in this case, likely includes patches, test suites, documentation, and civil, egoless, participation in relevant developer forums.)

Browsing the site on the web archive (since they have been defunct for ten years), I found a todo item.

John Connors proposes to revivive the Port module from the
[CLOCC](http://clocc.sourceforge.net/dist/port.html): it was a small module that
provides portable acess to filesystems, threads and sockets.

I was excited to see that two of the functions in ext.lisp were already in my uitility library (as version spontaneously written by me), so clearly they deserved to be revived!

Cleaned them up and submitted to alexandria.

posted on 2019-01-07

Defines a lisp reader to read is CSV:


which is used to read in CSV files with slurp:

(slurp #p"example.csv")

and the result is a list:

CL-USER> (csv:slurp #p"example.csv")
("example" "csv" "list" "result" "like" " this")

This program invokes the lisp reader, making it:

1) Potentially risky to use if the input it not trusted.

2) Resource intensive for medium to large files (>5MB).

Use with care.


Supports escaping quotes the CSV way, with quad quotes:

csv -> lisp

"""" -> "\""


Clone from github into asdf load directory and use ASDF to install:

$ git clone https://github.com/equwal/CSV
$ sbcl
CL-USER> (asdf:load-system :csv)


By default backslashes are not escaped. CSV is expected to be a list of quoted items, like this:


How to Beat Emacs M-x dunnet in 5 minutes.
posted on 2018-12-29


In the emacs text editor there are some goofy commands that play games. M-x (which means Alt+x) is the way to execute a command in the editor, so M-x dunnet starts the game called "dunnet" which is a text adventure. I cheated and won. Defining just one function and setting one variable is sufficient to win. Here is a text map of the easy path. The command prompt is a >.

Basic Commands

  • >take something
  • >look
  • >save path
  • >restore path
  • Directions Are: n,s,e,w,ne,se,nw,sw,u,d,in,out (so you might go n).

To win

First, save the game so you can restart easily later:

  • >save ~/fresh.dun

How you need to move around the world a bit. Dunnet will greet you:

You are at a dead end of a dirt road.  The road goes to the east.
In the distance you can see that it will eventually fork off.  The
trees here are very tall royal palms, and they are spaced equidistant
from each other.
There is a shovel here.
  • >take shovel
  • >go e
  • >go e
  • >dig
  • >look
  • >take cpu
  • >go se
  • >take food
  • >go se
  • >feed bear food
  • >look
  • >take key
  • >go nw
  • >go nw
  • >go ne
  • >go ne
  • >go ne
  • >go w
  • >put cpu in computer

Now in M-: you must login to the VAX console

  • Eval: (setq dun-logged-in t)

back to the dungeon:

  • >type

greeted by a $ prompt:

To get to endgame in the VAX console, define this with M-:

(defun dun-score (garb) 90)

Now back to the dungeon:

  • $ rlogin endgame

  • >go n

Congrats, now you get questions, here they all are with answers:

  • What is your password on the machine called 'pokey'? robert
  • What password did you use during anonymous ftp to gamma? foo
  • Excluding the endgame, how many places are there where you can put treasures for points? 4 or four
  • What is your login name on the 'endgame' machine? toukmond
  • What is the nearest whole dollar to the price of the shovel? 20 or twenty
  • What is the name of the bus company serving the town? mobytours
  • Give either of the two last names in the mailroom, other than your own. collier
  • What cartoon character is on the towel? snoopy
  • What is the last name of the author of EMACS? stallman
  • How many megabytes of memory is on the CPU board for the Vax? 2
  • Which street in town is named after a U.S. state? vermont
  • How many pounds did the weight weigh? ten
  • Name the STREET which runs right over the subway stop. 4th
  • How many corners are there in town (excluding the one with the Post Office)? 24
  • What type of bear was hiding your key? grizzly
  • Name either of the two objects you found by digging. cpu
  • What network protocol is used between pokey and gamma? ip

So you might do:

  • >answer cpu


  • >go n

there are three quesions in total:

  • >answer something
  • >go n
  • >answer something
  • >take bill

(naturally, you deserve it you cheater)!

  • >go n
  • >take Mona

(you dirty cheater)

Congrats you are in the winner's room.

  • >save ~/cheater.dun
  • >restore ~/fresh.dun

Now you can actually play it if you want.

posted on 2018-11-26
posted on 2018-11-21
Org Mode Support With Coleslaw
posted on 2018-02-01


Coleslaw is a static content generator, similar to Jekyll or Wordpress, written in Common Lisp. It supports Markdown, cl-who, and some other formats. I have written a very hacky org-mode format implementation that uses undocumented internals. Unfortunantly the only alternative is to require that everything is done from within Emacs by a user, instead of being able submit from the Common Lisp REPL. Hopefully I can petition to get the one function made external and supported, but otherwise you can expect this code to maybe randomly break in the future.

How it works

Just write a regular org-mode file, without any coleslaw headers. Everything is done via org, so use org headers like #+TITLE for metadata.


  • Tagging integration with coleslaw (so RSS feeds work, for example).

This blog covers article

View content from 2018-02, 2018-11, 2018-12, 2019-01, 2019-04, 2019-4-

Spenser Truex
hacker emblem