Sunday, August 28, 2005
This is the version of bash lambda before I reread the last mail from Kent Pitman:
LISP:
(in-package :cl-user)
(defpackage :bash-lambda (:use :cl))
(in-package :bash-lambda)
(defun arg-p (atom)
(and
(symbolp atom)
(eq #\$ (char (symbol-name atom) 0))
(every #'digit-char-p (subseq (symbol-name atom) 1))))
(defun arg-num (arg)
(read (make-string-input-stream
(subseq (symbol-name arg) 1))))
(defun find-max-weight (predicate weight list)
(loop for x in list
if (atom x)
when (funcall predicate x)
maximize (funcall weight x) into max1
end
else
maximize (find-max-weight predicate weight x) into max2
finally
(return (max max1 max2))))
(defun bash-lambda-reader (stream char)
(declare (ignore char))
(unwind-protect
(progn
(set-macro-character #\$ nil)
(let* ((body (read stream t nil t))
(arg-list
(loop for i from 1 to (find-max-weight #'arg-p #'arg-num body)
collect (intern (format nil "$~S" i)))))
`(function (lambda ,(append arg-list '(&rest rest))
(declare (ignorable ,@arg-list rest))
,body))))
(set-macro-character #\$ #'bash-lambda-reader)))
(set-macro-character #\$ #'bash-lambda-reader)
(Actually, I’m just checking if SynthHihol plugin works, and it seems to)
Sunday, August 28, 2005
I’m having a week off and I’d like to tie some of the loose ends in my lisp education:
- Reader macros
- After I learned about them, I wrote a tiny example - bash-lambda, which I presented to the gurus on comp.lang.lisp and got some feedback. I also went on to improve the example according to the advise and had Kent M Pitman tutor me further over email. But I didn’t answer nor used the advice from his last latter, which I can do now, that I have some free time.
- Chord builder
- Once I’ve hacked together a guitar chords builder in scheme. When I decided to learn common lisp (again) I rewrote the chord builder in it (not without some help from comp.lang.lisp). Since I haven’t learn any gui libraries yet I’m satisfied with what I’ve got now except for the fact that the program only knows like 4 chords. I have to fix that before I put it online.
- Compiler
- I want to understand how exactly the lisp compiler works. The easy way to find out would have been to take a simple common lisp implementation and read its sources. But, as our military faculty professors used to say: “where is challenge in that?” I am thus going to (try to) read the sources of sbcl. The reason I want to know how the compiler works, apart from my always having been interested in compiler technology, is that I’d like to imagine a signal processing language in common lisp. Something like Nyquist and Packet Forth but written in common lisp (to the maximum extent that makes sense) and being an extension to common lisp. Not that I’m going to implement it but I’d like to speculate about it. Why do I need to know about the compiler then? I intuit that it’d be helpfull, but I don’t know for sure. But learning something doesn’t hurt, now does it?
- GUI
- I want to be able to write graphical programs in lisp. I ran out of luck recently trying to build McClim with sbcl 0.9.3. I know the answer is out there somewhere in the mailing lists and usenet, but I haven’t had time to investigate. I’ll try now.
That sounds too ambitious for a week, but I’ll consider it a general direction in my lisp education for the following months.
Saturday, August 27, 2005
In a messy long forum discussion at last.fm I’ve found how to make lastfm:// links work:
Type in “about:config” in the location bar
right click, select New –> String
name of string should be: “network.protocol-handler.app.lastfm”
value should be the path to your player executable, eg “~/Last.fm/player”
He means right click on the list of properties
Saturday, August 27, 2005
I just went to last.fm to find this simon’s picture for the blogroll and look what i found: they’ve got a new player which ain’t no javascript, but a C++ and open source and I immediatelly found the lovely station playing artists similar to John Coltrain
Also the whole look of the site has changed and they finally clean(s)ed my profile from the buggy stats that we stored there by the previous version. Very lovely, I’m switching to listening last.fm again.
Friday, August 26, 2005
Yes, I did it again!
After like 1.5 years on mekka I moved again, this time to PowWeb
Why? Probably it’s logical consequence of my latest trend towards minimizing customization - now i can install stuff with one click and configure it via web interface and not write a single line of code for some time.
To begin with, I’ll install WordPress, register with flickr and see what can i do with this minimal set of services. The most important bit - my pub I’ve already moved from mekka, but it’s not absolutelly OK, yet - it won’t recognise the headers/footers so all of them directory listings look defaulty ugly. Gotta figure now, what went wrong there exactly?
Update: the header / footer problem solved.