In the playlist view of schemep3, I display the last play date of each song in the format YYYY-MM-DD. I discovered that PLT supplies a function called date->string whose format is determined by the value of the parameter date-display-format. Fortunately, one of the values of date-display-format is ‘iso-8601 which will display in YYYY-MM-DD [...]
One of the things that took me a long time to figure out, was how to do platform specific code from a C extension. It’s pretty easy to determine which platform you are on (system-type), but require must be a top-level form, so it can be in a conditional.
I discovered that what I really [...]
Due to frightful weather and an excess of accumulated days off, I spent the morning rocking out some AppleScript.
I’m a big fan of Jing. I’m also a fan of IRC. On the IRC channel/server I connect to, we send a lot of Jing recordings back and forth.
On my PC I use Pidgin to [...]
Yesterday I discovered match-lambda and match-lambda*.
They allow you to do lambda functions with pattern matching. It helped clean up my playlist callbacks in Schemep3.
Instead of this:
(playlist-add-hook
(lambda (op-type . params)
(case op-type
((playlists-create)
[...]
After I posted a question on the PLT Scheme mailing list asking how to clean up a database resource from an iterator, someone pointed me towards will-executor. Basically, it allows you to install a “will” that can get executed when a value has been determined to be no longer reachable. This allows you [...]
I found a bug in Schemep3 related to some issues in the paths Windows gives you for drag and drop.
I was getting duplicate entries for some files.
I had seen this problem before, but that time, the problem was that some paths had “/” in them where in other cases they had “” so the [...]
For Schemep3 it was very important that I have a parser for mp3 and FLAC files. At first, I rolled my own scheme only implementation for both, but found it very cumbersome and I did not have much faith in them. Then I tried id3lib which did not work as well as I [...]
Last post, I posted my in-path iterator that iterates through all the files in a particular path. Today’s function will recursively iterate through all the files in a path and its subdirectories. This is more useful for my Schemep3 program tha in-path because generally I want to recurse through all the files when [...]
As I mentioned last time, I’ve also used the cool iterators in PLT Scheme to create iterators for directory contents. Without further ado:
(require srfi/26)
(define (directory-or-file-list path)
(if (directory-exists? path)
(map (cut build-path path <>) (directory-list path))
(list path)))
(define (in-path path)
(make-do-sequence
[...]
I recently came to understand the great power behind the iteration and comprehension forms in PLT Scheme. Once I realized how they worked, I wrote the following iterator that will iterate over an association list and decouple the key and value in the process.
(define (in-alist alist)
(make-do-sequence
(lambda ()
[...]
Recent Comments