<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6885945</id><updated>2011-04-21T10:55:46.265-07:00</updated><title type='text'>Wacky Crazy Weblog</title><subtitle type='html'>Programming Languages, Tools, Databases, Data Warehouses, Just Plain Old Fashion Ranting</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>32</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6885945.post-115316517853954699</id><published>2006-07-17T12:30:00.000-07:00</published><updated>2006-07-17T12:39:38.550-07:00</updated><title type='text'>Insertion Sort</title><content type='html'>Its been a while since I posted any Lisp content and I have not been in touch for long. For anyone trying to get in touch, I still don't have access to my Yahoo account.&lt;br /&gt;&lt;br /&gt;Well, I was trying a simple insertion sort algorithm directly from a book.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(defun insertion-sort (A)&lt;br /&gt;  (do ((j 1 (+ j 1)))&lt;br /&gt;      ((&gt;= j (length A)) 'done)&lt;br /&gt;    (let ((key (aref A j))&lt;br /&gt;          (i (- j 1)))&lt;br /&gt;      (while (and (&gt;= i 0) (&gt; (aref A i) key))&lt;br /&gt;        (progn&lt;br /&gt;          (setf (aref A (+ i 1)) (aref A i))&lt;br /&gt;          (setf i (- i 1))&lt;br /&gt;          (setf (aref A (+ i 1)) key)&lt;br /&gt;          (print x))))))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The while is just a macro copied out of ANSI Common Lisp and very basic (no gensyms etc). Just for reference, it is&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(defmacro while (test &amp;rest body)&lt;br /&gt;  `(do ()&lt;br /&gt;    ((not ,test))&lt;br /&gt;    ,@body))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Executing it as follows (Followed the algo by the book).&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;CL-USER&gt; x&lt;br /&gt;#(5 2 4 6 1 3)&lt;br /&gt;CL-USER&gt; (insertion-sort x)&lt;br /&gt;&lt;br /&gt;#(2 5 4 6 1 3)&lt;br /&gt;#(2 4 5 6 1 3)&lt;br /&gt;#(2 4 5 1 6 3)&lt;br /&gt;#(2 4 1 5 6 3)&lt;br /&gt;#(2 1 4 5 6 3)&lt;br /&gt;#(1 2 4 5 6 3)&lt;br /&gt;#(1 2 4 5 3 6)&lt;br /&gt;#(1 2 4 3 5 6)&lt;br /&gt;#(1 2 3 4 5 6)&lt;br /&gt;DONE&lt;br /&gt;CL-USER&gt; x&lt;br /&gt;#(1 2 3 4 5 6)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Its amazing, how much one forgets in a few months/years.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-115316517853954699?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/115316517853954699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=115316517853954699' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/115316517853954699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/115316517853954699'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2006/07/insertion-sort.html' title='Insertion Sort'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-114936832132278827</id><published>2006-06-03T13:51:00.000-07:00</published><updated>2006-06-03T13:58:41.333-07:00</updated><title type='text'>Rocket &amp; Ricotta Special Rolls</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/2431/396/1600/IMG_0076.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://photos1.blogger.com/blogger/2431/396/320/IMG_0076.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Well, I am back after a long sojourn. Its been more than a year since I blogged. Sorry to people who have been reading and following along.&lt;br /&gt;&lt;br /&gt;We made an interesting looking meal today and it looked fairly ok and tasted quite good. It appears to be pretty healthy too.&lt;br /&gt;&lt;br /&gt;I will list all the ingredients here and you folks can try to figure out what went into it. Its not as simple as it looks as it does comprise of a lot of leftovers which were not that easy to make. So if someone wants the recipe then, let me know. I may send it to you if I can remember how.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Ingredients&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Tortilla Wraps, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Spinach, Small Radish, Cucumber, Onion, Yellow Pepper&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Rocket Salad - Lollo Bionda Lettuce, Red Batavia Lettuce, Rocket, Mizuna&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Garlic, Olive Oil, Soy Sauce, Cumin Seeds, Garam Masala, Maggi Hot &amp; Sweet Sauce&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Low Fat Cheese Slices, Ricotta Cheese&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Eggs and Egg Whites&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-114936832132278827?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/114936832132278827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=114936832132278827' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/114936832132278827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/114936832132278827'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2006/06/rocket-ricotta-special-rolls.html' title='Rocket &amp; Ricotta Special Rolls'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-109394339315293587</id><published>2004-08-31T02:07:00.000-07:00</published><updated>2004-08-31T02:09:53.153-07:00</updated><title type='text'>Hear me squeak</title><content type='html'>Squeak is a highly respected free implementation of Smalltalk based on the original Smalltalk 80 with names such as Alan Kay and Dan Ingalls (from the original Smalltalk project) involved in it. The cool thing about Squeak is that the code not only works bit-identical across platforms, but also looks the same.&lt;br /&gt;&lt;br /&gt;I have always wanted to play with Smalltalk because there are people who I respect and personally know in the software world who do not like to work with any other language. My friend Jason, a Smalltalk hacker had given me the 10 minute introduction a while ago about the 3 types of messages is all one needs to understand.&lt;br /&gt;&lt;br /&gt;So I decided, to try it out for real. This is more of a challenge than one thinks, because you have to change your way of thinking. However, some of the tutorials on the web were helpful.&lt;br /&gt;&lt;br /&gt;First things first. I hate the default theme. I can't stand it. They really could make it look nicer without my having to tweak the settings. But look and feel was the last thing on my mind. So I followed a few tutorials and came to one conclusion.&lt;br /&gt;&lt;br /&gt;I absolutely love the environment. I am not crazy about the language or syntax, even though its nicer than any of the mainstream languages. I would anyday choose Lisp over it. I miss the parens already.&lt;br /&gt;&lt;br /&gt;The image saving is probably the best part. CL implementations also have image saves, but really it cannot compare to the way Smalltalk does it. "Inspect" and "Do It" are great, but that is something that I expect from a half decent language anyway.&lt;br /&gt;&lt;br /&gt;My ideal development environment would probably be a Common Lisp that is really inspired by Smalltalk environments. As far as I have heard and read about it, Lisp Machines were/are like that some 20 years ago.  I do not know if any of the modern Lisp environments are like that.&lt;br /&gt;&lt;br /&gt;The Smalltalk System Browser is such an easy to use well thought out tool. I also tried the trial version of Visual Works on Mac OS X. I did not like it as much. It seemed too complicated to me after following the "WalkThru" exercise. One tip to Cincom - GUI walkthroughs suck. Show me the language first. Show me the power of iterating through a collection of objects or something of that nature. Something that lets me write the equivalent or at least close to MAPCAR in Smalltalk. Show me how to accomplish more with less code. I know it does have those capabilities and as a developer, that is what I am waiting to see.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-109394339315293587?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/109394339315293587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=109394339315293587' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/109394339315293587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/109394339315293587'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/08/hear-me-squeak.html' title='Hear me squeak'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-109276112284081094</id><published>2004-08-17T09:41:00.000-07:00</published><updated>2004-08-17T09:45:22.840-07:00</updated><title type='text'>Using CL-PPCRE for weblog search</title><content type='html'>A little while ago, I wrote a search facility for my weblog. This was for personal use, and the code might be very primitive. However, here are the main functions that I used.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;;;; This program depends on CL-PPCRE. It should be loaded&lt;br /&gt;;;; as a package first or available in the lisp image&lt;br /&gt;&lt;br /&gt;(defun file-to-string (file)&lt;br /&gt;  (apply #'concatenate 'string&lt;br /&gt;         (with-open-file (str file :direction :input)&lt;br /&gt;           (loop for line = (read-line str nil 'eof)&lt;br /&gt;              while (not (equal line 'eof))&lt;br /&gt;              collect line))))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(defun scan-in-file (srch file)&lt;br /&gt;  "scan for a single occurence of the string in the file"&lt;br /&gt;  (cl-ppcre:scan srch (file-to-string file)))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;;;; Takes a list of pathnames as the arg for dir.&lt;br /&gt;;;; (scan-in-directory "blah" (directory "*.txt"))&lt;br /&gt;(defun scan-in-directory (srch dir)&lt;br /&gt;  (let ((files (loop for x in dir collect&lt;br /&gt;                    (namestring x))))&lt;br /&gt;    (remove-if-not #'(lambda (file)&lt;br /&gt;                       (scan-in-file srch file)) files)))&lt;br /&gt;&lt;br /&gt;;;; searches the tree below current dir.&lt;br /&gt;;;; (search-in-tree "question" "*.txt")&lt;br /&gt;(defun search-in-tree (srch wildcard)&lt;br /&gt;  (let ((dir (nconc (directory wildcard)&lt;br /&gt;                    (directory (concatenate 'string "*/" wildcard)))))&lt;br /&gt;    (scan-in-directory srch dir)))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;;;; Creates a url that a browser can visit&lt;br /&gt;(defun create-url (file-name base-dir)&lt;br /&gt;  (let ((base-url (ext:getenv "SERVER_NAME")))&lt;br /&gt;    (let ((fpname (pathname file-name)))&lt;br /&gt;      (let ((abs-path (pathname-directory fpname))&lt;br /&gt;            (name (pathname-name fpname))&lt;br /&gt;            (type (pathname-type fpname)))&lt;br /&gt;        (let ((p (position base-dir abs-path :test #'equalp)))&lt;br /&gt;          (let ((rem-dirs (nthcdr (1+ p) abs-path)))&lt;br /&gt;            (let ((rem-path (namestring (make-pathname :directory (cons :absolute rem-dirs)))))&lt;br /&gt;              (concatenate 'string "http://" base-url "/" base-dir rem-path name "." type))))))))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If someone is curious enough to try it, its here&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sanjaypande.com/cgi-bin/mini-search-engine.lisp"&gt;Mini Weblog Search Feature&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I've used my homegrown CGI library, although this server does have mod_lisp installed, which I would like to play with when I have time.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-109276112284081094?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/109276112284081094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=109276112284081094' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/109276112284081094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/109276112284081094'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/08/using-cl-ppcre-for-weblog-search.html' title='Using CL-PPCRE for weblog search'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-109276016388627492</id><published>2004-08-17T09:24:00.000-07:00</published><updated>2004-08-17T09:36:38.216-07:00</updated><title type='text'>Increased usage of Smalltalk</title><content type='html'>Over the last couple of months, I have seen many new Smalltalk jobs here in India. Placement consultants also keep contacting me about opportunities just because I have Smalltalk on my resume. The only reason it is there is because of the description of software for which we were developing a data warehouse. While I do have a passing familiarity with the language, I did not realise that there would be people working on it in India. Intringuing.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-109276016388627492?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/109276016388627492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=109276016388627492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/109276016388627492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/109276016388627492'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/08/increased-usage-of-smalltalk.html' title='Increased usage of Smalltalk'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-109138597327425357</id><published>2004-08-01T11:40:00.000-07:00</published><updated>2004-08-01T11:46:13.273-07:00</updated><title type='text'>Self Publish Your Books</title><content type='html'>After looking at &lt;a href="http://lemonodor.com/archives/000875.html"&gt;this&lt;/a&gt; post via Lemonodor via Planet Lisp, I personally feel that more Lisp authors should self-publish their books on the web and serve them as downloadable softcopies. There are many sites that let people sell e-books, and I would anyday buy something that is good quality writing like Peter Siebel's upcoming book.&lt;br /&gt;&lt;br /&gt;This will help keep more of the money in the authors pocket's (which they deserve) and hold other rights to the content that they create. There are many reasons why I think this is a better approach than using a publisher especially in a small and niche market segment like Lisp related material.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-109138597327425357?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/109138597327425357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=109138597327425357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/109138597327425357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/109138597327425357'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/08/self-publish-your-books.html' title='Self Publish Your Books'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-109138558823979487</id><published>2004-08-01T11:34:00.000-07:00</published><updated>2004-08-01T11:39:48.240-07:00</updated><title type='text'>Been a bad week</title><content type='html'>This last week has been horrible. I managed to corrupt my hard disk to the point where my Powerbook would not even boot. This happened just before I took my set of data backups. All the code, I could rewrite but to go back to the himalayan ranges in the east and take pictures of nature and buddist monasteries again would have been some effort.&lt;br /&gt;&lt;br /&gt;Luckily I had YDL on a partition which came in handy, to install a new copy of Panther and access my hard disk. I managed to get all my backups done, and re-installed the OS. Now I am piecing things back together. Lets see how it goes.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-109138558823979487?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/109138558823979487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=109138558823979487' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/109138558823979487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/109138558823979487'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/08/been-bad-week.html' title='Been a bad week'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108963220629615294</id><published>2004-07-12T04:27:00.000-07:00</published><updated>2004-07-12T04:38:45.476-07:00</updated><title type='text'>This is better than that</title><content type='html'>It is really interesting when people highlight different parts of the same article when they interest them. Lispers and Smalltalkers usually get along quite well. I have hardly ever seen one say a bad thing about the other. I found this rather interesting, especially the pick of quotes. This refers to quotes picked out from &lt;a href="http://www.sauria.com/blog/2004/07/11#1014"&gt;Ted Leung's post&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;From a primarily Lisp &lt;a href="http://radio.weblogs.com/0102385/"&gt;blog&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Lisp is the number one programming language idea of all time. Smalltalk's contribution was to build encapsulation on top of the ideas in Lisp. Someone asked a question about the market voting or something like this. Kay's reply went something like this: Most people don't understand Lisp -- does that make it bad? Most people understand Maxwell's equations -- does that make them bad? One of the things that Kay is doing now is just going around and giving talks to remind people of the great ideas in Lisp and Doug Engelbart's work &lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;From a primarily Smalltalk &lt;a href="http://www.cincomsmalltalk.com/blog/blogView"&gt;blog&lt;/a&gt;.&lt;br /&gt;&lt;em&gt;&lt;br /&gt;Much as I love Lisp, it seems to me that the Smalltalk community, led by folks like Kay, are continuing to demonstrate a convincing agenda for forward progress, while the Lisp community is perennially struggling with basic infrastructure issues like which dialect of Lisp/Scheme, which windowing environment, etc. Perhaps this is due to the conception of Smalltalk as a system, in addition to a language.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Heh?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108963220629615294?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108963220629615294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108963220629615294' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108963220629615294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108963220629615294'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/07/this-is-better-than-that.html' title='This is better than that'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108955732371146489</id><published>2004-07-11T07:38:00.000-07:00</published><updated>2004-07-11T07:56:45.940-07:00</updated><title type='text'>Ayurvedic Massage</title><content type='html'>So I decided to get one of the Ayurvedic massages from one of the Ayurvedic clinics here. Ayurveda is India's oldest medical science and  probably pre-dates every other kind of medicine including the Chinese.  The state Kerala in the south of India has become a very popular tourist destination just because of Ayurvedic treatments.&lt;br /&gt;&lt;br /&gt;Anyway, it is quite an ordeal. The massage is extremely rigorous and tiring (not like the usual relaxing massages). They use heated medicated oils which they pour on different parts of the body depending on the treatment which is followed by a rigorous massage. This goes on for at least half an hour. Then they wipe you down steamed towels which smell like camphor.&lt;br /&gt;&lt;br /&gt;However, it is very rejuvenating. Google for 'Kerala Ayurvedic Massage' for interesting articles and pictures on the subject. If you have not tried this, it is recommended at least once. Besides, a trip to Kerala, India can be very relaxing. Its all coastal with nice clean beaches and backwaters on which you can rent a two bedroom boat for 2-3 days with a personal chef. &lt;br /&gt;&lt;br /&gt;Kerala is the only state in India that has achieved 100% literacy and people prefer to communicate in English, besides their local language Malayalam.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108955732371146489?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108955732371146489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108955732371146489' title='15 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108955732371146489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108955732371146489'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/07/ayurvedic-massage.html' title='Ayurvedic Massage'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108955660433728936</id><published>2004-07-11T07:29:00.000-07:00</published><updated>2004-07-11T07:36:44.336-07:00</updated><title type='text'>Writing LTK Extensions</title><content type='html'>Tcl/Tk have some nice extension packages like Tix, BWidgets, TkTable, Tclodbc etc. Most of them can be used from the tcl (tclsh) or tk (wish) shells. I asked Peter about adding extensions to Ltk, and he has included a chapter in the latest release of Ltk (0.8.5) AFAIK. Two thumbs up to this guy for documentation and support. He has included an example for one Tix widget.&lt;br /&gt;&lt;br /&gt;I have already started working on Ltk-odbc which will wrap tclodbc and return Lisp lists for data. It needs a lot of work as well as documenting but it has started. Watch for more on this. The next would probably be Tktable after this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108955660433728936?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108955660433728936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108955660433728936' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108955660433728936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108955660433728936'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/07/writing-ltk-extensions.html' title='Writing LTK Extensions'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108879024728819213</id><published>2004-07-02T10:41:00.000-07:00</published><updated>2004-07-02T10:56:03.440-07:00</updated><title type='text'>LTk and listboxes</title><content type='html'>Scrolling a listbox is a common requirement in many apps. The Tk listbox widget is very useful also because one can pack huge amounts of data in it very quickly. I was planning to use it for some data display functionality. So the experimentation started with a simple scrolling listbox. The first test was this&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(defun test-scroll ()&lt;br /&gt;  (with-ltk&lt;br /&gt;      (let* ((vs (make-instance 'scrollbar))&lt;br /&gt;	     (hs (make-instance 'scrollbar :orientation "horizontal"))&lt;br /&gt;	     (lb (make-instance 'listbox)))&lt;br /&gt;	(progn&lt;br /&gt;	  (configure vs "command" (concatenate 'string (path lb) " yview"))&lt;br /&gt;	  (configure hs "command" (concatenate 'string (path lb) " xview"))&lt;br /&gt;	  (configure lb "yscrollcommand" (concatenate 'string (path vs) " set"))&lt;br /&gt;	  (configure lb "xscrollcommand" (concatenate 'string (path hs) " set"))&lt;br /&gt;	  (listbox-append lb (apply #'* (loop for x from 1 to 100 collect x)))&lt;br /&gt;	  (listbox-append lb (loop for x from 1 to 100 collect x))&lt;br /&gt;	  (grid lb 0 0 :sticky "snew")&lt;br /&gt;	  (grid vs 0 1 :sticky "ns")&lt;br /&gt;	  (grid hs 1 0 :sticky "ew")))))&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The xscrolling is redundant here but I wanted to try it anyway. &lt;a href="http://www.peter-herth.de/index.html"&gt;Peter Herth&lt;/a&gt; (the author of LTk) also informed me that the PROGN is not needed. I still like to put it there anyway. So one thing I needed to try is scrolling multiple listboxes. This code has Peter's fix and the PROGN comment.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(defun test-scroll-3 ()&lt;br /&gt;  (with-ltk&lt;br /&gt;      (let* ((s1 (make-instance 'scrollbar))&lt;br /&gt;             (lb1 (make-instance 'listbox))&lt;br /&gt;             (lb2 (make-instance 'listbox)))&lt;br /&gt;        (progn  ;; you do not need a progn here...&lt;br /&gt;	;;; just define the tcl function by sending it to wish:&lt;br /&gt;	  (ltk::send-w&lt;br /&gt;	   "proc ScrollListboxes {listboxes args} {&lt;br /&gt;                foreach lb $listboxes {&lt;br /&gt;                        eval $lb yview $args&lt;br /&gt;                }&lt;br /&gt;           }")        &lt;br /&gt;          ;; now configuring the scrollbar works as in tk:&lt;br /&gt;          (configure s1 "command" (format nil "ScrollListboxes {~a ~a}" (path lb1) (path lb2)))&lt;br /&gt;          (configure lb1 "yscrollcommand" (concatenate 'string (path s1) " set"))&lt;br /&gt;          (configure lb2 "yscrollcommand" (concatenate 'string (path s1) " set"))&lt;br /&gt;          (listbox-append lb1 (loop for x from 1 to 20 collect x))&lt;br /&gt;          (listbox-append lb2 (loop for x from 1 to 20 collect x))&lt;br /&gt;          (grid lb1 0 0 :sticky "news")&lt;br /&gt;          (grid lb2 0 1 :sticky "news")&lt;br /&gt;          (grid s1 0 2 :sticky "ns")&lt;br /&gt;          (listbox-append lb1 (loop for x from 21 to 40 collect x))&lt;br /&gt;          (listbox-append lb2 (loop for x from 21 to 40 collect x))))))&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And based on this, I came up with this for data display&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(defun data-display (colnames data)&lt;br /&gt;  (with-ltk&lt;br /&gt;      (let ((ld (length colnames)))&lt;br /&gt;	(let* ((df (make-instance 'frame))&lt;br /&gt;	       (lbs (loop for i from 1 to ld collect (make-instance 'listbox :master df)))&lt;br /&gt;	       (sb (make-instance 'scrollbar :master df)))&lt;br /&gt;	       (ltk::send-w&lt;br /&gt;		"proc ScrollListboxes {listboxes args} {&lt;br /&gt;                    foreach lb $listboxes {&lt;br /&gt;                            eval $lb yview $args&lt;br /&gt;                    }&lt;br /&gt;              }")        &lt;br /&gt;	       (mapcar #'(lambda (lbox)&lt;br /&gt;			   (configure lbox "yscrollcommand" (concatenate 'string (path sb) " set"))) lbs)&lt;br /&gt;	       (configure sb "command"&lt;br /&gt;			  (format nil "ScrollListboxes {~{~a ~}}"&lt;br /&gt;				  (mapcar #'(lambda (lb) (path lb)) lbs)))&lt;br /&gt;	       (wm-title *tk* "Result Set")&lt;br /&gt;	       (configure df "width" 800)&lt;br /&gt;	       (configure df "height" 600)&lt;br /&gt;	       (pack df :expand 1 :fill "both")&lt;br /&gt;	       (loop for y from 0 to (1- ld) and name in colnames do&lt;br /&gt;		    (let ((lbl (make-instance 'label :text name :master df)))&lt;br /&gt;		      (grid lbl 0 y :sticky "w")))&lt;br /&gt;	       (loop for y from 0 to (1- ld) and lbx in lbs do&lt;br /&gt;		    (grid lbx 1 y))&lt;br /&gt;	       (grid sb 1 ld :sticky "ns")&lt;br /&gt;	       (loop for y from 0 to (1- ld) and lbx in lbs do&lt;br /&gt;		    (listbox-append lbx (mapcar #'(lambda (row) (nth y row)) data)))))))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This can be called as shown below. The two args are the field names and the data. Buggy but functional.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(data-display '("foo" "bar" "baz") '((a b c) (d e f) ("blah" "blah" "blah")))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, if only I can figure out how to limit this from jumping of the screen and proper horizontal scrolling, it might be more useful&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108879024728819213?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108879024728819213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108879024728819213' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108879024728819213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108879024728819213'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/07/ltk-and-listboxes.html' title='LTk and listboxes'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108832331332845559</id><published>2004-06-27T00:59:00.000-07:00</published><updated>2004-06-27T01:01:53.330-07:00</updated><title type='text'>What is a Lisp Machine?</title><content type='html'>Lisp Machines fairly well known in the Lisp world, however, even Lisp seems foreign to most people, including programmers. Lisp machines were common in the 1980s and are still considered one of the most productive developer environments and user experiences. Everything else is still playing catch up which is ironic.&lt;br /&gt;&lt;br /&gt;One common phenomenon in the Lisp space recently is Lisp based weblogs. They have been on the rise as one would notice from the aggregation at Planet Lisp. Even my weblog which was intended to be just another blog on the web has a very uneven ratio of Lisp vs other topics.&lt;br /&gt;&lt;a href="http://cooking-with-lisp.blogspot.com/"&gt;&lt;br /&gt;Glenn Ehrlich&lt;/a&gt; is another Lisp blogger. What is very cool about Glenn's postings is that he actually has a Lisp Machine which he purchased recently. He has answered the Lisp machine question rather well &lt;a href="http://cooking-with-lisp.blogspot.com/2004/05/what-is-lisp-machine.html"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;He has some really good posts about &lt;a href="http://cooking-with-lisp.blogspot.com/2004/06/finally-got-my-lisp-machine.html"&gt;his user experiences with his LispM&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108832331332845559?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108832331332845559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108832331332845559' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108832331332845559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108832331332845559'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/06/what-is-lisp-machine.html' title='What is a Lisp Machine?'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108818115374118267</id><published>2004-06-25T09:28:00.000-07:00</published><updated>2004-06-27T00:57:00.456-07:00</updated><title type='text'>Searching Entries On My Weblog</title><content type='html'>Sometimes one has a need to go back and read ones own weblog entries. The standard blogger template that I have did not seem to have that functionality. After I encountered cl-ppcre, I knew I wanted to use it for something. So I hacked together a little program that searched for regular expressions in html files that are generated for this blog. If anyone would like to test it its here.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sanjaypande.com/cgi-bin/mini-search-engine.lisp"&gt;Mini Weblog Search Feature&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It searches for Perl style regular expression matches on the html sources for the weblog. Try it out. I did have problems with the character sets. Thanks Thomas for helping me with that. It does have limitations. It reads the entire file into a string before doing the matching and searches for a single occurence of a match in the string. So the ^ and $ directives would be useless in most patterns here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108818115374118267?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108818115374118267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108818115374118267' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108818115374118267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108818115374118267'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/06/searching-entries-on-my-weblog.html' title='Searching Entries On My Weblog'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108793556301411281</id><published>2004-06-22T13:16:00.000-07:00</published><updated>2004-06-22T13:20:53.196-07:00</updated><title type='text'>My Road To Lisp</title><content type='html'>This is something that I wanted to do a while back. However, I never got to finishing it on time. When I did, I had some problems uploading it to the site. &lt;a href="http://www.tilton-technology.com/"&gt;Kenny Tilton&lt;/a&gt; was very kind to help me with that. Thanks Kenny. If anyone is interested, it is &lt;a href="http://alu.cliki.net/Sanjay%20Pande"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108793556301411281?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108793556301411281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108793556301411281' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108793556301411281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108793556301411281'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/06/my-road-to-lisp.html' title='My Road To Lisp'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108780108137543859</id><published>2004-06-20T23:56:00.000-07:00</published><updated>2004-06-20T23:58:01.376-07:00</updated><title type='text'>Regular Expressions with CL</title><content type='html'>Regex or regular expression search capabilities have become quite common now. They are a major factor in the popularity of Perl on *nix based systems. Perl has a highly optimized regex engine, written in C, and usually outperforms most others. Some CL dialects also come with their own regex engines like Clisp with the "REGEXP" package. However, using that would result in non-portable expressions.&lt;br /&gt;&lt;br /&gt;So there is &lt;a href="http://www.weitz.de/cl-ppcre/"&gt;CL-PPCRE&lt;/a&gt;, or Portable Perl Compatible Regular Expressions for CL. For me the real test of any piece of open source software is how easy it is to get, install and use. CL-PPCRE was a breeze to install. The easiest way is untar the files to a location and then run&lt;br /&gt;&lt;br /&gt;(load "load.lisp")&lt;br /&gt;&lt;br /&gt;which takes care of all compilation and loading. I tested it with Clisp, Openmcl and SBCL on Mac OS X and it worked fine. Since it is written with ANSI CL, it should function with any compatible CL dialect, which makes it extremely portable. It also comes with MK:DEFSYSTEM and ASDF packaging if you prefer to install it that way.&lt;br /&gt;&lt;br /&gt;Since it is so useful, I did an image save with Clisp and copied over my current Lisp image. This is with Clisp.&lt;br /&gt;&lt;br /&gt;(ext:saveinitmem)&lt;br /&gt;&lt;br /&gt;which saves the image file to lispinit.mem. I replaced my current lispinit.mem startup file with this which has my original lisp image + cl-ppcre. My lisp image resides in /sw/lib/clisp/full/. You can also always start clisp by pointing to an image file.&lt;br /&gt;&lt;br /&gt;# clisp -M lispinit.mem&lt;br /&gt;&lt;br /&gt;Most Common Lisp's have an image-save function, so it would be easy to replicate this. Once you have cl-ppcre, it has two packages - cl-ppcre and cl-ppcre-test. cl-ppcre has all the common regex functions like scan, replace, split etc.&lt;br /&gt;&lt;br /&gt;When compiled with CMUCL, it outperforms Perl in most cases. This is one great package.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108780108137543859?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108780108137543859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108780108137543859' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108780108137543859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108780108137543859'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/06/regular-expressions-with-cl.html' title='Regular Expressions with CL'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108780097371529737</id><published>2004-06-20T23:54:00.000-07:00</published><updated>2004-06-20T23:56:13.716-07:00</updated><title type='text'>(preferp 'language 'CL) =&gt; T</title><content type='html'>We had switched to PLT-Scheme as our platform a few weeks back for some simple reasons, mainly because of the available libraries and the cross-platform implementation. However, there are things about that environment that really caused us problems, mainly, because we have been spoilt by Common Lisp.&lt;br /&gt;&lt;br /&gt;The most irritating thing of the PLT-Scheme environment, DrScheme is the disconnect between the editor and the REPL. One of the best things about CL is loading functions into the environment on the fly. Once you load your test data in memory, and you have a test environment set up, there is no need to do that again.&lt;br /&gt;&lt;br /&gt;It is common practice to write and rewrite functions in the running environment. This makes it extremely productive. With the open source/free CL implementations, Emacs with Ilisp or Slime is the environment. The commercial ones come with their own which are also pretty good, maybe even better.&lt;br /&gt;&lt;br /&gt;This can be due to our own lack of knowledge of PLT-Scheme. We found the "Execute" button to be our enemy. When you press "Execute" it reloads all the current definitions into a new environment after resetting it. This in effect reduces the environments productivity levels to that of non-interactive languages.&lt;br /&gt;&lt;br /&gt;We decided to switch back to CL, despite the issues we had with the open source and free implementations. We already find that it is a better programmer environment, at least for us. In future if an when we decide to switch to a commercial CL, the transition will also probably be easier than from Scheme.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108780097371529737?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108780097371529737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108780097371529737' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108780097371529737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108780097371529737'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/06/preferp-language-cl-t.html' title='(preferp &apos;language &apos;CL) =&gt; T'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-10874574611830876</id><published>2004-06-17T00:30:00.000-07:00</published><updated>2004-06-17T04:02:57.546-07:00</updated><title type='text'>Lisp + Tk = LTk</title><content type='html'>Tk is quite a popular cross platform GUI library and Tcl and works identically across most platforms. Languages like Perl and Python use it as their standard GUI library with libraries like PerlTk and Python Tkinter. Over time many Lisp bindings have been written by passing Tcl commands over a stream to wish (The Tk interpreter). That however, required knowledge of Tcl.&lt;br /&gt;&lt;br /&gt;Now there is &lt;a href="http://www.peter-herth.de/ltk/"&gt;LTk&lt;/a&gt; (currently in version 0.8) written by &lt;a href="http://www.peter-herth.de/"&gt;Peter Herth&lt;/a&gt; and is written entirely in Common Lisp with Lispy bindings to most Tk widgets. It lets you write an entire GUI application in Lisp.&lt;br /&gt;&lt;br /&gt;The Lispy syntax is what makes LTk unique. Installing LTk is extremely simple as most of the code is in one file called ltk.lisp. The with-ltk macro sets up communication with Tk via a stream. LTk also comes with remote-ltk that lets you communicate from Lisp to Tk via a socket.&lt;br /&gt;&lt;br /&gt;Installing LTk is as simple as firing the following commands from your Lisp REPL, provided you have Tcl/Tk (wish) installed.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(compile-file "ltk")&lt;br /&gt;(load "ltk")&lt;br /&gt;(use-package 'ltk)&lt;br /&gt;(test)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If the test function runs without a problem, you should be all set. It also comes with an ASDF package if you prefer that. Please send feedback and patches to Peter so that this already nice package can be improved upon. Thanks again Peter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-10874574611830876?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/10874574611830876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=10874574611830876' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/10874574611830876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/10874574611830876'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/06/lisp-tk-ltk.html' title='Lisp + Tk = LTk'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108689124451663852</id><published>2004-06-10T11:02:00.000-07:00</published><updated>2004-06-10T11:14:35.580-07:00</updated><title type='text'>The Olympic Flame Passes Through India</title><content type='html'>The olympic flame made its way to the capital of India, New Delhi. It was passed on the streets by runners today, from person to person. The sad thing was that there were more celibrities and politicians who were carrying the flame than actual and past and current athletes. The only saving grace was a bunch of cricketers but that is not an olympic event. As Milkha Singh (the flying sikh) said, the flame should have only been carried by athletes who have or will participate in the olympics and all the celebrities who wanted to participate could have run with them. It would have been the right thing to do. I cannot agree more. As always, the politicians and celebs in the country have diluted the significance of this historic event.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108689124451663852?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108689124451663852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108689124451663852' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108689124451663852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108689124451663852'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/06/olympic-flame-passes-through-india.html' title='The Olympic Flame Passes Through India'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108683288286577080</id><published>2004-06-09T19:00:00.000-07:00</published><updated>2004-06-09T19:05:40.333-07:00</updated><title type='text'>A Range Function</title><content type='html'>The range function in Python is quite useful for generating lists of numbers quickly. It is often used with 'for' as a basic iterative construct. The same effect can easily be achieved with Lisp and the Loop macro. Here is an example of how range works&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Python 2.2.3 (#1, Nov  8 2003, 23:39:13) &lt;br /&gt;[GCC 3.3 20030304 (Apple Computer, Inc. build 1493)] on darwin&lt;br /&gt;Type "help", "copyright", "credits" or "license" for more information.&lt;br /&gt;&gt;&gt;&gt; range(5)&lt;br /&gt;[0, 1, 2, 3, 4]&lt;br /&gt;&gt;&gt;&gt; range(2,10)&lt;br /&gt;[2, 3, 4, 5, 6, 7, 8, 9]&lt;br /&gt;&gt;&gt;&gt; range(2,10,2)&lt;br /&gt;[2, 4, 6, 8]&lt;br /&gt;&gt;&gt;&gt; range(-10,-2)&lt;br /&gt;[-10, -9, -8, -7, -6, -5, -4, -3]&lt;br /&gt;&gt;&gt;&gt; range(-10,-2,2)&lt;br /&gt;[-10, -8, -6, -4]&lt;br /&gt;&gt;&gt;&gt; def square (x): return x * x &lt;br /&gt;... &lt;br /&gt;&gt;&gt;&gt; square&lt;br /&gt;&lt;function square at 0x432e10&gt;&lt;br /&gt;&gt;&gt;&gt; for x in range(5): print square(x)&lt;br /&gt;... &lt;br /&gt;0&lt;br /&gt;1&lt;br /&gt;4&lt;br /&gt;9&lt;br /&gt;16&lt;br /&gt;&gt;&gt;&gt; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is my Lisp function for the same using Lisp with Loop&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(defun range (n &amp;rest parms)&lt;br /&gt;  (case (length parms)&lt;br /&gt;    ((0) (loop for x from 0 to n collect x))&lt;br /&gt;    ((1) (loop for x from n to (first parms) collect x))&lt;br /&gt;    (t (let ((start n)&lt;br /&gt;             (stop (first parms))&lt;br /&gt;             (step (second parms)))&lt;br /&gt;         (loop for x = start then (+ x step) until (&gt;= x stop)&lt;br /&gt;              collect x)))))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Its a little different because I have inclusive of the highest number. That is the easiest thing to modify. here is a test&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[6]&gt; (range 5)&lt;br /&gt;(0 1 2 3 4 5)&lt;br /&gt;[7]&gt; (range 2 10)&lt;br /&gt;(2 3 4 5 6 7 8 9 10)&lt;br /&gt;[8]&gt; (range 2 10 2)&lt;br /&gt;(2 4 6 8)&lt;br /&gt;[9]&gt; (range -10 -2)&lt;br /&gt;(-10 -9 -8 -7 -6 -5 -4 -3 -2)&lt;br /&gt;[10]&gt; (range -10 -2 2)&lt;br /&gt;(-10 -8 -6 -4)&lt;br /&gt;[11]&gt; (defun square (x) (* x x))&lt;br /&gt;SQUARE&lt;br /&gt;[12]&gt; (loop for x in (range 5) do (print (square x)))&lt;br /&gt;&lt;br /&gt;0 &lt;br /&gt;1 &lt;br /&gt;4 &lt;br /&gt;9 &lt;br /&gt;16 &lt;br /&gt;25 &lt;br /&gt;NIL&lt;br /&gt;[13]&gt; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The Loop macro is much more powerful than the usage shown here but it can look ugly from a Lisp perspective. &lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108683288286577080?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108683288286577080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108683288286577080' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108683288286577080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108683288286577080'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/06/range-function.html' title='A Range Function'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108645581332025761</id><published>2004-06-05T10:12:00.000-07:00</published><updated>2004-06-25T09:18:43.250-07:00</updated><title type='text'>More Format Directives</title><content type='html'>A friend of mine &lt;a href="http://www.olivfabric.de/"&gt;Jorg Preisendorfer&lt;/a&gt;, came across my entries on &lt;a href="http://www.sanjaypande.com/weblog/archives/2004_05_17_archive.html"&gt;format directives&lt;/a&gt;. The modifiers for iteration as mentioned in section 22.3.7.4 of CLHS. I had discovered "~{" and "~}" directives. Here are the more elegant rewrites.&lt;br /&gt;&lt;br /&gt;My code&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; (format t "~{~{~A~%~A~%~}~}" '((a b) (c d) (e f) (g h)))&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The better version&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; (format t "~:{~A~%~A~%~}" '((a b) (c d) (e f) (g h)))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;More succinct, and easier to write. The colon performs the iteration on sublists.&lt;br /&gt;&lt;br /&gt;Another directive that I had discovered was "~R" which prints a number in the English formulation. I had also requested a Loop version mainly because of my inexperience with Loop. Here is the code.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  (loop for x = (expt 10 9) then (* x 1000)&lt;br /&gt;   		until (&gt;= x (expt 10 66))&lt;br /&gt;   do (format t "~R = ~:*~A~%" x))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The directive "~:*" directive is also very interesting as mentioned in section 22.3.7.1 of the CLHS.&lt;br /&gt;&lt;br /&gt;Thanks for the responses Jorg.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108645581332025761?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108645581332025761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108645581332025761' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108645581332025761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108645581332025761'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/06/more-format-directives.html' title='More Format Directives'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108632712516490472</id><published>2004-06-03T22:31:00.000-07:00</published><updated>2004-06-03T22:34:37.213-07:00</updated><title type='text'>Understanding Scheme Continuations - Part I</title><content type='html'>Scheme is one of the languages that has built in support for continuations. Sometimes understanding them is a little difficult because of the way they have been explained. The best way to explain them is by example. In Scheme the call-with-current-continuation is one way to use them. This is also abbreviated as call/cc.&lt;br /&gt;&lt;br /&gt;The call/cc procedure is passed a function of one argument and that argument is called the current continuation. &lt;br /&gt;&lt;br /&gt;One common example used is&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(+ 1 (call/cc&lt;br /&gt;       (lambda (k)&lt;br /&gt;         (+ 2 (k 3)))))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In this example there are a couple of things that are important to understand. Firstly the continuation can be explained as&lt;br /&gt;&lt;br /&gt;(+ 1 something)&lt;br /&gt;&lt;br /&gt;The call/cc part binds a continuation to  k and the argument 3. The + 2 is completely ignored. As shown here. Any computation outside of k will be ignored. &lt;br /&gt;&lt;pre&gt;&lt;br /&gt; (equal? (call/cc (lambda(k) (+ 2 (k 3)))) &lt;br /&gt;         (call/cc (lambda (k) (* 10 (k 3))))) ==&gt; #t &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Hence (+ 1 something) ==&gt; (+ 1 3) ==&gt; 4&lt;br /&gt;&lt;br /&gt;This is a very simple example of an exiting or escaping continuation. It is useful to use when you want to exit a program in between a recursive loop because of some condition. An example is a list-product function. Written recursively, it gets each element from the list and multiplies it. A continuation could be used to exit when encountering a 0 element, since that automatically means the computation would be 0. Without the exit, the computation will continue unnecessarily.&lt;br /&gt;&lt;br /&gt;Declaring a continuation globally can help one reuse it many times, which makes the 'rest of the computation' available for reuse. Taking the same example and modifying it a little.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(define r #f)&lt;br /&gt;&lt;br /&gt;(+ 1 (call/cc&lt;br /&gt;       (lambda (k)&lt;br /&gt;         (set! r k)&lt;br /&gt;         (k 3))))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is when it becomes interesting. The continuation as usual will return 4 when executed the first time. But now it is stored in the global variable r and can be called from the top level with any value.&lt;br /&gt;&lt;br /&gt;So&lt;br /&gt;&lt;br /&gt;(r 3) ==&gt; 4&lt;br /&gt;(r 10) ==&gt; 11&lt;br /&gt;(r 0.1) ==&gt; 1.1&lt;br /&gt;&lt;br /&gt;The critical thing to understand here is that, this is not a function but a continuation. That can be illustrated by&lt;br /&gt;&lt;br /&gt;(+ 3 (* 10 (r 5))) ==&gt; 6&lt;br /&gt;&lt;br /&gt;As shown above, it abandons the context that surrounds it.&lt;br /&gt;&lt;br /&gt;Now we'll take a slightly more interesting example. A simple function that evaluates 2x^2 + 3y + 1. We will bind x and y to continuations.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(define r1 #f)&lt;br /&gt;(define r2 #f)&lt;br /&gt;&lt;br /&gt;(define (somefunc x y)&lt;br /&gt;  (+ (* 2 (expt x 2)) (* 3 y) 1))&lt;br /&gt;&lt;br /&gt;(somefunc (call/cc&lt;br /&gt;           (lambda (c1)&lt;br /&gt;             (set! r1 c1)&lt;br /&gt;             (c1 1)))&lt;br /&gt;          (call/cc&lt;br /&gt;           (lambda (c2)&lt;br /&gt;             (set! r2 c2)&lt;br /&gt;             (c2 1))))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This example will show how the continuations remember the previous values. To start with it will call (somefunc 1 1) and set the values of x and y as 1 and 1. Everytime we call the continuations r1 and r2, it will record the previous value and use it to compute somefunc.&lt;br /&gt;&lt;br /&gt;(r1 5) will compute (somefunc 5 1) and return 54. This will also record the value of x as 5. Now calling (r2 5) will compute (somefunc 5 5) and return 66. Now both x and y have been recorded as 5 and 5. This process will continue for as long as r1 and r2 are called.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108632712516490472?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108632712516490472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108632712516490472' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108632712516490472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108632712516490472'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/06/understanding-scheme-continuations.html' title='Understanding Scheme Continuations - Part I'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108585887841206518</id><published>2004-05-29T12:21:00.000-07:00</published><updated>2004-05-29T21:06:16.086-07:00</updated><title type='text'>Go Figure?</title><content type='html'>The elections are over. The new government has been formed with some on the inside and a large part supporting the coalition from outside. Dr Manmohan Singh is our new prime minister. A very talented and accomplished economist, he is certainly deserving.&lt;br /&gt;&lt;br /&gt;The interesting tidbit here is that he was born much before 1947, the year of the partition of India and the formation of Pakistan. The place that he was born, is now in Pakistan, and the place that Pakistani President General Musharraf was born, is now in India.&lt;br /&gt;&lt;br /&gt;Leaders of two countries born across borders ... Interesting?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108585887841206518?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108585887841206518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108585887841206518' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108585887841206518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108585887841206518'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/go-figure.html' title='Go Figure?'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108539530234666207</id><published>2004-05-24T03:40:00.000-07:00</published><updated>2004-05-24T03:41:42.346-07:00</updated><title type='text'>Choosing a dialect ...</title><content type='html'>Choosing a Lisp dialect to learn is easy. Pick any Lisp or Scheme dialect and some tools and start. So far the best combination of tools in the scheme space is DrScheme which will run on most platforms or for Common Lisp, Get Clisp and configure Emacs + Ilisp. These are by far the easiest ways to start in the free tools space. The commercial vendors offer excellent tools as well like Xanalys Lispworks which is adequate in its cross-platform implementation or Franz Allegro CL which offers excellent tools especially on Windows. The commercial vendors offer trial versions for educational and learning purposes and are good tools.&lt;br /&gt;&lt;br /&gt;Choosing a Lisp dialect for commercial development is entirely a different ball game depending on where you are from. There are very few Common Lisp vendors who would qualify as affordable especially for a tiny startup with 2-4 developers. The two major competing folks are the Xanalys people and the Franz people both who have priced their product according to the American and European markets. Xanalys Lispworks Developer Edition starts at USD 900 and allows unlimited production of royalty-free runtimes. If I was in the US, this is extremely competitive and very affordable.&lt;br /&gt;&lt;br /&gt;However, the fact is that I sit in India. A friend of mine and I are in the process of developing a product for a particular market segment in my country. The difference of money in terms of USD and INR (Indian Rupees) fluctuates between 43 to 46 Rupees to a Dollar depending on many factors. There is only a certain reasonable amount that I can charge a customer in India for a product to have both a happy customer who sees value in what I deliver and get more customers to find my product attractive enough for them to invest in it.&lt;br /&gt;&lt;br /&gt;This really restricts my budget to the open source and free software segment that allows or encourages commercial development. This can also be done with the GPL tools which give a user more freedom, but is very unattractive for developers in a small niche market segment. The BSD or LGPL tools have more freedom for the developer in terms of choice of product licensing but that is another debate altogether.&lt;br /&gt;&lt;br /&gt;After reaching the conclusion that we needed free tools for our development, we also needed to reevaluate our need for a Lisp like language and if we could not just go with C, C++, Java or C# like the rest of the world. We even considered Python because it has some strengths that it inherited from Lisp and is very easy to learn. Being a tiny team, starting with two programmers these decisions are easy, because we do not care about what Gartner says and will almost always do exactly the opposite.&lt;br /&gt;&lt;br /&gt;All the Lisp and Scheme dialects satisfied our major requirement for the language to have the power to let us manage and modify complex data structures easily by their very nature. My main working platform is an Apple Powerbook with Mac OS X 10.3. My partners is a Debian GNU/Linux machine which runs Windows 98 on one partition but that seldom gets an opportunity to show its face. Most of our clientele will be running Windows. Suggesting that they migrate to Linux/BSD would be unfair to them. For us to invest in newer Windows machines would be a problem because absolutely any expense will eat into our potential profits which at the time of starting is 0 to begin with and negative if you consider programmer time expensive. Our real fun with Lisp is writing macros, for which we were hesitant to move to something else and also familiarity with the language.&lt;br /&gt;&lt;br /&gt;I had been exposed to the PLT-Scheme environment via DrScheme and knew it ran well and is reasonably cross-platform. So I decided to investigate the PLT-Scheme family of tools. DrScheme is a fairly usable IDE with Emacs like key-bindings. It has a powerful module system which looks very much like the CL packaging system. It has GUI bindings via MrEd to the wxWindows library. It has an ODBC layer via SrPersist and a lot more. On top of all this, it is distributed with an LGPL license. &lt;br /&gt;&lt;br /&gt;Based on our requirements and our restrictive situation, we really welcome the availability of PLT-Scheme. It is certainly an environment that open-source Common Lisp dialects should strive to become both in terms of cross-platform development and libraries. Some commercial Lisp dialects would have suited us beautifully but for their "American" prices. Maybe some people will accuse us of wanting to drive a Ferrari without having the money for it *grin*. &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108539530234666207?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108539530234666207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108539530234666207' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108539530234666207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108539530234666207'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/choosing-dialect.html' title='Choosing a dialect ...'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108481204754665282</id><published>2004-05-17T09:39:00.000-07:00</published><updated>2004-05-17T20:55:01.793-07:00</updated><title type='text'>Discovering Format Directives</title><content type='html'>So I was just reading some Common Lisp information on the web when I saw these really cool code examples in Peter Siebel's excellent book "Practical Common Lisp" that uses format. I have used format but had not realized how cool it really is.&lt;br /&gt;&lt;br /&gt;The first very interesting example used the "~{" and "~}" directive which lets us use nested lists as parameters to format. I decided to test this on my own for an understanding&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[30]&gt; (format t "~{~{~a~%~a~%~}~}" '((a b)))&lt;br /&gt;A&lt;br /&gt;B&lt;br /&gt;NIL&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Looks good. So I tried&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[34]&gt; (format t "~{~{~a~%~a~%~}~}" '((a b) (c d) (e f) (g h)))&lt;br /&gt;A&lt;br /&gt;B&lt;br /&gt;C&lt;br /&gt;D&lt;br /&gt;E&lt;br /&gt;F&lt;br /&gt;G&lt;br /&gt;H&lt;br /&gt;NIL&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Even better. So if it supports nested lists, then it should obviously allow more nesting and so I tried&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[35]&gt; (format t "~{~{~{~a~%~a~%~}~}~}" '(((a b))))&lt;br /&gt;A&lt;br /&gt;B&lt;br /&gt;NIL&lt;br /&gt;[36]&gt; (format t "~{~{~{~a~%~a~%~}~}~}" '(((a b) (c d))))&lt;br /&gt;A&lt;br /&gt;B&lt;br /&gt;C&lt;br /&gt;D&lt;br /&gt;NIL&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Yup. As usual in impressive Lisp style, my REPL responds as expected. So I was pretty happy about learning something new, thanks to Peter Siebel, I read further down and finally ended up in the footnotes section where I found this gem.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[37]&gt; (format nil "~r" 1606938044258990275541962092)&lt;br /&gt;"one octillion, six hundred and six septillion, nine hundred and thirty-eight sextillion, &lt;br /&gt;forty-four quintillion, two hundred and fifty-eight quadrillion, nine hundred and ninety &lt;br /&gt;trillion, two hundred and seventy-five billion, five hundred and forty-one million, nine &lt;br /&gt;hundred and sixty-two thousand, ninety-two"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Holy mother of batman! That is bloody impressive for a function I have so far only used for printing. Note to self -&gt; ALWAYS READ FOOTNOTES. Anyway, curious about how much it would take, I figured that Clisp can take a max of One Hundred Vigintillion which is 10^66. So guess what I had to know all the intermediate names.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[38]&gt; (do ((x (expt 10 9) (* x 1000)))&lt;br /&gt;    ((&gt;= x (expt 10 66)))&lt;br /&gt;  (format t "~r = ~a~%" x x))&lt;br /&gt;one billion = 1000000000&lt;br /&gt;one trillion = 1000000000000&lt;br /&gt;one quadrillion = 1000000000000000&lt;br /&gt;one quintillion = 1000000000000000000&lt;br /&gt;one sextillion = 1000000000000000000000&lt;br /&gt;one septillion = 1000000000000000000000000&lt;br /&gt;one octillion = 1000000000000000000000000000&lt;br /&gt;one nonillion = 1000000000000000000000000000000&lt;br /&gt;one decillion = 1000000000000000000000000000000000&lt;br /&gt;one undecillion = 1000000000000000000000000000000000000&lt;br /&gt;one duodecillion = 1000000000000000000000000000000000000000&lt;br /&gt;one tredecillion = 1000000000000000000000000000000000000000000&lt;br /&gt;one quattuordecillion = 1000000000000000000000000000000000000000000000&lt;br /&gt;one quindecillion = 1000000000000000000000000000000000000000000000000&lt;br /&gt;one sexdecillion = 1000000000000000000000000000000000000000000000000000&lt;br /&gt;one septendecillion = 1000000000000000000000000000000000000000000000000000000&lt;br /&gt;one octodecillion = 1000000000000000000000000000000000000000000000000000000000&lt;br /&gt;one novemdecillion = 1000000000000000000000000000000000000000000000000000000000000&lt;br /&gt;one vigintillion = 1000000000000000000000000000000000000000000000000000000000000000&lt;br /&gt;NIL&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I had a "for" loop macro construct that I used to use for simple stuff but realized I need to modify it after this example and had to get into a "DO". I would appreciate if someone can show me how to do this with the "LOOP" macro.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108481204754665282?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108481204754665282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108481204754665282' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108481204754665282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108481204754665282'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/discovering-format-directives.html' title='Discovering Format Directives'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108450968697403800</id><published>2004-05-13T21:40:00.000-07:00</published><updated>2004-05-13T21:47:31.770-07:00</updated><title type='text'>Coolie Valley?</title><content type='html'>I had read this &lt;a href="http://www.rediff.com/money/2004/mar/03guest1.htm"&gt;article&lt;/a&gt; on rediff a couple of months ago via a link on slashdot and wanted to comment on it. The comment section looks like everyone in the world had an opinion. Well I decided to join the world.&lt;br /&gt;&lt;br /&gt;Coolie is a Indian term which refers to a porter at a place of public transportation like a railway station. I have no idea why people refer to them in a denigrating fashion. After all they are doing a very nice job. Imagine you are 65 and have a good amount of luggage. What harm is there in paying someone to carry it?&lt;br /&gt;&lt;br /&gt;Getting back to the article it stresses that India does not bet on innovations. This is something I disagree with, however, not entirely.&lt;br /&gt;&lt;br /&gt;The majority of companies in Bangalore provide a service. They provide an army of cheap programmers for a fee. I do not see anything wrong with that. There are R &amp; D outfits of some major companies in India as well, albeit, in a smaller number. The fact is that services is a huge market and business is about making money. Even a company like IBM, which cannot be called "not innovative" is focusing on services as a sector.&lt;br /&gt;&lt;br /&gt;As far as patents in software are concerned, I believe they should not even be allowed, but thats my personal opinion, although, I have nothing against intellectual property.&lt;br /&gt;&lt;br /&gt;India as a country has developed supercomputers, ICBM's, nuclear weapons, Satellite Launch Vehicles, Linguistic software and many other things indigenously. None of these were originally created by them, so they were not responsible for the idea. They however, are responsible for the technology inside these which are in most cases unique. It would be prudent to also point out that India invented the zero and the basis of quite a bit of mathematics. Albert Einstein said, "We owe a lot to the Indians, who taught us how to count, without which no worthwhile scientific discovery could have been made."&lt;br /&gt;&lt;br /&gt;I do have issues with the term "Silicon Valley of the East" basically because it is a mimicry of the West which we need not do for everything. Bangalore is neither a valley nor a city of silicon, which, was initially associated with companies manufacturing hardware.&lt;br /&gt;&lt;br /&gt;As far as innovations are concerned, yes, Silicon Valley is ahead but lets not forget what should not be considered an innovation in the software sector which is attributed to companies like Sun, Apple, IBM etc.&lt;br /&gt;&lt;br /&gt;1) Virtual Machine - Popularly recognized as something done by Sun, this was originally done in the early 60's with Lisp and later with Smalltalk. Lisp and Smalltalk both have superior VM architecture to Java despite being languages that are over 20 years old.&lt;br /&gt;&lt;br /&gt;2) Garbage Collection - This is something that was necessary for C programs to run stable. There are many many languages with very good garbage collectors all dating way before Java was even concieved. &lt;br /&gt;&lt;br /&gt;3) GUI - Usually attributed to Apple, this was originally developed at Xerox Parc, a place where a lot of innovations came from. The mouse also came from Xerox. &lt;br /&gt;&lt;br /&gt;4) OOP - Xerox Parc again with Smalltalk. Even today Smalltalk is a better language than Java, C# or C++ which are the 3 most popular OOP languages, however, because of its diminishing popularity it has less libraries which can also be said of Lisp.&lt;br /&gt;&lt;br /&gt;5) Frameworks - CORBA begat COM that begat DCOM that begat .Net. J2EE also emerged from this pile. It is standard practice in OOP as well as functional languages to build frameworks first. Developers in these languages are used to it. There are many well known frameworks in other languages as well although they do not try to sell things based on marketing and world domination.&lt;br /&gt;&lt;br /&gt;What I am trying to say is that just because a company exists in Silicon Valley does not mean its innovative, just like companies in India are not necessarily just cheap labour as the article points out. Managers reading Gartner reports really do not help with that either which covers most of the US as far as innovation is concerned.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108450968697403800?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.rediff.com/money/2004/mar/03guest1.htm' title='Coolie Valley?'/><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108450968697403800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108450968697403800' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108450968697403800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108450968697403800'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/coolie-valley.html' title='Coolie Valley?'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108435417371632594</id><published>2004-05-12T02:19:00.000-07:00</published><updated>2004-05-12T02:29:33.716-07:00</updated><title type='text'>Clisp directory handling</title><content type='html'>The main problem with Lisp implementations, is the open-endedness that they have left for certain portions of the implementation. A very good example is the "directory" function which works differently on different flavours of CL. This is despite the fact that it has been listed in the CLHS. Some of the variance also probably comes from the different operating systems, which have their own representations. I mainly use Clisp for portability across OS's. The other ones like CMU CL, SBCL, OpenMCL, Corman Lisp etc are ahead in some respects and offer native code compilation but are way behind on portability.&lt;br /&gt;&lt;br /&gt;On Clisp just typing&lt;br /&gt;&lt;br /&gt;(directory)&lt;br /&gt;&lt;br /&gt;will list all files in the current directory&lt;br /&gt;&lt;br /&gt;(directory "*.txt")&lt;br /&gt;&lt;br /&gt;will list all files with a .txt extension in the current directory&lt;br /&gt;&lt;br /&gt;(directory "/usr/local/apache2/cgi-bin/*.lisp")&lt;br /&gt;&lt;br /&gt;can be used for a specific directory.&lt;br /&gt;&lt;br /&gt;(directory "*")&lt;br /&gt;&lt;br /&gt;fortunately works with most flavours.&lt;br /&gt;&lt;br /&gt;(directory "*/")&lt;br /&gt;&lt;br /&gt;Will list only sub-directories. This can be useful for some system programs. To get a listing of everything in a directory including sub-directories in Clisp&lt;br /&gt;&lt;br /&gt;(append (directory) (directory "*/"))&lt;br /&gt;&lt;br /&gt;nconc can also be used instead of append.&lt;br /&gt;&lt;br /&gt;There is a lot more information available &lt;a href="http://clisp.cons.org/impnotes/file-dict.html"&gt;here&lt;/a&gt;. I was very happy to read that Clisp does have these despite the fact that many people criticize it for some things.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108435417371632594?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108435417371632594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108435417371632594' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108435417371632594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108435417371632594'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/clisp-directory-handling.html' title='Clisp directory handling'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108421661653648489</id><published>2004-05-10T12:08:00.000-07:00</published><updated>2004-05-10T12:19:12.223-07:00</updated><title type='text'>Understanding Symbols and Variables</title><content type='html'>I was chatting with a friend of mine about some code that we are writing for a project and the discussion of symbol-value came up. I had a hard time explaining symbol-value mainly because I chose a wrong example to begin with. The best part about Common Lisp or any other interactive language is that you can try everything the moment you think about it.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(setf x 'a)&lt;br /&gt;&lt;br /&gt;(setf (symbol-value x) 'b)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The two statements are the simplest explanation. The first is creating a global variable x and binding the value 'a to it. The second statement is more interesting because it lets me set the value that was retrived from x to something, in effect, creating a global variable -&gt; a and binding the value of -&gt; a to 'b.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(setf (symbol-value x) 'b) =&gt; (setf a b)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Because of the current binding of x. This feature of Lisp will let me assign a global dynamically. Feel the power? No ... check out the set-var-from-string macro &lt;a href="http://www.sanjaypande.com/weblog/archives/2004_05_03_archive.html"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108421661653648489?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108421661653648489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108421661653648489' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108421661653648489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108421661653648489'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/understanding-symbols-and-variables.html' title='Understanding Symbols and Variables'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108415718234391067</id><published>2004-05-09T19:38:00.000-07:00</published><updated>2004-05-09T19:46:22.343-07:00</updated><title type='text'>Dangerous Tomatoes?</title><content type='html'>I have stopped eating tomatoes. It all started with the Eat Right 4 Your Blood Type diet which I tried after watching my cousin have quite a bit of success with it. My blood type is B (Rh factor is immaterial on this diet) and I learnt that tomatoes contain a lectin that can be dangerous and type B's should avoid anything with tomatoes in it. Yikes, that means no ketchup.&lt;br /&gt;&lt;br /&gt;Anyway, after i stopped eating tomatoes, my acidity problems disappeared and the occasional acid reflux is gone as well. The interesting thing is that its the same story with my father (type B) and my younger brother (type O).&lt;br /&gt;&lt;br /&gt;Being brought up in a culture where fruits and vegetables are regarded as healthy food, especially tomatoes, it was more difficult mentally. Interestingly, all the heartburn medicine commercials show people eating pizza or pasta or something very tomatoey. Interesting?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108415718234391067?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108415718234391067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108415718234391067' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108415718234391067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108415718234391067'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/dangerous-tomatoes.html' title='Dangerous Tomatoes?'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108391387365376556</id><published>2004-05-07T00:11:00.000-07:00</published><updated>2004-05-07T00:17:31.796-07:00</updated><title type='text'>The unexplored Eastern India</title><content type='html'>Arunachal Pradesh is India's extremity on the Eastern side. It is an unexplored beautiful region at the foothils of the Himalayan and Shivalik mountain ranges. This area is where the maximum Buddhism in current day India can be found with monasteries all over the region including the Tawang monastery at Tawang.&lt;br /&gt;&lt;br /&gt;I had the good fortune of visiting Arunachal earlier this year and have captured some of my moments on camera.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.sanjaypande.com/weblog/HotelDonyiPoloWindow.JPG"&gt;&lt;br /&gt;&lt;br /&gt;Itanagar is the capital of Arunachal and this is a view from the room window of Hotel Donyi Polo Ashok. I really had to scale the image down because of its actual size from my 6.3 Megapixel camera. Now back at Pune, I do miss the fresh air of Arunchal already.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108391387365376556?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108391387365376556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108391387365376556' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108391387365376556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108391387365376556'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/unexplored-eastern-india.html' title='The unexplored Eastern India'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108382272761462012</id><published>2004-05-05T22:52:00.000-07:00</published><updated>2004-05-05T22:56:34.076-07:00</updated><title type='text'>Passing variable arguments of a function</title><content type='html'>Yesterday I was struggling with the &amp;rest parameter, mainly due to my&lt;br /&gt;ignorance and inexperience. I have used the &amp;rest parameter in the&lt;br /&gt;past and it works very easily. For instance, the function below will&lt;br /&gt;just return its arguments. The &amp;rest parameter is very useful in case&lt;br /&gt;of variable arguments.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(defun foo (&amp;rest args)&lt;br /&gt;  args)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Evaluating the following&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(foo 1 2 3) =&gt; (1 2 3)&lt;br /&gt;&lt;br /&gt;(foo 'a 'b 1 2) =&gt; (a b 1 2)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Even though I have used this in functions before, I was having&lt;br /&gt;problems passing the &amp;rest arguments of one function to another. So I&lt;br /&gt;jumped on the #lisp channel and asked the experienced folks there,&lt;br /&gt;and they said, just use 'apply', and the bulb in head lit up, of course.&lt;br /&gt;&lt;br /&gt;Here is a very simple example of passing the &amp;rest parameter to the&lt;br /&gt;&amp;rest of another funtion.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(defun add (&amp;rest args)&lt;br /&gt;  (apply #'+ args))&lt;br /&gt;&lt;br /&gt;(defun sub (&amp;rest args)&lt;br /&gt;  (apply #'- args))&lt;br /&gt;&lt;br /&gt;(defun mul (&amp;rest args)&lt;br /&gt;  (apply #'* args))&lt;br /&gt;&lt;br /&gt;(defun div (&amp;rest args)&lt;br /&gt;  (apply #'/ args))&lt;br /&gt;&lt;br /&gt;(defun basic-calc (fun &amp;rest args)&lt;br /&gt;  (apply fun args))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now evaluating&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(add 1 2 3) =&gt; 6&lt;br /&gt;&lt;br /&gt;(basic-calc 'add 1 2 3) =&gt; 6&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I have used APPLY and FUNCALL many times without realizing the&lt;br /&gt;implications of how powerful these are. The solution is so simple&lt;br /&gt;that it never comes to mind.       &lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108382272761462012?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108382272761462012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108382272761462012' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108382272761462012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108382272761462012'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/passing-variable-arguments-of-function.html' title='Passing variable arguments of a function'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108358528628846318</id><published>2004-05-03T04:30:00.000-07:00</published><updated>2004-05-05T19:01:14.686-07:00</updated><title type='text'>Lisp Macros Rock</title><content type='html'>Lisp macros are the one feature that distinguish it from almost all other programming languages on the planet. For the benefit of people who would not understand, I shall make an attempt to explain them. Consider a programming language as a tool for feeding a set of instructions to a computer. This can be interpreted or compiled and then called. The call (usually functions) will try to either just perform something or return values after some processing. &lt;br /&gt;&lt;br /&gt;Lets take addition on a calculator. So you press 1, +, 2, = and expect it to read out the result 3. The + is a good example of what a function could be. In this instance, it expects two arguments, which are numbers. The two arguments are your variables, which, we shall name x and y. So the value of x or y can be anything as long as it is a number. Anytime you enter x + y, The function + performs its operations and returns the result. Most programming languages work the same way in the most basic sense. So there is a translation layer between the expression and the machine which tells the machine what it is reading. So&lt;br /&gt;&lt;br /&gt;Expression -&gt; Interpreter -&gt; Result&lt;br /&gt;&lt;br /&gt;Compilers just add another layer to this, often reducing the time of the last phase.&lt;br /&gt;&lt;br /&gt;Now imagine you can change what the interpreter or compiler sees at runtime. These are called macros.&lt;br /&gt;&lt;br /&gt;Expression -&gt; Macro Translation -&gt; Interpreter -&gt; Result&lt;br /&gt;&lt;br /&gt;Lisp macros are like Lisp functions that generate Lisp code and then evaluate them as well. Where is this useful is what most people ask. Well, for one, creating your own language on top of Lisp especially domain related. I am currently writing a persistent database query system in Lisp and one of the macros that was really needed was something that can parse a string, say "var1", extract its symbol value, var1, create a global variable by that name var1 and assign some value to it.&lt;br /&gt;&lt;br /&gt;The macro looked somewhat like this&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;(defmacro set-var-from-string (str val)&lt;br /&gt;  (let ((var (gensym)))&lt;br /&gt;    `(let ((,var (coerce (read-from-string ,str) 'symbol)))&lt;br /&gt;       (setf (symbol-value ,var) ,val)))) &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I can call this as follows&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;(set-var-from-string "var1" "test")&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Which will create a variable var1 and store the value "test" in it. I could also call it from a variable&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;(setf x "var2")&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and then call&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;(set-var-from-string x "test2")&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This call wil create a variable var2 and store the value "test2" in it. I encourage you to try to write an equivalent of this macro in any other non-lisp like language. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108358528628846318?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108358528628846318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108358528628846318' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108358528628846318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108358528628846318'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/lisp-macros-rock.html' title='Lisp Macros Rock'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6885945.post-108358347322991985</id><published>2004-05-03T04:21:00.000-07:00</published><updated>2004-05-05T18:52:57.890-07:00</updated><title type='text'>Here I go Again</title><content type='html'>So I figured that after taking so much time, between actually trying to write blog content and trying to write blogging software in my favourite programming language (Common Lisp), I should actually start blogging. So here goes, this is a first. Hopefully this will also give me a decent idea of designing weblogging software, considering that Blogger has been very popular.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6885945-108358347322991985?l=sanjaypande.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sanjaypande.blogspot.com/feeds/108358347322991985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6885945&amp;postID=108358347322991985' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108358347322991985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6885945/posts/default/108358347322991985'/><link rel='alternate' type='text/html' href='http://sanjaypande.blogspot.com/2004/05/here-i-go-again.html' title='Here I go Again'/><author><name>Sanjay Pande</name><uri>http://www.blogger.com/profile/06532004736083033765</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
