<?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:blogger='http://schemas.google.com/blogger/2008' 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-23326860</id><updated>2025-05-01T13:34:23.847+01:00</updated><category term="en"/><category term="lisp"/><category term="eo"/><category term="pt"/><title type='text'>Kvardek Du</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>77</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-23326860.post-3940676963024247576</id><published>2024-09-03T10:52:00.012+01:00</published><updated>2024-09-03T11:41:35.544+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Interview about Lisp at SISCOG</title><content type='html'>&lt;p&gt;My friend Rui was interviewed about Lisp and how we use it at &lt;a href=&quot;https://siscog.pt/&quot;&gt;SISCOG&lt;/a&gt;. The &lt;a href=&quot;https://blog.teamlyzer.com/posts/120/engenharia-da-siscog-conhece-esta-empresa-portuguesa-de-tecnologia-de-ponta&quot;&gt;original interview&lt;/a&gt; is in Portuguese but you can read a translation via &lt;a href=&quot;https://deepl.com/&quot;&gt;DeepL&lt;/a&gt; below:&lt;/p&gt;
  
&lt;p&gt;&lt;strong&gt;SISCOG Engineering: get to know this cutting-edge Portuguese company&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Find out how Lisp continues to drive innovation at SISCOG. Interview with Rui Patrocínio, Scheduling Team Leader at SISCOG&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#1 How did you first get to know the Lisp programming language?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When I joined Técnico in 1999, the programming language taught in Introduction to Programming was Scheme, which is in the Lisp family. The curriculum closely followed the MIT 6.001 course (whose lectures from the 80s are on Youtube) and one of the best programming books ever for beginners and beyond: Structure and Interpretation of Computer Programs. The great advantage of learning to program with Scheme is that it is a very simple language, with a very simple syntax. All the effort goes into understanding the logic of what you&#39;re implementing, so there&#39;s no need to memorize the syntactical nuances of the language.&lt;/p&gt;

&lt;p&gt;After that experience, Lisp reappeared as Common Lisp in the Artificial Intelligence course. Common Lisp is the current industrial version of the Lisp family of languages, which is what SISCOG uses on a daily basis. Common Lisp is a multi-paradigm language. Imperative, functional, object-oriented programming with very sophisticated meta-programming mechanisms available. As such, using the language as a whole implies some maturity and it&#39;s only natural that it should appear later in the curriculum of a computer engineering course.&lt;/p&gt;

&lt;p&gt;I think it was the “power” of the Common Lisp language that made it particularly appealing to me and, despite the standard being from 1994, it is a very modern language. It should be noted that Guy Steele, one of the main figures behind the Common Lisp standard, was also heavily involved in the development of Scheme, C and Java, being hired by Sun at one point to improve Java. Here&#39;s a quote from him on a mailing list focused on the discussion of programming languages from the 1990s, talking about Java:&lt;/p&gt;

&lt;blockquote&gt;And you&#39;re right: we were not out to win over the Lisp programmers; we were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp. Aren&#39;t you happy? —Guy Steele&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;#2 How SISCOG uses Lisp in its products&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We use Common Lisp in the vast majority of our software. Both desktop applications and backend parts of web applications are implemented in Common Lisp. We also use C++ to develop specific modules, but Common Lisp still has the most lines of code in our repositories. It&#39;s a very expressive language that compiles to machine code reasonably efficiently without much effort on the part of the programmer. So it&#39;s an easy choice for most scenarios.&lt;/p&gt;

&lt;p&gt;It remains to be said that our products have been in operation for more than 30 years in various national and international companies, such as the London and Lisbon Underground, or the railways of the Netherlands or Canada. They are decision support software for the optimized planning of these transport operators&#39; resources, namely time and space, materialized in timetables, vehicles and personnel. These products help to plan and manage these operational resources as quickly and efficiently as possible, providing gains and savings in various areas, as well as, for example, greater satisfaction on the part of workers thanks to shifts and work schedules that better meet their preferences. And all with Lisp as a base!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#3 What are the main advantages of the Lisp syntax compared to other programming languages, such as C++?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The great advantage of the syntax is also the thing you&#39;ll find most strange at first: the brackets. The fact that everything uses a prefixed syntax also makes everything quite uniform. This combination of parentheses and prefixed syntax is called s-expressions in Lisp. S-expressions are code and data at the same time, and this is what allows you to have macros (functions that take code as an argument and return code as a value) that extend the language transparently, as if they belonged to the standard language.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#4 Can you explain the concept of “S-expressions” and how they contribute to the clarity of LISP code?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Basically, “S-expressions” are one of two things:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;atomic expressions (e.g. the number 2024 or the string “hello world” or the symbol +)&lt;/li&gt;
  &lt;li&gt;a list, typically in the format (operator arg1 arg2 ... argn)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It&#39;s this uniformity, as I said earlier, that makes everything simpler. It also helps a lot to be able to generate code programmatically because it&#39;s all about manipulating lists, for which Common Lisp has a very reasonable API. This is where the power of Lisp macros comes from.&lt;/p&gt;

