The American Republic will endure until the day Congress discovers that it can bribe the public with the public’s money. - de Tocqueville
I dislike Scala but it’s harder to rationalize →@milessabin:…Dependent method types enabled by default on #Scala trunk! http://t.co/oLKP5L0N
Bets on another run at legal legerdemain? → @AJEnglish: Obama: All US troops out of Iraq by year-end http://t.co/5PVlOT00
Both JPEG, automatic settings on each. Imported both into Aperture and cropped some vines reflected on the hood of my car. Definitely more noise on the phone, but its sensor is about 1/1,000,000th the size and the glass is about 1/1000th the price. And it’s a phone, iPod, and Internet connection device and can fit in a shirt or pants pocket, geotag images, film video, and power on and take a photo much faster than the X1 (even with firmware 2.0).
The heck? 200MB for McAfee bundled w/VMware Fusion?
That is criminal.
How do I not notice that it gets so late? It’s as if I go into a time warp (yeah, yeah) from 10pm-2am. #blackouts?
Has anyone used one of those standalone flat panel lifts? Not the horrid pop-out fake furniture but something I could hide behind a credenza
At http://stackoverflow.com/questions/7424307/can-i-save-source-files-in-clisp/7425043#7425043, someone asked how to save Lisp source files from the CLISP REPL. It’s been a really, really long time since I used CLISP, but I like to help people out. Here’s my response so that people can find it with Google – not that StackOverflow has a lower Page rank than my blog.
No. Once you enter a function into the REPL, the source form is gone and you just have the interpreted or compiled form. You can do some clever things, but I suspect you don’t want to deal with them right now.
Use Emacs and SLIME
First, I know you are enjoying the REPL, but I would encourage you to look at some of the editors with Lisp support, such as Emacs with SLIME, which give you the best of both worlds. You type into the editor, it types into the REPL, and you really don’t know the difference from how you are doing things now. Then you can copy and paste the functions you like into a “proper” .lisp file. The other advantage of using Emacs is that it’s based on a variant of Lisp called Elisp, so you can program your editor in Lisp. You can pretty print your code, reformat and refactor it into multiple functions, and do all kinds of excellent things.
If you still just want to type clisp and play at the REPL, then you still have options.
If you want to log the output of your REPL session, check out DRIBBLE. It will log your session to a file, and you can edit that later to extract what you want.
For example, this is a simple session:
ataylor:~ $ clisp
> (dribble "/Users/ataylor/jerome.lisp") # > (defun add-two (a b) (+ a b)) ADD-TWO > (add-two 1 2) 3 > (dribble) # > Bye.
Viewing the contents of the file is easy, but it can get big quickly.
ataylor:~ $ cat jerome.lisp ;; Dribble of # started on 2011-09-14 18:16:57. # > (defun add-two (a b) (+ a b)) ADD-TWO > (add-two 1 2) 3 > (dribble) ;; Dribble of # finished on 2011-09-14 18:17:16.
You could copy
(defun add-two (a b) (+ a b)) and
paste it into a file for later.
Loading that file (I added it to
ataylor:~ $ cat jerome1.lisp (defun add-two (a b) (+ a b)) ataylor:~ $ clisp
> (load "/Users/ataylor/jerome1.lisp") ;; Loading file /Users/ataylor/jerome1.lisp ... ;; Loaded file /Users/ataylor/jerome1.lisp T > (add-two 1 2) 3 > Bye.
Saving a session
The easiest thing you can do is saving your Lisp session to an image. It will save all of the functions you’ve created or compiled, along with most state. When you load it at your next session, it will be almost as if you hadn’t exited clisp. The way to do this is implementation dependent, and differs between clisp, sbcl, etc. I’ll show you what you would do for clisp.
The problem with this is that you can’t open a file and edit it, post it on github, or whatever. I’ll give a brief example.
ataylor:~ $ clisp
> (defun add-two (a b) (+ a b)) ADD-TWO > (add-two 1 2) 3 > (EXT:SAVEINITMEM) ;; Wrote the memory image into lispinit.mem (3,422,616 bytes) Bytes permanently allocated: 171,840 Bytes currently in use: 3,243,400 Bytes available until next GC: 808,130 3243400 ; 808130 ; 171840 ; 1 ; 65640 ; 7834 > Bye.
Note that message about where clisp wrote the memory image. You’ll give that back to clisp with the
when starting it the next time.
ataylor:~ $ clisp -M lispinit.mem
> (add-two 1 2) 3
Why is the the CITY OF BERKELEY, CA (sic) charging me a $2 “convenience fee” for paying a ticket online? A stamp is only 4x¢.
Not speaking of which, know anyone who will develop custom keymaps? I’d also love a good matrix kbd that’s as good as a flat Mac kbd.