Tuesday, August 31, 2010

scheme

I have so much spare time...
I'm in my summer vacations. And I don't have much work to do (on my part-time job), and pretty much nothing to do at University...
I've spent it so far studying scheme/emacs lisp/logo.
I finally ended reading "Computer Science Logo Style Volume 1: Symbolic Computing". It was a great reading. It's supposed to be like for high school or hobbyist programmers though... I'm a senior at my University and it took me some time to get many of the concepts there... damn. But reading that book really helped me out, it has helped understand many other lisp-like programming languages (scheme and emacs lisp). And volumes 2, and 3 seem like a good read too^^.
I really wish I have read this when I was in high school... actually I wish I had used linux when I was in high school so much. But the knowledge was to far away from me.

I rewrote a program I had written in C, which did a calculation of some huge files (5235 lines of some columns of big numbers...) to scheme --- I actually wanted to write it at first with logo, but since the current stable debian version doesn't support arguments I decided to give scheme a chance---. What a beautiful language. So simple, it doesn't even have a format function by default! You have to search the SRFIs for any not-simple stuff.
Actually many scheme's implementations (interpreter/compiler) didn't accept command line arguments either, so I went to the freenode's IRC's scheme channel and had a very educational chat.
I ended up using gambit (the gambc package in debian) which takes command line arguments by default, so you can use it with windows and macs too. Being that I want to give this program to a friend that only has windows, that was a very good feature.
In C the program took about 4 mins per directory. In scheme (not compiled), it took 5 mins and a half. Which is not bad at all! I tried compiling it but I guess I have to read the documentation some more...

I started learning scheme here and reading the gambit's info manual. At first, it's very much alike emacs lisp (being that it is a lisp dialect) so it was very easy to read.

I've been thinking of taking my programming skills to a decent level, and make my own bittorrent client. So lately I've been reading about bittorrent's protocol, and emacs lisp related http post/get functions.
I want to write in emacs lisp, obviously because I want to use it in emacs! I want something like Ktorrent in the aspect that I can choose the encoding and the files to download myself, but something like aria2c in the aspect that I just want to start it fast....
Besides aria2c has some problems with files encoding when they're in Japanese (even in unicode...) I don't get why. But not being able to choose the trackers to use in aria2c is a problem too. Now that I read the bittorrent's protocol documentation I know I can just edit the torrent file and delete any other trackers myself. But still, I would like it to be simpler...
Anyway, I guess it's gonna take some time, but I'm gonna try writing it.

No comments:

Post a Comment