&lt;p&gt;At first you find it strange, then you understand it. &lt;em&gt;[nice try, DeepL. Rui wrote &quot;Primeiro estranha-se, depois entranha-se.&quot; which is quoting a famous Coca-Cola slogan written by Fernando Pessoa in the 1940s. Richard Zenith, in his biography Pessoa: An Experimental Life, attempts to translate it as &quot;On the first day you drink it slow. On the fifth day you can&#39;t say no.&quot; —Luís]&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#5 How does Lisp allow rapid prototyping using untyped variables?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Static typing in large codebases is widely advocated today because it allows more automatic tools to check for problems in the code. Common Lisp has dynamic typing, but allows optional type declaration. It&#39;s quite common to only declare types when it&#39;s necessary to “squeeze” more performance out of a code segment. The compiler, via type inference, provides some information about problems encountered when there are enough type declarations to extract relevant information. This allows us to “fight the compiler” only in segments of code where it is very relevant and not be making premature optimizations to the whole code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#6 How does Lisp facilitate metaprogramming?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are two basic “tools” for metaprogramming in Common Lisp: the Meta Object Protocol and the macros mentioned earlier.&lt;/p&gt;

&lt;p&gt;Meta Object Protocol is basically the mechanism behind the implementation of the Common Lisp object system (called CLOS, Common Lisp Object System). Although it doesn&#39;t belong to the standard, it is available in most Common Lisp implementations and is sometimes useful, particularly when implementing utilities to inspect the code or improve our development environment. For example, it&#39;s possible to implement something that shows us the relationships between classes, what methods exist, etc. This is not something you do on a day-to-day basis, but it can be done by you without depending on the guts of a specific IDE.&lt;/p&gt;

&lt;p&gt;Another interesting mechanism is macros. When CLOS was introduced, it was basically a set of macros on top of the Lisp of the time (historically there were a few more iterations - CLOS wasn&#39;t the first object system developed). In other words, with macros it&#39;s possible to extend the language to introduce most of the mechanisms and paradigms that exist in other languages (such as object-oriented programming) in a way that feels natural to a Lisp programmer.&lt;/p&gt;

&lt;p&gt;This type of mechanism allows SISCOG to implement undo and redo mechanisms in our software in a way that is practically transparent to the programmer. This is done by extending the class declaration. The programmer notes for which attributes of each class a history needs to be kept and the end user is able to undo their operations and see these data variations instantly (with the typical implementation using Command Pattern, multi-level undo is not instantaneous as it is necessary to re-execute operations, which may not be trivial; the tradeoff is, of course, the memory spent).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#7 What is your opinion of Lisp&#39;s learning curve compared to other programming languages?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Anyone with experience in a few different paradigm languages can quickly program in Common Lisp without major problems. Most of the concepts are familiar. Our experience at SISCOG, particularly with more recent hires who had no contact with Lisp in college, is that people adapt quickly and within a week are programming and making minor corrections.&lt;/p&gt;

&lt;p&gt;Obviously, there are parts of the language that are less common and you need more maturity to use them effectively. These include the Meta-object protocol and the macros mentioned earlier.&lt;/p&gt;

&lt;p&gt;In this case, the need for greater maturity comes simply from the fact that we are extending the language. Designing a new language isn&#39;t easy and there are people whose career it is to do this (like Guy Steele mentioned earlier). Of course, this is also rare and the most common thing is to introduce macros for small functionalities that make the programmer more productive with Domain Specific Languages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#8 Why is Lisp a popular choice for specialized areas such as artificial intelligence and natural language processing?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It&#39;s essentially for historical reasons. Lisp was born in that context, there have been several “classic” artificial intelligence systems implemented in Lisp and so it has continued to be used. The fact that it&#39;s very easy to start a project quickly, it&#39;s easy to iterate and progressively improve what&#39;s been done, also helps in a research context where we&#39;re more concerned with testing ideas than making the software “bulletproof”, which you can do progressively (treating errors, adding static typing, etc.) in Common Lisp.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#9 Can you give some examples of projects at SISCOG where Lisp has proved particularly advantageous?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SISCOG has relied on Lisp from the start. It&#39;s a very stable language, with good compilers and good performance, it&#39;s compact and has allowed us to go through the history of computer science across various platforms (Lisp machines, Unix, Windows) and maintain a code base with immense domain knowledge over the years. A company with software in production for over 30 years is not very common in the world and Lisp is clearly our little secret weapon.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#10 How does the Lisp development community compare with other programming language communities in terms of support and resources?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Lisp community isn&#39;t very large, but what we lack in programmers, we make up for in enthusiasm. Paul Graham (of Y Combinators) was a great driving force behind the language in the late 1990s, early 2000s and Hacker News still talks about Common Lisp (and variants) on a regular basis. Many years ago there was a strong community on the old newsgroups, but that has largely moved on to Reddit and IRC. There are also a few annual conferences (e.g. European Lisp Symposium) where some of the most important members of the community usually gather. We don&#39;t have by far the largest number of libraries available and sometimes we have to implement things &#39;in house&#39;. The community does, however, have enough to make high-quality software that is sold all over the world, as SISCOG has demonstrated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#11 What are your predictions for the future of Lisp in the technology industry?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It seems to me that the future of a language depends a lot on fashions and the investments made in it. Google uses Lisp via the purchase of a company a few years ago (ITA Software, for flight search) and, as long as these large companies continue to invest, languages will thrive. At the moment, fashions have moved on to other platforms, but let&#39;s see what the future brings. Perhaps our little secret weapon will become less and less secret.&lt;/p&gt;


</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/3940676963024247576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/3940676963024247576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/3940676963024247576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/3940676963024247576'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2024/09/interview-about-lisp-at-siscog.html' title='Interview about Lisp at SISCOG'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-6277125541511931441</id><published>2024-01-30T14:56:00.002+00:00</published><updated>2024-01-30T14:56:53.750+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Manuel Simoni on CL&#39;s control flow primitives</title><content type='html'>&lt;p&gt;Manuel Simoni dusts his &lt;em&gt;Axis of Eval&lt;/em&gt; blog off and writes about &lt;a href=&quot;http://axisofeval.blogspot.com/2024/01/common-lisps-block-return-from-and.html&quot;&gt;Common Lisp&#39;s BLOCK / RETURN-FROM and UNWIND-PROTECT&lt;/a&gt;. A summary for non-Lispers.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/6277125541511931441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/6277125541511931441' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/6277125541511931441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/6277125541511931441'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2024/01/manuel-simoni-on-cls-control-flow.html' title='Manuel Simoni on CL&#39;s control flow primitives'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-1465082592233550615</id><published>2018-04-02T13:03:00.001+01:00</published><updated>2018-04-02T13:05:32.577+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Reddit 1.0</title><content type='html'>As many Lisp programmers may remember, &lt;a href=&quot;https://reddit.com/&quot;&gt;Reddit&lt;/a&gt; was initially written in Common Lisp. Then, in late 2005, it was &lt;a href=&quot;https://web.archive.org/web/20051230165203/http://reddit.com:80/blog/2005/12/night-of-living-python.html&quot;&gt;rewritten in Python&lt;/a&gt;. Much discussion ensued. Steve Huffman (aka spez, current CEO of Reddit) wrote about &lt;a href=&quot;https://redditblog.com/2005/12/05/on-lisp/&quot;&gt;why they switched to Python&lt;/a&gt;. The late Aaron Swartz also wrote &lt;a href=&quot;http://www.aaronsw.com/weblog/rewritingreddit&quot;&gt;Rewriting Reddit&lt;/a&gt;, focusing on the Python side of things.&lt;br /&gt;
&lt;br /&gt;
Last week, that original, Common Lisp version of Reddit was published on GitHub: &lt;a href=&quot;https://github.com/reddit-archive/reddit1.0&quot;&gt;reddit-archive/reddit1.0&lt;/a&gt;. There&#39;s no documentation, but we know from the articles above that it ran on CMUCL. &lt;a href=&quot;https://github.com/reddit-archive/reddit1.0/blob/master/reddit.asd&quot;&gt;reddit.asd&lt;/a&gt; is perhaps a good entry point, where we can see it used &lt;a href=&quot;https://edicl.github.io/hunchentoot/&quot;&gt;TBNL&lt;/a&gt;, &lt;a href=&quot;https://edicl.github.io/cl-who/&quot;&gt;CL-WHO&lt;/a&gt; and &lt;a href=&quot;http://clsql.kpe.io/&quot;&gt;CLSQL&lt;/a&gt;, a common toolset at the time.&lt;br /&gt;
&lt;br /&gt;
It&#39;s missing various bits of static HTML, CSS and JS, so I don&#39;t think you can actually run this website without a fair bit of scrapping and stitching from the Wayback Machine. The code is quite readable and clean. It&#39;s not terribly interesting, since it&#39;s a fairly simple website. Still, it&#39;s a website that grew to become the 6th most visited worldwide (with 542 million monthly visitors) and now has 230 employees, says Wikipedia, so it&#39;s nice to see what it looked like at the very beginning.</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/1465082592233550615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/1465082592233550615' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/1465082592233550615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/1465082592233550615'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2018/04/reddit-10.html' title='Reddit 1.0'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-741045754299407386</id><published>2017-12-19T22:37:00.000+00:00</published><updated>2017-12-19T22:40:20.456+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>A Lisp REPL in your pocket</title><content type='html'>&lt;p&gt;Thanks to Polos Ruetz, you can now play with Common Lisp directly on your Android phone. All you need to do is install &lt;a href=&quot;https://play.google.com/store/apps/details?id=org.eql5.android.repl&quot;&gt;CL REPL&lt;/a&gt; from the Google Play Store. CL REPL is &lt;a href=&quot;https://gitlab.com/eql/EQL5-Android/tree/master/examples/REPL&quot;&gt;one of the examples&lt;/a&gt; part of &lt;a href=&quot;https://gitlab.com/eql/EQL5-Android&quot;&gt;EQL5-Android&lt;/a&gt; which is built on top of &lt;a href=&quot;https://gitlab.com/eql/EQL5&quot;&gt;EQL5&lt;/a&gt;, a project that marries &lt;a href=&quot;https://common-lisp.net/project/ecl/&quot;&gt;ECL&lt;/a&gt; with &lt;a href=&quot;https://www.qt.io/&quot;&gt;Qt&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://play.google.com/store/apps/details?id=org.eql5.android.repl&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5caJ9pZiz-UfFl9V_WBiKMYAU_LiCR9g-9VeeQyV5lMUMrsNLIDmf-jGIu37JFbMSQrKYkrK9zNEgj2nkQgyv3kRjJ9SC7s4cB59xWKS5SJ06zcFaBUNNZo96k62VQimFtb3SYQ/s200/cl-repl-logo.png&quot; width=&quot;200&quot; height=&quot;200&quot; data-original-width=&quot;300&quot; data-original-height=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;blockquote&gt;&lt;strong&gt;CL REPL&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;A Common Lisp REPL with command line and history, plus a simple editor with syntax highlighting, simple visual paren-matching, a file dialog for opening/saving files, and a simple debug dialog. It uses the ECL implementation for the Lisp side, and Qt5/QML for the UI. This is an open source project (see EQL5-Android).&lt;/em&gt;&lt;/blockquote&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://play.google.com/store/apps/details?id=org.eql5.android.repl&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgekDqBD-AQ-r6frvnXYfXXbZ7kwLOfKntP9QYzulPiaUQnmuFS6J11HI7W_RsF98dXkb6__l7KLNF5P21qI1gfWsXLOpNnZp5XpN06i7I1-LkcMLFJIwZe82FOzvCA3ZA8qTrVJw/s1600/cl-repl.png&quot; data-original-width=&quot;506&quot; data-original-height=&quot;900&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;p&gt;(via &lt;a href=&quot;https://twitter.com/dk_jackdaniel/status/942857838644400129&quot;&gt;@dk_jackdaniel&lt;/a&gt;)&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/741045754299407386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/741045754299407386' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/741045754299407386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/741045754299407386'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2017/12/a-lisp-repl-in-your-pocket.html' title='A Lisp REPL in your pocket'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5caJ9pZiz-UfFl9V_WBiKMYAU_LiCR9g-9VeeQyV5lMUMrsNLIDmf-jGIu37JFbMSQrKYkrK9zNEgj2nkQgyv3kRjJ9SC7s4cB59xWKS5SJ06zcFaBUNNZo96k62VQimFtb3SYQ/s72-c/cl-repl-logo.png" height="72" width="72"/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-6017297687415416855</id><published>2016-07-10T23:39:00.001+01:00</published><updated>2016-07-14T13:46:09.348+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Re: Querying plists</title><content type='html'>Zach&#39;s &lt;a href=&quot;http://lispblog.xach.com/post/147048601608&quot;&gt;Querying plists&lt;/a&gt; blog post showcases a neat little querying DSL for plists. I couldn&#39;t shake the feeling that it looked an awful lot like pattern matching. I&#39;ve often been impressed by &lt;a href=&quot;https://github.com/m2ym/optima&quot;&gt;optima&lt;/a&gt;, but I barely get to use it, so I thought I should try and see what querying plists looked like using pattern matching.&lt;br /&gt;
&lt;br /&gt;
Here&#39;s what I came up with. Zach&#39;s example&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;(query-plists &#39;(:and (:= :first-name &quot;Zach&quot;) (:= :state &quot;ME&quot;)
                     (:not (:= :last-name &quot;Beane&quot;)))
              *people*)
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;becomes:&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;(remove-if-not (lambda-match ((plist :first-name &quot;Zach&quot; :state &quot;ME&quot;
                                     :last-name (not &quot;Beane&quot;)) t))
               *people*)
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;
It turned out more succinct than I initially expected! Also, it&#39;s trivially adaptable to other kinds of objects. E.g., given the following class:&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;(defclass person ()
  ((first-name :initarg :first-name)
   (last-name  :initarg :last-name)
   (state      :initarg :state)))
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;all we have to do is swap &lt;code&gt;plist&lt;/code&gt; with the class name &lt;code&gt;person&lt;/code&gt; and we&#39;re all set:&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;(remove-if-not (lambda-match ((&lt;strong&gt;person&lt;/strong&gt; :first-name &quot;Zach&quot; :state &quot;ME&quot;
                                      :last-name (not &quot;Beane&quot;)) t))
               *people*)
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;
We can&#39;t quite define something exactly like Zach&#39;s &lt;code&gt;query-plists&lt;/code&gt; because, AFAICT, optima&#39;s patterns are not first-class objects but perhaps we can cheat a little bit.&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;;; naming things is hard. :-/
(defmacro matchp (pattern) `(lambda-match (,pattern t)))
(defun filter (predicate list) (remove-if-not predicate list))

(filter (matchp (plist :first-name &quot;Zach&quot; :state &quot;ME&quot;
                       :last-name (not &quot;Beane&quot;)))
        *people*)
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;
Making this equally succinct when the query criteria are not constant is a challenge for another day and makes it clear that &lt;code&gt;matchp&lt;/code&gt; is a lousy abstraction. ;-)</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/6017297687415416855/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/6017297687415416855' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/6017297687415416855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/6017297687415416855'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2016/07/re-querying-plists.html' title='Re: Querying plists'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-8312694162128243786</id><published>2016-02-03T00:51:00.001+00:00</published><updated>2016-02-03T00:56:41.000+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>slime-macrostep</title><content type='html'>SLIME&#39;s just got a new contrib called &lt;code&gt;slime-macrostep&lt;/code&gt;, courtesy of &lt;a href=&quot;https://github.com/joddie&quot;&gt;Jon Oddie&lt;/a&gt; who also wrote the underlying &lt;a href=&quot;https://github.com/joddie/macrostep&quot;&gt;macrostep&lt;/a&gt; package.&lt;br /&gt;
&lt;br /&gt;
And what is &lt;code&gt;slime-macrostep&lt;/code&gt;? It&#39;s an interactive inline macro-expander. Have a look:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhApTjRNs214Q-YxiV75AOAhgjID_gH9EtxZme7m60IgR5TAMtR_PWNcRCWTmXlFcutT_e25Vdhsr2KEoGnHzf2BWeRTSM9Z_6oUsmPl-NnyxFpoZoaPUwFEuSmdoX4dgOrLxKn9A/s1600/macrostep-demo.gif&quot; /&gt;&lt;/div&gt;&lt;br /&gt;
In this quick demo, using a &lt;a href=&quot;http://common-lisp.net/project/cffi&quot;&gt;CFFI&lt;/a&gt; example, I start by expanding the top-level &lt;code&gt;WITH-FOREIGN-OBJECT&lt;/code&gt; form, then I expand the &lt;code&gt;WITH-ALIEN&lt;/code&gt; form, but regret it and collapse it back. Then I proceed to expand everything else, including compiler macros!&lt;br /&gt;
&lt;br /&gt;
A nice feature of &lt;code&gt;slime-macrostep&lt;/code&gt; is that the expansions are annotated to show which forms are further expandable and &lt;code&gt;macrostep-expand&lt;/code&gt; will jump automatically to the next expandable form. That&#39;s what makes it a stepper: pressing &lt;kbd&gt;e&lt;/kbd&gt; repeadly will step through the macroexpansion. Plus, it expands macrolets!&lt;br /&gt;
&lt;br /&gt;
If you&#39;d like to try it out, please grab SLIME&#39;s bleeding edge (&lt;a href=&quot;https://github.com/slime/slime#quick-setup-instructions&quot;&gt;via MELPA or Git&lt;/a&gt;). It&#39;s enabled by default if you use the &lt;code&gt;slime-fancy&lt;/code&gt; meta contrib. Feedback is most welcome.</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/8312694162128243786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/8312694162128243786' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/8312694162128243786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/8312694162128243786'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2016/02/slime-macrostep.html' title='slime-macrostep'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhApTjRNs214Q-YxiV75AOAhgjID_gH9EtxZme7m60IgR5TAMtR_PWNcRCWTmXlFcutT_e25Vdhsr2KEoGnHzf2BWeRTSM9Z_6oUsmPl-NnyxFpoZoaPUwFEuSmdoX4dgOrLxKn9A/s72-c/macrostep-demo.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-4459129205843866670</id><published>2016-01-04T11:18:00.001+00:00</published><updated>2016-01-04T11:23:24.869+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Common Lisp Recipes: A Problem-Solution Approach</title><content type='html'>Edi Weitz, author of things like &lt;a href=&quot;http://weitz.de/cl-ppcre/&quot;&gt;CL-PPCRE&lt;/a&gt; and &lt;a href=&quot;http://weitz.de/hunchentoot/&quot;&gt;Hunchentoot&lt;/a&gt; (amongst many other pieces of &lt;a href=&quot;http://weitz.de/lisp.html&quot;&gt;&lt;em&gt;ediware&lt;/em&gt;&lt;/a&gt;), has just published a new book, &lt;a href=&quot;http://weitz.de/cl-recipes/&quot;&gt;“Common Lisp Recipes: A Problem-Solution Approach”&lt;/a&gt;. I&#39;ve ordered mine. Get yours from &lt;a href=&quot;http://www.apress.com/9781484211779&quot;&gt;Apress&lt;/a&gt; or a &lt;a href=&quot;https://www.curiua.com/dp/1484211774&quot;&gt;European Amazon store&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlkIvRm1Yo3DjXUSkoJ_KG-NkxE7quAzpdZAzjxFfdzYeAKS4dNvCW-s4wBv7c2p5iL1Sh_hsoHKgaz9qOFR8213ZNX_bmKf6Bt462YIkEnZVOaF471IaRte9AHoebqocmT64cEw/s1600/7177Nn51w5L.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlkIvRm1Yo3DjXUSkoJ_KG-NkxE7quAzpdZAzjxFfdzYeAKS4dNvCW-s4wBv7c2p5iL1Sh_hsoHKgaz9qOFR8213ZNX_bmKf6Bt462YIkEnZVOaF471IaRte9AHoebqocmT64cEw/s320/7177Nn51w5L.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;Common Lisp Recipes is a collection of solutions to problems and answers to questions you are likely to encounter when writing real-world applications in Common Lisp. Written by an author who has used Common Lisp in many successful commercial projects over more than a decade, this book is the first Common Lisp book which covers areas as diverse as web programming, databases, graphical user interfaces, communication with other programming languages, multi-processing, and mobile devices as well as debugging techniques and optimization, to name just a few. It is organized around specific problems or questions each followed by ready-to-use example solutions and clear explanations of the concepts involved, plus pointers to alternatives and more information. Each recipe can be read independently of the others and thus the book will hopefully earn a special place on your bookshelf as a reference work you always want to have within reach.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;Common Lisp Recipes is aimed at programmers who are already familiar with Common Lisp to a certain extent but do not yet have the experience you typically only get from years of hacking in a specific computer language. It is written in a style that mixes hands-on no-frills pragmatism with precise information and prudent mentorship.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;If you feel attracted to Common Lisp&#39;s mix of breathtaking features and down-to-earth utilitarianism, you&#39;ll also like this book.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/4459129205843866670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/4459129205843866670' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/4459129205843866670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/4459129205843866670'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2016/01/common-lisp-recipes-problem-solution.html' title='Common Lisp Recipes: A Problem-Solution Approach'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlkIvRm1Yo3DjXUSkoJ_KG-NkxE7quAzpdZAzjxFfdzYeAKS4dNvCW-s4wBv7c2p5iL1Sh_hsoHKgaz9qOFR8213ZNX_bmKf6Bt462YIkEnZVOaF471IaRte9AHoebqocmT64cEw/s72-c/7177Nn51w5L.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-4054101790617748697</id><published>2015-05-30T17:06:00.000+01:00</published><updated>2016-02-03T17:14:42.733+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>My answer to the Pretty Printer Puzzle</title><content type='html'>As promised, I&#39;ll describe my solution to the &lt;a href=&quot;http://kvardek-du.kerno.org/2015/05/pretty-printer-puzzle.html&quot;&gt;Pretty Printer Puzzle&lt;/a&gt; I proposed last week. To recap, we wish to pretty print a Lisp form to a string and identify the textual positions of arbitrary subforms therein. &lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;First attempt&lt;/h3&gt;A couple of folks proposed a clever solution that goes like this: (1) replace the &lt;code&gt;CAR&lt;/code&gt; of each subform with some unique token (a gensym should be close enough), (2) pretty-print that, (3) find the token positions and replace them with the original &lt;code&gt;CAR&lt;/code&gt;s.&lt;br /&gt;
&lt;br /&gt;
Problem with this solution: changing the form affects pretty-printing. In particular, it will no longer be able to properly indent macros and special forms.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Second attempt&lt;/h3&gt;Another approach is to pretty-print then read the form back and track positions by either using a custom reader that keeps track of form positions (such as &lt;a href=&quot;http://hub.darcs.net/hu.dwim/hu.dwim.reader&quot;&gt;hu.dwim.reader&lt;/a&gt;) or instrumenting the standard readtable by &lt;a href=&quot;https://github.com/sbcl/sbcl/blob/master/contrib/sb-cover/cover.lisp#L459&quot; title=&quot;like this, for example&quot;&gt;wrapping the &lt;code&gt;#\(&lt;/code&gt; reader-macro&lt;/a&gt; and doing the reading from a so-called &lt;a href=&quot;https://github.com/sbcl/sbcl/blob/399c6f8dee7b07c8c0a17510ed78411672cba2f9/src/code/fd-stream.lisp#L197&quot;&gt;form-tracking-stream&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Problem with this solution: it breaks down if the form contains unreadable objects.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Third attempt, getting closer&lt;/h3&gt;The pretty printer is customisable through a &lt;a href=&quot;http://www.lispworks.com/documentation/HyperSpec/Body/22_bad.htm&quot;&gt;pprint-disptach-table&lt;/a&gt;. It is analogous to the reader&#39;s &lt;code&gt;&lt;a href=&quot;http://www.lispworks.com/documentation/lw51/CLHS/Body/t_rdtabl.htm&quot;&gt;readtable&lt;/a&gt;&lt;/code&gt;. So, we try and &lt;a href=&quot;https://gist.github.com/luismbo/edbff74733812f57c5d9#file-tracking-string-output-stream-lisp&quot;&gt;instrument it&lt;/a&gt; like in the previous approach. Each time a list is about to be pretty-printed, we store the current position in the output stream.&lt;br /&gt;
&lt;br /&gt;
Problem: we have been defeated by the pretty printer&#39;s intermediate buffer. Turns out the pretty printer only writes to the output stream at the very end of the process. Back to the drawing board.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Fourth and final attempt&lt;/h3&gt;But these attempts have not been in vain, and my final solution involves elements from all three. It goes like this:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Pretty print the form normally.&lt;/li&gt;
&lt;li&gt;Pretty print the form again, this time instrumenting the &lt;code&gt;pprint-dispatch-table&lt;/code&gt; to wrap lists with some token identifying the subform being printed. (I decided to use the unicode range &lt;code&gt;U+E000..U+F8FF&lt;/code&gt; which is reserved for private-use, which seemed neat.) This messes up the pretty-printing a little bit, but not too much, it turns out.&lt;/li&gt;
&lt;li&gt;Cross-reference the token positions in #2 with #1 by taking advantage of the fact these outputs differ by whitespace (and tokens) only!&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
And that&#39;s it!&lt;br /&gt;
&lt;br /&gt;
With this tool in hand, there are some interesting utilities that can be built in SLIME, but that&#39;s &lt;a href=&quot;http://kvardek-du.kerno.org/2016/02/slime-macrostep.html&quot;&gt;another blog post&lt;/a&gt;. :-)</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/4054101790617748697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/4054101790617748697' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/4054101790617748697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/4054101790617748697'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2015/05/my-answer-to-pretty-printer-puzzle.html' title='My answer to the Pretty Printer Puzzle'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-363259020681951587</id><published>2015-05-24T15:20:00.001+01:00</published><updated>2015-05-26T01:04:17.163+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Pretty printer puzzle</title><content type='html'>This past week, I came across a Lisp challenge that turned out to be trickier than one might expect at first. I needed to pretty-print a Lisp form to a string and identify the positions of certain subforms. Here&#39;s an example:&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;CL-USER&gt; (with-output-to-string (*standard-output*)
           (pprint &#39;(defun factorial (x) (if (zerop x) 1 (* x (factorial (1- x)))))))
&quot;
(DEFUN FACTORIAL (X)
  (IF (ZEROP X)
      1
      (* X (FACTORIAL (1- X)))))&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;In this, output the &lt;a href=&quot;http://www.lispworks.com/documentation/lw50/CLHS/Body/26_glo_b.htm#bounding_index&quot;&gt;bounding indices&lt;/a&gt; of the &lt;code&gt;IF&lt;/code&gt; form are 24 and 77. In other words:&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;CL-USER&gt; (subseq * 24 77)
&quot;(IF (ZEROP X)
      1
      (* X (FACTORIAL (1- X))))&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;The challenge, then, is to write a function that, given a form and list of subforms, returns a string with the pretty-printed output and a list of bounding indices for each subform. E.g.&lt;br /&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;CL-USER&gt; (pprinted-bounds &#39;(defun factorial (x) #1=(if (zerop x) 1 (* x #2=(factorial (1- x)))))
                          (list &#39;#1# &#39;#2#))
&quot;
(DEFUN FACTORIAL (X)
  (IF (ZEROP X)
      1
      (* X (FACTORIAL (1- X)))))&quot;
((24 77) (57 75))
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;I&#39;ll post my solution later. Have fun. :-)</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/363259020681951587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/363259020681951587' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/363259020681951587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/363259020681951587'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2015/05/pretty-printer-puzzle.html' title='Pretty printer puzzle'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-1772733771574178658</id><published>2014-12-19T18:27:00.000+00:00</published><updated>2014-12-20T00:08:06.032+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>LOOP quiz</title><content type='html'>&lt;ol&gt;&lt;li&gt;Does &lt;code&gt;(loop for i below 10 finally (return i))&lt;/code&gt; return 9 or 10?&lt;br /&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Does &lt;code&gt;(loop for i upto 10 finally (return i))&lt;/code&gt; return 10 or 11?&lt;br /&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;What does &lt;code&gt;(loop for i below 10 for j upto 10 finally (return (list i j)))&lt;/code&gt; return?&lt;br /&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;What about &lt;code&gt;(loop for i below 10 &lt;strong&gt;and&lt;/strong&gt; j upto 10 finally (return (list i j)))&lt;/code&gt;?&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
I stumbled upon the semantics of this last example &lt;a href=&quot;https://github.com/cl-babel/babel/commit/c53ee13b19e5a3184c106aff88b38871204e88ad?diff=split&quot;&gt;in a recent bugfix&lt;/a&gt; and thought it was worth sharing. (Reminded me of &lt;a href=&quot;http://martinfowler.com/bliki/TwoHardThings.html&quot;&gt;the joke about what&#39;s hard in CS&lt;/a&gt;, too.)&lt;br /&gt;
&lt;br /&gt;
Turns out &lt;code&gt;LOOP&lt;/code&gt;&#39;s &lt;code&gt;FOR ... AND&lt;/code&gt; not only mimics &lt;code&gt;LET&lt;/code&gt; (rather than &lt;code&gt;LET*&lt;/code&gt;) in terms of binding visibility, it also influences when the loop termination checks take place. That was new to me. I initially expected examples 3 and 4 to return the same values. What about you? Which ones, if any, did you get wrong? :-)&lt;br /&gt;
&lt;br /&gt;
P.S.: &lt;a href=&quot;http://www.gigamonkeys.com/book/loop-for-black-belts.html&quot;&gt;LOOP for Black Belts&lt;/a&gt; is my favorite LOOP tutorial.</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/1772733771574178658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/1772733771574178658' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/1772733771574178658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/1772733771574178658'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2014/12/loop-quiz.html' title='LOOP quiz'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-3836914246392425633</id><published>2014-12-11T21:20:00.000+00:00</published><updated>2015-05-31T16:21:10.408+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>paredit</title><content type='html'>Taylor Campbell&#39;s &lt;a href=&quot;http://emacswiki.org/ParEdit&quot;&gt;paredit&lt;/a&gt; is one of those Emacs extensions that I can&#39;t live without. In a nutshell, it forces you to deal with Lisp code exclusively via operations that don&#39;t introduce unbalanced parenthesis (or other similar violations of structure). The genius about this approach is that it completely eliminates the step of making sure parentheses are properly balanced after you write or edit a piece of code. After you get used to paredit, performing &amp;mdash; or even watching &amp;mdash; manual parenthesis balancing becomes painful.&lt;br /&gt;
&lt;br /&gt;
Recently, I&#39;ve come across these two introductions to paredit:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;http://emacsrocks.com/e14.html&quot;&gt;Emacs Rocks! Episode 14: Paredit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://danmidwood.com/content/2014/11/21/animated-paredit.html&quot;&gt;The Animated Guide to Paredit&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;So, if you&#39;re still not using paredit, have a look at those and give it a try. At first you might feel like the karate kid doing frustrating chores &amp;mdash; you can always take a break with &lt;kbd&gt;M-x paredit-mode&lt;/kbd&gt; &amp;mdash; but I promise it&#39;ll soon pay off!&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Uut8pPI67KAvM3schGsTR5ght8DEtgqNQ0AmSuFXznERIhOVMn16cyLw__Ue27N_GxP49R6BntnWRO_G9zmVHGv6rDcHZRJzp-lEasV4j-IBdUqVwIzfSZyIkoPJm1vT2IfZRA/s1600/tumblr_m7k3xbemnG1qg4blro1_500.gif&quot;/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/3836914246392425633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/3836914246392425633' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/3836914246392425633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/3836914246392425633'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2014/12/paredit.html' title='paredit'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Uut8pPI67KAvM3schGsTR5ght8DEtgqNQ0AmSuFXznERIhOVMn16cyLw__Ue27N_GxP49R6BntnWRO_G9zmVHGv6rDcHZRJzp-lEasV4j-IBdUqVwIzfSZyIkoPJm1vT2IfZRA/s72-c/tumblr_m7k3xbemnG1qg4blro1_500.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-6366071411183563593</id><published>2014-12-01T12:04:00.000+00:00</published><updated>2014-12-01T18:15:56.731+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>SLIME officially available via MELPA</title><content type='html'>SLIME has been &lt;a href=&quot;http://melpa.org/#/slime&quot;&gt;available from MELPA&lt;/a&gt; for a while, but only recently did we iron out some annoying bugs. Notably, upgrading the SLIME package no longer results in confusion about where SWANK is.&lt;br /&gt;
&lt;br /&gt;
So, as of SLIME 2.11, once you have the &lt;a href=&quot;http://melpa.org&quot;&gt;melpa&lt;/a&gt; (or &lt;a href=&quot;http://stable.melpa.org&quot;&gt;melpa stable&lt;/a&gt;) repository set up, installing and updating SLIME from within Emacs is pretty easy:&lt;br /&gt;
&lt;pre&gt;    M-x package-install RET slime RET&lt;/pre&gt;Enjoy!&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Update:&lt;/strong&gt; Oh, if you want to switch to MELPA, make sure you remove your old SLIME location from Emacs&#39;s &lt;code&gt;load-path&lt;/code&gt;, otherwise the old version will take precedence.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align:center&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1YcUvwAdGQKuW4-O4km1ToBRKHgDLcXIo6HjsV4VxN7BpU6pRKsoFQRK4UnDVrEQG2B5NhJi4Z1QmXe2bNwuv32LM0zeNHE3cAXxeESim2m9hC6iJpDMenb0IIpMN4j9Eeki9Qg/s1600/package-install-slime.gif&quot; /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/6366071411183563593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/6366071411183563593' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/6366071411183563593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/6366071411183563593'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2014/12/slime-officially-available-via-melpa.html' title='SLIME officially available via MELPA'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1YcUvwAdGQKuW4-O4km1ToBRKHgDLcXIo6HjsV4VxN7BpU6pRKsoFQRK4UnDVrEQG2B5NhJi4Z1QmXe2bNwuv32LM0zeNHE3cAXxeESim2m9hC6iJpDMenb0IIpMN4j9Eeki9Qg/s72-c/package-install-slime.gif" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-2733599997253165180</id><published>2014-11-28T22:04:00.000+00:00</published><updated>2014-11-28T22:09:03.842+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>(cons cat (cons cat nil))</title><content type='html'>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwFGsoF-WX9Y7PKFF97e__EaQvf-ahMdaUbCN8C1grKF3LG9B86S_wR-ahzVnEmcENawDvpOJSXEmCC-jwdMx90rdO4id06vrv5pUJKif7OlkrDgqTTc5iSP8bNjgcaBw0MZG20Q/s1600/unnamed.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwFGsoF-WX9Y7PKFF97e__EaQvf-ahMdaUbCN8C1grKF3LG9B86S_wR-ahzVnEmcENawDvpOJSXEmCC-jwdMx90rdO4id06vrv5pUJKif7OlkrDgqTTc5iSP8bNjgcaBw0MZG20Q/s400/unnamed.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I thought &lt;a href=&quot;https://twitter.com/lvsn/status/533685461957349376&quot;&gt;this tweet&lt;/a&gt; was pretty funny, despite the diagrammatic inaccuracy that twitterers were quick to point out. :-) Reminds me of &lt;a href=&quot;http://catrapum.kerno.org/image/9848612617&quot;&gt;my second cat&lt;/a&gt;, whom I named CADR, of course.</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/2733599997253165180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/2733599997253165180' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/2733599997253165180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/2733599997253165180'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2014/11/cons-cat-cons-cat-nil.html' title='(cons cat (cons cat nil))'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwFGsoF-WX9Y7PKFF97e__EaQvf-ahMdaUbCN8C1grKF3LG9B86S_wR-ahzVnEmcENawDvpOJSXEmCC-jwdMx90rdO4id06vrv5pUJKif7OlkrDgqTTc5iSP8bNjgcaBw0MZG20Q/s72-c/unnamed.jpg" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-7707383753400924976</id><published>2014-03-02T14:40:00.003+00:00</published><updated>2014-03-02T18:13:22.653+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>SLIME 2.4</title><content type='html'>&lt;a href=&quot;https://github.com/slime/slime/releases/tag/v2.4&quot;&gt;SLIME 2.4 has been released&lt;/a&gt; without any &lt;a href=&quot;http://christophe.rhodes.io/notes/blog/posts/2014/sbcl_release_management_in_the_air/&quot;&gt;exciting release management&lt;/a&gt;, but with &lt;a href=&quot;https://raw.github.com/slime/slime/v2.4/NEWS&quot;&gt;extensive release notes&lt;/a&gt;! :-)&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiIclVT1PFJXJNWyIfF_25kB2W6I6DSKcuI_G2uvNwD8mrfhTks5Tpsd27mzDTVnoevuKa_ol7Q9uA_I8K8LlfFLeH43YNAsTNtdrYWlaIzniM7DrX9jotTqQnCbxYFM0ugrAJiA/s1600/slime-connected.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiIclVT1PFJXJNWyIfF_25kB2W6I6DSKcuI_G2uvNwD8mrfhTks5Tpsd27mzDTVnoevuKa_ol7Q9uA_I8K8LlfFLeH43YNAsTNtdrYWlaIzniM7DrX9jotTqQnCbxYFM0ugrAJiA/s1600/slime-connected.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/7707383753400924976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/7707383753400924976' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/7707383753400924976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/7707383753400924976'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2014/03/slime-24.html' title='SLIME 2.4'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiIclVT1PFJXJNWyIfF_25kB2W6I6DSKcuI_G2uvNwD8mrfhTks5Tpsd27mzDTVnoevuKa_ol7Q9uA_I8K8LlfFLeH43YNAsTNtdrYWlaIzniM7DrX9jotTqQnCbxYFM0ugrAJiA/s72-c/slime-connected.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-8520974947578225997</id><published>2014-02-23T16:40:00.000+00:00</published><updated>2014-02-23T17:56:06.888+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Call for SLIME testers</title><content type='html'>As you may have heard, SLIME&#39;s recently moved to GitHub where, for the last 3 months or so, code has been refactored, bugs have been fixed and some new features have been introduced.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://github.com/slime/slime/graphs/commit-activity&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; alt=&quot;SLIME&#39;s commit activity over the last 12 months&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6JrN6HHA9fJQ4fKs01DRrUPuHv2T-KhEMbnFhBye5pZXVMAj2P6cqDXZl_4Nzp4yYIBUtrNN3xfRgEqy593HAwSnnRx4ayr0E8eihL0nZSWi7NVLK4u3GPpj0Cj4oLel-_VN8tw/s1600/slime-activity.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
The last SLIME release has a very long beard, so we&#39;d like to make a new one next weekend. To make it a good release, it&#39;d be very really helpful if fellow SLIME users grabbed &lt;a href=&quot;https://github.com/slime/slime&quot;&gt;the latest code from github&lt;/a&gt; (via either git or the ZIP download link), took it for a spin and, if need be, used the &lt;a href=&quot;https://github.com/slime/slime/issues&quot;&gt;issue tracker&lt;/a&gt; to report issues that may pop up.&lt;br /&gt;
&lt;br /&gt;
Thanks!</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/8520974947578225997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/8520974947578225997' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/8520974947578225997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/8520974947578225997'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2014/02/call-for-slime-testers.html' title='Call for SLIME testers'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6JrN6HHA9fJQ4fKs01DRrUPuHv2T-KhEMbnFhBye5pZXVMAj2P6cqDXZl_4Nzp4yYIBUtrNN3xfRgEqy593HAwSnnRx4ayr0E8eihL0nZSWi7NVLK4u3GPpj0Cj4oLel-_VN8tw/s72-c/slime-activity.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-606817847906557339</id><published>2013-11-21T12:13:00.000+00:00</published><updated>2013-11-22T16:20:32.680+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>SISCOG&#39;s ECLM 2013 slides (finally) up</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;float: right; clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://www.siscog.eu/upload/GESTAO-DE-LISTAS/News/PDF/eclm-2013-siscog-a-story-written-in-lisp-20130602.pdf&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img style=&quot;border-style:solid;
border-width:1px;&quot; border=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOmNN2f5LwAFuurFyFGZcfk2vzNYDvYNgDkk5S8WfIz6wfNyUjs7qus2dbKrMzCVWe84a3QfweR_g8Bw1eEwjKvV50joueYKbkbP49ZK2neyUCcHClBKZRT875rdO2yL4pkeTtEw/s400/presentation.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
It took a while, but our &lt;a href=&quot;http://weitz.de/eclm2013&quot;&gt;ECLM 2013&lt;/a&gt; slides &amp;ldquo;&lt;a href=&quot;http://www.siscog.eu/upload/GESTAO-DE-LISTAS/News/PDF/eclm-2013-siscog-a-story-written-in-lisp-20130602.pdf&quot;&gt;SISCOG: a story written in Lisp&lt;/a&gt;&amp;rdquo; have been published. Incidentally, they are also featured in Franz&#39;s &lt;a href=&quot;http://www.franz.com/success/customer_apps/scheduling/siscog.lhtml&quot;&gt;ACL Success Stories&lt;/a&gt;, yay.&lt;br /&gt;
&lt;br /&gt;
On a related note, Vsevolod Dyomkin published his &lt;a href=&quot;http://www.youtube.com/playlist?list=PLyKekftcIioT995qDMGO8TtSLIz25lhGd&quot;&gt;video recordings&lt;/a&gt; of the meeting. Sadly, we didn&#39;t get permission to publish our video.&lt;br /&gt;
&lt;br /&gt;
Finally, &lt;a href=&quot;http://www.siscog.eu/list_detail.asp?idArea=3&amp;idList=7&amp;idListDetail=506&quot;&gt;SISCOG is hiring&lt;/a&gt; and has open positions for Software Engineers and Operations Research Analysts that require C++ programming, which is rather ironic and anti-climatic for this blog post. :-)&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/606817847906557339/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/606817847906557339' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/606817847906557339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/606817847906557339'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2013/11/siscogs-eclm-2013-slides-finally-up.html' title='SISCOG&#39;s ECLM 2013 slides (finally) up'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOmNN2f5LwAFuurFyFGZcfk2vzNYDvYNgDkk5S8WfIz6wfNyUjs7qus2dbKrMzCVWe84a3QfweR_g8Bw1eEwjKvV50joueYKbkbP49ZK2neyUCcHClBKZRT875rdO2yL4pkeTtEw/s72-c/presentation.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-5651739108810578060</id><published>2013-06-06T11:46:00.001+01:00</published><updated>2013-06-06T19:27:28.000+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>ECLM 2013</title><content type='html'>Another odd year, another &lt;a href=&quot;http://weitz.de/eclm2013/&quot;&gt;ECLM&lt;/a&gt;. This time around in sunny Madrid at the posh &lt;a href=&quot;https://plus.google.com/114180786369307770957/photos?hl=en&quot;&gt;TRYP Ambassador&lt;/a&gt; within walking distance from Teatro Real and Plaza Mayor. 63 people from 20 countries turned up.&lt;br /&gt;
&lt;br /&gt;
On &lt;strong&gt;Saturday&lt;/strong&gt; I failed to meet some other lispers for lunch. Apparently, there&#39;s two or three Museos del Jamón around Plaza Mayor and I stood for 20 minutes in front of the wrong one. Took the afternoon to tweak my slides. Dinner was nice for catching up with familiar faces from past meetings. Met some new lispers as well. Some of us went for a quick drink at &lt;a href=&quot;http://www.mercadodesanmiguel.es/&quot;&gt;Mercado de San Miguel&lt;/a&gt; afterwards.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Sunday&lt;/strong&gt; started off with a visibly jet lagged &lt;strong&gt;Wes Henderson&lt;/strong&gt; talking about &lt;a href=&quot;http://wukix.com/mocl&quot;&gt;mocl&lt;/a&gt;, a Lisp-to-C compiler with two backends tailored for the iPhone and Android environments. Despite the jet lag, he was quite eloquent! mocl makes it trivial to call Lisp from Java/ObjC:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(declaim (call-in foo)) ; declares FOO can be called from foreign land
    (defun foo (x)
      (format t &quot;~a~%&quot; x))
&lt;/pre&gt;&lt;br /&gt;
After compiling this function, it will be available from the ObjC or Java environments. I didn&#39;t quite figure out how mocl deals with the mismatch between static and dynamic typing, but apparently that&#39;s taken care of. Note that the goal is for mocl to be embedded in Android/Java or iOS/ObjC applications. I.e., you&#39;ll be writing your GUIs in Java/ObjC and call out to Lisp for the remaining bits. I don&#39;t recall anything being mentioned about calling Java/ObjC from the Lisp side.&lt;br /&gt;
&lt;br /&gt;
I enjoyed his thought out justification of why Common Lisp is a good match for mobile applications. First off, CL has a stable specification and a rich ecosystem with many alternative implementations. That means that, if he follows the spec, our existing code (namely libraries) will work as is. Secondly, CL is fast and that&#39;s important for resource-constrained mobile devices. (What does it mean for a language to be fast? I guess it means that there are plenty of implementations around that show how its semantics can be implemented efficiently.) Thirdly, the CL ecosystem has a relatively reduced dependency on foreign libraries which may or may not work on mobile environments. I was convinced. :-)&lt;br /&gt;
&lt;br /&gt;
Wes took the opportunity to announce that mocl will be released at 3581000000 lisp universal time. (That&#39;s from memory, I hope I got it right.)&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Michael Eisfeld&lt;/strong&gt; presented &lt;a href=&quot;http://www.coned.de/&quot;&gt;ConED&lt;/a&gt;, an application to help engineers design the first stages of building structures.&lt;br /&gt;
&lt;br /&gt;
&lt;p style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;http://www.coned.de/uploads/tx_e3pslideshow/step5.png&quot; /&gt;&lt;/p&gt;&lt;br /&gt;
There weren&#39;t many lispy details, but the application seemed quite useful and interesting. I&#39;m told this is a hard market to get into, so best of luck to Michael and his team!&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Michael Compton&lt;/strong&gt; talked about Accenture&#39;s digital optimisation software, &lt;a href=&quot;http://marketingsoftware.accenture.com/en-US/Products/Marketing-Software/Software-Products/Accenture-Digital-Optimization.aspx&quot;&gt;ADO&lt;/a&gt;. In a nutshell, ADO will feed various versions of a webpage to users and cleverly measure which ones work best. I didn&#39;t understand most of what was discussed, but apparently they&#39;re market leaders.&lt;br /&gt;
&lt;br /&gt;
Then, &lt;strong&gt;Tiago Maduro Dias&lt;/strong&gt; and I talked about the company where we work, &lt;a href=&quot;http://www.siscog.pt&quot;&gt;SISCOG&lt;/a&gt;. Tiago presented SISCOG&#39;s history, problem domain and products and I tried to illustrate some interesting ways how we use Lisp. Thanks to Murphy&#39;s law, projector woes took up a fair chunk of our allotted time and I had to compress 25 minutes of talk into 15 or so. In the end, I think it went OK and the feedback was pretty positive. SISCOG is a 27 year old company with a rich Lisp history (going back to the Lisp Machines!) and it&#39;s quite successful in its market: resource planning, management and optimisation for railway companies. Oh, and we have about 70 full-time lispers.&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;Tapas&lt;/em&gt; for lunch.&lt;br /&gt;
&lt;br /&gt;
After lunch, &lt;strong&gt;R. Matthew Emerson&lt;/strong&gt; (rme) talked about Clozure CL&#39;s Objective-C bridge. I enjoyed his presentation style, and there were plenty of demos, which is nice. I had heard about CCL&#39;s IDE before, but this was the first time I got to see it.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Janusz Podrazik&lt;/strong&gt; then demoed &lt;a href=&quot;http://opusmodus.com/&quot;&gt;Opusmodus&lt;/a&gt;, written using CCL and the aforementioned ObjC bridge, which looked quite slick! It felt a bit like an Emacs-inspired IDE for writing music with lots of pretty graphs and visualizations. Plus, it lets you write music using Lisp! IIUC, the coding was done by rme who did a very fine job! Looking forward to its release this coming September.&lt;br /&gt;
&lt;br /&gt;
&lt;p style=&quot;text-align: center&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicO1RAV4xPOx9Fm-9xBhLK_MWt4i5zVURSEYTDiO4noXCa7x6q9XcKcCLf7Ihk3xtlJDjx9PtymZkNEJ5EGkmTALKqiEohAi-xb0UUi3JXbi9iCB-LFXSoewYN2Kmx8bIWuHP7oQ/s1600/omn10.png&quot; /&gt;&lt;/p&gt;&lt;br /&gt;
&lt;strong&gt;Erik Huelsmann&lt;/strong&gt; (ehu) talked about &lt;a href=&quot;http://abcl.org/&quot;&gt;ABCL&lt;/a&gt;, whose version &lt;a href=&quot;http://article.gmane.org/gmane.editors.j.devel/5515&quot;&gt;1.2.0 RC&lt;/a&gt; had been released that morning from the venue. He basically talked about the latest developments and how ABCL is being used out there (including an application of his). I liked how the ABCL developers are using cl-test-grid to assess ABCL&#39;s compatibility with major libraries and how Quicklisp&#39;s download statistics helps them prioritise bug fixing.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Sven Emtell&lt;/strong&gt; demoed &lt;a href=&quot;http://scorecleaner.com/&quot;&gt;ScoreCleaner&lt;/a&gt;. (I don&#39;t recall exactly which bits were written in Common Lisp. It was a very polyglot product, IIRC.) He showed nicely done marketing videos, such as &lt;a href=&quot;http://www.youtube.com/watch?&amp;v=nl9uxZefWdY&quot;&gt;this one&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
At dinner, Faré tried to explain to me what Interface Passing Style was all about and how he used it in his &lt;a href=&quot;http://common-lisp.net/~frideau/lil-ilc2012/lil-ilc2012.html&quot;&gt;Lisp Interface Library&lt;/a&gt;. He almost succeeded!&lt;br /&gt;
&lt;br /&gt;
There were lightning talks throughout the day. Here are the ones I remember. &lt;strong&gt;Mark Evenson&lt;/strong&gt; presented a very clear explanation of what went wrong with the latest &lt;a href=&quot;http://common-lisp.net&quot;&gt;common-lisp.net&lt;/a&gt; migration and how he and other folks plan to fix outstanding issues and generally improve how the logistics of this service are managed. &lt;strong&gt;Nick Levine&lt;/strong&gt; talked about &lt;a href=&quot;http://www.ravenbrook.com/&quot;&gt;Ravenbrook&lt;/a&gt;. &lt;strong&gt;Christophe Rhodes&lt;/strong&gt; released &lt;a href=&quot;http://www.sbcl.org/news.html#1.1.8&quot;&gt;SBCL 1.1.8&lt;/a&gt; live.&lt;br /&gt;
&lt;br /&gt;
All in all, I think this was the best ECLM yet. Lots of cool applications and a vibrant community. Looking forward to the next one!</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/5651739108810578060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/5651739108810578060' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/5651739108810578060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/5651739108810578060'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2013/06/eclm-2013.html' title='ECLM 2013'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicO1RAV4xPOx9Fm-9xBhLK_MWt4i5zVURSEYTDiO4noXCa7x6q9XcKcCLf7Ihk3xtlJDjx9PtymZkNEJ5EGkmTALKqiEohAi-xb0UUi3JXbi9iCB-LFXSoewYN2Kmx8bIWuHP7oQ/s72-c/omn10.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-7322625352734018738</id><published>2013-03-18T00:46:00.000+00:00</published><updated>2013-03-18T00:48:28.095+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Kálmán Réti on Lisp Machines</title><content type='html'>&lt;p&gt;An interesting video popped up on the &lt;a href=&quot;http://www.reddit.com/r/lisp/comments/1a24aj/kalman_reti_the_last_symbolics_developer_speaks/&quot;&gt;Lisp Reddit&lt;/a&gt; last week: &lt;a href=&quot;http://www.loper-os.org/?p=932&quot;&gt;Kálmán Réti, the Last Symbolics Developer, Speaks of Lisp Machines&lt;/a&gt;. The first half goes into satisfyingly low-level detail about the Lisp Machine&#39;s history and architecture, and the second half contains the most in-depth demo I recall watching. Enjoy.&lt;/p&gt;&lt;iframe src=&quot;https://docs.google.com/file/d/0Bw4Wz8Ir0pl1cmNRaHYwdU1wdXM/preview&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/iframe&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/7322625352734018738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/7322625352734018738' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/7322625352734018738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/7322625352734018738'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2013/03/kalman-reti-on-lisp-machines.html' title='Kálmán Réti on Lisp Machines'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-8034543745121836504</id><published>2013-03-09T18:55:00.000+00:00</published><updated>2013-03-09T21:23:13.630+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>CFFI 0.11.0 released</title><content type='html'>CFFI 0.11.0 has been released on Feb 25th, 2013, but I only finished writing the release notes today:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;em&gt;new feature:&lt;/em&gt; &lt;a href=&quot;http://repo.or.cz/w/fsbv.git&quot;&gt;fsbv&lt;/a&gt; has been integrated into CFFI, courtesy of Liam Healy. This means we now support passing structs by value via [libffi](http://sourceware.org/libffi/)!  &lt;strong&gt;NB:&lt;/strong&gt; in order to differentiate between structure passing by value from structure by reference, &lt;code&gt;(:struct foo)&lt;/code&gt; and &lt;code&gt;:pointer&lt;/code&gt; should be used. The old way of referring to struct types by bare name is now deprecated.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;new feature:&lt;/em&gt; a new MKCL backend has been added courtesy of Jean-Claude Beaudoin.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;enhancement:&lt;/em&gt; the ABCL backend has improved considerably thanks to Mark Evenson and Stas Boukarev.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;enhancement:&lt;/em&gt; the ECL backend now supports multiple linking strategies thanks to Juanjo Garcia-Ripoll.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;optimization:&lt;/em&gt; &lt;code&gt;foreign-free&lt;/code&gt; is non-consing on SBCL. (Thanks to Stas Boukarev.)&lt;/li&gt;
&lt;li&gt;&lt;em&gt;bugfix:&lt;/em&gt; in some situations we were not signalling a warning upon defining a foreign type using a symbol from the &lt;code&gt;:cl&lt;/code&gt; or &lt;code&gt;:keyword&lt;/code&gt; packages. Because of this, some projects will see new compilation warnings that will require fixing.&lt;/li&gt;
&lt;li&gt;and various other bugfixes.&lt;/li&gt;
&lt;/ul&gt;This version will be included in the next Quicklisp dist.</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/8034543745121836504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/8034543745121836504' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/8034543745121836504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/8034543745121836504'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2013/03/cffi-0110-released.html' title='CFFI 0.11.0 released'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-5065868433153657035</id><published>2012-06-06T02:59:00.000+01:00</published><updated>2012-06-10T01:47:20.075+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Augmenting bordeaux-threads with atomic operations</title><content type='html'>&lt;p&gt;&lt;a href=&quot;http://common-lisp.net/project/bordeaux-threads/&quot;&gt;Bordeaux-threads&lt;/a&gt; is a portability layer that defines a low-level API for programming shared-state concurrency: basic thread management, locks, timeouts, and condition variables. It has been ported to plenty of CL implementations: ABCL, Allegro CL, CLISP, Clozure CL, CMUCL, Corman Lisp, ECL, Lispworks, MCL, SBCL, and SCL. As such, it&#39;s an ubiquitous building block for useful higher-level libraries such as &lt;a href=&quot;http://lparallel.org/&quot;&gt;lparallel&lt;/a&gt;, &lt;a href=&quot;http://marijnhaverbeke.nl/pcall/&quot;&gt;PCall&lt;/a&gt;, &lt;a href=&quot;http://common-lisp.net/project/cl-stm/&quot;&gt;CL-STM&lt;/a&gt;, and &lt;a href=&quot;http://www.cliki.net/concurrency&quot;&gt;many others&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;One important piece missing from bordeaux-threads is the support for atomic operations such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Compare-and-swap&quot;&gt;compare-and-swap&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/Fetch-and-add&quot;&gt;fetch-and-add&lt;/a&gt;, atomic-swap, &lt;a href=&quot;http://en.wikipedia.org/wiki/Atomic_(computer_science)&quot;&gt;etc&lt;/a&gt;. Among other things, these operations are useful for implementing scalable, efficient lock-free or wait-free algorithms and data-structures. The availability of such data-structures in a portable fashion would benefit many of the higher-level libraries that use bordeaux-threads. (E.g.: lparallel, when running on SBCL, takes advantage of the lock-free queues provided by that implementation.)&lt;/p&gt;&lt;p&gt;Back when bordeaux-threads was created, virtually no CL implementation supported these operations.&lt;sup&gt;&lt;a name=&quot;ref-20120607-1&quot; href=&quot;#footnote-20120607-1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; Nowadays, though, more and more implementations support at least a subset thereof. What follows is a survey of that support in modern CL implementations, a necessary first step to add an atomic operation API to bordeaux-threads.&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;compare-and-swap&lt;/h3&gt;&lt;p&gt;I&#39;ll start with compare-and-swap (CAS), which is the most powerful of the atomic operators we&#39;ll be looking into, and consequently the most widely supported in CL implementations. Typically, this operation is syntactically similar to &lt;code&gt;SETF&lt;/code&gt; but is restricted to a handful of CL &lt;em&gt;places&lt;/em&gt;:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;SLOT-VALUE&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SYMBOL-VALUE&lt;/code&gt;, i.e. the value of a dynamic variable.&lt;/li&gt;
&lt;li&gt;The global value of a dynamic variable, a common extension to standard CL.&lt;/li&gt;
&lt;li&gt;Structure accessors.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CAR&lt;/code&gt; and &lt;code&gt;CDR&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SYMBOL-PLIST&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SVREF&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;MOP&#39;s &lt;code&gt;STANDARD-INSTANCE-ACCESS&lt;/code&gt; and &lt;code&gt;FUNCALLABLE-STANDARD-INSTANCE-ACCESS&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;table border=1 cellpadding=5 align=&quot;center&quot;&gt;&lt;caption&gt;Table 1. CAS support per place.&lt;/caption&gt;&lt;tbody&gt;     &lt;!-- Results table headers --&gt;
&lt;tr&gt;       &lt;th&gt;&lt;/th&gt;       &lt;th&gt;&lt;abbr title=&quot;slot-value&quot;&gt;slotval&lt;/abbr&gt;&lt;/th&gt;       &lt;th&gt;&lt;abbr title=&quot;symbol-value&quot;&gt;symval&lt;/abbr&gt;&lt;/th&gt;       &lt;th&gt;&lt;abbr title=&quot;global-symbol-value&quot;&gt;gsymval&lt;/abbr&gt;&lt;/th&gt;       &lt;th&gt;&lt;abbr title=&quot;defstruct-defined accessor&quot;&gt;structslot&lt;/abbr&gt;&lt;/th&gt;       &lt;th&gt;car/cdr&lt;/th&gt;       &lt;th&gt;&lt;abbr title=&quot;symbol-plist&quot;&gt;symplist&lt;/abbr&gt;&lt;/th&gt;       &lt;th&gt;svref&lt;/th&gt;     &lt;th&gt;mop&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;       &lt;td&gt;ACL 9.0b&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;     &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;       &lt;td&gt;CCL 1.7&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;    &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;     &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;       &lt;td&gt;LW 6.0&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;     &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;       &lt;td&gt;SBCL 1.0.54&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;              &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;   &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;    &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;     &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;       &lt;td&gt;SCL 1.3&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;       &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: green&quot;&gt;✔&lt;/span&gt;&lt;/td&gt;     &lt;td align=&quot;center&quot;&gt;&lt;span style=&quot;color: red&quot;&gt;✖&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;
&lt;p&gt;&lt;em&gt;(2012-06-07 update: fixed table to correctly reflect the fact that SCL does support &lt;code&gt;SYMBOL-GLOBAL-VALUE&lt;/code&gt; as a CAS place.)&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;(2012-06-10 update: Nikodemus wrote in to point out that &lt;code&gt;(cas (symbol-value &#39;*foo*) ...)&lt;/code&gt; on SBCL modifies the special variable&#39;s global value rather than its dynamic binding. Fixed table accordingly.)&lt;/em&gt;&lt;br /&gt;
&lt;p&gt;As far as I can tell, ABCL, CMUCL and ECL don&#39;t yet have any support for atomic operations. I didn&#39;t check MCL or Corman Lisp. Also, note that CCL&#39;s CAS &amp;mdash; &lt;code&gt;ccl::conditional-store&lt;/code&gt; &amp;mdash; is in fact an unexported interface. All in all, the feature overlap amongst the Lisps that better support CAS (ACL, LW, SBCL, SCL) is not too bad.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt; bordeaux-threads should support CAS for &lt;code&gt;SLOT-VALUE&lt;/code&gt;, &lt;code&gt;CAR/CDR&lt;/code&gt;, structure accessors, and &lt;code&gt;SVREF&lt;/code&gt; on ACL, LW, SBCL, and SCL. The other partially supported places could perhaps be supported where possible but with a compile-time style warning about their unportability; haven&#39;t decided yet whether this would be worth the trouble.&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;fetch-and-add&lt;/h3&gt;&lt;p&gt;A concrete implementation of fetch-and-add is the x86 &lt;code&gt;LOCK&lt;/code&gt;-prefixed &lt;code&gt;XADD&lt;/code&gt; instruction. It atomically increments an integer using word-sized modular arithmetic, i.e. the addition can overflow and the result wraps.&lt;/p&gt;&lt;p&gt;SBCL has &lt;code&gt;ATOMIC-INCF&lt;/code&gt; whose name is slightly misleading because it is pretty much a direct interface to the aforementioned &lt;code&gt;XADD&lt;/code&gt; instruction (on x86, of course), and thus only works on word-sized places: structure slots with type &lt;code&gt;SB-EXT:WORD&lt;/code&gt; or simple arrays with element-type &lt;code&gt;SB-EXT:WORD&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;Lispworks on the other hand, provides &lt;code&gt;ATOMIC-FIXNUM-INCF&lt;/code&gt;. Although it also boils down to &lt;code&gt;XADD&lt;/code&gt; and the addition will overflow, it works on all the same places as CAS since it handles plain fixnums.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt; bordeaux-threads can define &lt;code&gt;ATOMIC-WORD-INCF&lt;/code&gt; and &lt;code&gt;ATOMIC-FIXNUM-INCF&lt;/code&gt;, support those operations efficiently on SBCL and LW respectively, and emulate them on other Lisps using CAS.&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;atomic-swap&lt;/h3&gt;&lt;p&gt;Only Lispworks provides this functionality (via &lt;code&gt;ATOMIC-EXCHANGE&lt;/code&gt;). Not yet sure whether it&#39;s sensible to emulate this using CAS on other Lisps.&lt;/p&gt;&lt;br /&gt;
&lt;h3&gt;Coming next&lt;/h3&gt;&lt;p&gt;Having surveyed the support for atomic operations, we&#39;ll proceed to define a useful interface and some slightly higher-level utilities around CAS. There&#39;s plenty of inspiration to be found in the various implementations and we should be able to draw various ideas from each.&lt;/p&gt;&lt;p&gt;(P.S.: hopefully this doesn&#39;t overlap too much with Nikodemus&#39;s &lt;a href=&quot;http://random-state.net/log/3522216438.html&quot;&gt;MADEIRA&lt;/a&gt; efforts.)&lt;/p&gt;&lt;br /&gt;
&lt;p style=&quot;font-size: smaller&quot;&gt;&lt;sup&gt;&lt;a href=&quot;#ref-20120607-1&quot; name=&quot;footnote-20120607-1&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; (2012-06-07 update) I hadn&#39;t realized this until Douglas Crosher wrote in to set some facts straight: turns out SCL has supported SMP (including compare-and-swap) for nearly a decade!&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/5065868433153657035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/5065868433153657035' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/5065868433153657035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/5065868433153657035'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2012/06/augmenting-bordeaux-threads-with-atomic.html' title='Augmenting bordeaux-threads with atomic operations'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-918849520557693311</id><published>2011-12-09T09:39:00.001+00:00</published><updated>2011-12-09T15:07:10.923+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Setting up CommonQt on OSX</title><content type='html'>&lt;p&gt;&lt;a href=&quot;http://common-lisp.net/project/commonqt/&quot;&gt;CommonQt&lt;/a&gt; can be tricky to setup due to its dependencies from C++ land. Tricky enough to warrant writing down the steps I went through to get it running on Mac OS 10.7:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;If you don&#39;t already have &lt;a href=&quot;http://developer.apple.com/xcode/&quot;&gt;Xcode&lt;/a&gt;, install it because you&#39;ll need &lt;code&gt;g++&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Grab and install the &lt;a href=&quot;http://qt.nokia.com/downloads/downloads#qt-lib&quot;&gt;Qt Libraries&lt;/a&gt; (&lt;em&gt;&lt;strong&gt;not&lt;/strong&gt;&lt;/em&gt; the Qt SDK). I used version 4.7.4.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install &lt;code&gt;CMake&lt;/code&gt;. (I used &lt;code&gt;&lt;a href=&quot;http://mxcl.github.com/homebrew/&quot;&gt;brew&lt;/a&gt; install cmake&lt;/code&gt;.)
&lt;li&gt;&lt;p&gt;Download, compile and install the &lt;a href=&quot;https://projects.kde.org/projects/kde/kdebindings/smoke&quot;&gt;SMOKE&lt;/a&gt; library:&lt;/p&gt;
&lt;pre&gt;
$ git clone git://anongit.kde.org/smokegen
$ cd smokegen
$ cmake .
$ make install

$ cd ..
$ git clone git://anongit.kde.org/smokeqt
$ cd smokeqt
$ cmake -DSmoke_DIR=&quot;$PWD/../smokegen/cmake&quot; .
$ make install
&lt;/pre&gt;
&lt;p&gt;At this point, &lt;code&gt;smokephonon&lt;/code&gt; failed to build so I had to manually install the two modules I actually needed:&lt;/p&gt;
&lt;pre&gt;
$ make -C qtcore install
$ make -C qtgui install
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get an &lt;a href=&quot;http://www.sbcl.org&quot;&gt;SBCL&lt;/a&gt; with threads enabled and &lt;a href=&quot;http://www.quicklisp.org&quot;&gt;Quicklisp&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CommonQt needed a couple of tweaks for OSX and recent changes in SMOKE. While said changes aren&#39;t reviewed and integrated into the main repository, you can fetch them as follows:&lt;/p&gt;
&lt;pre&gt;
$ cd ~/quicklisp/local-projects
$ git clone git://gitorious.org/~luismbo/commonqt/commonqt-luis.git
$ cd commonqt-luis
$ git checkout modular-smoke-and-osx-fixes
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Start SBCL and &lt;code&gt;(ql:quickload :qt)&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Hopefully that went well. Next we&#39;ll try and run an application.

&lt;ol&gt;
&lt;li&gt;Enable the &lt;code&gt;swank-listener-hooks&lt;/code&gt; contrib by adding &lt;code&gt;(slime-require&amp;nbsp;&#39;swank-listener-hooks)&lt;/code&gt; to your SLIME configuration.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(asdf:load-system :qt-tutorial)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(asdf:load-system :qt-repl)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;(qt-repl:start-gui-thread)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;And &lt;em&gt;finally&lt;/em&gt;, &lt;code&gt;(qt-tutorial-14::test)&lt;/code&gt;!&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwiz016g6JPJzxfLdabUXIakjHbClb_Blikq-97vyys7T-_sv1DSylpg77Qm-lMclcdL6jZDo_XumbISXluvKH8U1s65qIpsNaYfoU-ieSstfJHQQGTzZ6DXoHKS1ByCOA0nJBkQ/s1600/qt-tutorial.png&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;If not running under SLIME, &lt;code&gt;(asdf:load-system :qt-tutorial)&lt;/code&gt; followed by &lt;code&gt;(qt-tutorial-14:main)&lt;/code&gt; would be sufficient.&lt;/p&gt;

&lt;p&gt;If you want to try and skip the C++ compilation steps, grab &lt;a href=&quot;http://common-lisp.net/~loliveira/tmp/commonqt-libs-20111209.tar.gz&quot;&gt;this tarball&lt;/a&gt; with &lt;code&gt;libcommonqt.dylib&lt;/code&gt; and &lt;code&gt;libsmoke*.dylib&lt;/code&gt;. You should place &lt;code&gt;libcommonqt.dylib&lt;/code&gt; in CommonQt&#39;s source directory. The SMOKE libs go into &lt;code&gt;/usr/local/lib&lt;/code&gt; or similar.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/918849520557693311/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/918849520557693311' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/918849520557693311'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/918849520557693311'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2011/12/setting-up-commonqt-on-osx.html' title='Setting up CommonQt on OSX'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwiz016g6JPJzxfLdabUXIakjHbClb_Blikq-97vyys7T-_sv1DSylpg77Qm-lMclcdL6jZDo_XumbISXluvKH8U1s65qIpsNaYfoU-ieSstfJHQQGTzZ6DXoHKS1ByCOA0nJBkQ/s72-c/qt-tutorial.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-2876365393751464863</id><published>2011-11-16T23:20:00.004+00:00</published><updated>2012-01-07T00:09:25.991+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>TIME on steroids</title><content type='html'>&lt;p&gt;
Nikodemus&#39;s &lt;a href=&quot;http://random-state.net/log/3530433886.html&quot;&gt;recent post&lt;/a&gt; about a yet-to-be-released micro-benchmarking tool prompted me to talk about &lt;a href=&quot;https://github.com/luismbo/perfpiece&quot;&gt;Perfpiece&lt;/a&gt;. I describe it as a tool for measuring the performance of Lisp code, not unlike the standard &lt;code&gt;CL:TIME&lt;/code&gt; and I wrote over two years ago to measure the performance of SBCL&#39;s garbage collector.&lt;/p&gt;

&lt;h3&gt;
Features&lt;/h3&gt;
&lt;p&gt;
Here are its main features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;
Lispy interface to &lt;a href=&quot;http://icl.cs.utk.edu/papi/&quot;&gt;PAPI&lt;/a&gt; (Performance Application Programming Interface). PAPI is a library that enables access modern CPU’s hardware counters. This allows us to measure several events such as processor cycles, cache misses, number of floating-point instructions, and almost two hundred other events. Perfpiece dynamically inspects the current platform’s supported events at runtime and enables the user to inspect this list and measure these events. We also use this library to measure real (wall-clock) time and user (virtual) time.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Support for other non-PAPI events such as the number of GC runs, CPU usage, and operating system resource usage (via the &lt;code&gt;getrusage()&lt;/code&gt; system call).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Transparent support for multi-threaded programs. It includes a helper C library that when loaded through the POSIX &lt;code&gt;LD_PRELOAD&lt;/code&gt; mechanism will preempt pthread creation/termination calls and allow for the individual measurement of events across threads created during a measurement session. This includes both Lisp threads as well as threads created by C code. This is rather limited at the moment; only real/user/cpu time is measured for new threads.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Segregation of measurements between mutator and GC.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Support for sampling. Perfpiece can repeat a given a measurement a number of times then calculate and report basic statistic analysis: minimums, maximums, geometric means, and standard deviations for each measured event.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
Usage&lt;/h3&gt;
&lt;p&gt;
The simplest way to interact with this library is through the &lt;strong&gt;&lt;code&gt;ascertain&lt;/code&gt;&lt;/strong&gt; macro, which works very much like &lt;code&gt;cl:time&lt;/code&gt;. The following example shows the default events measured for a very simple arithmetic form:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;PERFPIECE&gt; (ascertain (+ 1 1))

                                          non-GC            GC         Total
────────────────────────────────────────────────────────────────────────────
                     Total cycles:         8,343             0         8,343
           Instructions completed:           481             0           481
        Level 2 data cache misses:            78             0            78
 Level 2 instruction cache misses:            24             0            24
                         GC count:             -             -             0
     Involuntary context-switches:             0             0             0
       Voluntary context-switches:             1             0             1
                      Page faults:             0             0             0
                    Page reclaims:             6             0             6
                      System time:             0             0             0
                        CPU usage:       100.00%             -       100.00%
                        User time:       6.00 µs             0       6.00 µs
                        Real time:        613 ns             0        613 ns

0 new threads were spawned

2 ; printed result of (+ 1 1)
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;
Having loaded the helper library using &lt;code&gt;LD_PRELOAD&lt;/code&gt;, we can measure multi-threaded code:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;PERFPIECE&gt; (ascertain (loop repeat 2 do
                        (sb-thread:join-thread
                         (sb-thread:make-thread (lambda () (sleep 0.5)))))
                      :events &#39;(:real-time :user-time :cpu-usage))

                                          non-GC            GC         Total
────────────────────────────────────────────────────────────────────────────
                        CPU usage:         0.02%             -         0.02%
                        User time:     206.00 µs             0     206.00 µs
                        Real time:       1.335 s             0       1.335 s

2 new threads were spawned
  #0 real: 667.54 ms, user: 101.00 µs, cpu: 0.02%
  #1 real: 667.60 ms, user: 144.00 µs, cpu: 0.02%
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;
The other main function is &lt;strong&gt;&lt;code&gt;sample&lt;/code&gt;&lt;/strong&gt;. In the following example, we&#39;re measuring FP instructions, invoking some code 10 times, and aggregating measurements in several ways:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;PERFPIECE&gt; (sample (lambda () (* 2 pi)) :events &#39;(:papi-fp-ins) :samples 10)

[Floating point instructions]       Min           Max          Mean     Stddev
──────────────────────────────────────────────────────────────────────────────
                   total:            35            36         35.60  ±  1.376%
                  non-gc:            35            36         35.60  ±  1.376%
                 gc-only:             0             0             0  ±  0.000%
&lt;/pre&gt;&lt;/blockquote&gt;


&lt;p&gt;
&lt;code&gt;sample&lt;/code&gt;&#39;s got a &lt;code&gt;:report&lt;/code&gt; keyword argument that you can use to get machine-readable results:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;PERFPIECE&gt; (sample (lambda () (* 2 pi)) :events &#39;(:papi-fp-ins) :samples 10
                   :report nil)

((:PAPI-FP-INS :MIN (35 35 0)
               :MAX (38 38 0)
               :MEAN (184/5 184/5 0)
               :STDDEV (1.0770329 1.0770329 0.0)))
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;h3&gt;Fork it!&lt;/h3&gt;
&lt;p&gt;That&#39;s pretty much it. There is some SBCL-specific code, but it shouldn&#39;t be too hard to port to other implementations. Its use of PAPI could be made optional since that makes this library pretty much Linux-only otherwise. &lt;a href=&quot;https://github.com/luismbo/perfpiece&quot;&gt;Patches are most welcome!&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/2876365393751464863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/2876365393751464863' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/2876365393751464863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/2876365393751464863'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2011/11/time-on-steroids.html' title='TIME on steroids'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-6125634669945167698</id><published>2011-11-16T19:07:00.001+00:00</published><updated>2011-11-16T19:09:31.528+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>ECLM videos</title><content type='html'>&lt;p&gt;Just a quick note: Vsevolod Dyomkin has posted a couple of &lt;a href=&quot;http://blip.tv/eclm&quot;&gt;ECLM 2011 videos&lt;/a&gt; with more to come.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/6125634669945167698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/6125634669945167698' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/6125634669945167698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/6125634669945167698'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2011/11/eclm-videos.html' title='ECLM videos'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-4517728581160346316</id><published>2011-10-25T09:18:00.007+01:00</published><updated>2011-10-25T23:14:56.007+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>ECLM 2011</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjajpuKwE36JLRlz__iDiHdN1a0UtTCKKvpso7UHbTx6UUQCTia9RpdPuIklPMMMa1KV5TUJLNoDh78rVTx8t1FXV8dHvOp1fU5UYp1a2919xe-qagP2bzUnrTDa4N2aCz3zWwiKA/s1600/IMG_1142.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear:left; float:left;margin-right:1em; margin-bottom:1em&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; width=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjajpuKwE36JLRlz__iDiHdN1a0UtTCKKvpso7UHbTx6UUQCTia9RpdPuIklPMMMa1KV5TUJLNoDh78rVTx8t1FXV8dHvOp1fU5UYp1a2919xe-qagP2bzUnrTDa4N2aCz3zWwiKA/s400/IMG_1142.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;Contrary to &lt;a href=&quot;http://kvardek-du.kerno.org/2011/02/another-zslug-meeting-report.html&quot;&gt;my expectations&lt;/a&gt; earlier this year, &lt;a href=&quot;http://weitz.de/eclm2011&quot;&gt;ECLM 2011&lt;/a&gt; happened and ~90 people turned up. Yay!&lt;/p&gt;

&lt;p&gt;Saturday, a bunch of us went on a guided tour across Amsterdam. We had a great guide with an awesome sense of humor and this was a nice way to meet new Lispers and catching up with folks I&#39;d met in past meetings.&lt;/p&gt;

&lt;p&gt;Dinner was fun. One very prominent Lisper who shall remain anonymous didn&#39;t know what &lt;a href=&quot;http://quicklisp.org/&quot;&gt;Quicklisp&lt;/a&gt; was. Everyone sitting at that particular table was shocked. :-)&lt;/p&gt;

&lt;p&gt;Sunday started off with Nick Levine talking about learnt lessons from his failed attempt at writing a &lt;a href=&quot;http://lisp-book.org/&quot;&gt;Lisp book&lt;/a&gt;. Midway through, he took the opportunity to rant a little bit about how there were at least 3 overlapping, incomplete websites (&lt;a href=&quot;http://cliki.net&quot;&gt;cliki&lt;/a&gt;, &lt;a href=&quot;http://common-lisp.net/&quot;&gt;c-l.net&lt;/a&gt;, &lt;a href=&quot;http://cl-user.net&quot;&gt;cl-user.net&lt;/a&gt;) and how the solution would be to, huh, create yet another one. The consensus seems to be that cliki is the one that&#39;s best suited for a starting point, but Nick complains that its focus on Free Software Lisps is too narrow. Anyway, cliki could indeed use a revamp.&lt;/p&gt;

&lt;p&gt;Jack Harper talked about using Lisp on &lt;a href=&quot;http://www.secureoutcomes.net/&quot;&gt;portable fingerprint scanners&lt;/a&gt;. He had great things to say about &lt;a href=&quot;http://www.lispworks.com/&quot;&gt;Lispworks&lt;/a&gt; which, by the way, had 3 people at this year&#39;s meeting.&lt;/p&gt;

&lt;p&gt;Luke Gorrie did an extended version of the presentation on Teclo I had seen &lt;a href=&quot;http://kvardek-du.kerno.org/2011/02/another-zslug-meeting-report.html&quot;&gt;earlier this year in Zürich&lt;/a&gt;. This one included even more interesting diagrams, in particular some illustrating the contrast between 3G network performance before and after enabling their product.&lt;/p&gt;

&lt;p&gt;After lunch, Dave Cooper talked about his &lt;a href=&quot;http://genworks.com/downloads/customer-documentation/index.xml&quot;&gt;GDL&lt;/a&gt; product, which includes &lt;a href=&quot;http://www.cliki.net/KR&quot;&gt;yet&lt;/a&gt; &lt;a href=&quot;http://www.cliki.net/Cells&quot;&gt;another&lt;/a&gt; &lt;a href=&quot;http://www.cliki.net/Clon&quot;&gt;object&lt;/a&gt; &lt;a href=&quot;http://www.cliki.net/computed-class&quot;&gt;constraint&lt;/a&gt;-ish system framework thingie.&lt;/p&gt;

&lt;p&gt;Hans Hübner picked a controversial topic: code style and conventions. (A bit reminiscent of &lt;a href=&quot;norvig.com/luv-slides.ps&quot;&gt;Norvig and Pitman&lt;/a&gt;&#39;s slides.) He picked on the veritable 80-column rule (&lt;em&gt;blasphemy!&lt;/em&gt;) and pushed for project/company style guides. The discussion was entertaining. The general conclusion I drew from that is that while it might be useful to write the more important points down, it&#39;s even better to programmatically enforce the more important ones like tabs vs. spaces and trailing whitespace. In my experience, good programmers pick up and follow (or challenge) code style fairly quickly without needing to go through an explicit style guide.&lt;/p&gt;

&lt;p&gt;Paul Miller demoed his company&#39;s &lt;a href=&quot;http://www.xanalys.com/solutions/linkexplorer.html&quot;&gt;data analysis tool&lt;/a&gt; written in Lispworks and talked a little bit about how it interacted and integrated with things like Excel via COM.&lt;/p&gt;

&lt;p&gt;Lisp hero extraordinaire Xach Beane did an awesome presentation on &lt;a href=&quot;http://quicklisp.org&quot;&gt;Quicklisp&lt;/a&gt; detailing some of his implementation strategies, what problems Quicklisp purports to solve, its social impact on the Lisp community, and what his vision for the future is. I was particularly excited about his plan to enable hacking on random project à la &lt;a href=&quot;http://common-lisp.net/project/clbuild&quot;&gt;clbuild&lt;/a&gt;. Definitely the juiciest talk in the meeting in my opinion.&lt;/p&gt;

&lt;p&gt;Finally, there were lots of lightning talks this year:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;Marco Antoniotti announced &lt;a href=&quot;http://www.european-lisp-symposium.org/&quot;&gt;ELS&lt;/a&gt; 2012.&lt;/li&gt;
&lt;li&gt;Christophe Rhodes&#39;s talked about R&#39;s lispiness and demoed his &lt;a href=&quot;http://common-lisp.net/~crhodes/swankr/&quot;&gt;swankr&lt;/a&gt; project that brings R to SLIME and has nifty features like &lt;a href=&quot;http://common-lisp.net/~crhodes/swankr/lattice-presentations.png&quot;&gt;graphical presentations&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Erik Huelsmann announced &lt;a href=&quot;http://abcl-dev.blogspot.com/2011/10/abcl-100-released.html&quot;&gt;ABCL 1.0&lt;/a&gt;! (There were three quite enthusiastic ABCL developers at the meeting.)&lt;/li&gt;
&lt;li&gt;Pierre-Yves Baccou shared some thoughts on &lt;a href=&quot;https://github.com/pyb/zen&quot;&gt;Zen&lt;/a&gt;, his X-server in ~5K lines of CL code.&lt;/li&gt;
&lt;li&gt;... and many others including a valiant attempt at subverting the 5+2 minute rule.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Drinks, dinner, then drinks again. Hanging out with Lispers is the best part of ECLM and there was plenty of that. Looking forward to the next one already!&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/4517728581160346316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/4517728581160346316' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/4517728581160346316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/4517728581160346316'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2011/10/eclm-2011.html' title='ECLM 2011'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjajpuKwE36JLRlz__iDiHdN1a0UtTCKKvpso7UHbTx6UUQCTia9RpdPuIklPMMMa1KV5TUJLNoDh78rVTx8t1FXV8dHvOp1fU5UYp1a2919xe-qagP2bzUnrTDa4N2aCz3zWwiKA/s72-c/IMG_1142.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-23326860.post-3029194527275359745</id><published>2011-08-14T17:00:00.000+01:00</published><updated>2011-08-14T17:00:30.006+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="en"/><title type='text'>Figuring out the print size of a photo at 300 DPI</title><content type='html'>&lt;p&gt;I was looking for an easy way to tell the print size of a photo at 300 DPI. It wasn&#39;t as easy to find the answer as I&#39;d expected. For future reference, here&#39;s a solution using &lt;a href=&quot;http://www.imagemagick.org/script/identify.php&quot;&gt;ImageMagick&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;&lt;code&gt;identify -format &quot;%[fx:w/300*2.54] x %[fx:h/300*2.54] cm&quot; photo.jpg&lt;/code&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://kvardek-du.kerno.org/feeds/3029194527275359745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/23326860/3029194527275359745' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/3029194527275359745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/23326860/posts/default/3029194527275359745'/><link rel='alternate' type='text/html' href='http://kvardek-du.kerno.org/2011/08/figuring-out-print-size-of-photo-at-300.html' title='Figuring out the print size of a photo at 300 DPI'/><author><name>Luís</name><uri>http://www.blogger.com/profile/04787580931645750027</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>