<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4694016830113568730</id><updated>2012-01-27T07:22:35.567+01:00</updated><category term='w7'/><category term='leopard'/><category term='humor'/><title type='text'>Professor Fish</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>38</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-8947198242699094840</id><published>2011-12-08T16:03:00.004+01:00</published><updated>2011-12-09T00:01:33.490+01:00</updated><title type='text'>Ein Weihnachtsgedicht</title><content type='html'>&lt;p style="margin-bottom: 0cm"&gt;&lt;i&gt;(C) Professor Fish, aka Ralf Lämmel&lt;/i&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0cm"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0cm"&gt;Stille Nacht! Unheilvolle Nacht!&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Alles schläft; einsam wacht&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;nur der Bachelor-Student,&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;der nie pennt,&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;der nur rennt.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;i&gt;So viele Prüfungen, o weh!&lt;/i&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;i&gt;So viele Prüfungen, o weh!&lt;/i&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Stille Nacht! Unheilvolle Nacht!&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Die wird wieder durchgemacht.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Bester Student, o wie lacht&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;bös' aus Deinem Gesicht&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;die Aversion gegen Bologna's Gericht.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;i&gt;So viele Regularien, o weh!&lt;/i&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;i&gt;So viele Regularien, o weh!&lt;/i&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Stille Nacht! Unheilvolle Nacht!&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Was hat man nur aus dem Uni-Studium gemacht?&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Es ist nicht Bologna allein.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Andere Trends reihen sich hier ein.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Das Denken an Deutschland in der Nacht, &lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;hat auch den Professor um den Schlaf gebracht.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Lautes Land! Unheilvolles Land!&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;O Marx, gib mir Eltern,&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;die Kinder fordern anstatt Lehrer zu quälen.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;O Lenin, gib mir Erstsemester,&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;die wissen wollen anstatt videozugamen.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;i&gt;Früher war alles besser, o weh!&lt;/i&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;i&gt;Früher war alles besser, o weh!&lt;/i&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Stille Nacht! Unheilvolle Nacht!&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Soll es Weihnachten nun sein,&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;dann Tod den Enten und glühe der Wein.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;Der Wunschzettel ist auch schon da.&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;i&gt;Merkel &amp;amp; Co. machen es klar.&lt;/i&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm"&gt;&lt;i&gt;Merkel &amp;amp; Co. machen es klar.&lt;/i&gt;&lt;/p&gt;&lt;p style="margin-bottom: 0cm"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-8947198242699094840?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/8947198242699094840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2011/12/ein-weihnachtsgedicht.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8947198242699094840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8947198242699094840'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2011/12/ein-weihnachtsgedicht.html' title='Ein Weihnachtsgedicht'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-5715295826689433161</id><published>2011-12-07T12:22:00.003+01:00</published><updated>2011-12-07T12:39:00.643+01:00</updated><title type='text'>A riddle regarding type safety</title><content type='html'>Of course, I have explained to the students in my &lt;a href="http://softlang.wikidot.com/course:plt1112"&gt;language theory class&lt;/a&gt; what &lt;i&gt;type safety&lt;/i&gt; means (remember: progress + preservation) and we have studied this notion time and again for some of the TAPL languages. However, I don't feel like the notion really sinked in universally. Some students consider all this semantics and calculus stuff as obscure and there is a certain critical mass of notation, when passed, concepts are not understood anymore (by some if not many of the Bachelor-level students in my class).&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Last night, I came up with a nice "semantics riddle" for type safety:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;        &lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;b&gt;What would be a super-trivial language with a type system and an SOS semantics such that type safety is violated?&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left; "&gt;I gave the students 2 minutes to think about the question.&lt;/div&gt;&lt;div style="text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left; "&gt;I emphasized several times that the language should be super-trivial.&lt;/div&gt;&lt;div style="text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left; "&gt;I also asked them for a general strategy for mis-designing a language to be type-unsafe.&lt;/div&gt;&lt;div style="text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left; "&gt;One idea that popped up was to support some notion of cast.&lt;/div&gt;&lt;div style="text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left; "&gt;We agreed that this would not be trivial, certainly not super-trivial.&lt;/div&gt;&lt;div style="text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left; "&gt;Here is my reference solution:&lt;/div&gt;&lt;div style="text-align: left; "&gt;        &lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;b&gt;Syntax of expressions&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;i&gt;e&lt;/i&gt; ::= &lt;i&gt;v&lt;/i&gt; | &lt;i&gt;z&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;(Hence, there are expressions (forms) &lt;i&gt;x&lt;/i&gt;, &lt;i&gt;y&lt;/i&gt; and &lt;i&gt;z&lt;/i&gt;.)&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;b&gt;Values (normal forms)&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;i&gt;v&lt;/i&gt; := &lt;i&gt;x&lt;/i&gt; | &lt;i&gt;y&lt;/i&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;b&gt;Types&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;i&gt;t&lt;/i&gt; ::= &lt;i&gt;a&lt;/i&gt; | &lt;i&gt;b&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;(&lt;i&gt;a&lt;/i&gt; and &lt;i&gt;b&lt;/i&gt; are the possible types.)&lt;/p&gt; &lt;p class="p1"&gt;&lt;b&gt;Small-step relation&lt;/b&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;i&gt;z&lt;/i&gt; -&amp;gt; &lt;i&gt;x&lt;/i&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;(Yes, we only have one axiom.)&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;b&gt;Typing rules&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;x : a&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;y : b&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;z : b&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;(Yes, we have only axioms here.)&lt;/span&gt;&lt;/p&gt; &lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;b&gt;Demonstration of lack of type safety&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;The term &lt;i&gt;z&lt;/i&gt; is the culprit.&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;i&gt;z &lt;/i&gt;: &lt;i&gt;b&lt;/i&gt; but &lt;i&gt;z&lt;/i&gt; -&amp;gt; &lt;i&gt;x&lt;/i&gt; and &lt;i&gt;x&lt;/i&gt; : &lt;i&gt;a&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;/p&gt;&lt;/div&gt;&lt;div style="text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left; "&gt;Regards,&lt;/div&gt;&lt;div style="text-align: left; "&gt;Ralf&lt;/div&gt;&lt;div style="text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left; "&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-5715295826689433161?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/5715295826689433161/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2011/12/riddle-regarding-type-safety.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/5715295826689433161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/5715295826689433161'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2011/12/riddle-regarding-type-safety.html' title='A riddle regarding type safety'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-7146470202003471292</id><published>2011-05-30T06:49:00.007+02:00</published><updated>2011-05-30T17:53:11.558+02:00</updated><title type='text'>A more serious online partial evaluator</title><content type='html'>Admittedly, the illustrative partial evaluator of the &lt;A HREF="http://professor-fish.blogspot.com/2011/05/illustrative-online-partial-evaluator.html"&gt;previous blog post&lt;/A&gt; was quite limited. Consider, for example, the following attempts of partially evaluating different applications of the exponentiation function; the last attempt diverges:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; peval (lib, (Apply "exp" [Const 2, Const 3]))&lt;br /&gt;Const 8&lt;br /&gt;&lt;br /&gt;&gt; peval (lib, (Apply "exp" [Var "x", Const 3]))&lt;br /&gt;Binary Times (Var "x") (Binary Times (Var "x") (Binary Times (Var "x")(Const 1)))&lt;br /&gt;&lt;br /&gt;&gt; peval (lib, (Apply "exp" [Const 2, Var "n"]))&lt;br /&gt;IfZero (Var "n") (Const 1) (Binary Times (Const 2) (IfZero (Binary Plus (Var "n") (Const (-1))) (Const 1) (Binary Times (Const 2) (IfZero (Binary Plus (Binary Plus (Var "n") (Const (-1))) (Const (-1))) (Const 1) (Binary Times (Const 2) (IfZero (Binary Plus (Binary Plus (Binary Plus (Var "n") (Const (-1))) (Const (-1))) (Const (-1))) (Const 1) (Binary Times (Const 2) (IfZero (Binary Plus (Binary Plus (Binary Plus (Binary Plus (Var "n") (Const (-1))) (Const (-1))) (Const (-1))) (Const (-1))) (Const 1) (Binary Times (Const 2) (IfZero ...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In the first attempt, we partially evaluate a ground term, which is as if we were using the regular interpreter. In the second attempt, we leave the base parametric, but we fix the exponent. In the third attempt, it is the other way around: we fix the base, but we leave the exponent parametric. The divergence for the third attempt is clearly undesirable. Ideally, partial evaluation of a non-ground term &lt;I&gt;t&lt;/I&gt; should terminate whenever there is an ground instance &lt;I&gt;t'&lt;/I&gt; of &lt;I&gt;t&lt;/I&gt; such that regular evaluation terminates for &lt;I&gt;t'&lt;/I&gt;. Otherwise, we could never be sure whether we can safely decompose a computation into partial evaluation followed by evaluation of the residual program.&lt;br /&gt;&lt;br /&gt;So let us develop a more advanced partial evaluator:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;peval :: Prog -&gt; (Expr, FEnv)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The result type has changed. In addition to a transformed main expression, we also expect to obtain specialized function definitions as they are encountered by partial evaluation. That is, function definitions are specialized by statically known argument values. A demo helps:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; peval (lib, (Apply "exp" [Var "x", Const 3]))&lt;br /&gt;( Apply "exp_[(n,3)]" [Var "x"],&lt;br /&gt;  [("exp_[(n,3)]", (["x"], Apply "times" [Var "x",Apply "exp_[(n,2)]" [Var "x"]])),&lt;br /&gt;   ("exp_[(n,2)]", (["x"], Apply "times" [Var "x",Apply "exp_[(n,1)]" [Var "x"]])),&lt;br /&gt;   ("exp_[(n,1)]", (["x"], Apply "times" [Var "x",Apply "exp_[(n,0)]" [Var "x"]])),&lt;br /&gt;   ("exp_[(n,0)]", (["x"], Const 1))])&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thus, specialized function definitions were inferred for all the inductively encountered values for the exponent. Subject to a simple inlining optimization (which is not shown here for brevity but included into the open-source repository), we obtain the familiar expression for "x" to the power 3:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Apply "times" [Var "x",Apply "times" [Var "x",Apply "times" [Var "x",Const 1]]]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The partial evaluator commences as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;peval :: Prog -&gt; (Expr, FEnv)&lt;br /&gt;peval (fe,m) = runState (peval' m []) []&lt;br /&gt; where&lt;br /&gt;  peval' :: Expr -&gt; VEnv -&gt; State FEnv Expr &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That is, the expression-level partial evaluation function starts from the empty variable environment and it uses the state monad to aggregate specialized function definitions, starting also from the empty list. The type of variable environments is the same as in the original interpreter:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;type VEnv = [(String,Int)]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The cases for all constructs but function application can be adopted from the simpler partial evaluator--except that we need to convert to monadic style:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  peval' :: Expr -&gt; VEnv -&gt; State FEnv Expr &lt;br /&gt;  peval' (Const i) ve = return (Const i)&lt;br /&gt;  peval' (Var x) ve&lt;br /&gt;   = return (case lookup x ve of&lt;br /&gt;              Just v -&gt; Const v&lt;br /&gt;              Nothing -&gt; Var x)&lt;br /&gt;  peval' (Binary op e1 e2) ve&lt;br /&gt;   = do&lt;br /&gt;        e1' &lt;- peval' e1 ve&lt;br /&gt;        e2' &lt;- peval' e2 ve&lt;br /&gt;        return (case (e1', e2') of &lt;br /&gt;                 (Const v1, Const v2) -&gt; Const (op2f op v1 v2)&lt;br /&gt;                 _ -&gt; Binary op e1' e2')&lt;br /&gt;  peval' (IfZero e1 e2 e3) ve&lt;br /&gt;   = do&lt;br /&gt;        e1' &lt;- peval' e1 ve&lt;br /&gt;        case e1' of &lt;br /&gt;          (Const v1) -&gt; if (v1==0) then r2 else r3&lt;br /&gt;          _ -&gt; r2 &gt;&gt;= \e2' -&gt; r3 &gt;&gt;= \e3' -&gt; return (IfZero e1' e2' e3')&lt;br /&gt;   where&lt;br /&gt;    r2 = peval' e2 ve&lt;br /&gt;    r3 = peval' e3 ve&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The deviating and complicated and interesting case is the one for function application. We prepare this development by an informal specification. (Thanks again to William Cook for teaching me on this part.) The following specification relies on two important terms used in partial evaluation. That is, when partial evaluation encounters a function application with a value (say, a constant---as opposed to an expression) for a given argument position, then this position (or the associated variable) is called &lt;I&gt;static&lt;/I&gt;; otherwise, it is called &lt;I&gt;dynamic&lt;/I&gt;. The specification follows.&lt;br /&gt;&lt;br /&gt;1. The applied function is looked up. 2. The arguments of the function application are partially evaluated. 3. The arguments are partitioned into static and dynamic ones. 4. The specialized function name consists of the original function name qualified by the static arguments. 5. The body of the specialized funtion is obtained by partially evaluating the original body in the variable envrironment of the static variables. 6. An application of the specialized function is constructed from the dynamic arguments. This is the result of partial evaluation.&lt;br /&gt;&lt;br /&gt;The following function definition clarifies the step of partitioning the partially evaluated arguments (see 3. above). One list of&lt;br /&gt;expressions is partioned into two lists of static versus dynamic arguments qualified by the formal argument names. Static arguments are &lt;I&gt;Const&lt;/I&gt; expressions. Dynamic arguments are all other expressions. Thus:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;    partition [] [] = ([],[])&lt;br /&gt;    partition (n:ns) (Const i:es)&lt;br /&gt;     = ((n,i):ss,ds) where (ss,ds) = partition ns es&lt;br /&gt;    partition (n:ns) (e:es)&lt;br /&gt;     = (ss,(n,e):ds) where (ss,ds) = partition ns es&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The following equation for function applications implements the afore-mentioned steps 1.-6., but additional details&lt;br /&gt;arise. In order to deal with recursion, it is important that the specialized function is already added to the state before its body is&lt;br /&gt;obtained. To this end, an undefined body is preliminarily associated with the new name, which is replaced later; see get, put, get, put. Furher, we need to distunguish function applications that are fully static from those that involve dynamic arguments because fully static function applications should not be specialized; instead, they should be evaluated.&lt;br /&gt;&lt;br /&gt;Here are the glory details:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  peval' (Apply n es) ve&lt;br /&gt;   = do&lt;br /&gt;     -- Look up function&lt;br /&gt;     let (ns,e) = fromJust (lookup n fe)&lt;br /&gt;&lt;br /&gt;     -- Partially evaluate arguments&lt;br /&gt;     es' &lt;- mapM (flip peval' ve) es&lt;br /&gt;&lt;br /&gt;     -- Partition arguments into static and dynamic ones&lt;br /&gt;     let (ss,ds) = partition ns es'&lt;br /&gt;&lt;br /&gt;     case (null ss, null ds) of&lt;br /&gt;&lt;br /&gt;       -- A constant application&lt;br /&gt;       (True, True) -&gt; peval' e []&lt;br /&gt;&lt;br /&gt;       -- A fully static application&lt;br /&gt;       (False, True) -&gt; peval' e ss&lt;br /&gt;&lt;br /&gt;       -- A fully dynamic application&lt;br /&gt;       (True, False) -&gt; return (Apply n es')&lt;br /&gt;&lt;br /&gt;       -- A mixed static application&lt;br /&gt;       (False, False) -&gt; (do&lt;br /&gt;&lt;br /&gt;         -- The name that encodes the static values&lt;br /&gt;         let n' = n ++ "_" ++ myshowl ss&lt;br /&gt;&lt;br /&gt;         -- Construct application of specialized function&lt;br /&gt;         let e' = Apply n' (map snd ds)&lt;br /&gt;        &lt;br /&gt;         -- See whether the specialization exists already           &lt;br /&gt;         fe &lt;- get&lt;br /&gt;         case lookup n' fe of&lt;br /&gt;           Just _ -&gt; return e'&lt;br /&gt;           Nothing -&gt; (do &lt;br /&gt;&lt;br /&gt;             -- Memo before possible recursion&lt;br /&gt;             put (fe++[(n',undefined)])&lt;br /&gt;&lt;br /&gt;             -- Partial evaluation of function body&lt;br /&gt;             e'' &lt;- peval' e ss&lt;br /&gt;&lt;br /&gt;             -- Record definition of specialized function&lt;br /&gt;             fe' &lt;- get&lt;br /&gt;             put (update (const (map fst ds,e'')) n' fe')&lt;br /&gt;&lt;br /&gt;             -- Return application of specialized function&lt;br /&gt;             return e'))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So much for partial evaluation.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;PF&lt;br /&gt;&lt;br /&gt;PS: The source code of this blog post is available through the repository of the Software Language Processing Suite; see &lt;A HREF="http://slps.svn.sourceforge.net/viewvc/slps/topics/partialevaluation/simplepe/"&gt;here&lt;/A&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-7146470202003471292?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/7146470202003471292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2011/05/more-serious-online-partial-evaluator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/7146470202003471292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/7146470202003471292'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2011/05/more-serious-online-partial-evaluator.html' title='A more serious online partial evaluator'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-8977392225166182853</id><published>2011-05-27T12:00:00.024+02:00</published><updated>2011-05-30T17:32:30.264+02:00</updated><title type='text'>An illustrative online partial evaluator</title><content type='html'>Let's understand the &lt;B&gt;basic mechanics of a (too?) simple online partial evaluator&lt;/B&gt;. (I am grateful to &lt;a href="http://www.cs.utexas.edu/~wcook/"&gt;William Cook&lt;/a&gt; for encouraging the following Haskell exercise, and for sharing with me some stimulating slides and notes on the subject.) I recommend John Hatcliff's excellent and detailed course material on "Foundations of Partial Evaluation and Program Specialization"---available &lt;A HREF="http://people.cis.ksu.edu/~hatcliff/FPEPS/"&gt;online&lt;/A&gt;. For those in a hurry, try &lt;A HREF="http://en.wikipedia.org/wiki/Partial_evaluation"&gt;Wikipedia&lt;/A&gt;. Anyway, partial evaluation, macro systems, and multi-stage programming is a lot of fun. Here is also &lt;A HREF="http://www.cs.utexas.edu/~wcook/Drafts/2011/javape.pdf"&gt;a paper&lt;/A&gt; (draft) by William Cook that I can warmly recommend.&lt;br /&gt;&lt;br /&gt;Consider the following syntax of a simple, pure, first-order, functional programming language:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;type Prog = (FEnv,Expr)&lt;br /&gt;type FEnv = [FDef]&lt;br /&gt;type FDef = (String,([String],Expr))&lt;br /&gt;&lt;br /&gt;data Expr&lt;br /&gt; = Const Int&lt;br /&gt; | Var String&lt;br /&gt; | Binary Op Expr Expr&lt;br /&gt; | IfZero Expr Expr Expr&lt;br /&gt; | Apply String [Expr]&lt;br /&gt; deriving (Show)&lt;br /&gt;&lt;br /&gt;data Op = Plus | Times&lt;br /&gt; deriving (Show)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thus, a program consists of a main expression and bindings for functions (i.e., a "function environment" FEnv is a list of "function definitions" FDef each of them being of term form &lt;I&gt;(s,(ss,e))&lt;/I&gt; with &lt;I&gt;s&lt;/I&gt; as the function name, &lt;I&gt;ss&lt;/I&gt; the formal parameters and &lt;I&gt;e&lt;/I&gt; the body). Evaluation of an expression is supposed to return an integer (or to diverge or to fail in reply to a dynamic type error). The functions are supposed to be of first-order: functions are neither passed as arguments, nor returned as results.&lt;br /&gt;&lt;br /&gt;Here are some function definitions---including those for factorial and exponentiation:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;lib :: FEnv&lt;br /&gt;lib&lt;br /&gt; = [ ("neg", (["x"], Binary Times (Var "x") (Const (-1)))),&lt;br /&gt;     ("add", (["x", "y"], Binary Plus (Var "x") (Var "y"))),&lt;br /&gt;     ("minus", (["x", "y"], Binary Plus (Var "x") (Apply "neg" [Var "y"]))),&lt;br /&gt;     ("times", (["x", "y"], Binary Times (Var "x") (Var "y"))),&lt;br /&gt;     ("inc", (["x"], Binary Plus (Var "x") (Const 1))),&lt;br /&gt;     ("dec", (["x"], Binary Plus (Var "x") (Const (-1)))),&lt;br /&gt;&lt;br /&gt;     ("fac",&lt;br /&gt;       ( ["x"]&lt;br /&gt;       , IfZero (Var "x")&lt;br /&gt;           (Const 1)&lt;br /&gt;           (Apply "times" [Var "x", Apply "fac" [Apply "dec" [Var "x"]]]))),&lt;br /&gt;&lt;br /&gt;     ("exp",&lt;br /&gt;       ( ["x","n"]&lt;br /&gt;       , IfZero (Var "n")&lt;br /&gt;           (Const 1)&lt;br /&gt;           (Apply "times" [Var "x", Apply "exp" [Var "x", Apply "dec" [Var "n"]]])))]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Let's first develop a straightforward interpreter.&lt;br /&gt;&lt;br /&gt;We expect interpretation to behave as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; eval (lib, Apply "fac" [Const 5])&lt;br /&gt;120&lt;br /&gt;&gt; eval (lib, Apply "exp" [Const 2, Const 3])&lt;br /&gt;8&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is the complete interpreter:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;type VEnv = [(String,Int)]&lt;br /&gt;&lt;br /&gt;eval :: Prog -&gt; Int&lt;br /&gt;eval (fe,m) = eval' m []&lt;br /&gt; where&lt;br /&gt;  eval' :: Expr -&gt; VEnv -&gt; Int&lt;br /&gt;  eval' (Const i) ve = i&lt;br /&gt;  eval' (Var x) ve = fromJust (lookup x ve)&lt;br /&gt;  eval' (Binary op e1 e2) ve = f v1 v2&lt;br /&gt;   where&lt;br /&gt;    f  = op2f op&lt;br /&gt;    v1 = eval' e1 ve&lt;br /&gt;    v2 = eval' e2 ve&lt;br /&gt;  eval' (IfZero e1 e2 e3) ve = if (v1==0) then v2 else v3&lt;br /&gt;   where&lt;br /&gt;    v1 = eval' e1 ve&lt;br /&gt;    v2 = eval' e2 ve&lt;br /&gt;    v3 = eval' e3 ve&lt;br /&gt;  eval' (Apply n es) ve = eval' e ve'&lt;br /&gt;   where&lt;br /&gt;    (ns,e) = fromJust (lookup n fe)&lt;br /&gt;    vs = map (\e -&gt; eval' e ve) es&lt;br /&gt;    ve' = zip ns vs&lt;br /&gt;&lt;br /&gt;op2f :: Op -&gt; (Int -&gt; Int -&gt; Int)&lt;br /&gt;op2f Plus = (+) &lt;br /&gt;op2f Times = (*)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It must be emphasized that this interpreter is in no way special, unusual, or targeted at partial evaluation. One gets this interpreter naturally when using denotational semantics (i.e., compositional functional semantics) as the guiding principle. Now the key "challenge" of our effort here is to modify the interpreter so that it effectively serves as a partial evaluator. That is, the partial evaluator should produce the same result as the interpreter when faced with a ground main expression, but it should compute a residual expression otherwise. Let's think of the residual expression as the "rest of the program" that needs to be evaluated once the free variables are bound to values. For instance:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; peval (lib, Apply "exp" [Var "x", Const 3])&lt;br /&gt;Binary Times (Var "x") (Binary Times (Var "x") (Binary Times (Var "x") (Const 1)))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thus, the function "exp" is applied to a specific exponent 3, but the base remains a variable "x", and the result of partial evaluation essentially represents the code to compute "x" to the power 3: "x*x*x*1".&lt;br /&gt;&lt;br /&gt;Our design of a partial evaluator starts from the insight that the type of the top-level function must be changed so that expressions are returned instead of integers. (A more general design would also return any number of bindings for specialized functions that were encountered along partial evaluation.) Please note that integers are trivially embedded into expressions through the constant form of expressions. Thus:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-- Interpreter&lt;br /&gt;eval :: Prog -&gt; Int&lt;br /&gt;eval (fe,m) = eval' m []&lt;br /&gt; where&lt;br /&gt;  ...&lt;br /&gt;&lt;br /&gt;-- Partial evaluator&lt;br /&gt;peval :: Prog -&gt; Expr&lt;br /&gt;peval (fe,m) = peval' m []&lt;br /&gt; where&lt;br /&gt;  ...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In the chosen style of partial evaluator design, we also propagate the type change into the definition of variable environments. (This leads to a simple development, but implies some issues as we will discuss towards the end of the blog post.) Thus, variables may be bound to (free) variables:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-- Interpreter&lt;br /&gt;type VEnv = [(String,Int)]&lt;br /&gt;&lt;br /&gt;-- Partial evaluator&lt;br /&gt;type VEnv = [(String,Expr)]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The cases for constant expressions differ trivially only as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-- Interpreter&lt;br /&gt;  eval' :: Expr -&gt; VEnv -&gt; Int&lt;br /&gt;  eval' (Const i) ve = i&lt;br /&gt;&lt;br /&gt;-- Partial evaluator&lt;br /&gt;  peval' :: Expr -&gt; VEnv -&gt; Expr&lt;br /&gt;  peval' (Const i) ve = Const i&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Variables are to be treated in a special manner. The interpreter can only deal with ground main expressions, and---subject to other reasonable assumptions about well-typedness of programs---variables would always be bound throughout interpretation.  In contrast, the partial evaluator faithfully deals with free variables: a free variable is partially evaluated to itself.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-- Interpreter&lt;br /&gt;  eval' (Var x) ve = fromJust (lookup x ve)&lt;br /&gt;&lt;br /&gt;-- Partial evaluator&lt;br /&gt;  peval' (Var x) ve&lt;br /&gt;   = case lookup x ve of&lt;br /&gt;      Just e -&gt; e&lt;br /&gt;      Nothing -&gt; Var x&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Compound expression forms are also affected non-trivially but systematically. The general idea is that an expression form may be evaluated if some or all operands can be, in turn, partially evaluated to values, or the expression form may need to be re-generated in the result otherwise. Consider the following cases for binary expressions:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-- Interpreter&lt;br /&gt;  eval' (Binary op e1 e2) ve = f v1 v2&lt;br /&gt;   where&lt;br /&gt;    f  = op2f op&lt;br /&gt;    v1 = eval' e1 ve&lt;br /&gt;    v2 = eval' e2 ve&lt;br /&gt;&lt;br /&gt;-- Partial evaluator&lt;br /&gt;  peval' (Binary op e1 e2) ve&lt;br /&gt;   = case (e1', e2') of &lt;br /&gt;      (Const v1, Const v2) -&gt; Const (f v1 v2)&lt;br /&gt;      _ -&gt; Binary op e1' e2'&lt;br /&gt;   where&lt;br /&gt;    f  = op2f op&lt;br /&gt;    e1' = peval' e1 ve&lt;br /&gt;    e2' = peval' e2 ve&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thus, in the interpreter, subexpressions are recursively evaluated, and the corresponding operator is applied to the intermediate results. Subexpressions are also recursively evaluated in the partial evaluator, but the intermediate results are to be checked this time such that the operator is applied for the case of value results (constants). Otherwise, a binary expression is generated which incorporates partially evaluated operands as opposed to the original operand expressions.&lt;br /&gt;&lt;br /&gt;The same idea is applied to the IsZero construct:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-- Interpreter&lt;br /&gt;  eval' (IfZero e1 e2 e3) ve = if (v1==0) then v2 else v3&lt;br /&gt;   where&lt;br /&gt;    v1 = eval' e1 ve&lt;br /&gt;    v2 = eval' e2 ve&lt;br /&gt;    v3 = eval' e3 ve&lt;br /&gt;&lt;br /&gt;-- Partial evaluator&lt;br /&gt;  peval' (IfZero e1 e2 e3) ve&lt;br /&gt;   = case e1' of&lt;br /&gt;      (Const v1) -&gt; if (v1==0) then e2' else e3'&lt;br /&gt;      _ -&gt; IfZero e1' e2' e3'&lt;br /&gt;   where&lt;br /&gt;    e1' = peval' e1 ve&lt;br /&gt;    e2' = peval' e2 ve&lt;br /&gt;    e3' = peval' e3 ve&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The pleasant status of IfZero is that it is enough to partially evaluate the condition to a value in order to be able to eliminate the conditional form. &lt;br /&gt;&lt;br /&gt;Perhaps surprisingly, the cases for function application can be identical (modulo renaming):&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-- Interpreter&lt;br /&gt;  eval' (Apply n es) ve = eval' e ve'&lt;br /&gt;   where&lt;br /&gt;    (ns,e) = fromJust (lookup n fe)&lt;br /&gt;    vs = map (\e -&gt; eval' e ve) es&lt;br /&gt;    ve' = zip ns vs&lt;br /&gt;&lt;br /&gt;-- Partial evaluator&lt;br /&gt;  peval' (Apply n es) ve = peval' e ve'&lt;br /&gt;   where&lt;br /&gt;    (ns,e) = fromJust (lookup n fe)&lt;br /&gt;    es' = map (\e -&gt; peval' e ve) es&lt;br /&gt;    ve' = zip ns es'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In both cases, we look up the function from the function environment, we bind (partially) evaluated actual parameters to the formal parameter variables, and we proceed with the (partial) evaluation of the function's body relative to the local environment.&lt;br /&gt;&lt;br /&gt;&lt;B&gt;Exercise:&lt;/B&gt; Is there any issue of &lt;A HREF="http://www.bookshelf.jp/texi/onlisp/onlisp_10.html"&gt;variable capture&lt;/A&gt; with the partial evaluator at hand? Can you demonstrate a problem? How would you generally rule out variable capture? Further, can you think of situations where the partial evaluator clones too much code or where it even loops, even though a non-cloning and non-looping partial evaluator would be desirable and feasible, perhaps subject to some form of &lt;A HREF="http://en.wikipedia.org/wiki/Memoization"&gt;memoization&lt;/A&gt;?&lt;br /&gt;&lt;br /&gt;The source code of this blog post is available in the repository for the Software Language Processing Suite; see &lt;A HREF="http://slps.svn.sourceforge.net/viewvc/slps/topics/partialevaluation/simplepe/"&gt;here&lt;/A&gt;. You would also find a not so simple partial evaluator discussed in the &lt;A HREF="http://professor-fish.blogspot.com/2011/05/more-serious-online-partial-evaluator.html"&gt;next blog post&lt;/A&gt;.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;PF&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-8977392225166182853?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/8977392225166182853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2011/05/illustrative-online-partial-evaluator.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8977392225166182853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8977392225166182853'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2011/05/illustrative-online-partial-evaluator.html' title='An illustrative online partial evaluator'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-4302579198973516712</id><published>2011-05-14T00:03:00.007+02:00</published><updated>2011-05-16T20:26:48.577+02:00</updated><title type='text'>Empirical studies of software languages</title><content type='html'>&lt;div&gt;Dear language researchers and engineers,&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;if you were interested in &lt;b&gt;empirical studies of software languages&lt;/b&gt;, what journals and conferences come to your mind as potential publication venues for such studies? In different terms, what do you think what quality journals and conferences would be popping up if you were googling (binging) intelligently for empirical studies of programming languages, modeling languages, domain-specific languages, and other software languages you can think of? &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Please send your ideas by email to &lt;a href="mailto:rlaemmel@acm.org"&gt;rlaemmel@acm.org&lt;/a&gt; by 19 May. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The results of this inquiry will be published while preserving anonymity of all participants.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Thanks!&lt;/div&gt;&lt;div&gt;Professor Fish&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;PS1:&lt;/b&gt; The reason for asking is that we are into a meta-empirical effort, continuing our SLE 2010 paper "&lt;a href="http://softlang.uni-koblenz.de/toknow/"&gt;Empirical language analysis in software linguistics&lt;/a&gt;" (Jean-Marie Favre and Dragan Gasevic and Ralf Lämmel and Ekaterina Pek). We are going to use &lt;i&gt;content analysis&lt;/i&gt;, where we aim for automation for data mining to the extent possible, but substantial manual efforts remain. Therefore, scalability is limited, and we would like to narrow down the search space for relevant publications by using a short list of journals and conferences, but, at the same time, remaining transparent about what we use. &lt;b&gt;So please, in the interest of science, send your journal and conference acronyms.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;PS2&lt;/b&gt;: Please understand that I do not include any journals and conferences that are already on our mind. I do not want to bias you in any way. This is also the reason for disabling comments on this post.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-4302579198973516712?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/4302579198973516712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/4302579198973516712'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2011/05/empirical-studies-of-software-languages.html' title='Empirical studies of software languages'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-8014403659572405070</id><published>2011-05-08T04:29:00.002+02:00</published><updated>2011-05-08T05:21:48.473+02:00</updated><title type='text'>Language processing for dummies</title><content type='html'>I enjoyed reading recently "&lt;span style="font-style:italic;"&gt;Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages&lt;/span&gt;" by Terence Parr (the ANTLR guy) as available from &lt;a href="http://pragprog.com/titles/tpdsl/language-implementation-patterns"&gt;The Pragmatic Bookshelf&lt;/a&gt;. The book uses a design pattern style to present techniques for language processing. Eventually the book gets to leverage ANTLR for many problems, but it also explains language processing in terms of patterns that require regular programming effort without the help of a program generator. This is a clever way of teaching some basics of grammars, parsing, tree walking and other concepts that can be explained all too easily (elsewhere) in a too complicated manner, or in a manner requiring substantial background.&lt;br /&gt;&lt;br /&gt;In my (very) advanced Bachelor's course &lt;a href="http://softlang.wikidot.com/course:ptt"&gt;Programming techniques and technologies&lt;/a&gt;, I face students who don't know much yet about formal languages and certainly nothing about compiler construction; they are aware though of context-free grammars (EBNFs) for the purpose of syntax definition. The course covers many programming techniques and technologies, and I am willing to dedicate two lectures to language processing. Hence, I designed patterns that are really simple and that allow me to discuss a number of language processors for &lt;a href="http://101companies.uni-koblenz.de/"&gt;101companies&lt;/a&gt; in a systematic manner.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;"Manual" patterns&lt;/span&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The &lt;i&gt;Chopper&lt;/i&gt; Pattern: Chop input into pieces for classification and iterator-based processing.&lt;/li&gt;&lt;li&gt;The &lt;i&gt;Lexer&lt;/i&gt; Pattern: Transform character stream into token stream for iterator-based processing.&lt;/li&gt;&lt;li&gt;The &lt;i&gt;Copy/Replace&lt;/i&gt; Pattern: Implement text transformation by copying tokens from input to output while replacing tokens of interest.&lt;/li&gt;&lt;li&gt;The &lt;i&gt;Acceptor&lt;/i&gt; Pattern: Implement a context-free grammar with procedures for parsing input and signaling acceptance or rejection.&lt;/li&gt;&lt;li&gt;The &lt;i&gt;Parser&lt;/i&gt; Pattern: Advance the Acceptor Pattern such that semantic actions are to be executed along with parsing input.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;"Generative" patterns&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The &lt;i&gt;Lexer Generation&lt;/i&gt; Pattern:  Use a lexer/parser generator to derive a character-to-token stream conversion from a grammar generatively.&lt;/li&gt;&lt;li&gt;The &lt;i&gt;Acceptor Generation&lt;/i&gt; Pattern: Use a parser generator to derive an acceptor from a grammar generatively.&lt;/li&gt;&lt;li&gt;The &lt;i&gt;Parser Generation&lt;/i&gt; Pattern: Use a parser generator to derive an parser from a grammar with associated semantic actions generatively.&lt;/li&gt;&lt;li&gt;The &lt;i&gt;Text-to-object&lt;/i&gt; Pattern: Instantiate the Parser (Generation) Pattern such that the semantic actions construct objects that resemble the syntactical structure of the input.&lt;/li&gt;&lt;li&gt;The &lt;i&gt;Object-to-text Pattern&lt;/i&gt;: Implement an operation on an object model that writes out the object graph in the underlying textual notation.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Associated 101companies implementations&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://101companies.uni-koblenz.de/index.php/101implementation:javaScanner"&gt;javaScanner&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://101companies.uni-koblenz.de/index.php/101implementation:javaLexer"&gt;javaLexer&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://101companies.uni-koblenz.de/index.php/101implementation:javaParser"&gt;javaParser&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://101companies.uni-koblenz.de/index.php/101implementation:antlrLexer"&gt;antlrLexer&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://101companies.uni-koblenz.de/index.php/101implementation:antlrAcceptor"&gt;antlrAcceptor&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://101companies.uni-koblenz.de/index.php/101implementation:antlrParser"&gt;antlrParser&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://101companies.uni-koblenz.de/index.php/101implementation:antlrObjects"&gt;antlrObjects&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Slide decks (.pdf): &lt;/span&gt;&lt;a href="http://www.uni-koblenz.de/~softlang/ptt11/resources/pdf/grammars.pdf"&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;[1]&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;. &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;a href="http://www.uni-koblenz.de/~softlang/ptt11/resources/pdf/generative.pdf"&gt;[2]&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Lecture videos (.mov): &lt;a href="http://www.uni-koblenz.de/~laemmel/ptt/movies/grammars.mov"&gt;[1]&lt;/a&gt;. &lt;a href="http://www.uni-koblenz.de/~laemmel/ptt/movies/generative.mov"&gt;[2]&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Regards,&lt;/div&gt;&lt;div&gt;PF&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-8014403659572405070?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/8014403659572405070/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2011/05/language-processing-for-dummies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8014403659572405070'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8014403659572405070'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2011/05/language-processing-for-dummies.html' title='Language processing for dummies'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-557997107623990922</id><published>2011-05-05T09:39:00.009+02:00</published><updated>2011-05-05T17:36:17.342+02:00</updated><title type='text'>A tiny attribute grammar exercise</title><content type='html'>(C) 2011, Ralf Laemmel&lt;br /&gt;&lt;br /&gt;Let's map Knuth' attribute grammar example to Haskell. This has been done many times. In fact, there is a long track of excellent research on the relation between attribute grammars and functional programming. For instance, see the work by Doaitse Swierstra and team over many years. Our development here is meant to just illustrate the basic mapping in an as simple and self-contained manner as possible.&lt;br /&gt;&lt;br /&gt;One should notice that the chosen example (due to Knuth) requires laziness for the straightforward encoding that is leveraged&lt;br /&gt;below. Hence, C programmers are encouraged to try to transcribe this Haskell program to their favorite language.&lt;br /&gt;&lt;br /&gt;The following context-free grammar is assumed:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;digit : '0'&lt;br /&gt;digit : '1'&lt;br /&gt;digits : digit&lt;br /&gt;digits : digits digit&lt;br /&gt;number : digits&lt;br /&gt;number : digits '.' digits&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That is, we deal with binary numbers---both integer and fractional numbers.&lt;br /&gt;&lt;br /&gt;We use the following algebraic datatypes to model the grammar:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;data Digit = Zero | One&lt;br /&gt;data Digits = Single Digit | Several Digits Digit &lt;br /&gt;data Number = Int Digits | Frac Digits Digits&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Let us now associate attributes with the nonterminals:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;* digit:&lt;br /&gt;  - inh. p -- position of digit&lt;br /&gt;  - syn. v -- value of digit&lt;br /&gt;* digits:&lt;br /&gt;  - inh. p -- position of digits&lt;br /&gt;  - syn. v -- value of digits&lt;br /&gt;  - syn. l -- length of digits&lt;br /&gt;* number:&lt;br /&gt;  - syn. v -- value of number&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In Haskell, we can introduce designated type aliases to capture the names of the attributes, and the association of nonterminals with attributes is modeled with the signatures for functions that are expected to model the semantic equations. (We could also use record types, but Haskell's record system is not quite convenient in this context.) Here, the assumption is that those functions carry one argument for the syntactial part, another argument for (the tuple of) the inherited attributes, and the result corresponds to (the tuple of) the synthesized attributes. Thus:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-- Type synonyms for attributes&lt;br /&gt;type Val = Float&lt;br /&gt;type Pos = Int&lt;br /&gt;type Len = Int&lt;br /&gt;&lt;br /&gt;-- Functions for semantic equations&lt;br /&gt;digit :: Digit -&gt; Pos -&gt; Val&lt;br /&gt;digits :: Digits -&gt; Pos -&gt; (Val,Len)&lt;br /&gt;number :: Number -&gt; Val&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here are the semantic equations for the example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;digit : '0'&lt;br /&gt;  v.digit = 0&lt;br /&gt;&lt;br /&gt;digit : '1'&lt;br /&gt;  v.digit = 2^^p.digit&lt;br /&gt;&lt;br /&gt;digits : digit&lt;br /&gt;  v.digits = v.digit&lt;br /&gt;  l.digits = 1&lt;br /&gt;  p.digit = p.digits&lt;br /&gt;&lt;br /&gt;digits : digits' digit&lt;br /&gt;  v.digits = v.digits' + v.digit&lt;br /&gt;  p.digit = p.digits&lt;br /&gt;  p.digits' = p.digits + 1&lt;br /&gt;  l.digits = l.digits' + 1&lt;br /&gt;&lt;br /&gt;number : digits&lt;br /&gt;  v.number = v.digits&lt;br /&gt;  p.digits = 0&lt;br /&gt;&lt;br /&gt;number : digits '.' digits'&lt;br /&gt;  v.number = v.digits + v.digits'&lt;br /&gt;  p.digits = 0&lt;br /&gt;  p.digits' = -l.digits'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We implement these semantic equations as equations defining the functions from syntax times inherited attributes to synthesized attributes.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;digit Zero _ = 0&lt;br /&gt;digit One p = 2^^p&lt;br /&gt;&lt;br /&gt;digits (Single d) p = (digit d p,1)&lt;br /&gt;digits (Several ds d) p = (v,l)&lt;br /&gt; where&lt;br /&gt;  v = v' + v''&lt;br /&gt;  l = l' + 1&lt;br /&gt;  (v',l') = digits ds (p+1)&lt;br /&gt;  v'' = digit d p&lt;br /&gt;&lt;br /&gt;number (Int ds) = fst (digits ds 0)&lt;br /&gt;number (Frac ds1 ds2) = v1+v2&lt;br /&gt; where&lt;br /&gt;  (v1,l1) = digits ds1 0&lt;br /&gt;  (v2,l2) = digits ds2 (-l2)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Let us evaluate 10.01.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;main = do print (number n)&lt;br /&gt; where&lt;br /&gt;  n = Frac ds ds'&lt;br /&gt;  ds = Several (Single One) Zero&lt;br /&gt;  ds' = Several (Single Zero) One&lt;br /&gt;&lt;br /&gt;&gt; main&lt;br /&gt;2.25&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Prof. Fisch&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-557997107623990922?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/557997107623990922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2011/05/tiny-attribute-grammar-exercise.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/557997107623990922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/557997107623990922'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2011/05/tiny-attribute-grammar-exercise.html' title='A tiny attribute grammar exercise'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-2480351327289566550</id><published>2011-04-28T17:14:00.006+02:00</published><updated>2011-04-29T19:11:18.442+02:00</updated><title type='text'>Test-driven grammar-class understanding with ANTLR</title><content type='html'>Suppose you would like to understand some grammar classes such as LL(1) and LL(*). Then you might appreciate a test suite like the following, or you would actually try to discover such a test suite yourself. I used the following suite in a lab of my "&lt;a href="http://softlang.wikidot.com/course:slp"&gt;Software Language Processing&lt;/a&gt;" class. It is very convenient means of illustrating things. Students can copy and paste these codes now and further investigate. It helps understanding formal notions and actual, operational parser behaviors.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;The first ANTLR input specifies a trivial grammar with a fixed lookahead of 1.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;grammar LL1;&lt;br /&gt;options { k = 1; }&lt;br /&gt;s : 'a' 'x' | 'b' 'x' ;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Let's apply ANTLR:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;java -classpath ".:antlr-3.2.jar" org.antlr.Tool LL1.g&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;ANTLR likes that grammar just fine. (There are no complains.) We are allowed to infer hence that the grammar is indeed LL(1).&lt;br /&gt;&lt;br /&gt;The next ANTLR input combines two alternatives that are clearly not LL(1). However, we still use a lookahead of 1.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;grammar NotLL1;&lt;br /&gt;options { k = 1; }&lt;br /&gt;s : 'a' 'x' | 'a' 'y';&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Let's apply ANTLR again:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;java -classpath ".:antlr-3.2.jar" org.antlr.Tool NotLL1.g&lt;br /&gt;warning(200): NotLL1.g:3:3: Decision can match input such as "'a'" using multiple alternatives: 1, 2&lt;br /&gt;As a result, alternative(s) 2 were disabled for that input&lt;br /&gt;error(201): NotLL1.g:3:3: The following alternatives can never be matched: 2&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;That is, ANTLR complains that both alternatives are to be selected with the same lookahead, and hence, ANTLR announces effectively that it will (pragmatically) favor the first alternative. As a result, the second alternative can never be matched operationally.&lt;br /&gt;&lt;br /&gt;The next ANTLR input is basically the same as before except that we use a lookahead of 2 now.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;grammar LL2;&lt;br /&gt;options { k = 2; }&lt;br /&gt;s : 'a' 'x' | 'a' 'y';&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The grammar is indeed LL(2). ANTLR likes the grammar just fine.&lt;br /&gt;&lt;br /&gt;The next ANTLR input goes back to lookahead 1 but it enables backtracking.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;grammar Backtracking;&lt;br /&gt;options { backtrack = true; k = 1; }&lt;br /&gt;s : 'a' 'x' | 'a' 'y';&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;With backtracking turned on, ANTLR just gracefully accepts the grammar even with the insufficient look ahead. It is easy to guess that the operational behavior will combine use of lookahead for the optimization of decisions with the use of backtracking for completeness. That is, whenever input cannot be matched on the grounds of lookahead-based decisions, then additional choices are to be explored through backtracking.&lt;br /&gt;&lt;br /&gt;The next ANTLR input explores the ANTLR semantics of backtracking. That is, we retain the same grammar as before---except that we inject a semantic action for output into the first alternative---just to see whether semantic actions will be prematurely executed---even if an alternative will not be completed, and a different alternative is chosen by backtracking eventually.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;grammar Delay;&lt;br /&gt;options { backtrack = true; k = 1; }&lt;br /&gt;s : 'a' { System.out.println(42); } 'b' 'x' | 'a' 'b' 'y';&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;When we apply the generated parser for the grammar to the input "aby", then no output will be printed. That is, the parser explores the alternative with the semantic action first, but it delays execution of semantic actions. Such delayed actions are a safe choice when backtracking is involved.&lt;br /&gt;&lt;br /&gt;The next ANTLR input starts two alternatives with a kind of prefix that rules out finite lookahead for deterministic decisions.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;grammar Not42;&lt;br /&gt;options { k = 42; }&lt;br /&gt;s : 'a'* 'x' | 'a'* 'y';&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In particular, the grammar is not LL(42). This is how ANTLR reports the problem:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;java -classpath ".:antlr-3.2.jar" org.antlr.Tool Not42.g&lt;br /&gt;warning(200): Not42.g:3:3: Decision can match input such as "'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a' 'a'" using multiple alternatives: 1, 2&lt;br /&gt;As a result, alternative(s) 2 were disabled for that input&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Hence, a parser based on lookahead of 42 would not be able to make the right decision for longer inputs.&lt;br /&gt;&lt;br /&gt;The next ANTLR input simply removes the LL(k) option. Thereby, ANTLR's infinite lookahead applies.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;grammar LLstar;&lt;br /&gt;s : 'a'* 'x' | 'a'* 'y';&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Indeed, ANTLR likes the grammar just fine. The grammar is hence LL(*).&lt;br /&gt;&lt;br /&gt;The next ANTLR input starts two alternatives with a kind of prefix that rules out even infinite (DFA-based) lookahead for deterministic decisions. A recursive nonterminal is used which clearly rules out DFAs for lookahead.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;grammar NotLLstar;&lt;br /&gt;s : p 'x' | p 'y';&lt;br /&gt;p : 'a' p 'b' | ;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Indeed, ANTLR complains.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;java -classpath ".:antlr-3.2.jar" org.antlr.Tool NotLLstar.g&lt;br /&gt;error(211): NotLLstar.g:2:3: [fatal] rule s has non-LL(*) decision due to recursive rule invocations reachable from alts 1,2.  Resolve by left-factoring or using syntactic predicates or using backtrack=true option.&lt;br /&gt;make: [NotLLstar.gen] Error 1 (ignored)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;ANTLR basically suggests a few options which are all worth investigating: factoring, syntactic predicates, and backtracking.&lt;br /&gt;&lt;br /&gt;Let's try factoring first. It does not take a rocket grammar engineer to even guess that we get back to LL(1):&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;grammar Factoring;&lt;br /&gt;options { k = 1; }&lt;br /&gt;s : p ('x' | 'y');&lt;br /&gt;p : 'a' p 'b' | ;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Indeed, ANTLR likes the grammar just fine. We quickly transitioned from non-LL(*) to LL(1).&lt;br /&gt;&lt;br /&gt;Now let's try syntactic predicates. That is, we attach essentially grammar expressions as guards to the alternatives:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;grammar SynPreds;&lt;br /&gt;s : (p 'x') =&amp;gt; p 'x'&lt;br /&gt; | (p 'y') =&amp;gt; p 'y';&lt;br /&gt;p : 'a' p 'b' | ;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;ANTLR also is Ok with that grammar. However, we should not expect too much. Essentially, we are using an operational semantics now such that the first alternative is tried first subject to the syntactic predicate to be satisfied; otherwise we continue with the second alternative which is guarded as well. No formal property for the predicates is to be checked. All reasoning is based on order. From a practical point of view, the predicates at hand are somewhat terrible because they actually run the complete alternative in the guard. (We simulate backtracking in a sense.) We should try to find a shorter prefix for the test, but this is impossible in the example at hand. However, even guards that test a lot of the actual alternative may be efficient if we could additionally leverage memoization, but we do not attempt this here.&lt;br /&gt;&lt;br /&gt;It is reasonable to turn on backtracking again. In this case, the grammar itself does not need to be transformed:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;grammar Desperate;&lt;br /&gt;options { backtrack = true; }&lt;br /&gt;s : p 'x' | p 'y';&lt;br /&gt;p : 'a' p 'b' | ;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We can parse just fine with that grammar. Demo omitted. Of course, efficiency issues are to be expected whenever backtracking is involved, but, again, we could try to leverage memoization in some cases, or we should indeed try to factor---as it is clearly trivial and appropriate in the specific case at hand.&lt;br /&gt;&lt;br /&gt;Happy grammar engineering!&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Ralf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-2480351327289566550?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/2480351327289566550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2011/04/test-driven-grammar-class-understanding.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/2480351327289566550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/2480351327289566550'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2011/04/test-driven-grammar-class-understanding.html' title='Test-driven grammar-class understanding with ANTLR'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-1792810913390517843</id><published>2011-01-20T11:44:00.008+01:00</published><updated>2011-01-20T14:55:32.594+01:00</updated><title type='text'>A tiny bit of denotational semantics</title><content type='html'>All languages and assignments in this blog post are (C) 2011 Ralf Lämmel.&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 15.8333px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 15.8333px; "&gt;This is actually an assignment for my &lt;a href="http://www.uni-koblenz.de/~laemmel/paradigms1011/"&gt;paradigms/semantics class&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 15.8333px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 15.8333px; "&gt;Consider the following super-trivial interpreter written in Haskell and in the direct style of denotational semantics:&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;data Exp = Const Int&lt;br /&gt;    | Add Exp Exp&lt;br /&gt;&lt;br /&gt;eval :: Exp -&gt; Int&lt;br /&gt;eval (Const i) = i&lt;br /&gt;eval (Add x y) = eval x + eval y&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It's time to test:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; eval (Add (Const 20) (Const 22))&lt;br /&gt;42&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This incredible language handles integer constants and addition. Now assume that we are adding an "exit" form of expression. The intended semantics of a term "Exit &lt;i&gt;e&lt;/i&gt;" is to define the final result of expression evaluation as the value of &lt;i&gt;e&lt;/i&gt;. Hence, if an exit expression occurs inside an addition, then the addition is effectively cancelled. Thus:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;data Exp = Const Int&lt;br /&gt;    | Add Exp Exp&lt;br /&gt;    | Exit Exp&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For instance:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Add (Const 20) (Const 22) should evaluate to 42.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Add (Exit (Const 88)) (Const 42) should evaluate to 88.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;A particularly clumsy way of writing an interpreter for the extended language is to stubbornly stick to direct style of denotational semantics. That is, we may use, for example, the result type to encode whether we are returning from a normal evaluation or whether we are supposed to exit. In such a case, we have to systematically check intermediate results to propagate exit. In our simple language, we need to propagate in the equation for addition. Thus:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;-- Result type for clumsy direct style:&lt;br /&gt;-- The sum serves for tagging.&lt;br /&gt;-- Left tags normal result values.&lt;br /&gt;-- Right tags exit values.&lt;br /&gt;type R = Either Int Int&lt;br /&gt;&lt;br /&gt;-- Standard combinator for sum processing&lt;br /&gt;(\/) :: (a -&gt; c) -&gt; (b -&gt; c) -&gt; Either a b -&gt; c&lt;br /&gt;(f \/ g) (Left x)  = f x&lt;br /&gt;(f \/ g) (Right y) = g y&lt;br /&gt;&lt;br /&gt;-- Tag removal&lt;br /&gt;toInt :: Either Int Int -&gt; Int&lt;br /&gt;toInt = id \/ id&lt;br /&gt;&lt;br /&gt;-- Clumsy semantic function&lt;br /&gt;eval :: Exp -&gt; R&lt;br /&gt;eval (Const i) = con i&lt;br /&gt;eval (Add x y) = add (eval x) (eval y)&lt;br /&gt;eval (Exit x) = exit (eval x)&lt;br /&gt;&lt;br /&gt;-- Algebra for denotations&lt;br /&gt;con :: Int -&gt; R&lt;br /&gt;con = Left&lt;br /&gt;&lt;br /&gt;add :: R -&gt; R -&gt; R&lt;br /&gt;add x y = ((\x' -&gt; ((Left . (x'+)) \/ Right) y) \/ Right) x&lt;br /&gt;&lt;br /&gt;exit :: R -&gt; R&lt;br /&gt;exit = Right . toInt&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The clumsy interpreter can indeed be tested as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; toInt (eval (Add (Const 20) (Const 22)))&lt;br /&gt;42&lt;br /&gt;&gt; toInt (eval (Add (Exit (Const 88)) (Const 42)))&lt;br /&gt;88&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here are two trivial assignments that make you understand a) the basics of continuations and b) the relationship between analysis and denotational semantics. 1st assignment: Design an alternative semantics for the extended language so that you exploit continuation style instead of direct style. 2nd assignment: Revise the direct style semantics to derive a program analysis determining the purity of an expression; an expression is pure if it does not contain any reference to the Exit form of expression. Thus, we would like to be able to run tests as follows:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&gt; eval (Add (Const 20) (Const 22)) id&lt;br /&gt;42&lt;br /&gt;&gt; eval (Add (Exit (Const 88)) (Const 42)) id&lt;br /&gt;88&lt;br /&gt;&gt; pure (Add (Const 20) (Const 22))&lt;br /&gt;True&lt;br /&gt;&gt; pure (Add (Exit (Const 88)) (Const 42))&lt;br /&gt;False&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;(We pass the identity continuation to the applications of eval.)&lt;br /&gt;&lt;br /&gt;Regards,&lt;div&gt;PF&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-1792810913390517843?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/1792810913390517843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2011/01/tiny-bit-of-denotational-semantics.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/1792810913390517843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/1792810913390517843'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2011/01/tiny-bit-of-denotational-semantics.html' title='A tiny bit of denotational semantics'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-2176185490511891811</id><published>2010-12-31T18:22:00.003+01:00</published><updated>2010-12-31T18:44:22.498+01:00</updated><title type='text'>The underappreciated banana and its buddy monoid</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Note&lt;/span&gt;: This is the blog post that goes with the Channel9 lecture "Going Bananas". You find all material (slides, code) linked up on the web site for &lt;a href="http://sourceforge.net/apps/mediawiki/developers/index.php?title=Ralfs-channel9-lectures"&gt;my Channel9 series&lt;/a&gt;; see the section on "Going Bananas". I will add a link to the C9 website with the video as soon as it gets available.&lt;br /&gt;&lt;br /&gt;I am really Ok. Well, but I do see bananas (folds) everywhere. This tells me that data processing is quite regular. For instance, MapReduce computations for parallel data processing are essentially folds that extract some intermediate data from the records of a voluminous input---subject to subsequent, possibly distributed and staged reduction. Also, in program transformation and analysis, many data processing steps are compositional, and thereby suggest themselves as being implemented through "large" bananas. Further, in XML processing, many operations are busy with folding over XML trees. &lt;b&gt;There are bananas for everyone&lt;/b&gt;---not just for lists. If we were just acknowledging such omnipresence of fold, reasoning about our programs may be drastically simplified.&lt;br /&gt;&lt;br /&gt;Many bananas team up with monoids. Again, this is great because this tells me that combination of intermediate results along recursive computations is typically quite regular, too. For instance, MapReduce computations for parallel data processing essentially use monoids to aggregate results and to build up indexes. (The monoidal properties enable parallel composition in so far that we can take any segment of input and process it on a separate machine, and such per-machine results can be combined, in fact, reduced later. We also see easily when we need more than just a monoid. For instance, we may need commutativity in order to be even more flexible with parallel processing schedules.) Also, in program analysis, many data processing steps recurse into substructures, and combine intermediate results in a monoidal fashion. It seems that some people mainly think of monoids as numbers and perhaps lists with the usual culprits for binary operation and identity. &lt;b&gt;If you have never used a monoid for pairs or maps, then you should try it as soon as you can.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;One may end up obfuscating programs by under-appreciating the fundamental concepts of bananas and monoids for recursion schemes and algebraic computations. For instance, suppose you design a domain-specific language for parallel data processing, and you suggest certain language concepts for data analysis. Wouldn't it be helpful to point out that the key underlying concept is essentially the one of a list homomorphism, which has been heavily studied from a point of view of data parallelism? This is not a conceived example. &lt;a href="http://research.google.com/archive/sawzall.html"&gt;Sawzall&lt;/a&gt; describes a DSL just like that, and it took me a few hours to see that Sawzall's aggregators boil down to a programming scheme for list homomorphisms with interesting monoids. Likewise, the visitor pattern in OO programming is a bit of a chaos, and so it may help to see something as simple and powerful as a large bananas to consider switching paradigms or develop a simpler view on visitors.&lt;br /&gt;&lt;br /&gt;I have compiled a lecture with accompanying code base, to appear on Channel9, which discusses a number of use cases for bananas and monoids. I begin with simple uses of foldr meant to show the generality and expressiveness of this great operator; this also includes a quick discussion of those type classes that can be used for folds on container types other than Haskell's concrete list type. (See code module Foldr.hs for this part.) Then I switch to parallel data processing à la MapReduce, and have a lot of fun with map, foldr, monoids, and friends. (See code module MapReduce.hs for this part.) Then, I switch from lists to heterogenous types, as they are used to model problem domains in programming, e.g., dataypes for ASTs used in interpretation, software transformation and analysis. On such AST types, I discuss large bananas, i.e., bananas that possibly handle many constructors, and the "Scrap Your Boilerplate" style of generic functional programming which involves yet other bananas. (See code modules Large.hs and SYB.hs for these two parts.) I had to be selective in the interest of staying close to a 1h lecture. For instance, folds in the sense of Church encodings, functorial style generic programming, or graph traversals remain unmentioned. I also fail to spend significant time on reasoning about the programs at hand, but I give some further reader pointers as usual. Enjoy, and please provide feedback.&lt;br /&gt;&lt;br /&gt;Regards&lt;br /&gt;Ralf&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-2176185490511891811?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/2176185490511891811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/12/underappreciated-banana-and-its-buddy.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/2176185490511891811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/2176185490511891811'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/12/underappreciated-banana-and-its-buddy.html' title='The underappreciated banana and its buddy monoid'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-8386273106493927171</id><published>2010-12-21T12:29:00.002+01:00</published><updated>2010-12-21T15:03:36.922+01:00</updated><title type='text'>A brutalized Haskell programmer</title><content type='html'>In working on a special Xmas lecture for my 1st semester course, I was going through Fritz Ruehr's "&lt;a href="http://www.willamette.edu/~fruehr/haskell/evolution.html"&gt;The Evolution of a Haskell Programmer&lt;/a&gt;" only to notice that there is no imperatively faked version that uses references. This omission could be resolved with the following code:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;module Control.Pascal where&lt;br /&gt;&lt;br /&gt;import Data.IORef&lt;br /&gt;&lt;br /&gt;while :: IORef a -&gt; (a -&gt; Bool) -&gt; IO () -&gt; IO ()&lt;br /&gt;while ref pred body = while'&lt;br /&gt; where&lt;br /&gt;  while' = do&lt;br /&gt;              v &lt;- readIORef ref&lt;br /&gt;              if (pred v)&lt;br /&gt;                then body &gt;&gt; while'&lt;br /&gt;                else return ()&lt;br /&gt;&lt;br /&gt;{- ******************************* -}&lt;br /&gt;&lt;br /&gt;import Data.IORef&lt;br /&gt;import Control.Pascal&lt;br /&gt;&lt;br /&gt;factorial n&lt;br /&gt; = do&lt;br /&gt;      r &lt;- newIORef 1&lt;br /&gt;      i &lt;- newIORef n&lt;br /&gt;      while i (&gt;0) (&lt;br /&gt;        readIORef i &gt;&gt;= &lt;br /&gt;        modifyIORef r . (*) &gt;&gt;&lt;br /&gt;        modifyIORef i ((+) (-1))&lt;br /&gt;       )&lt;br /&gt;      readIORef r&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For instance:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Prelude&gt; factorial 5&lt;br /&gt;120&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-8386273106493927171?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/8386273106493927171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/12/brutalized-haskell-programmer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8386273106493927171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8386273106493927171'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/12/brutalized-haskell-programmer.html' title='A brutalized Haskell programmer'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-1362187621007721130</id><published>2010-12-13T04:35:00.003+01:00</published><updated>2010-12-13T17:41:45.152+01:00</updated><title type='text'>Going bananas</title><content type='html'>&lt;div&gt;This week I will be visiting Klaus Ostermann and his team. I am going to be a guest lecturer in Klaus' programming languages lecture. I am going to misuse this opportunity for a rehearsal of my upcoming Channel9 lecture on bananas. I eat 2 bananas over the last 42 hours in order to get into the right mood.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;The talk announcement follows.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Speaker&lt;/b&gt;: &lt;a href="http://www.uni-koblenz.de/~laemmel/Site/Contact.html"&gt;&lt;i&gt;Ralf Lämmel&lt;/i&gt;&lt;/a&gt;&lt;i&gt;, Software Languages Team, Universität Koblenz-Landau&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Title&lt;/b&gt;: &lt;i&gt;Going bananas&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Slides:&lt;/b&gt; [&lt;a href="http://developers.svn.sourceforge.net/viewvc/developers/repository/ralfs-channel9-lectures/decks/bananas.pdf"&gt;.pdf&lt;/a&gt;]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Abstract&lt;/b&gt;: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Banana is functional programming slang for "fold", say an application of the catamorphic recursion scheme---most widely known in higher-order list processing in the tradition of the Bird-Meertens Formalism and the Squiggol community.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this talk, I will present various kinds of folds, and thereby show the omnipresence, versatility, and expressive power of folds in different areas of programming. This presentation will integrate work by others and my own in a balanced manner, while aiming at broad coverage of bananas and good accessibility of the subject that is sometimes unjustly considered difficult, if not esoteric. Fold is one of the few swiss army knifes of functional programming. Even if you have to code in Java, knowledge of fold will help you to better understand what you are doing with collections, functors, visitors, or otherwise.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The presentation is structured as follows.  First, the basics of higher-order list processing are recalled. Second, folds and friends are examined from the more abstract point of view of iteration over general (abstract) containers as opposed to concrete lists. Third, folds are put to work to serve parallel data processing based on list homomorphisms, and Google's MapReduce and Sawzall approaches are revisited in this context. Fourth, folds are generalized beyond lists, in fact, beyond containers---so that data of arbitrary algebraic datatypes can be processed in catamorphic fashion, thereby entering the area of generic programming. Finally, the "&lt;a href="http://sourceforge.net/apps/mediawiki/developers/index.php?title=ScrapYourBoilerplate"&gt;Scrap Your Boilerplate&lt;/a&gt;" style of generic programming is presented as a logical continuation of previous work on folds and friends.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Bio&lt;/b&gt;: [&lt;a href="http://www.uni-koblenz.de/~laemmel/Site/Bio.html"&gt;.html&lt;/a&gt;]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-1362187621007721130?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/1362187621007721130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/12/going-bananas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/1362187621007721130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/1362187621007721130'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/12/going-bananas.html' title='Going bananas'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-9139327500557045135</id><published>2010-11-15T04:15:00.004+01:00</published><updated>2010-11-18T15:19:49.527+01:00</updated><title type='text'>Grammar-based Testing Revisited</title><content type='html'>&lt;div&gt;I am about to leave for Southampton (&lt;a href="http://en.wikipedia.org/wiki/RMS_Titanic"&gt;this is from where the Titanic started&lt;/a&gt;) for a few days to visit &lt;a href="http://www.ecs.soton.ac.uk/about/bernd_fischer.php"&gt;Dr. Bernd Fischer&lt;/a&gt;, who also calls himself Fish. (Another fish that is!) The idea is to give a talk and have interaction on the topic of grammar-based testing. In fact, I don't tell you any secret, if I say that Bernd is &lt;i&gt;the&lt;/i&gt; expert on code generation, and so I am keen to intensify collaboration on that topic as well.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;The talk announcement follows.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Speaker&lt;/b&gt;: &lt;a href="http://www.uni-koblenz.de/~laemmel/Site/Contact.html"&gt;&lt;i&gt;Ralf Lämmel&lt;/i&gt;&lt;/a&gt;&lt;i&gt;, Software Languages Team, Universität Koblenz-Landau&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Title&lt;/b&gt;: &lt;i&gt;Grammar-based Testing Revisited&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Slides&lt;/b&gt;: &lt;a href="http://userpages.uni-koblenz.de/~laemmel/101117-southampton.pdf"&gt;[.pdf]&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Abstract&lt;/b&gt;: Testing grammar-based artifacts has been researched for decades. A classical and enduring motivation for such testing is that grammar-based functionality (such as an interpreter or a compiler) may be formally specified (e.g., by means of an attribute grammar) so that the specification lends itself to test-data generation. The test data, in turn, can be used to test a proper implementation for compliance with the specification. Yet other motivations arise, for example, in the context of DSL design, and, more generally, &lt;a href="http://userpages.uni-koblenz.de/~laemmel/tse-sle/"&gt;software language engineering&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Despite all such longstanding and recently renewed interests in grammar-based testing, &lt;b&gt;&lt;i&gt;there is no best practice; there are no standard tools&lt;/i&gt;&lt;/b&gt;. In this talk, I analyze the current, fragmented, insufficiently automated, predominantly ad-hoc approach. To this end, I survey testing approaches and use cases. Finally, I start infering requirements of a more general approach to grammar-based testing.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is a good time for revisiting grammar-based testing because some categories of industrial users (e.g., compiler writers, who finally start to use parser generators in products) and several major research communities (such as those working on model-driven engineering and software language engineering) face the need for this sort of testing urgently. Also, there are less obviously related communities who touch upon grammar-based testing needs: think&lt;span class="Apple-style-span"  style=" ;font-size:16.2037px;"&gt; of the grammar-like structures in theorem proving, hardware design, and software-product lines.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Bio&lt;/b&gt;: Ralf Lämmel is Professor of Computer Science at University of Koblenz-Landau. In his career, he also served at Microsoft Corp., Free University of Amsterdam, Dutch Center for Mathematics and Computer Science (CWI), and University of Rostock. Ralf Lämmel's speciality is "software language engineering" but he is generally interested in themes that combine software engineering and programming languages. Ralf Lämmel is one of the founding fathers of the international summer school series GTTSE-Generative and Transformational Techniques on Software Engineering and the SLE conference (Software Language&lt;/div&gt;&lt;div&gt;Engineering).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-9139327500557045135?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/9139327500557045135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/11/grammar-based-testing-revisited.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/9139327500557045135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/9139327500557045135'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/11/grammar-based-testing-revisited.html' title='Grammar-based Testing Revisited'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-391289410146240611</id><published>2010-11-03T10:03:00.002+01:00</published><updated>2010-11-03T10:06:48.377+01:00</updated><title type='text'>Statistische Analyse der Parkplatz-Situation auf einem Universitätscampus</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: arial; font-size: small; "&gt;&lt;div&gt;Wenn sich ein Kandidat und ein Mitbetreuer etwa aus dem Inst. CV des FB4 (Informatik) findet, dann soll ich dieses ansonsten für illustrative oder Frustrations-lösende Zwecke erfundene Bachelor-Thema am Ende wirklich gern betreuen.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Bachelorarbeitsthema&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Thema&lt;/b&gt;: Statistische Analyse der Parkplatz-Situation auf einem Universitätscampus&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Motivation&lt;/b&gt;: Auf dem einen oder anderen solchen Parkplatz bzw. Campus gibt es empirische Hinweise, dass es einerseits zu wenig Parkplätze oder anderseits zu wenig verantwortliches Verhalten der Parkplatznutzer gibt. In Vorbereitung dieser Themenstellung hat der Themenstellende beispielsweise am 3.11.2010 um 8.45 eine Zählung auf dem Mitarbeiterteil des Parkplatzes am Campus Koblenz der Universität Koblenz-Landau vorgenommen. Um diese Zeit waren alle bis auf 3 Parkplätze belegt und diese verbleibenden Plätze waren nicht mit handelsüblichen Fahrzeugen einnehmbar wegen der durch das Falschparken Anderer verursachten Verringerung des Platzes. Knapp 1/3 aller Fahrzeuge berührten signifikant bzw. übertraten die Trennlinien. Dies sind alarmierende Hinweise.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Beschreibung&lt;/b&gt;: Die Arbeit soll geeignete Daten erheben und auswerten---zum Teil auch unter der Verwendung von digitaler Bildtechnik und Analyse (etwa zur Kennzeichenerkennung). Folgende Forschungsfragen werden vorgeschlagen. a) Was ist der Grad der Belegung der Parkflächen? b) Welche Kapazität wird durch Fehlverhalten verschwendet? c) Gibt es Parkplatz-Benutzer, welche statistisch signifikant durch Fehlverhalten auffallen? Der Kandidat soll gern weitere Fragestellungen beitragen.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Gruss,&lt;/div&gt;&lt;div&gt;PF&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-391289410146240611?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/391289410146240611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/11/statistische-analyse-der-parkplatz.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/391289410146240611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/391289410146240611'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/11/statistische-analyse-der-parkplatz.html' title='Statistische Analyse der Parkplatz-Situation auf einem Universitätscampus'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-35920075388570011</id><published>2010-10-11T11:26:00.007+02:00</published><updated>2010-10-14T00:54:30.858+02:00</updated><title type='text'>Towards a megamodel for programming and language technologies</title><content type='html'>&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-weight: normal;  font-size:16px;"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:large;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Summary&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal;  "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal;  "&gt;&lt;div style="display: inline !important; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;We have started a major effort on megamodeling programmig and language technologies.  &lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal;  "&gt;&lt;div style="display: inline !important; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;At GPCE 2010 and SLE 2010, we have revealed this effort. &lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal;  "&gt;&lt;div style="display: inline !important; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Contributions are more than welcome. &lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal;  "&gt;&lt;div style="display: inline !important; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Our next milestone is an actual megamodel that covers the software corpus "101companies".&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;Links&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The GPCE/SLE megamodeling tutorial: description [&lt;a href="http://userpages.uni-koblenz.de/~softlang/meganalysis/GpceSle10-tutorial-description.pdf"&gt;.pdf&lt;/a&gt;]; slides [&lt;a href="http://userpages.uni-koblenz.de/~softlang/meganalysis/GpceSle10-tutorial-slides.pdf"&gt;.pdf&lt;/a&gt;].&lt;/li&gt;&lt;li&gt;The GPCE 2010 keynote: website: [&lt;a href="http://userpages.uni-koblenz.de/~laemmel/42/"&gt;.html&lt;/a&gt;]; slides: [&lt;a href="http://userpages.uni-koblenz.de/~laemmel/42/slides.pdf"&gt;.pdf&lt;/a&gt;].&lt;/li&gt;&lt;li&gt;The 101company website at SourceForge developers: [&lt;a href="http://sourceforge.net/apps/mediawiki/developers/index.php?title=101companies"&gt;.html&lt;/a&gt;].&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;Acknowledgements&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;All of this is joint work with Jean-Marie Favre and Dragan Gasevic.&lt;/li&gt;&lt;li&gt;Thomas Schmorleiz is the incredible developer who helps on 101companies.&lt;/li&gt;&lt;li&gt;Wolfgang Lohmann has done a great job on the empirical parts of the keynote.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Background&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have been developing an &lt;a href="http://userpages.uni-koblenz.de/~laemmel/programmierung/"&gt;advanced programming class&lt;/a&gt; over the last 3 years. A defining characteristic of the class is that it is supposed to cover a broad range of programming and language technologies---perhaps a much broader range than in many other programming courses elsewhere.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In spring 2010, Jean-Marie Favre, Dragan Gasevic and me had an informal workshop in Malaga, where we developed the idea of teaching software languages (or the broader theme of programming and language technologies) in a manner that heavily relies on a) examples; b) comparison; c) megamodeling. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The tutorial and the keynote reveal this idea in more detail.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Your 101companies contributions are welcome.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Regards,&lt;/div&gt;&lt;div&gt;PF&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-35920075388570011?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/35920075388570011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/10/towards-megamodel-for-programming-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/35920075388570011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/35920075388570011'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/10/towards-megamodel-for-programming-and.html' title='Towards a megamodel for programming and language technologies'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-77258513148402711</id><published>2010-09-14T14:37:00.004+02:00</published><updated>2010-09-14T14:57:38.273+02:00</updated><title type='text'>Dealing comfortably with the confusion of tongues</title><content type='html'>&lt;div&gt;That's the title of my invited talk at &lt;a href="http://choose.s-i.ch/events/forum2010"&gt;CHOOSE Forum 2010&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;See the abstract below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I just realized that I am going to meet some esteemed colleagues there: Jean Bezivin, Jean-Marie Favre, Uwe Zdun.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Talk announcement&lt;/b&gt;: &lt;a href="http://choose.s-i.ch/events/forum2010/laemmel"&gt;http://choose.s-i.ch/events/forum2010/laemmel&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Abstract&lt;/b&gt;: Yahweh brought the confusion of tongues upon the people in the plain of Shinar because he did not like their efforts of building the Tower of Babel with its top in the heavens. In IT, we brought the confusion of tongues upon ourselves with the continuous aggregation of ideas for programming (languages), modeling (languages), domain concepts and domain-specific languages, design patterns, APIs, and so on. All this diversity makes a nontrivial software system look like the Tower of Babel—in terms of the involved complexity. That is, a nontrivial software system involves multiple technical spaces, technologies, bridges between them, and harmful amounts of software asbestos. How can IT personnel acquire the relevant skills more effectively? How would we want to prepare an undergraduate in CS for such toughness? These are the questions that we address in this talk. We put to work a combo of technology modeling, metamodeling, and megamodeling—plus a suite of well-designed examples in any lingo that we could think of. (Contrary to this abstract, the talk is going to be very technical; target audience: software engineers.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Acknowledgment&lt;/b&gt;: This is joint work with Dragan Gasevic and Jean-Marie Favre. Further, I acknowledge contributions by some of my students—most notably Thomas Schmorleiz.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-77258513148402711?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/77258513148402711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/09/dealing-comfortably-with-confusion-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/77258513148402711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/77258513148402711'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/09/dealing-comfortably-with-confusion-of.html' title='Dealing comfortably with the confusion of tongues'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-6894759770748746344</id><published>2010-09-13T23:50:00.002+02:00</published><updated>2010-09-13T23:55:43.216+02:00</updated><title type='text'>(Mega)modeling Software Language Artifacts</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;GPCE/SLE 2010 tutorial&lt;/span&gt;&lt;/b&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Jean-Marie Favre (OneTree Technologies, Luxembourg)&lt;/div&gt;&lt;div&gt;Dragan Gaševic (Athabasca University, Canada)&lt;/div&gt;&lt;div&gt;Ralf Lämmel (University of Koblenz, Germany)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Description&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Modern software is typically made of heterogeneous sets of software artifacts including for instance databases, programs, transformations, grammars, models and metamodels, compilers, interpreters, formats, ontologies, frameworks, APIs, schemas, configuration files, makefiles, etc. In practice particular languages, tools, implementations, and standards are used such as SQL DDL, Saxon, XLST, Java, Hibernate, XSD, OWL, DOM, Antlr, UML, XMI, Ecore, Awk, and so on. In the absence of a conceptual framework it is difficult to understand the relationships between these software artifacts, if any. The goal of this tutorial is to provide such a framework, showing that the similarity and relationships between techniques can be modeled at a high level of abstraction, and even more importantly that recurring patterns occur in such models. Some of these patterns, for instance those involving “bridges” between technologies, would be really difficult to grasp without a proper conceptualization. As a result software engineers and researchers usually find it hard to understand the intricacies of technologies that are out of their area of expertise and it is more than likely that they do not realize the analogies that exist between heterogeneous technologies. This tutorial aims to unveil these recurring patterns and to show participants coming from different horizons how to model the technologies they design or work with in an uniform way and how to situate them into the overall software language landscape.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the first part of the tutorial, the notions of software languages and technical spaces are briefly presented with a special emphasis on their unifying character. Then fundamental relations such RepresentationOf and ElementOf are introduced forming the basis of a (mega)modeling framework. Recurrent patterns based on these relations are then presented, allowing to describe for instance the “conformance” relation between let’s say a program and a grammar, an xml file and an xsd schema, or an uml model and its metamodel, etc. More complex patterns such as bridges between technologies (e.g. XML &lt;==&gt; Relational, OO &lt;==&gt; XML, etc.) are defined following the same approach. Though this notion of bridges seems easy to grasp informally at the first sight, it often leads to a rather large and complex set of technologies that are hard to understand and compare without an appropriate framework.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the second part of the tutorial, the use of (mega)modeling framework is illustrated through its application in three different technical spaces: Grammarware, Modelware and Ontologyware. Concrete examples of various degree of complexity are provided in each case, with again an emphasis on similarities between technical spaces. The hope of this approach is that it should be possible for someone with some knowledge in technical spaces (let’s say grammarware) to improve significantly his or her comprehension about another space (let’s say ontologyware), and this by virtue of analogy. It is our believe that the (mega)modeling approach, by raising the level of abstraction and focusing on essential software language concepts, enables both to better understand complex structures involving many heterogeneous software artifacts, but also to better apprehend new technologies coming from other spaces.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;One of the objectives of the tutorial is to show that bridges can be successfully established between heterogeneous technical spaces such as Modelware, Ontologyware and Grammarware, and in particular to go beyond traditional divisions of fields of expertise. This tutorial being directly inscribed into a “community engineering” perspective, we believe that having three presenters coming from different horizons would be the best way to insist on the integrative aspect of the mega-modeling approach.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Presenters&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Jean-Marie Favre is a software anthropologist and a software language archeologist. He is principal scientist at One Tree Technologies. He has published numerous papers and coedited a book (in French) Beyond MDA: Model Driven Engineering. He has given tutorials and keynotes in more than dozen of international events and summer schools and has organized various national and international events. His research interests include software language engineering, software linguistics, software evolution and reverse engineering, model driven engineering and research 2.0.&lt;/li&gt;&lt;li&gt;Dragan Gaševic is a Canada Research Chair in Semantic Technologies and an Associate Professor in the School of Computing and Information Systems at Athabasca University. His research interests include semantic technologies, software language engineering, technology-enhanced learning, and service- oriented architectures. He has (co-)authored numerous research papers and is a led author of the book "Model Driven Engineering and Ontology Development." He has given tutorials at many well-known conferences such as WWW, ISWC, and CAiSE.&lt;/li&gt;&lt;li&gt;Ralf Lämmel is Professor of Computer Science at University of Koblenz-Landau. In his career, he also served at Microsoft Corp., Free University of Amsterdam, Dutch Center for Mathematics and Computer Science (CWI), and University of Rostock. Ralf Lämmel is generally interested in the combination of software engineering and programming languages. Together with the other tutorial speakers and further researchers, he is one of the founding fathers of the SLE conference. He is one of the founding fathers of the summer school series GTTSE--Generative and Transformational Techniques on Software Engineering.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Content&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The tutorial will be divided in various parts introducing first the key issues relative to modeling heterogeneous software language artifacts, then presenting the conceptual framework for mega-modeling, and finally examples of application in different technical spaces.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Provisional outline&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Introduction and objectives (5’) &lt;/li&gt;&lt;li&gt;Technical Spaces and Software Languages (5’) &lt;/li&gt;&lt;li&gt;Megamodeling fundamentals (10’) &lt;/li&gt;&lt;li&gt;Application to Grammarware (10’) &lt;/li&gt;&lt;li&gt;Application to Ontologyware (10’) &lt;/li&gt;&lt;li&gt;Application to Modelware (10’) &lt;/li&gt;&lt;li&gt;Synthesis and conclusion (10’)&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Relevance to GPCE/SLE attendees&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Because of its emphasis of software language artifacts, this tutorial should be of interest to SLE attendees. Compilers, transformations and generators being extensively used in generative programming the tutorial should also attract GPCE attendees. We believe that providing a conceptual and unified approach for mega- modeling and showing its application across various technical spaces could improve cross fertilization between communities.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-6894759770748746344?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/6894759770748746344/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/09/megamodeling-software-language.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/6894759770748746344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/6894759770748746344'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/09/megamodeling-software-language.html' title='(Mega)modeling Software Language Artifacts'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-7603187914878764074</id><published>2010-09-12T16:43:00.016+02:00</published><updated>2010-09-13T00:46:59.994+02:00</updated><title type='text'>The essence of "The essence of functional programming"</title><content type='html'>&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;If "code is the essence", then this blog post is concerned with the essence of "The essence of functional programming" --- because the post matches a code distribution that is derived from P. Wadler's paper of just that title. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The code distribution has two branches: "&lt;i&gt;origin&lt;/i&gt;" --- where it indeed stays close to the original code of the paper, and "&lt;i&gt;overhaul&lt;/i&gt;" --- where it uses the Haskell's monad/monad transformer library to show some of the examples in modern style. This code has been initially prepared for a Channel9 lecture about monads. The code is available through the SourceForge project &lt;a href="http://developers.sourceforge.net/"&gt;developers&lt;/a&gt;; browse the code &lt;a href="http://developers.svn.sourceforge.net/viewvc/developers/repository/ralfs-channel9-lectures/code/monads/"&gt;here&lt;/a&gt;; see the slide deck for the Channel9 lecture &lt;a href="http://developers.svn.sourceforge.net/viewvc/developers/repository/ralfs-channel9-lectures/decks/monads.pdf"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Here is a more complete reference to Wadler's paper:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;P. Wadler: &lt;i&gt;The essence of functional programming&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://doi.acm.org/10.1145/143165.143169"&gt;http://doi.acm.org/10.1145/143165.143169&lt;/a&gt;&lt;/div&gt;&lt;div&gt;POPL 1992&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Henceforth, we refer to this paper as "the paper".&lt;/div&gt;&lt;div&gt;Recovery and modularization effort due to Ralf Lämmel.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;Disclaimer&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The code distribution has not been approved, in any form, by the original author (P. Wadler). The author of the code distribution (R. Lämmel) takes all responsibility for any imprecision or misconception of this recovery and elaboration effort. Comments are welcome, as usual. Also, the particular way of distributing (modularizing) the code by means of heavy cpp usage is not meant to suggest any useful style of functional programming. It is merely used as a convenience for organizing the code such that code reuse is explicitly captured.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;The paper's code vs. this code distribution&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The branch "&lt;i&gt;origin&lt;/i&gt;" is meant to stay close to the code in the paper. In particular, Haskell's monad (transformer) library is used only in branch "&lt;i&gt;overhaul&lt;/i&gt;". We identify the following deviations (in branch "&lt;i&gt;origin&lt;/i&gt;"):&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Most importantly, the original paper did not organize the code in any way that would explicitly represent code reuse. In contrast, the code distribution leverages cpp to this end. This approach may be viewed as an ad-hoc cpp-based product-line-like approach.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;We use the type class Show for "showing" values and for "getting out of the monads".&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;We added a few samples; they are labeled with code comments.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Minor forms of name mangling and refactoring are not listed here.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;We renamed a few operators to better match the current Haskell library:&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;unit...&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;-&gt; return&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;bind...&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;-&gt; (&gt;&gt;=)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;error...&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;-&gt; fail&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;zero...&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;-&gt; mzero&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;plus...&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;-&gt; mplus&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;out...&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;-&gt; tell&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;How to understand and run the code?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One should probably have modest knowledge of monads. For instance, one may read &lt;i&gt;the paper&lt;/i&gt;. The easiest approach towards understanding the code distribution is to study the final interpreters in subdirectory "cache". (These interpreters were assembled from pieces, but this may be less important initially.) With two exceptions, these are all complete Haskell 98 programs (modulo &lt;i&gt;TypeSynonymInstances&lt;/i&gt; and &lt;i&gt;FlexibleInstances&lt;/i&gt; for the sake of Show) with a main function with test cases corresponding to the samples in the paper. The interpreters correspond to scenarios in the paper, and there is a corresponding comment at the beginning of each file to identify relevant sections in the paper. A complete list of all interpreters follows below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you want to better understand the structure of the interpreters and their relationships, you may want to have a look at the primary sources that are preprocessed via cpp. Each interpreter is assembled through cpp #includes; see the files in subdirectory "templates".  A more profound description of our ad-hoc cpp-based product-line-like approach follows below.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;List of interpreters in the order of occurrence in the paper&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Baseline.hs&lt;/b&gt;: This is a non-monadic, CBV interpreter. This is the (non-monadic) baseline for all experiments. That is, we will turn this interpreter into monadic style, instantiate the monad parameter, perform data extensions and selective code replacements. We will also vary CBV vs. CBN, and we will use CPS eventually.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;CBV.hs&lt;/b&gt;: This is the scheme of a monadic-style CBV intepreter. This file is incomplete as it lacks a concrete monad. (Don't run this file.) Some of the following interpreters complete this scheme. Such completion typically involves data extension and selective code replacement.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Identity.hs&lt;/b&gt;: This is CBV.hs completed by the identity monad.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Errors.hs&lt;/b&gt;: This is an interpreter with error messages. To this end, we instantiate the monad parameter of our monadic-style CBV interpreter with the error monad, and we apply selective code replacement so that error messages are actually thrown by the interpreter.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Positions.hs&lt;/b&gt;: This is an elaboration of Errors.hs so that position information is maintained and accordingly used in the error messages.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;State.hs&lt;/b&gt;: This is an interpreter with a reduction count for function applications including additions. To this end, we instantiate the monad parameter with the state monad, where the state models the reduction count. We also need to apply selective code replacement so that function applications are actually counted. We also perform a data extension to provide a language construct for reading the reduction count within the interpreted language.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Output.hs&lt;/b&gt;: This is an interpreter with output. To this end, we instantiate the monad parameter with the writer monad, so that output is aggregated as a string. We also perform a data extension to provide a language construct for producing output within the interpreted language.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Nondeterminism.hs&lt;/b&gt;: This is an interpreter with non-deterministic choice. To this end, we instantiate the monad parameter with the list monad, so that nondeterminism is modeled with a multiplicity of result values. We also perform a data extension to provide language constructs for the failing computation (that produces the empty list of results) and for nondeterministic choice, indeed.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Backwards.hs&lt;/b&gt;: This is a variation on State.hs with backwards propagation of state.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;CBN.hs&lt;/b&gt;: This is the scheme of a monadic-style CBN interpreter. This file is incomplete as it lacks a concrete monad. (Don't run this file.) Some of the following interpreters complete this scheme.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;StateCBN.hs&lt;/b&gt;: This is a variation on State.hs with CBN.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;NondeterminismCBN.hs&lt;/b&gt;: This is a variation on Nondeterminism.hs with CBN.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;CPS.hs&lt;/b&gt;: This is a non-monadic, CBV and CPS interpreter.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Callcc.hs&lt;/b&gt;: This is a monadic-style interpreter (CBV) that uses the continuation monad to provide "call with current continuation" (callcc). We perform a data extension to provide callcc as a language construct within the interpreted language.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;ErrorsCPS.hs&lt;/b&gt;: This is a variation on Errors.hs which leverages the continuation monad and uses the Answer type to plug errors into the interpreter.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;StateCPS.hs&lt;/b&gt;: This is a variation on State.hs which leverages the continuation monad and uses the Answer type to plug state into the interpreter.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Code organization of the distribution&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Directories:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;cache&lt;/i&gt;: ready-to-run interpreters&lt;/li&gt;&lt;li&gt;&lt;i&gt;templates&lt;/i&gt;: cpp templates for interpreters&lt;/li&gt;&lt;li&gt;&lt;i&gt;monads&lt;/i&gt;: monads used in the interpreters&lt;/li&gt;&lt;li&gt;&lt;i&gt;types&lt;/i&gt;: syntactic and semantic domains&lt;/li&gt;&lt;li&gt;&lt;i&gt;functions&lt;/i&gt;: functions making up the interpreters&lt;/li&gt;&lt;li&gt;&lt;i&gt;terms&lt;/i&gt;: sample terms for the interpreters&lt;/li&gt;&lt;li&gt;&lt;i&gt;baselines&lt;/i&gt;: interpreter outputs for regression testing&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Some types and functions require variation for the different monads and also in terms of the choice CBV vs. CBN. The subdirectory cba (read as call-by-"any") hosts definitions that are shared by CBV, CBN, and CPS. (Here, we should note that the CPS experiments use CBV (not CBN).) Within directories &lt;i&gt;types&lt;/i&gt; and &lt;i&gt;functions&lt;/i&gt;, the subdirectories cbv and cbn host definitions specific to CBV or CBN respectively. Monad-specific variations are hosted in yet deeper subdirectories with the (one-letter) name of the corresponding monad; see, for example, &lt;i&gt;functions/cbv/E&lt;/i&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Comments and questions and contributions welcome.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ralf&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-7603187914878764074?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/7603187914878764074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/09/essence-of-essence-of-functional.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/7603187914878764074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/7603187914878764074'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/09/essence-of-essence-of-functional.html' title='The essence of &quot;The essence of functional programming&quot;'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-7597409693027316426</id><published>2010-09-10T16:42:00.010+02:00</published><updated>2010-09-11T05:56:37.880+02:00</updated><title type='text'>Bulk mailing for your conferences not appreciated</title><content type='html'>Dear Dr. Nagib Callaos,&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;For some years now, my mailbox is flooded by CFPs for your many conferences such as WMSCI 2011 (for which you are General Chair etc.). My email address is rlaemmel@gmail.com. Please remove me from your bulk mailing system. (I have tried your instructions for unsubscribing in the past, obviously, w/o success.)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Keep up the &lt;a href="http://news.bbc.co.uk/2/hi/americas/4449651.stm"&gt;good work&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Thanks,&lt;/div&gt;&lt;div&gt;Ralf Lämmel&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;PS: It is not easy to set up a mail filter that addresses this problem reliably over the years. Or does anyone have an idea as to how to stretch gmail's filter mechanism? I can think of a rule that checks whether a) we face a CFP or some other form of conference ad, and b) certain keywords (names) occur on the website of the conference. Now, gmail, please provide us with that expressiveness :-)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-7597409693027316426?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/7597409693027316426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/09/bulk-mailing-for-your-conferences-not.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/7597409693027316426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/7597409693027316426'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/09/bulk-mailing-for-your-conferences-not.html' title='Bulk mailing for your conferences not appreciated'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-3956423283994957464</id><published>2010-08-24T18:42:00.007+02:00</published><updated>2010-08-31T17:03:01.135+02:00</updated><title type='text'>A bunch of interpreters using CPP and Haskell</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This text is about the code distribution that you find &lt;a href="http://developers.svn.sourceforge.net/viewvc/developers/repository/ralfs-channel9-lectures/code/interpretation/"&gt;here&lt;/a&gt; (@ SourceForge project &lt;a href="http://developers.sourceforge.net/"&gt;developers&lt;/a&gt;).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Released: 24 Aug 2010&lt;/div&gt;&lt;div&gt;Last updated: 31 Aug 2010&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We walk through the evolution of a simple interpreter. This exercise is meant to explore functional programming in the context of language interpreters. We start from a trivial language which can generate natural numbers. Step by step, we add some language constructs that make us deal with partiality of interpretation, type tests, a binding mechanism, and different forms of recursion.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;None of these evolution steps are particularly advanced. The contribution of this code distribution lies more in the pedagogical style of making simple, well-understood extensions, and reflecting on the functional programming issues that pop up as well as the code-level organization and reusability that is achievable. (For the actual reflection, I recommend the upcoming Channel9 lecture on language interpretation that will use some part of the code base.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The interpreters are programmed in a naive denotational style. We do not use monads for modularization until somewhat late in the exercise. Also, we do not make any effort to add language constructs in a type-safe, modular way (c.f., the Expression Problem). Instead, we use CPP to incrementally extend the interpreter; we also subdivide the interpreters into chunks of code so that we can reuse and replace chunks (files) selectively along evolution. Arguably, we use low level techniques for setting up a kind of product line for simple interpreters.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:large;"&gt;&lt;b&gt;Code organization&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Each interpreter is subdivided into code units as follows:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Imports: any imports needed to use Haskell's library.&lt;/li&gt;&lt;li&gt;Syntax: the algebraic datatype for the abstract syntax.&lt;/li&gt;&lt;li&gt;Value: the designated domain for the types of results.&lt;/li&gt;&lt;li&gt;Domains: other types used by the interpreter.&lt;/li&gt;&lt;li&gt;Interpreter: the semantic function (the interpreter).&lt;/li&gt;&lt;li&gt;Algebra: composition functions for semantic meanings.&lt;/li&gt;&lt;li&gt;Library: reusable, auxiliary functions for the interpreter.&lt;/li&gt;&lt;li&gt;Locals: not so reusable auxiliary functions.&lt;/li&gt;&lt;li&gt;Test: any code needed for testing the interpreter.&lt;/li&gt;&lt;li&gt;Main: the main function for testing the interpreter.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;Running the stuff&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The code is available from &lt;a href="http://developers.sourceforge.net/"&gt;SourceForge&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Contributions are welcome.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;All interpreters are readily cached in subdirectory Haskell/src/cache.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can rebuild and test all this stuff very easily if you have:&lt;/div&gt;&lt;div&gt;- ghc(i) (tested with version 6.10.4)&lt;/div&gt;&lt;div&gt;- gcc cpp (tested with version 4.2.1)&lt;/div&gt;&lt;div&gt;- make (tested with GNU Make 3.81)&lt;/div&gt;&lt;div&gt;Go to subdirectory "Haskell/src" and type in "make".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;CPP is used to glue together the interpreters from the code units.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;Description of the versions of the interpreter&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;0-ConstAdd: This is an evaluator for Const/Add expressions. (If you have seen the C9 lecture on the Expression Problem, this option only serves as a reminder that we have already dealt with interpreters back then.)&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;1-ZeroSucc: Let's pick a trivial starting point for interpretation. This language has a constant operation, Zero, and the successor operation, Succ. This is the basis for Peano-like natural numbers. Semantically, we represent natural numbers through Haskell's Ints. Hence, this tiny interpreter allows us to build Haskell Ints from Peano's Zero and Succ. That's nothing short of impressive. :-)&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;2-ZeroSuccPred: So far, our interpreter was a total function (assuming non-bottom arguments). We add a predecessor construct to the abstract syntax. Since our (intended) semantic domain is natural numbers, our interpreter function gets partial in this manner. That is, we need to rule out that we compute the predecessor of zero. We need to rewrite existing equations and use "partial function application" all over the place.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;3-NB: We add a few more primitives to the interpreter: operations for Booleans. In fact, we arrive at the NB language of Pierce's TAPL (except that we leave out False and True (because they can be expressed already (as you may want to show))). This step of evolution adds something new insofar that we start to consider different result types. Hence, we need to perform partial projections on results, if some operation of the interpreter requires a certain type. (For instance, the successor operation is only applicable to natural numbers.) In principle, NB also brings up typing, but we do not get into issues of static semantics/typing here.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;4-Lambda: We add the lambda calculus to NB. Adopting common terminology, our composed beast is best called an applicative lambda calculus. We are ready for functional programming now. (We are Turing complete, too, for what it matters.) For instance, we can define recursive, arithmetic operations. To this end, we leverage the CBV fixed-point operator which is representable as a lambda expression.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;5-Letrec: We add a recursive let construct to the applicative lambda calculus. This is a minor extension in terms of interpreter design. That is, it is a straightforward data extension---we do not leave the ground of our current semantic model. Conceptually, this is an interesting extension though because we can now define proper nested, recursive bindings. Our Turing-complete language gets closer to a proper functional programming language. In fact, this is as much expressiveness as we get. The two remaining versions of the interpreter only vary style of its definition.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;6-Monads: The signature of the interpreter function involves partiality (c.f., Maybe Value) and environment passing (Env -&gt; ...). The actual interpreter involves considerable plumbing to deal with partiality and environment passing.  This makes it hard to focus on the core meaning of the interpreter's equations. We migrate to monadic style to raise the level of abstraction, and to make parts of the interpreter more oblivious to partiality and environment passing, where possible. We compose the required monad through monad transformation---using a Maybe and a Reader transformer on top of the identity monad. (Arguably, one may object to the use of the reader monad for environment passing. The resulting semantics of lambda abstraction shows the difficulty of using the monad.)&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;7-Bananas: Finally, we separate recursion of the interpreter from the actual algebra of meanings of constructs. In this manner, we clarify the intention of compositionality for such a denotational-style interpreter. Also, this step presents the generalization of folding that is established for lists, which however can also be used for domain-specific algebraic datatypes such as types of abstract syntaxes.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Comments and questions and contributions welcome.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ralf&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;PS: This is not rocket science, but it may be pretty useful in teaching interpretation and executable semantics and functional programming, no?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-3956423283994957464?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/3956423283994957464/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/08/bunch-of-interpreters-using-cpp-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/3956423283994957464'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/3956423283994957464'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/08/bunch-of-interpreters-using-cpp-and.html' title='A bunch of interpreters using CPP and Haskell'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-8884358118595951867</id><published>2010-08-06T18:35:00.009+02:00</published><updated>2010-08-10T18:34:22.013+02:00</updated><title type='text'>Lecture series on advanced (functional) programming concepts</title><content type='html'>&lt;div&gt;[&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Added 10 Aug 2010: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is the link to the first lecture's video: "&lt;a href="http://channel9.msdn.com/shows/Going+Deep/C9-Lectures-Dr-Ralf-Laemmel-Advanced-Functional-Programming-The-Expression-Problem/"&gt;The Expression Problem&lt;/a&gt;".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;If you are a programming nerd or something of a similar species, you may know of C9 Lectures at &lt;a href="http://channel9.msdn.com/tags/C9+Lectures"&gt;http://channel9.msdn.com/tags/C9+Lectures&lt;/a&gt;. Several of the lectures are given by &lt;a href="http://research.microsoft.com/en-us/um/people/emeijer/"&gt;Erik Meijer&lt;/a&gt; who has turned many chapters of &lt;a href="http://www.cs.nott.ac.uk/~gmh/"&gt;Graham Hutton&lt;/a&gt;'s book "&lt;a href="http://www.cs.nott.ac.uk/~gmh/book.html"&gt;Programming in Haskell&lt;/a&gt;" into videos. In my recent, recorded lecture on "&lt;a href="http://www.uni-koblenz.de/~laemmel/paradigms0910/"&gt;Programming Paradigms and Formal Semantics&lt;/a&gt;", I also incorporated Graham's text, but you should really watch Erik's lectures, if you haven't---they are more fun. I am inspired by his ability to present relatively simple content in such a crisp, insightful, and enjoyable manner.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the aforementioned lecture, I covered all kinds of "crazy stuff" though, and in the end, I had to deliver body bags to my Bachelor students---in the form of a radically simple examination. Thanks a lot btw to @grammarware for helping with this matter. Thanks a lot to my students who coped with this deadly mix of process algebra, semantics, Haskell, constraints, type systems, and what have you. Some of the topics from the lecture may be of interest though to advanced programming nerds (and similar species), and this is where this post fits in.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Based on an ECOOP 2010 tutorial proposal, which was never implemented, Charles Torre (@C9, &lt;a href="http://channel9.msdn.com/shows/This+Week+On+Channel+9/This-Week-on-C9-Charles-Torre-on-camera-C9-turns-5-and-lots-of-freebies/"&gt;this&lt;/a&gt; is how he looks like) and Erik Meijer suggested in January 2010 that I could do a few &lt;i&gt;C9 Lectures on advanced (functional) programming concepts&lt;/i&gt;. So the idea would be to dive deeper into subjects that were introduced in Graham's chapters, and to generally include some advanced subjects, also possibly related to the tension between mainstream programming and Haskell programming. Well, this sounded cool!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It took me some time to come up with a concept that is hopefully useful for both---the community, say developers or CS students who want to dive deeper into programming, and me who wants to aggregate and improve material that helps with my general occupation in academic and industrial research and education.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Perhaps I have figured out an option.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;What this bunch of lectures will &lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;not&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt; be like:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;A detailed Haskell programming tutorial.&lt;/li&gt;&lt;li&gt;An otherwise technology-centric discussion.&lt;/li&gt;&lt;li&gt;A totally Haskell-centric lecture series.&lt;/li&gt;&lt;li&gt;A never-ending lesson in Greek (Math).&lt;/li&gt;&lt;li&gt;An otherwise academic discussion.&lt;/li&gt;&lt;li&gt;A &lt;i&gt;pure&lt;/i&gt; functional programming story.&lt;/li&gt;&lt;li&gt;An OO bashing series.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;Here is what I will try to cover:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;Advanced&lt;/i&gt; topics in functional/OO programming.&lt;/li&gt;&lt;li&gt;&lt;i&gt;Properties&lt;/i&gt; of programs such as modularity or purity.&lt;/li&gt;&lt;li&gt;Composition of programs from function &lt;i&gt;combinators&lt;/i&gt;. &lt;/li&gt;&lt;li&gt;&lt;i&gt;Multi-paradigm&lt;/i&gt; programming (functions, objects, predicates).&lt;/li&gt;&lt;li&gt;&lt;i&gt;Software Language Engineering&lt;/i&gt; (incl. language processing). &lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;The first few lectures&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Let's begin the series with the &lt;a href="http://en.wikipedia.org/wiki/Expression_Problem"&gt;Expression Problem&lt;/a&gt; because it connects OOP and FP ingeniously; it helps understanding pattern matching, dispatch, function application, encapsulation in a combined fashion that complements established means of introducing those subjects in isolation. In this lecture, I don't present &lt;i&gt;solutions&lt;/i&gt; to the problem---because they are too hard and too idiosyncratic. I rather present &lt;i&gt;non-solutions&lt;/i&gt; because they are insightful and make you ask for more (I hope). See the slide deck &lt;a href="http://developers.svn.sourceforge.net/viewvc/developers/repository/ralfs-channel9-lectures/decks/xproblem.pdf"&gt;here&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Let's continue with a lecture on Haskell's type classes. Thereby, we cover one of Haskell's supernatural powers. Again, I am not describing type classes in the manner of a language manual; I rather demonstrate a few of the mechanisms that are supported by type classes; I will also discuss a bit the underlying principles. For instance, type classes allow us to solve the expression problem like a charm, and to also address several sophistications thereof. It will take a while until C# and Java are on par with type classes. See the slide deck &lt;a href="http://developers.svn.sourceforge.net/viewvc/developers/repository/ralfs-channel9-lectures/decks/typeclasses.pdf"&gt;here&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;I will discuss language interpretation because it is such a fundamental subject in computer science and programming that also allows us to deeply understand some properties and styles of functional programming. Unfortunately, language interpretation is often obfuscated by academic style of presentation---as if it was something purely mathematical. So this will be the challenge for me to find many advanced Java and .NET programmer who say in the end that language interpretation is a "must-know". &lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;More keywords:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Effects (monads)&lt;/li&gt;&lt;li&gt;Continuations&lt;/li&gt;&lt;li&gt;Algebraic structures (e.g., monoids)&lt;/li&gt;&lt;li&gt;Parallelism (e.g., MapReduce)&lt;/li&gt;&lt;li&gt;Genericity (e.g., "Scrap your boilerplate")&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For the rest of the lectures, please see C9 or follow-up posts on my blog. I have started to upload decks and code for lectures to the open-source project &lt;a href="https://sourceforge.net/projects/developers/"&gt;https://sourceforge.net/projects/developers/&lt;/a&gt;. You can browse the SVN repository and download files &lt;a href="http://developers.svn.sourceforge.net/viewvc/developers/repository/ralfs-channel9-lectures/"&gt;here&lt;/a&gt;. If everything goes as planned, then the first video will go live at C9 somewhere next week. &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I am really excited to work on a lecture series like this because I feel that it allows me to focus on non-trivial, conceptual stuff. This is a welcome break from the typical Bachelor-level lecture where I am supposed to go slowly so that "no student is left behind". In the present lecture series, I enjoy the privilege of diving deep into concepts, and I assume that folks will figure out many details for themselves. I inject riddles into the lectures here and there; some of them are incredibly hard, but you will figure out I hope, and you will gain understanding no matter what---even if the riddles are too hard (perhaps infeasible) in the end. Enjoy, and please let me know how I can improve the concept of the lecture series within the implicit and explicit bounds that I described above.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Thanks,&lt;/div&gt;&lt;div&gt;Ralf&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-8884358118595951867?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/8884358118595951867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/08/lecture-series-on-advanced-functional.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8884358118595951867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8884358118595951867'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/08/lecture-series-on-advanced-functional.html' title='Lecture series on advanced (functional) programming concepts'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-8482284802607573624</id><published>2010-06-11T13:11:00.003+02:00</published><updated>2010-06-11T14:57:15.868+02:00</updated><title type='text'>Software adaptation in Koblenz in Sep --- Summer School</title><content type='html'>&lt;div&gt;Please spread the message.&lt;/div&gt;&lt;div&gt;Looking forward the 1st ADAPT Summer School.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Regards,&lt;/div&gt;&lt;div&gt;PF&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;CALL FOR PARTICIPATION  :  ADAPT 2010&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1st ADAPT Summer School&lt;/div&gt;&lt;div&gt;September 26 - October 2, 2010, Koblenz, Germany&lt;/div&gt;&lt;div&gt;&lt;a href="http://adapt.uni-koblenz.de/summerschool2010"&gt;http://adapt.uni-koblenz.de/summerschool2010&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Software adaptation is a topic that crosscuts much of software engineering, programming languages, information systems, formal methods, and other major areas of computer science. The CS department at the University of Koblenz-Landau engages in a research focus on software adaptation, and thereby connects scientists and teams in classical areas of computer science as much as application areas such as web-based systems, SOA, mobile systems, and robotics. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;ADAPT 2010 is the first edition in a series of summer schools on software adaptation. The program of ADAPT 2010 appeals to PhD students and possibly specialized Master's students in computer science.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-8482284802607573624?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/8482284802607573624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/06/software-adaptation-in-koblenz-in-sep.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8482284802607573624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8482284802607573624'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/06/software-adaptation-in-koblenz-in-sep.html' title='Software adaptation in Koblenz in Sep --- Summer School'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-4646533700732493595</id><published>2010-03-31T22:21:00.018+02:00</published><updated>2010-04-04T16:31:43.367+02:00</updated><title type='text'>A solution to the Halting problem</title><content type='html'>&lt;div&gt;[ This is not about this &lt;a href="http://en.wikipedia.org/wiki/Halting_problem"&gt;Halting problem&lt;/a&gt;. ]&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;The Halting problem&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The problem is how to halt execution of Ali Hussain Sibat. I cite &lt;a href="http://edition.cnn.com/2010/WORLD/meast/03/31/saudi.arabia.sorcery/"&gt;CNN as of 31 March 2010&lt;/a&gt;: "A Lebanese man charged with sorcery and sentenced to death in Saudi Arabia is scheduled to be beheaded on Friday [PF: 2 April] the man's lawyer said Wednesday [PF: 31 March]." Amnesty International has reported about this case on 8 Dec 2009 [&lt;a href="http://www.amnesty.org/en/library/info/MDE23/036/2009/en"&gt;Article from the Amnesty International Website&lt;/a&gt;]. I became aware of the case by &lt;a href="http://edition.cnn.com/2010/WORLD/meast/03/19/saudi.arabia.sorcery/"&gt;CNN's article on 19 Mar 2010&lt;/a&gt;. &lt;b&gt;Update&lt;/b&gt;: &lt;a href="http://edition.cnn.com/2010/WORLD/meast/04/01/saudi.arabia.sorcery/"&gt;CNN reported on Thursday, 1 April 2010&lt;/a&gt; that Sibat "won't face beheading Friday [PF: 2 April], his lawyer said Thursday [PF: 1 April]".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;The solution to the Halting problem&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I am pretty sure that Sibat's lawyer, his family, Amnesty International, Lebanese government and many other individuals and organizations are working frantically to stop the beheading. Here is an &lt;a href="http://www.PetitionOnline.com/lksadcdc/petition.html"&gt;online petition&lt;/a&gt; that I ask you to sign if you agree with me that sorcery does not qualify for the death penalty. It takes a lot of public outcry to solve this Halting problem. This is what I call a solution: a) beheading does not take place + b) the public outcry, also with the contribution of the informed and outspoken online society, made a difference.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Update&lt;/b&gt;: I have meanwhile (11pm CEST, 1 April 2010) contacted the Saudi Embassy in Germany, and brought the petition to their attention. I also asked them to pass on the information to the Saudi Ministry of Justice whose email address / fax address is not available on the web. I will sent an update once the petition reaches 1000 signatures and then again for 10.000 signatures.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Update&lt;/b&gt;: Join this &lt;a href="http://www.facebook.com/?ref=home#!/group.php?gid=106683049355688&amp;amp;ref=nf"&gt;Facebook group&lt;/a&gt; which fights for the same cause. This group is growing rapidly and it is great information centre on Sibat's case, when compared to my humble blog post. The group endorses the petition.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Disclaimer&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;Please note that the petition and this post do not attempt to make any general statement about Saudi Arabia or Lebanon, their  juridical systems or governments (Saudi Arabia's, in particular), about &lt;span class="Apple-style-span" style="font-weight: normal; "&gt;&lt;b&gt;Sharia, &lt;/b&gt;&lt;b&gt;Islam, or you name it.&lt;/b&gt; Instead the petition and this post is concerned with the specific case of Ali Hussain Sibat and with the charge and death penalty in this case in particular.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;A personal note: I condemn with my whole authority the charge and the punishment in question on the grounds of information provided by Amnesty International and CNN reporters modulo personal judgement.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Privacy issues&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;You are only required to share your email address with PetitionsOnline. Their privacy rules are such that they do not share these email addresses with anyone for whatever reason. PetitionsOnline only uses the email addresses for some forms of validation. If you decide to share your email address with me (the petition's initiator), I will not share your email addresses with anyone for whatever reason. The primary purpose of the petition is to be online and allow us to refer the target of the petition to it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.PetitionOnline.com/lksadcdc/petition.html"&gt;http://www.PetitionOnline.com/lksadcdc/petition.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Thanks to everyone who has signed already.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Thank you&lt;/div&gt;&lt;div&gt;Ralf Lämmel&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-4646533700732493595?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/4646533700732493595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/03/solution-to-halting-problem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/4646533700732493595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/4646533700732493595'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/03/solution-to-halting-problem.html' title='A solution to the Halting problem'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-2408389643714199883</id><published>2010-03-28T21:07:00.003+02:00</published><updated>2010-03-28T21:22:26.343+02:00</updated><title type='text'>Proprietary hardware jokes</title><content type='html'>&lt;div&gt;Suppose you own a 2007 model of the then-cutting-edge, high-end laptop of a given brand A with say 4 GB of Ram, an 2.4 GHz Intel Core 2 Duo. Further suppose you want to purchase the current display offering of the same brand (available since Oct 2008), wouldn't you expect to be able connecting both expensive pieces of hardware without yet further investment, say without purchasing a converter that's not even available from brand A? Of course, I should get a 2010 model of an A-branded laptop, and everything works fine until I guess 2011, when they replace the Mini DisplayPort by say a new "Nano DVI port".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Suppose you are very happy with the display, the computing power, the browser speed of your lovely smartphone, again from the same brand A. Occasionally, you would like to write some longer emails or edit online documents, or ride on a wave, for which it would make terribly sense to have an external keyboard. Technically, it is trivial to enable this through bluetooth, unless brand A decides to cripple the bluetooth driver specifically, in which case you can always buy the new iPad-like device of brand A, for which a keyboard is available (unless you are living in Europe, where you can't purchase that device yet).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;PF&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-2408389643714199883?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/2408389643714199883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/03/proprietary-hardware-jokes.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/2408389643714199883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/2408389643714199883'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/03/proprietary-hardware-jokes.html' title='Proprietary hardware jokes'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-1990496508705337057</id><published>2010-02-25T02:12:00.018+01:00</published><updated>2010-03-03T00:41:16.506+01:00</updated><title type='text'>Our corpus is your corpus.</title><content type='html'>&lt;div&gt;[ Here is &lt;a href="https://svn.uni-koblenz.de/laemmel/p3p/"&gt;our P3P corpus&lt;/a&gt;, be it your corpus as well. ]&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Giving away your corpus (in &lt;i&gt;empirical language analysis&lt;/i&gt; or elsewhere) is perhaps nothing extremely established, but it's nothing original or strange either. It does make sense a lot! &lt;b&gt;Stop limiting the impact of your research efforts! Stop wasting the time of your community members!&lt;/b&gt; Sharing corpora is one of these many good ideas of Research 2.0: see &lt;a href="http://www1.in.tum.de/static/sse10/"&gt;SSE'10&lt;/a&gt; (and &lt;a href="http://www1.in.tum.de/static/sse10/index.php/past-events"&gt;friend events&lt;/a&gt;), &lt;a href="http://blogs.msdn.com/escience/"&gt;eScience&lt;/a&gt; @ Microsoft, &lt;a href="http://planet-research20.org/r2ose2010"&gt;R2oSE&lt;/a&gt;, ... &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;Computer Science vs. Science&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;When you do academic CS research in programming- or software development-related contexts&lt;/i&gt;, then the culture of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; is these days such that you are often expected to provide online access to your program, application, library, tool, what have you as an implementation or illustration. There are various open-source repositories that are used to this end--as a backend (a storage facility), but any sort of author-hosted download locations are also used widely. In basic terms, &lt;b&gt;&lt;i&gt;if you write a paper, you include a URL&lt;/i&gt;&lt;/b&gt;. (There is one exception: if your work leverages Haskell, you can usually include the complete source code right into your paper so that one gets convenient access through copy and paste. Sorry for the silly joke.) Metadating-wise, common practice is nowhere perfect, but it's perfect compared to what follows.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;When you do empirical analysis in CS, which results in some statements or data about software/IT artifacts&lt;/i&gt;, then the culture of validation is essentially the one of &lt;i&gt;&lt;a href="http://en.wikipedia.org/wiki/Science"&gt;science&lt;/a&gt;&lt;/i&gt;. In particular, &lt;b&gt;&lt;i&gt;reproducibility&lt;/i&gt;&lt;/b&gt; is the crucial requirement. You describe the methodology of your analysis in a detailed manner. So you define your hypotheses, your input, your techniques for measurement, your results (which you also interpret), your threats to validity, what have you. &lt;i&gt;&lt;b&gt;Downloads aren't integral with science&lt;/b&gt;&lt;/i&gt;. What would you want to download anyway? &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Message of this post?!&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I suggest that various artifacts of an empirical analysis in CS, in general; in empirical &lt;i&gt;language&lt;/i&gt; analysis, in particular, qualify for a valuable download. In this post, I want to call out the &lt;b&gt;&lt;i&gt;corpora&lt;/i&gt;&lt;/b&gt; (as in corpora of source projects, buildable projects, built projects, runnable projects, ran projects, demos, etc.).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;Beyond reproducibility in CS&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;What's indeed not yet commonplace (if done ever) is that the corpora underlying empirical analyses are given &lt;b&gt;&lt;i&gt;convenient access&lt;/i&gt;&lt;/b&gt; to. Consider for example &lt;a href="http://doi.acm.org/10.1145/1167515.1167507"&gt;Baxter et. al's paper&lt;/a&gt; on structural properties of Java software, or &lt;a href="http://lorrie.cranor.org/pubs/p3p-deployment.html"&gt;Cranor et al.'s paper&lt;/a&gt; on P3P deployment. These are two seminal papers in their fields. I would loose a night of sleep over each of the two corpora.&lt;/div&gt;&lt;div&gt;&lt;i&gt;Wouldn't it be helpful for researchers if such corpora were made available for one-click download incl. useful metadata, potentially even tooling?&lt;/i&gt; Let's suppose such convenient access became a best practice. First, reproducibility would be improved. Second, derived research would be simplified. Third, incentives for collaboration would be added. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I contend that convenient access adds little pain for the original author, but adds huge value for the scientific community. Why should we need to execute the description of some corpus from some paper, if it requires substantial work for us, but the corpus would be easily shared by the primary author. Why should we work hard to "reproduce the corpus" if some little help by the original authors would make reproducibility (of the corpus and most of the research work, perhaps) a charm. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Naysayers -- get lost&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I can think of many reasons why 'convenient access' is not getting off the ground. Here are few obvious options:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;"&lt;i&gt;It's extra work, even if it is little extra work.&lt;/i&gt;" This problem can be solved if incentives are created. For instance, publications on empirical analysis with 'convenient access' to the corpus could be rated higher than those w/o. Also, just like tool papers in many venues, &lt;b&gt;&lt;i&gt;there could be corpus papers&lt;/i&gt;&lt;/b&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt; "&lt;i&gt;There is sufficient, inconvenient access available already.&lt;/i&gt;" At least, for one of the two examples above, I fully understand how I could go about gathering the corpus myself, but I have not executed this plan, even though I could really use this corpus in some ongoing research activity. It's just too much work for me. I am effectively hampered in benefitting from the authors' research beyond their immediate results.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;"&lt;i&gt;Provision of convenient access is too difficult.&lt;/i&gt;" Think of a corpus of Java programs. Suddenly, an access provider gets into the business of configuration management. After all, convenience would imply that the corpus builds and runs out of the box. I think the short-term answer is that access to the corpus w/o extra "out-of-the box" magic is still more convenient than no access. The long-term-answer is that we may need a notion of &lt;b&gt;&lt;i&gt;remote access to corpora&lt;/i&gt;&lt;/b&gt;, where I can give you access to my corpus in my environment, through appropriate, web-based or service-oriented interfaces.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;"&lt;i&gt;Convenient access gives a head start to the competition.&lt;/i&gt;" I refuse to believe that this is really too relevant in academic practice. For instance, I am sure that the research groups behind the above-mentioned papers have no "corpus monopoly" in mind. I have not done much work on empirical analysis, but I have experience with papers that "give away details", and I must say that those papers which give away the most typically coincide with those which have the highest impact in all possible ways.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;"&lt;i&gt;There is copyright &amp;amp; Co. in the way.&lt;/i&gt;" Yes, it is. &lt;b&gt;&lt;i&gt;This is a serious problem&lt;/i&gt;&lt;/b&gt;, and we better focus on solving the problem shortly, if we want to get anywhere with science and (IT) society in this age. This post will just explode if I tried to comment on that issue over here. There are many good ideas around on this issue, and we all understand that some amount of sharing works even now in this very imperfect world as we have it. If you are pro-Research 2.0, don't get bogged down by this red herring.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Well, I can think of quite a number of other reasons, but I reckon that all the usual suspects have been named, and everything else can be delegated perhaps to some discussion on this blog or elsewhere.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Regards,&lt;/div&gt;&lt;div&gt;Ralf Lämmel&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;PS: CS is of an age that empirical research is becoming viral and vital. I am grateful for talking to &lt;a href="http://megaplanet.org/jean-marie-favre/"&gt;Jean-Marie&lt;/a&gt; occasionally with his lucid vision of Research 2.0 and linguistics for software languages---two topics that are strongly connected. Empirical analysis of software languages has got to be an integral part of software language linguistics. Specialized software-engineering conferences like &lt;a href="http://planet-sl.org/"&gt;SLE&lt;/a&gt;, &lt;a href="http://www.program-comprehension.org/"&gt;ICPC&lt;/a&gt; and &lt;a href="http://www.msrconf.org/"&gt;MSR&lt;/a&gt; or even big ones like ICSE or OOPSLA include empirical research for a while now.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-1990496508705337057?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/1990496508705337057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/02/our-corpus-is-your-corpus.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/1990496508705337057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/1990496508705337057'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/02/our-corpus-is-your-corpus.html' title='Our corpus is your corpus.'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-5748239424957887951</id><published>2010-02-24T23:26:00.005+01:00</published><updated>2010-02-25T00:32:47.622+01:00</updated><title type='text'>An ambitious course on programming paradigms, semantics, and types</title><content type='html'>We have completed &lt;a href="http://www.uni-koblenz.de/~laemmel/paradigms0910/"&gt;this course&lt;/a&gt;.&lt;div&gt;I hope others find the design or some of the material helpful.&lt;/div&gt;&lt;div&gt;See more about reuse below.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;Coverage&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;- Parsing and interpretation in Prolog&lt;/div&gt;&lt;div&gt;- Basics of small-step and big-step semantics&lt;/div&gt;&lt;div&gt;- Basics of untyped and typed lambda calculi&lt;/div&gt;&lt;div&gt;- Introduction to Haskell&lt;/div&gt;&lt;div&gt;- Basics of denotational semantics&lt;/div&gt;&lt;div&gt;- Denotational semantics in Haskell&lt;/div&gt;&lt;div&gt;- Basics of static program analysis&lt;/div&gt;&lt;div&gt;- Static program analysis in Haskell&lt;/div&gt;&lt;div&gt;- OO programming in Haskell&lt;/div&gt;&lt;div&gt;- The Expression Problem&lt;/div&gt;&lt;div&gt;- Basics of Constraint-Logic Programming&lt;/div&gt;&lt;div&gt;- Basics of Process Algebra (CCS)&lt;/div&gt;&lt;div&gt;- ... a few more specialized lectures&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Characteristics &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;- English as the course language&lt;/div&gt;&lt;div&gt;- Slides, &lt;b&gt;videos&lt;/b&gt;, exercises available online publicly&lt;/div&gt;&lt;div&gt;- 42 hours (45mins each) of lectures over 4 months&lt;/div&gt;&lt;div&gt;- 12 programming-oriented, interactive labs&lt;/div&gt;&lt;div&gt;- Transparent scheme for &lt;a href="http://www.uni-koblenz.de/~laemmel/paradigms0910/resources/midterm.html"&gt;midterm&lt;/a&gt; and &lt;a href="http://www.uni-koblenz.de/~laemmel/paradigms0910/resources/final.html"&gt;final&lt;/a&gt; exam &lt;/div&gt;&lt;div&gt;- Heavy reuse of material from other courses&lt;/div&gt;&lt;div&gt;- Use of Twitter for notification and aggregation&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Experiences&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;This course is my only chance to tell &lt;i&gt;many&lt;/i&gt; students at my department about semantics, type systems, bits of interesting functional programming, declarative language processors, and sophisticated declarative methods such as process algebra or constraint-logic programming. Luckily there was a similar module in our curriculum, but I admit that I had to hijack this module a bit. (That is, the module is designed for the last semester of Bachelors, whereas the actual course is probably meant for Masters.) The students have complained in a friendly manner that the course is very heavy, but in return, I have designed the exam to be feasible for Bachelors. So everyone is happy: me because I could do loads of material and topics; the students because they receive unusual help in preparation for the exam. As to the content, students are relatively happy with the techniques that we studied---in particular because we are running the course in such a pragmatic mode, where we basically leverage Prolog and Haskell throughout---for every bit of type systems and semantics and programming concepts. In this manner, the CS students can improve the programming skills in paradigms and domains to which they used before. I also admit guilty by saying that there was no way of selling the formal details of many topics. (For instance, an attempt to do soundness proofs almost triggered a riot.) As to the use of twitter, it seems that not enough students were keen to use Twitter; so we had to continue using a newsgroup in parallel.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But again, I am confident that the design of such a course with broad coverage, low formal depth, but operational depth based on declarative programming and a transparent exam is an effective way of exposing Bachelor students (possibly some of them future Master students) to critically important foundations of computer science and modern programming techniques.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" font-weight: bold; font-size:large;"&gt;The future&lt;/span&gt;&lt;/div&gt;&lt;div&gt;I will mature the course next year.  I will be happy if others use the design of the course to some extent, or any specific material. Please note that more than half of the material is directly based on other people's work. I probably used 3 resources heavily, and about another 7 for some bits. Each non-original slide has credits on it in the header area. If you want to reuse anything, please let me know.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" font-weight: bold; font-size:large;"&gt;Acknowledgement&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.uni-koblenz.de/~zaytsev/"&gt;Vadim Zaytsev&lt;/a&gt; did an excellent job in running the lab and helping me to prepare the exam at the level of quality that we had in mind. It is good to have such a committed (emerging) declarative programmer next to you for a course like this! As to the reused material, detailed credits are online and on the slides, but I want to emphasize a few sources because of the degree of reuse and my admiration of their work: Hanne Riis Nielson and Flemming Nielson (for their book "&lt;a href="http://www.daimi.au.dk/~bra8130/Wiley_book/wiley.html"&gt;Semantics with Applications&lt;/a&gt;" with slides); &lt;a href="http://www.cs.nott.ac.uk/~gmh/"&gt;Graham Hutton&lt;/a&gt; (for his wonderful introduction to Haskell);  &lt;a href="http://parasol.tamu.edu/~jarvi/"&gt;Jaakko Järvi&lt;/a&gt; (for the slides of his mainly TAPL-based programming course).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Regards,&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;PF&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-5748239424957887951?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/5748239424957887951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/02/ambitious-course-on-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/5748239424957887951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/5748239424957887951'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/02/ambitious-course-on-programming.html' title='An ambitious course on programming paradigms, semantics, and types'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-5155573868477205035</id><published>2010-02-21T20:33:00.004+01:00</published><updated>2010-02-21T21:11:41.800+01:00</updated><title type='text'>Empirical Language Analysis</title><content type='html'>&lt;div&gt;We have been trying to understand the language &lt;a href="http://www.w3.org/P3P/"&gt;P3P&lt;/a&gt;. Ok, its pretty simple to say what it is. It's a small (domain-specific, non-executable) language for privacy policies and it's used by web sites and checked by user agents (potentially part of browsers). Arguably, understanding is limited if you look at online samples and syntax definition alone.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So we figured we had to &lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;understand usage of the language&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-style: normal; font-weight: normal; "&gt;&lt;b&gt;&lt;i&gt;in order to understand the language&lt;/i&gt;&lt;/b&gt;.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is the link to the paper:&lt;/div&gt;&lt;div&gt;&lt;a href="http://userpages.uni-koblenz.de/~laemmel/p3p/"&gt;http://userpages.uni-koblenz.de/~laemmel/p3p/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;Joint work with &lt;a href="http://www.uni-koblenz.de/~pek/"&gt;Ekaterina Pek&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Keywords:&lt;div&gt;&lt;ul&gt;&lt;li&gt;Software Language Engineering&lt;/li&gt;&lt;li&gt;Domain-Specific Languages&lt;/li&gt;&lt;li&gt;Empirical Analysis&lt;/li&gt;&lt;li&gt;Policy Languages&lt;/li&gt;&lt;li&gt;P3P&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;Abstract&lt;/b&gt;: &lt;span class="Apple-style-span" style="font-family: Times, serif; font-size: medium; "&gt;P3P is the policy language with which web sites declare the intended use of data that is collected about users of the site. We have systematically collected P3P-based privacy policies from web sites listed in the Google directory, and analysed the resulting corpus with regard to metrics and cloning of policies, adherence to constraints, coverage of the P3P language, and a number of additional properties of language usage. This effort helps understanding the de-facto usage of the non-executable, domain-specific language P3P. Some elements of our methodology may be similarly useful for other software languages.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:Times, serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:Times, serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Regards,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:Times, serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;PF&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:Times, serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-5155573868477205035?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/5155573868477205035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/02/empirical-language-analysis.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/5155573868477205035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/5155573868477205035'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/02/empirical-language-analysis.html' title='Empirical Language Analysis'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-5184443934516460738</id><published>2010-01-19T22:08:00.010+01:00</published><updated>2010-01-20T21:43:22.488+01:00</updated><title type='text'>Constructive art on software languages</title><content type='html'>If you (feel like you) need to explain a piece of art, then something sucks. But I am not saying that Haskell's Tower of Babel is true art. Perhaps it could be called constructive art (or nerdy art). Anyway, I am going to explain you how I constructed this picture. See &lt;a href="http://twitpic.com/xhs02"&gt;here&lt;/a&gt; for the original twitpic with the tower, but it's included right below for your convenience.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_WMxgFmsgalU/S1YyOTMAIAI/AAAAAAAADQo/Bk2E5EGSd1o/s1600-h/tower.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 298px;" src="http://2.bp.blogspot.com/_WMxgFmsgalU/S1YyOTMAIAI/AAAAAAAADQo/Bk2E5EGSd1o/s320/tower.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5428581622091882498" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;This is how you can reproduce the tower:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Use something like Mac OS's Keynote to actually assemble the picture.&lt;/li&gt;&lt;li&gt;Go through a nifty Haskell project and gather all Haskell 98 extensions.&lt;/li&gt;&lt;li&gt;Use one line per pragma and format everything with a proportional font as shown.&lt;/li&gt;&lt;li&gt;Sort the extensions (the lines) by the visual length. Results depend on the font chosen.&lt;/li&gt;&lt;li&gt;Starting at the bottom, adjust font size per line to get a smooth slide from top to bottom.&lt;/li&gt;&lt;/ul&gt; In my instance, there was some fuzzy effect due to the used proportional font and the tension between the upper case LANGUAGE and the camel-cased name of the extension in each line. Say,  while I was generally trying to decrease font size as I was going from bottom to top, I had to actually &lt;b&gt;increase&lt;/b&gt; it every now and then--if I wanted that smooth slide from top to bottom.&lt;br /&gt;&lt;br /&gt;Background for non-Haskell nerds: In contemporary Haskell, programmers tend to express their dependence on non-standardized features by using detailed pragmas in their modules. For instance, if someone places the pragma for "FunctionalDependencies" in a module, then this means that class declarations are allowed to restrict multi-parameter type classes to model functions on types as opposed to general relations.&lt;br /&gt;&lt;br /&gt;At some point, it just occurred to me how organized we Haskell programmers are and how much expressivity we have at avail. From a more historical point of view, we may just run into the kind of problem that is symbolized by the Tower of Babel, but honestly I don't feel like I am suffering from too much &lt;a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.51.4656"&gt;expressivity&lt;/a&gt; and too &lt;a href="http://doi.acm.org/10.1145/997140.997142"&gt;sexy types&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;As a data point, the project from which I extracted the above language pragmas is &lt;a href="http://userpages.uni-koblenz.de/~laemmel/TheEagle/"&gt;a tutorial on type-level programming&lt;/a&gt; (joint work with &lt;a href="http://okmij.org/ftp/"&gt;Oleg Kiselyov&lt;/a&gt;). The first two lectures of this tutorial have been recorded and posted. I have presented that material for folks with pretty much no Haskell background. Several of the lectures (not those currently available online) require advanced background in typing and programming languages (also measured by the number of language pragmas shown), but the plan is ultimately to get this tutorial to the point that everyone with modest interest in language design and type systems can fully appreciate all that expressivity and sexy typing.&lt;br /&gt;&lt;br /&gt;PF&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-5184443934516460738?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/5184443934516460738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/01/constructive-art-on-software-languages.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/5184443934516460738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/5184443934516460738'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/01/constructive-art-on-software-languages.html' title='Constructive art on software languages'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_WMxgFmsgalU/S1YyOTMAIAI/AAAAAAAADQo/Bk2E5EGSd1o/s72-c/tower.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-4569523893972200955</id><published>2010-01-03T05:39:00.007+01:00</published><updated>2010-01-03T06:00:48.051+01:00</updated><title type='text'>Palindrom dates</title><content type='html'>@lizettegagne re-tweeted as follows earlier today (or yesterday +/-): "RT @mashable: Happy Palindrome Day everyone - 01022010! Last one was 10022001, prior to that 08311380!! Wow! They don't come around often." I hacked up the following Prolog code to get some certainty. Simple modification reveals that European ordering or YYYYMMDD ordering would lead to entirely different results. Try it out!&lt;br /&gt;&lt;p&gt;PF&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;&lt;br /&gt;?- main.&lt;br /&gt;08311380&lt;br /&gt;10022001&lt;br /&gt;01022010&lt;br /&gt;true.&lt;br /&gt;&lt;br /&gt;% This is what a palindrom is ...&lt;br /&gt;palindrom(S) :- reverse(S,S).&lt;br /&gt;&lt;br /&gt;% Generate all palindrom dates; ignoring leap years.&lt;br /&gt;special(MDYS) :-&lt;br /&gt;  year(_,YS),&lt;br /&gt;  month(M,MS),&lt;br /&gt;  day(M,_,DS),&lt;br /&gt;  append(MS,DS,MDS),&lt;br /&gt;  append(MDS,YS,MDYS),&lt;br /&gt;  palindrom(MDYS).&lt;br /&gt;&lt;br /&gt;% Here is an over-approximation of dates.&lt;br /&gt;year(X,S) :- ranges(4,1380,2010,X,S).&lt;br /&gt;month(X,S) :- ranges(2,1,12,X,S).&lt;br /&gt;day(1,X,S) :- ranges(2,1,31,X,S).&lt;br /&gt;day(2,X,S) :- ranges(2,1,29,X,S).&lt;br /&gt;day(3,X,S) :- ranges(2,1,31,X,S).&lt;br /&gt;day(4,X,S) :- ranges(2,1,30,X,S).&lt;br /&gt;day(5,X,S) :- ranges(2,1,31,X,S).&lt;br /&gt;day(6,X,S) :- ranges(2,1,30,X,S).&lt;br /&gt;day(7,X,S) :- ranges(2,1,31,X,S).&lt;br /&gt;day(8,X,S) :- ranges(2,1,31,X,S).&lt;br /&gt;day(9,X,S) :- ranges(2,1,30,X,S).&lt;br /&gt;day(10,X,S) :- ranges(2,1,31,X,S).&lt;br /&gt;day(11,X,S) :- ranges(2,1,30,X,S).&lt;br /&gt;day(12,X,S) :- ranges(2,1,31,X,S).&lt;br /&gt;&lt;br /&gt;% Generate all strings of values in that range with that length&lt;br /&gt;ranges(L,Min,Max,X,S2) :-&lt;br /&gt;  ( Min =&lt; Max, X = Min, name(Min,S1), pad(L,S1,S2)&lt;br /&gt;  ; Min &lt; Max, Min1 is Min + 1, ranges(L,Min1,Max,X,S2)&lt;br /&gt;  ).&lt;br /&gt;&lt;br /&gt;% Extend a string to the length given&lt;br /&gt;pad(L,S1,S2) :-&lt;br /&gt;  length(S1,L1),&lt;br /&gt;  ( L1 &gt; L, abort&lt;br /&gt;  ; L1 = L, S2 = S1&lt;br /&gt;  ; L1 &lt; L, pad(L,[0'0|S1],S2)&lt;br /&gt;  ).&lt;br /&gt;&lt;br /&gt;% Print all solutions&lt;br /&gt;print(S) :- atom_codes(A,S), write(A), nl.&lt;br /&gt;main :- findall(S,special(S),Ss), maplist(print,Ss).&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-4569523893972200955?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/4569523893972200955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2010/01/palindrom-dates.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/4569523893972200955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/4569523893972200955'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2010/01/palindrom-dates.html' title='Palindrom dates'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-3965853262541090079</id><published>2009-12-23T18:33:00.005+01:00</published><updated>2009-12-23T19:11:24.028+01:00</updated><title type='text'>Major breakthrough in image processing</title><content type='html'>&lt;span class="Apple-style-span"  style="font-size:large;"&gt;In fact, this breakthrough is based on &lt;a href="http://www.haskell.org/"&gt;Haskell&lt;/a&gt;.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Find all the resources here:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://userpages.uni-koblenz.de/~laemmel/bildverarbeitung/"&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;http://userpages.uni-koblenz.de/~laemmel/bildverarbeitung/&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Or just go right away to this YouTube video to get a quick idea:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;a href="http://www.youtube.com/watch?v=eKVxlHG6Jrw"&gt;http://www.youtube.com/watch?v=eKVxlHG6Jrw&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:large;"&gt;This lecture was prepared upon invitation by the &lt;a href="http://www.uni-koblenz-landau.de/koblenz/fb4/institute/icv/agpaulus"&gt;local research team on active vision&lt;/a&gt;. They asked me to hold a lecture on "Bildverarbeitung in Haskell" (engl.: "Image processing in Haskell"). Here I should mention in passing that their invitation was about an Xmas party kind of workshop. Accordingly, my lecture is short and somewhat contrived, but see for yourself. More importantly, all the shown Haskell code is short, well-typed, and available for download, but totally useless.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Technically, the shown, 4th encoding of "image processing" encodes "Bildverarbeitung" and potentially other words, letter by letter, in the type system. The overloaded functions for the letters of the alphabet can only be composed (by means of ".") to form words that are known to the type system. &lt;b&gt;&lt;i&gt;Hence, type checking is spell checking.&lt;/i&gt;&lt;/b&gt; Quite obviously, this particular approach is horrendously verbose, inefficient and limited. The encoding is good however in so far that it allowed me to illustrate the notion of Haskell's Triangle (as opposed to Pascal's).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Merry Xmas and a Happy New Year!&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Yours,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;PF&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-3965853262541090079?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/3965853262541090079/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2009/12/major-breakthrough-in-image-processing.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/3965853262541090079'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/3965853262541090079'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2009/12/major-breakthrough-in-image-processing.html' title='Major breakthrough in image processing'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-773061554757818592</id><published>2009-11-29T18:38:00.009+01:00</published><updated>2009-11-29T21:22:32.763+01:00</updated><title type='text'>OOPM-Vorlesung auf der Treppe</title><content type='html'>&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" font-weight: normal; font-size:16px;"&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Im folgenden fasse ich die Abläufe zusammen, welche ultimativ zu der "Treppenvorlesung" in der &lt;/span&gt;&lt;a href="http://userpages.uni-koblenz.de/~laemmel/oopm0910/"&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;OOPM&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;-Veranstaltung am 26.11.2009 geführt haben. Alle die dabei waren, hatten trotz des schlechten Sounds und der Besetzung doch auch ein bisschen Spass neben all der harten Materie?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/b&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;_______________________________________________________&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;25.11.2009, 13:03, Post von &lt;/b&gt;&lt;/span&gt;&lt;a href="http://asta.uni-koblenz.de/asta/"&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;ASta&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;-Vorsitz in Newsgroup infko.general&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;"Die VV [Vollversammlung, Anmerkung PF] aller Studierenden hat soeben beschlossen, dass der Audimax (D 028) besetzt wird."&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;_______________________________________________________&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;25.11.2009, 13:39, Reply von PF in eben dieser Newsgroup&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;"Was ist die Semantik dieser Aktion insbesondere in Hinblick auf die Frage, ob damit grosse Vorlesungen im D 028 bis auf weiteres abzusetzen sind?"&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;_______________________________________________________&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;25.11.2009, 17:45, PF veröffentlicht eine Blogpost zum Thema&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://professor-fish.blogspot.com/2009/11/vorlesung-kampft-um-ihre-austragung.html"&gt;http://professor-fish.blogspot.com/2009/11/vorlesung-kampft-um-ihre-austragung.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ein bisschen Wertung extra: &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Mein Verständnis war, dass die &lt;a href="http://userpages.uni-koblenz.de/~laemmel/oopm0910/"&gt;OOPM&lt;/a&gt;-Vorlesung nicht ausfallen sollte, da es sich bei der Besetzung des AUDIMAX nicht um einen allgemeinen Streik handelt. Vielmehr schien es im Sinne der Organisatoren und aller Studenten zu sein, dass Lehrveranstaltungen weiter stattfinden. Allerdings kann eine Grossveranstaltung wie OOPM natürlich nur schwer einen anderen Raum finden. Somit ist die Besetzung des AUDIMAX nahezu effektiv ein Ausschlusskriterium für die Durchführung der Veranstaltung.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;... abgesehen von Alternativen, die in der Blogpost erwähnt wurden.&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;_______________________________________________________&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:large;"&gt;&lt;b&gt;25.11.2009, 22:39, Reply von &lt;span class="Apple-style-span"  style=" font-weight: normal; font-size:16px;"&gt;&lt;a href="http://asta.uni-koblenz.de/asta/"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:large;"&gt;&lt;b&gt;ASta&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style=" ;font-size:large;"&gt;&lt;b&gt;-Vorsitz in eben dieser Newsgroup&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-size:medium;"&gt;Meine Zusammenfassung: Der AUDIMAX wird insbesondere während der OOPM-Veranstaltung für einen anderen Programmpunkt benötigt.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;_______________________________________________________&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;26.11.2009, ab 9:00, diverse Anrufe durch PF&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;- Raumplanung Campus; Nachfrage nach Ersatzraum; Bescheid negativ.&lt;/div&gt;&lt;div&gt;- Leitung der Mensa; Nachfrage nach Erlaubnis zur Austragung: Bescheid negativ.&lt;/div&gt;&lt;div&gt;- Hausmeister; Nachfrage nach Lautsprechersystem; Keine rechtzeitige Verfügbarkeit.&lt;/div&gt;&lt;div&gt;- ...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;_______________________________________________________&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;26.11.2009, 9:43, Post von PF in Newsgroup  infko.oopm&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Bekanntgabe der Treppe neben AUDIMAX als Austragungsort&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;_______________________________________________________&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;26.11.2009, 10:21, Beginn der Vorlesung mit 6 Minuten Verspätung.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Die Verzögerung war wie folgt zu erklären:&lt;/div&gt;&lt;div&gt;- Besorgung und nicht-trivialle Aufstellung des Projektors&lt;/div&gt;&lt;div&gt;- Besorgung und Tuning eines eher ungeeigneten Lautsprechersystems&lt;/div&gt;&lt;div&gt;- Interaktion mit den Teilnehmern&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;_______________________________________________________&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:x-large;"&gt;Weitere Links&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;- &lt;a href="http://www.youtube.com/watch?v=okagDv_q6Ao"&gt;Kurzfilm&lt;/a&gt; (YouTube)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;- &lt;/span&gt;&lt;a href="http://userpages.uni-koblenz.de/~laemmel/oopm0910/resources/pointers.html"&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Langfilm&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt; (Webseite der Lehrveranstaltung)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Gruss,&lt;/div&gt;&lt;div&gt;PF&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-773061554757818592?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/773061554757818592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2009/11/oopm-vorlesung-auf-der-treppe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/773061554757818592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/773061554757818592'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2009/11/oopm-vorlesung-auf-der-treppe.html' title='OOPM-Vorlesung auf der Treppe'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-3850385489270443738</id><published>2009-11-25T17:25:00.008+01:00</published><updated>2009-11-25T18:47:06.964+01:00</updated><title type='text'>Vorlesung kämpft um ihre Austragung</title><content type='html'>&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Durch eine Vollversammlung der Studenten wurde heute auf dem Campus beschlossen, dass unser, über alles geliebte AUDIMAX (grosser Hörsaal D 028) besetzt wird. Dies zu tun, ist das demokratische Recht der Studenten und deren Argumentation ist anderswo verfügbar. Ich werde mich hier dazu nicht weiter äussern.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Allerdings überlege ich gerade, ob und wie diese Aktion meine donnerstägliche OOPM-&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:Helvetica, serif;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Vorlesung in eben diesem Raum (follow @oopm, siehe Link hier &lt;/span&gt;&lt;/span&gt;&lt;a href="http://userpages.uni-koblenz.de/~laemmel/oopm0910/"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;http://userpages.uni-koblenz.de/~laemmel/oopm0910/&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; ) beeinträchtigt.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-family:Helvetica, serif;"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Da weder AStA noch die Uni-Leitung, noch irgend jemand anders mit Autorität, so weit ich weiss, bisher klare Empfehlungen gibt, was anstehende Veranstaltungen im D 028 angeht, versuche ich mal etwas OOPM-spezifisches -- in der Hoffnung dass ich nicht unwissentlich meine Beamten- und demokratischen Pflichten verletze:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:x-large;"&gt;Gelingen und Kooperation durch die Besatzungsmacht vorausgesetzt, findet die morgige OOPM-Veranstaltung im D 028 in unkonventionellerer Form statt.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Ich höre gerade, dass es Bemühungen für einen Ersatzraum gibt, aber das bleibt abzuwarten. Ich ziehe natürlich auch gern mit Ihnen auf eine andere Ecke von Koblenz um und kann wieder 3-4 Leute in meinem Auto mitnehmen.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Wenn die Besetzer des D 028 mir freundlicherweise etwas Platz auf der Bühne lassen und ebenfalls die Benutzung der Technik nicht behindern, dann soll es am Ende der Veranstaltung einen attraktiven Preis für den qualifiziertesten (aus OOPM-Sicht) Besetzer oder Herumsitzer geben. Ich werde den Gewinner demokratisch selbst auswählen.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Ich sehe das wirklich als eine Chance für die Besetzer, etwas Fundiertes über die Programmierung von imperativen Datenstrukturen zu erfahren. Lassen Sie sich das nicht entgehen! Wenn Sie interessante, thematische Bezüge zu dem Besetzungsthema herstellen können, werden wir uns alle freuen.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Gelingen und Kooperation durch die Besatzungsmacht vorausgesetzt, werde ich die Vorlesung wie immer aufzeichnen und verlinken. Dies kommt doch vielleicht auch dem PR-Ziel der Besatzungsmacht zugute? Ich könnte die Kamera so ausrichten, dass die Situation im Raum erfassbar ist. Durch Auflösungsmanipulation würde ich Ihre Persönlichkeitsrechte wahren -- ausgenommen Sie treten nah an meine Kamera.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Falls es nicht zumutbar für die Besetzer ist oder sie den Ablauf unserer OOPM-Veranstaltung zu sehr stören, schlage ich vor, dass wir in das Treppenhaus neben D 028 umziehen. Dort könnte man eine Projektion von vielen Seiten einsehen.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial, serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Falls die Besatzungsmacht auch anreichende Gebiete einnimmt, dann lassen Sie uns in mein Büro verlegen. Dort gibt es eine grosse rote Couch und 4 weitere Sitzgelegenheiten (die altmodischen Riesenlautsprecher nicht eingeschlossen). Wir können dann nebenbei an einem Wetten Dass - Beitrag arbeiten. Ich hoffe, dass es keine baustatischen Gründe gibt, die gegen diese Ausweichvariante sprechen.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Gruss,&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;PF/RL&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:Helvetica, serif;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="font-size:12px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-3850385489270443738?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/3850385489270443738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2009/11/vorlesung-kampft-um-ihre-austragung.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/3850385489270443738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/3850385489270443738'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2009/11/vorlesung-kampft-um-ihre-austragung.html' title='Vorlesung kämpft um ihre Austragung'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-8835922002117942888</id><published>2009-11-22T00:15:00.005+01:00</published><updated>2009-11-22T00:46:53.731+01:00</updated><title type='text'>Countdown with Prolog</title><content type='html'>&lt;div&gt;I was just going through G. Hutton's Haskell code for the (simplified) countdown problem which I plan to mention in a class on functional programming. The aforementioned code is discussed in the wonderful book "&lt;a href="http://www.cs.nott.ac.uk/~gmh/book.html"&gt;Programming in Haskell&lt;/a&gt;". The development of the brute-force model looks verbose and detouring however. (This is probably because the problem serves some pedagogical purposes.) Here is a simple Prolog-based solution. It is much faster than the brute-force Haskell-based solution, also because some optimizations are naturally achieved by a straightforward solution. I am sure others have tried this because it is so strikingly obvious.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Suppose you want to compute a given number X, by applying the arithmetic operations addition, subtraction, multiplication, and division to numbers picked from a given sequence of positive natural numbers, while using any candidate at most once, and all intermediate results must be positive natural numbers again.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For instance: 765 = (25-10)*(50+1)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;% Solutions Ts for countdown problem with numbers Ns, result X&lt;br /&gt;&lt;br /&gt;solve(Ns,X,Ts) :-&lt;br /&gt; findall(T,(&lt;br /&gt;   sublist(L,Ns),&lt;br /&gt;   permutation(L,P),&lt;br /&gt;   compute(P,T),&lt;br /&gt;   X is T&lt;br /&gt; ),Ts).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;% Generate all sublists of a given list&lt;br /&gt;&lt;br /&gt;sublist([],[]).&lt;br /&gt;sublist(Z,[H|T]) :-&lt;br /&gt; sublist(Y,T),&lt;br /&gt; ( Z = Y&lt;br /&gt; ; Z = [H|Y]&lt;br /&gt; ).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;% Generate all permutations of a given list&lt;br /&gt;&lt;br /&gt;permutation([],[]).&lt;br /&gt;permutation([H|T1],L) :-&lt;br /&gt; permutation(T1,T2),&lt;br /&gt; append(T2a,T2b,T2),&lt;br /&gt; append(T2a,[H|T2b],L).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;% Complete sequences of numbers into arithmetic expressions&lt;br /&gt;&lt;br /&gt;compute([R],R).&lt;br /&gt;compute(As,T) :-&lt;br /&gt; As = [_,_|_],&lt;br /&gt; append(As1,As2,As),&lt;br /&gt; As1 = [_|_],&lt;br /&gt; As2 = [_|_],&lt;br /&gt; compute(As1,T1),&lt;br /&gt; compute(As2,T2),&lt;br /&gt; ( T = T1 + T2&lt;br /&gt; ; T = T1 - T2&lt;br /&gt; ; T = T1 * T2&lt;br /&gt; ; T = T1 / T2&lt;br /&gt; ),&lt;br /&gt; R is T,&lt;br /&gt; R &gt; 0,&lt;br /&gt; integer(R).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Regards,&lt;/div&gt;&lt;div&gt;PF&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-8835922002117942888?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/8835922002117942888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2009/11/countdown-with-prolog.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8835922002117942888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8835922002117942888'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2009/11/countdown-with-prolog.html' title='Countdown with Prolog'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-4248891631724075546</id><published>2009-09-11T00:18:00.005+02:00</published><updated>2009-09-11T00:28:47.903+02:00</updated><title type='text'>PPDP 2009 over and Prological SYB code goes live</title><content type='html'>Just tried to send an email to what I thought would be the cafe mailing list of &lt;span&gt;&lt;span&gt;the Association of Logic Programming (ALP). My message bounced. Sigh! Anyway, here is the message and below you also see the content of the README file for the tiny code distribution for scrap[p]ing boilerplate prologically.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;From: Ralf Laemmel rlaemmel@gmail.com&lt;br /&gt;&lt;br /&gt;To: Alp-cafe-request@babel.ls.fi.upm.es&lt;br /&gt;&lt;br /&gt;Date: Thu, 10 Sep 2009 22:57:11 +0100&lt;br /&gt;&lt;br /&gt;Subject: post-PPDP 2009 greeting&lt;br /&gt;&lt;br /&gt;Not sure whether this mailing list is actually working (because I haven't seen any traffic since June when it all started) but I thought it couldn't hurt to send a short post-PPDP 2009 greeting.  António Porto, Francisco J. López-Fraguas, Pedro Quaresma, Ana Paula Tomás, and their collaborators have put together a great conference event. The program was really packed; perhaps even a bit stressful :-) I would have loved to interact a bit more during additional breaks and panels.&lt;br /&gt;&lt;br /&gt;For what it's worth, I have uploaded the SYB sources for my invited talk to a google code repository.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/strafunski/source/browse/#svn/trunk/ppdp09" target="_blank" style="color: rgb(35, 87, 195); "&gt;http://code.google.com/p/&lt;wbr&gt;strafunski/source/browse/#svn/&lt;wbr&gt;trunk/ppdp09&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Ralf&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:arial, sans-serif;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="border-collapse: collapse; font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:arial, sans-serif;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style="border-collapse: collapse; font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;README follows&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;These are sources that I release with my PPDP 2009 invited talk.&lt;br /&gt;Please understand that this is *illustrative* code.&lt;br /&gt;I have merely sketched certain aspects.&lt;br /&gt;It is really just illustration for a talk!&lt;br /&gt;It may be useful though.&lt;br /&gt;&lt;br /&gt;Here is quick inventory of this file system:&lt;br /&gt;&lt;br /&gt;shared: basic lib functionality used by several "experiments"&lt;br /&gt;* holp: higher-order logic programming convenience&lt;br /&gt;* syb: very little to be shared of SYB among experiments&lt;br /&gt;* lists: (mainly higher-order) list processing&lt;br /&gt;* meta: metaprogramming convenience&lt;br /&gt;* vars: operations on lists/sets of logical/nonground variables&lt;br /&gt;* msft: test data&lt;br /&gt;&lt;br /&gt;experiments: experiments or illustrations used in the talk&lt;br /&gt;* basic: the most basic SYB experiment&lt;br /&gt;* backtracking: illustration of backtracking traversal&lt;br /&gt;* nonground: illustration of traversal of nonground terms&lt;br /&gt;* bidirectional: crazy inquiry into multi-mode traversal&lt;br /&gt;* optimized: a generative and optimized model of SYB&lt;br /&gt;&lt;br /&gt;All the experiments consist of two parts:&lt;br /&gt;* lib: all library (generic) functionality&lt;br /&gt;* app: specific illustrations (using msft typically)&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-4248891631724075546?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/4248891631724075546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2009/09/ppdp-2009-over-and-prological-syb-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/4248891631724075546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/4248891631724075546'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2009/09/ppdp-2009-over-and-prological-syb-code.html' title='PPDP 2009 over and Prological SYB code goes live'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-6548997248765866032</id><published>2009-09-10T11:12:00.005+02:00</published><updated>2009-09-10T12:41:37.595+02:00</updated><title type='text'>Decreasing salaries with addition</title><content type='html'>There are some parts of my &lt;a href="http://www.uni-koblenz.de/~laemmel/OdeToProlog/"&gt;PPDP 2009 invited talk&lt;/a&gt; that didn't make it into the short paper for that talk. In particular, I played a bit with the feature interaction of traversal (SYB) and using predicates in different modes.  The use of multi-mode predicates is one of the exciting aspects of logic programming. (It is somewhat disputed how crucial or useful it is, but it is impressive/expressive anyhow.) For instance, beginners are always surprised to see that one can use append/3 to both .... well ... append but also take apart lists. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So I considered the question how to use such multi-modeness, if at all, perhaps even usefully, in the context of traversal programming. Here, we would expect traversal predicates to serve the normal forward direction (traverse first argument, compute second argument) and the unusual &lt;b&gt;backward direction&lt;/b&gt;.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;Let's consider the following, &lt;b&gt;&lt;i&gt;recession-inspired&lt;/i&gt;&lt;/b&gt; scenario for the sake of the argument:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;We certainly know how to increase salaries (say by 1 $) everywhere.&lt;/li&gt;&lt;li&gt;However, there is pressure that we need to decrease salaries lately.&lt;/li&gt;&lt;li&gt;&lt;b&gt;We wish to run an increasing traversal backwards to decrease salaries&lt;/b&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;Let's start with the increase-only traversal.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;pre&gt;incSalary(X,Y) :- everywhere(mkT(incSalary_),X,Y).&lt;br /&gt;incSalary_(salary(S1),salary(S2)) :- add(S1,1,S2).&lt;br /&gt;add(X,Y,Z) :- Z is X + Y.&lt;/pre&gt;&lt;br /&gt;everywhere/3, mkT/3 are defined in a straightforward manner:&lt;/div&gt;&lt;div&gt;(See the &lt;a href="http://www.uni-koblenz.de/~laemmel/OdeToProlog/"&gt;PPDP 2009 paper&lt;/a&gt; for details.)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="font-family:monospace, serif;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style=" white-space: pre;font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="font-family:Georgia, serif;font-size:130%;"&gt;&lt;span class="Apple-style-span"  style=" white-space: normal;font-size:16px;"&gt;&lt;span class="Apple-style-span"  style="font-size:130%;"&gt;&lt;span class="Apple-style-span"  style="font-size:16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre&gt;% Transform everywhere (bottom-up)&lt;br /&gt;&lt;br /&gt;everywhere(T,X,Z) :-&lt;br /&gt; gmapT(everywhere(T),X,Y),&lt;br /&gt; apply(T,[Y,Z]).&lt;br /&gt;&lt;br /&gt;% One-layer traversal&lt;br /&gt;&lt;br /&gt;gmapT(T,X,Y) :-&lt;br /&gt; X =.. [C|Kids1],&lt;br /&gt; map(T,Kids1,Kids2),&lt;br /&gt; Y =.. [C|Kids2].&lt;br /&gt;&lt;br /&gt;% "Make transformation"&lt;br /&gt;&lt;br /&gt;mkT(T,X,Y) :- choice(T,id,X,Y).&lt;br /&gt;&lt;br /&gt;% Left-biased choice&lt;br /&gt;&lt;br /&gt;choice(F,G,X,Y) :-&lt;br /&gt; apply(F,[X,Y]) -&gt;&lt;br /&gt;     true&lt;br /&gt;   ; apply(G,[X,Y]).&lt;br /&gt;&lt;br /&gt;% Identity&lt;br /&gt;&lt;br /&gt;id(X,X).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The above development will not be able to decrease salaries (by traversing "backwards"). Quite obviously, we need an add/3 predicate that can go backwards. That's easy enough. The following revision of add/3 can cope with any combination of 2 argument positions being instantiated with numbers.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;pre&gt;add(X,Y,Z) :-&lt;br /&gt;( \+ var(X), \+ var(Y), Z is X + Y&lt;br /&gt;; \+ var(X), \+ var(Z), Y is Z - X&lt;br /&gt;; \+ var(Y), \+ var(Z), X is Z - Y&lt;br /&gt;).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;We need to do a few more things before backward traversal works. In particular, one-layer traversal is not prepared to deal with an uninstantiated first argument. There are actually two reasons for an uninstantiated, first argument to make sense. Reason 1 is that we might be traversing terms with logical variables. Reason 2 is related to our current endeavor: &lt;b&gt;backward traversal with the 2nd argument being instantiated and the first one being variable. &lt;span class="Apple-style-span" style="font-weight: normal; "&gt;So here is our blow that resolves both issues:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;pre&gt;gmapT(T,X,Y) :-&lt;br /&gt; var(X), var(Y),&lt;br /&gt; Y = X&lt;br /&gt;;&lt;br /&gt; \+ var(X),&lt;br /&gt; X =.. [C|Kids1],&lt;br /&gt; map(T,Kids1,Kids2),&lt;br /&gt; Y =.. [C|Kids2]&lt;br /&gt;;&lt;br /&gt; var(X), \+ var(Y),&lt;br /&gt; Y =.. [C|Kids2],&lt;br /&gt; map(T,Kids1,Kids2),&lt;br /&gt; X =.. [C|Kids1].&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;However, this is still not enough. We also need to make fit the traversal scheme everywhere/3. We need to adjust the sequential order of the body of everywhere/3 depending on instantiation. Please note that the resulting traversal is still to be considered a bottom-up traversal (which is good news!).&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;everywhere(T,X,Z) :-&lt;br /&gt; Apply = apply(T,[Y,Z]),&lt;br /&gt; Recurse = gmapT(everywhere(T),X,Y),&lt;br /&gt; ( var(X), \+ var(Z) -&gt;&lt;br /&gt;     Apply, Recurse&lt;br /&gt;   ; Recurse, Apply ).&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That's it, we can do backward traversal and hence decrease salaries with incSalary/2.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;PF&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-6548997248765866032?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/6548997248765866032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2009/09/decreasing-salaries-with-addition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/6548997248765866032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/6548997248765866032'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2009/09/decreasing-salaries-with-addition.html' title='Decreasing salaries with addition'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-2932101321741235150</id><published>2009-08-27T04:05:00.008+02:00</published><updated>2009-08-27T14:18:45.043+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='humor'/><category scheme='http://www.blogger.com/atom/ns#' term='leopard'/><category scheme='http://www.blogger.com/atom/ns#' term='w7'/><title type='text'>Locked into a juicy apple</title><content type='html'>A bit more than 2 years ago I got bored by my usual XP+cygwin box (and I had given up on Linux anyway), and thought I would try a mac. Meanwhile I have tried macs a lot, spent a fortune on software. Sigh, I am having quite some hardware issues, but fortunately everything so far was covered by warranty or apple care. Anyway, my house is the perfect Mac Family place: several MacBook[pro]s, a time capsule, an iPhone, several editions of all the basic software (iWork, iLive, Mac OS -- Snow Leopard pre-ordered), and a good deal of pay and freeware (e.g., several kinds of screen/video capture/recording).&lt;br /&gt;&lt;br /&gt;Here is the problem: I have gotten addicted to apples.&lt;br /&gt;&lt;br /&gt;So let me self-diagnose whether I can get rid of that addiction:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;I write texts with web apps or with LaTeX. Other Oss can do this too.&lt;br /&gt; &lt;/li&gt;&lt;li&gt;I use .key for slides. Some bits would get lost in translation to .ppt[x].&lt;br /&gt; &lt;/li&gt;&lt;li&gt;iTunes seems to be platform-independent, no?&lt;/li&gt;&lt;li&gt;iPhoto. Who needs that? I am using Picasa above it anyway.&lt;/li&gt;&lt;li&gt;iWeb. Why did I ever start using it? It is sooo constraining anyway!&lt;br /&gt; &lt;/li&gt;&lt;li&gt;I have some minor utilities that I would need to find counterparts for ...&lt;/li&gt;&lt;li&gt;Sure my kids will miss PhotoBooth.&lt;/li&gt;&lt;li&gt;I will miss iMovie; it helped me to understand that I need 4 GB.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt; &lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;Based on such preliminary reflection, I claim that there is an Ok transition path to W7. It's good to have a choice.&lt;br /&gt;&lt;br /&gt;PF&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-2932101321741235150?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/2932101321741235150/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2009/08/locked-into-juicy-apple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/2932101321741235150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/2932101321741235150'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2009/08/locked-into-juicy-apple.html' title='Locked into a juicy apple'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-8950279267011506008</id><published>2009-08-26T17:41:00.001+02:00</published><updated>2009-08-26T20:03:05.750+02:00</updated><title type='text'>SWI-Prolog's Java Interface JPL</title><content type='html'>I would like to mix Java and Prolog code on a number of occasions. Together with a student of mine (Joachim Pehl), we just convinced ourselves that the &lt;a href="http://www.swi-prolog.org/packages/jpl/"&gt;JPL library of SWI-Prolog&lt;/a&gt; is really cool. Basically JPL allows you to call Prolog from Java and Java from Prolog.&lt;br /&gt;&lt;br /&gt;But the question is, of course, &lt;span style="font-style: italic; font-weight: bold;"&gt;how easy is it and can you easily go back and forth&lt;/span&gt;. For instance, can we call Prolog from Java and  call back Java from Prolog and share Java state throughout? Sure it works!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;PROLOG PORTION FOLLOWS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;% This library is all we need to call Java from Prolog&lt;br /&gt;:- ensure_loaded(library(jpl)).&lt;br /&gt;&lt;br /&gt;main&lt;br /&gt;:-&lt;br /&gt;  % Create an object&lt;br /&gt;  jpl_new(class([],['Test']), [], X),&lt;br /&gt;&lt;br /&gt;  % Printing objects is like printing object ids&lt;br /&gt;  write(X),nl,&lt;br /&gt;&lt;br /&gt;  % Access a field of the object; happens to be static&lt;br /&gt;  jpl_get(X, state, Y),&lt;br /&gt;&lt;br /&gt;  % Prints whatever the state's value is&lt;br /&gt;  write(Y),nl.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;JAVA PORTION FOLLOWS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// This jar is all we need to call Prolog from Java&lt;br /&gt;import jpl.*;&lt;br /&gt;&lt;br /&gt;public class Test {&lt;br /&gt;&lt;br /&gt;public static int state = 0;&lt;br /&gt;&lt;br /&gt;public static void main(String[] args) {&lt;br /&gt;&lt;br /&gt; // Consult a Prolog file&lt;br /&gt; Query q1 = new Query("consult", new Term[] { new Atom("Test.pro") });&lt;br /&gt;&lt;br /&gt; // Prints boolean success/failure value&lt;br /&gt; System.out.println(q1.query());&lt;br /&gt;&lt;br /&gt; // Affect static field.&lt;br /&gt; // This way we can see whether Prolog sees the same JVM instance.&lt;br /&gt; Test.state = 42;&lt;br /&gt;&lt;br /&gt; // Invoke a predicate&lt;br /&gt; Query q2 = new Query("main");&lt;br /&gt;&lt;br /&gt; // Prints boolean success/failure value&lt;br /&gt; System.out.println(q2.query());&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;BUILDING and RUNNING BOTH&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;javac -cp $CLASSPATH:/opt/local/lib/swipl-5.6.62/lib/jpl.jar:. Test.java&lt;br /&gt;java -cp $CLASSPATH:/opt/local/lib/swipl-5.6.62/lib/jpl.jar:. -Djava.library.path="/opt/local/lib/swipl-5.6.62/lib/i386-darwin9.5.0" Test&lt;br /&gt;true&lt;br /&gt;@(J#00000000000016809476)&lt;br /&gt;42&lt;br /&gt;true&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;SO WHAT?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hence, we can start a Java app, have it start a Prolog engine and consult the Prolog portion of our app, then delegate from Java to Prolog, where we in turn call back on Java in the same JVM and can access some state that we left off in Java before we were calling Prolog.&lt;br /&gt;&lt;br /&gt;PF&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-8950279267011506008?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/8950279267011506008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2009/08/swi-prologs-java-interface-jpl.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8950279267011506008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/8950279267011506008'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2009/08/swi-prologs-java-interface-jpl.html' title='SWI-Prolog&apos;s Java Interface JPL'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4694016830113568730.post-3792461169894665437</id><published>2009-08-25T14:39:00.000+02:00</published><updated>2009-08-25T14:52:09.122+02:00</updated><title type='text'>The same guy as "Grammarware, Haskellware, XMLware"</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;What's wrong with the old blog?&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;I have been using &lt;a href="http://blogs.msdn.com/ralflammel/"&gt;http://blogs.msdn.com/ralflammel/&lt;/a&gt; for some blogging until now. I created that blog when I was still a MS employee and it may be inappropriate to keep using this blog forever. Not that I have any plans to say anything controversial about MS in the future, but some of my personal opinions may be inappropriate on a blogger's domain that is mostly used by MS employees with often more MS-related content. Actually I really like some MS technologies, and I think I can speak about them much more easily when not being hosted on msdn.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Why "Professor Fish"?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I was looking for a content-free title and so I recalled that one of the more offensive students in one of my courses called me a "fish" in a newsgroup. I actually like that name because I like the sea and I like to swim and I like sea food. Anyway, the name is still better than "grammarware, haskellware, xmlware" (the name of my msdn blog) because I also want to (potentially) blog about non-CS stuff.&lt;br /&gt;&lt;br /&gt;See me on Twitter.&lt;br /&gt;http://twitter.com/notquiteabba&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;PF&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4694016830113568730-3792461169894665437?l=professor-fish.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://professor-fish.blogspot.com/feeds/3792461169894665437/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://professor-fish.blogspot.com/2009/08/same-guy-as-grammarware-haskellware.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/3792461169894665437'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4694016830113568730/posts/default/3792461169894665437'/><link rel='alternate' type='text/html' href='http://professor-fish.blogspot.com/2009/08/same-guy-as-grammarware-haskellware.html' title='The same guy as &quot;Grammarware, Haskellware, XMLware&quot;'/><author><name>Ralf Lämmel</name><uri>http://www.blogger.com/profile/11811593229142993414</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_WMxgFmsgalU/SpPaCZkokdI/AAAAAAAADE4/27x8AhwFmoE/s1600-R/2945260838_63510a84e4.jpg%253Fv%253D0'/></author><thr:total>3</thr:total></entry></feed>
