tag:blogger.com,1999:blog-97573772008-07-08T09:34:48.515+01:00Wadler's BlogPhilip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comBlogger199125tag:blogger.com,1999:blog-9757377.post-17723745578111651222008-06-30T13:39:00.003+01:002008-06-30T13:46:39.265+01:00Welcome to Scotland, Neil, Patricia, and Conor!A big welcome to Neil Ghani, Patricia Johann, and Conor McBride, who are establishing a new research group in Mathematically Structured Programming at the University of Strathclyde. And a big congratulations to Strathclyde, on attracting three top-notch researchers. Their arrival will strengthen the already strong programming languages community in Scotland, and they've already volunteered to host a meeting of <a href="http://www.dcs.gla.ac.uk/research/spls/" >SPLS</a>.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-25454413039420492552008-06-10T18:29:00.002+01:002008-06-10T18:38:16.994+01:00Add FP to the ACM curriculumAs a result of a recent Harvard workshop, there is a <a href="">proposal</a> to add FP to the ACM curriculum, and ACM members are encouraged to <a href="http://campus.acm.org/public/comments/comments_cs2001.cfm?CFID=6226350&CFTOKEN=53183970">comment</a>. Many excellent arguments appear on the comment page, here are two of my favorites.<br /><br />Greg Morrisett:<br /><blockquote>I strongly endorse the recommendation to include functional programming in the curriculum. The most important benefit is a change in the mode of thought that can strongly influence design at all levels, from hardware to distributed systems. If they are to be successful, students must be able to pick up and learn new languages. Without deep experience in at least two very different environments, they will be unable to do so.</blockquote><br /><br />Robert Harper:<br /><blockquote>I endorse the proposed change to PL7/FunctionalProgramming to include more hours on the topic of functional programming and to correspondingly reduce commitment to vague or obsolete topics in the proposed curriculum. Functional programming has emerged as the central organizing principle in programming language design, and is increasingly important in industrial as well as academic settings. Once considered an esoteric niche topic, functional programming has emerged as a unifying conceptual framework that encompasses and enriches traditional concepts such as imperative and object-oriented programming. Many of the major innovations in language design over the last decade have emerged from the functional programming perspective, including reliance on managed storage ("garbage collection"); emphasis on static type disciplines in general and specific advances such as generics in particular; and the role of higher-order techniques, including functions and objects, for building reusable software component.<br /><br />Current trends in the computer industry favor the functional perspective: (a) very large scale distributed computing models, such as Hadoop or map/reduce, depend essentially on the functional (state-free) model of computing; (b) small to medium-scale parallel computing, such as multicore processors or shared memory multiprocessors, strongly favors the functional model, which ensures determinacy of outcomes even in the presence of parallelism; (c) demand for mechanical verification of program properties to ensure software quality favors the functional model, which emphasizes the single most successful integration of formal methods into programming, rich static type systems.<br /><br />It is entirely appropriate for ACM to place renewed emphasis on functional programming in the undergraduate curriculum. The present proposal, though overly modest, takes a step towards modernizing undergraduate education in programming languages. I urge that this change be adopted. </blockquote>Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-91720473551881426692008-06-05T10:50:00.002+01:002008-06-05T11:04:51.655+01:00History of Lambda-calculus and Combinatory LogicThis is the most definitive history of lambda calculus of which I am aware, a most useful resource. It includes two contradictory stories, both told by Church, of why Church picked the symbol 'lambda' (see p 7), but not the story that Church conceived the predecessor function after exposure to laughing gas at his dentist. (Does anyone know a source for that story?) My thanks to the authors for their efforts.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-15638654624442192762008-06-02T19:08:00.002+01:002008-06-02T19:12:57.679+01:00The Expression LemmaRalf Laemmel and Ondrej Rypacek have a paper in MPC 2008 on the duality of functions and objects, which they formalize as folds over algebras and unfolds over coalgebras, as a step toward deeper understanding of The Expression Problem. I like their idea of dual models of functions and objects as algebras and coalgebras, has this appeared elsewhere?Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-45292923104848555492008-04-25T15:54:00.004+01:002008-04-25T16:00:30.212+01:00Alien Category TheoryFrom Glory, by Greg Egan, a story about one alien race trying to uncover the mathematics of another alien race, three million years old.<blockquote><p>The theorem itself was expressed as a commuting hypercube, one of the Niah's favorite forms. You could think of a square with four different sets of mathematical objects associated with each of its corners, and a way of mapping one set into another associated with each edge of the square. If the maps commuted, then going across the top of the square, then down, had exactly the same effect as going down the left edge of<br />the square, then across: either way, you mapped each element from the top-left set into the same element of the bottom-right set. A similar kind of result might hold for sets and maps that could naturally be placed at the corners and edges of a cube, or a hypercube of any dimension. It was also possible for the square faces in these structures to stand for relationships that held between the maps between sets, and for cubes to describe relationships between those relationships, and so on.</p><p>That a theorem took this form didn't guarantee its importance; it was easy to cook up trivial examples of sets and maps that commuted. The Niah didn't carve trivia into their timeless ceramic, though, and this theorem was no exception. The seven-dimensional commuting hypercube established a dazzlingly elegant correspondence between seven distinct, major branches of Niah mathematics, intertwining their most important concepts into a unified whole. It was a result Joan had never seen before: no mathematician anywhere in the Amalgam, or in any ancestral culture she had studied, had reached the same insight.</p></blockquote>Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-90888749845660849022008-04-16T11:31:00.003+01:002008-04-17T10:13:20.801+01:00Fun with correlation and citationsI'm sure I'll want to cite this someday, possibly in class but perhaps in the pub. What I'll be citing it as an example of, I'm not yet sure. Thanks to Leonid Libkin for spotting this.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-30137052316394351532008-04-11T15:28:00.002+01:002008-06-30T13:37:46.362+01:00Fractal Food<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://farm4.static.flickr.com/3257/2400413026_f2f3635eb9.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px;" src="http://farm4.static.flickr.com/3257/2400413026_f2f3635eb9.jpg" alt="" border="0" /></a><br />Who can resist<br /><a href="http://www.evilmadscientist.com/article.php/fractalcookies">Sierpinski cookies</a> and <a href="http://www.urbanhonking.com/digest/archives/2006/06/fractal_pizza.html">fractal pizza</a>? Spotted via Boing Boing.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-9758910140190744342008-04-10T14:10:00.004+01:002008-04-10T14:58:29.494+01:00AOSD 2008, Brussels<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_cvcVu6XSdag/R_4Skg1zzKI/AAAAAAAAAA0/etsX9-CkQ1s/s1600-h/IMG_0131.JPG"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_cvcVu6XSdag/R_4Skg1zzKI/AAAAAAAAAA0/etsX9-CkQ1s/s320/IMG_0131.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5187604239277608098" /></a><br />Last week I delivered a keynote at AOSD, on <a href="http://homepages.inf.ed.ac.uk/wadler/topics/links.html#blame-icfp" >Well-typed programs can't be blamed</a>. It was a marvelous opportunity to learn more about aspects, and more about Brussels.<br /><p>The photo shows me with Gary Leavens atop the <a href="http://www.mim.fgov.be/home_uk.htm" >Musical Instruments Museum</a>. You wander around wearing a headset, and when you stand next to an instrument you can hear it play. Someday soon, our whole world will be augmented in this way; but you won't need a specially supplied headset, you'll use your phone. One pleasure of my trip was to meet Wolfgang De Meuter and Tom Van Cutsem, whose <a href="http://prog.vub.ac.be/amop/" >Ambient Oriented Programming</a> is aimed at just such applications. <br /><p>People I enjoyed meeting include <a href="http://www.deanwampler.com/" >Dean Wampler</a>, <a href="http://www.cs.utah.edu/~eeide/" >Eric Eide</a>, <a href="http://www.rose-hulman.edu/~clifton/" >Curt Clifton</a>, <br /><a href="http://www.cs.technion.ac.il/people/emika/" >Emilia Katz</a>, Maja D'Hondt, and <a href="http://www.vub.ac.be/CLEA/ellie/homepage/welcome.html" >Ellie D'Hondt</a>. Ellie works in quantum computation, and told me (rather to my surprise) that monads have an application there. She had once read one of my papers on monads, but found it too difficult. This cheered me up, since I feel the same when I try to read about quantum computation. <br /><p>Special thanks to <a href="http://prog.vub.ac.be/~tjdhondt/HTM.dir/homepage.htm" >Theo D'Hondt</a>, <a href="http://ssel.vub.ac.be/Members/VivianeJonckers/" >Viviane Jonckers</a>, and <a href="http://prog.vub.ac.be/~imichiel/my_web_page/" >Isabelle Michiels</a> for organizing the conference so well.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-36559076286546200832008-04-07T17:47:00.003+01:002008-04-10T13:44:17.101+01:00Functional Programming is Beautiful<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.lisperati.com/landoflisp/f001.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px;" src="http://www.lisperati.com/landoflisp/f001.png" border="0" alt="" /></a><br />If you use Lisp and disdain Haskell, or vice versa, you'll want to read this brilliant Orwellian strip by Conrad Barski. <a href="http://lambda-the-ultimate.org/node/2749">Spotted</a> by Ehud Lamm at Lambda the Ultimate. Thanks Conrad! Thanks Ehud!Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-26919715512364986392008-03-20T09:48:00.004Z2008-03-20T10:11:28.840ZLockhart's LamentSchool teacher and professional mathematician Paul Lockhart has written a brilliant denunciation of what is wrong with the teaching of mathematics in schools. Much of what he says applies equally well to other subjects, I expect. Certainly much of what passes for learning reading in schools takes something lively and beautiful and does its best to render it dull and lifeless, just like mathematics. And exposure to computing in secondary schools seems more likely to turn off and misdirect students then to prepare them to continue the subject in university.<br /><br />I particularly enjoyed Lockhart's opening, an extended metaphor:<br /><quotation><br />'A musician wakes from a terrible nightmare. In his dream he finds himself in a society where music education has been made mandatory. “We are helping our students become more competitive in an increasingly sound-filled world.” Educators, school systems, and the state are put in charge of this vital project. Studies are commissioned, committees are formed, and decisions are made—all without the advice or participation of a single working musician or composer.<br /><br />'Since musicians are known to set down their ideas in the form of sheet music, these curious black dots and lines must constitute the “language of music.” It is imperative that students become fluent in this language if they are to attain any degree of musical competence; indeed, it would be ludicrous to expect a child to sing a song or play an instrument without having a thorough grounding in music notation and theory. Playing and listening to music, let alone composing an original piece, are considered very advanced topics and are generally put off until college, and more often graduate school.'<br /></quotation>Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-48046707270992234532008-03-06T10:45:00.003Z2008-03-12T09:34:36.612ZOn Extending Wand’s Type Reconstruction Algorithm to Handle Polymorphic LetYears ago, I asked Mitch Wand whether it was possible to extend his lovely <a href="ftp://ftp.ccs.neu.edu/pub/people/wand/papers/fundamenta-87.dvi" >constraint-based inference algorithm</a> to handle polymorphic let. Now Sunil Kothari and James Caldwell have done just that. (François Pottier has also done <a href="http://cristal.inria.fr/~fpottier/publis/fpottier-appsem-2005.pdf" >nice work</a> along these lines, which these authors don't cite.)<br /><br /><b>Postscript:</b> Didier Rémy writes to let me know that the material in François Pottier's notes that I cite above also appears in a definitive textbook form: François Pottier and Didier Rémy. <a href="http://cristal.inria.fr/attapl/" >The Essence of ML Type Inference</a>. In Benjamin C. Pierce, editor, Advanced Topics in Types and Programming Languages, Chapter 10, pages 389-489, MIT Press, 2005. Didier confirms that this work subsumes the work of Kothari and Caldwell.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-3642133376142634682008-02-29T10:49:00.006Z2008-03-03T09:22:31.085ZThe cold truth about climate changeLast December, I wrote about <a href="http://wadler.blogspot.com/2007/12/johnny-ball-betrayal-of-science.html" >Johnny Ball</a>. I was outraged that he ended a lecture that was supposed to educate children about science with a rant denying climate change. That post has eighteen comments to date, more than any other blog entry.<br /><br />I wrote: "The danger in this is that he may leave youngsters feeling that scientific disputes are similar to political disputes, with no understanding of how the scientific method can establish truth independent of popular opinion."<br /><br />Most of those commenting took umbrage with my claim that there is a scientific consensus that man-made climate change is occuring, and they counter-claimed that the IPCC is politically biased. The article linked to above, by Joseph Romm on Salon, sets out the case very well. He points out that the word 'consensus' is indeed inappropriate in the scientific context, and that the IPCC is indeed biased: political influences have caused it to water down its conclusions enormously.<br /><br />My favorite lines from the article: "One reason science works is that a lot of scientists devote their whole lives to overturning whatever is the current hypothesis -- if it can be overturned. That's how you become famous and remembered by history, like Copernicus, Galileo, Newton, Darwin and Einstein.<br /><br />"In fact, science doesn't work by consensus of opinion. Science is in many respects the exact opposite of decision by consensus. General opinion at one point might have been that the sun goes around the Earth, or that time was an absolute quantity, but scientific theory supported by observations overturned that flawed worldview."<br /><br />Thanks to Maurice Naftalin for pointing me at the article. (And now I await a new cascade of critical comments.)Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-40305142130984610352008-02-28T11:57:00.002Z2008-02-28T12:00:04.461ZSimply EasyAndres Loeh, Conor McBride, and Wouter Swierstra. Simply Easy! An implementation of a dependently typed lambda calculus. Draft.<br /><br />A tutorial introduction to dependent types aimed specifically at Haskell programmers. Lovely! I hope this appears somewhere soon.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-7384256115213213012008-02-28T11:55:00.003Z2008-02-28T12:06:35.575ZData Types a la CarteWouter Swierstra. Data Type a la Carte. Functional Pearl, accepted to Journal of functional programming.<br /><br />Presents the best solution to the Expression Problem that I've seen in Haskell (well, Haskell with -fglasgow-exts).<br /><br />There is one unfortunate feature. The instances of the injection function for subtypes are assymmetric:<br /><code><br />data (f :+: g) e = Inl (f e) | Inr (g e)<br /><br />class (Functor sub, Functor sup) => (:<:) sub sup where<br /> inj :: sub a -> sup a<br /><br />instance Functor f => (:<:) f f where<br /> inj = id <br /><br />instance (Functor f, Functor g) => (:<:) f (f :+: g) where<br /> inj = Inl<br /><br />instance (Functor f, Functor g, Functor h, (:<:) f h) => (:<:) f (g :+: h) where<br /> inj = Inr . inj <br /></code><br /><br />It would be better to replace the left instance by one symmetric with the right:<br /><code><br />instance (Functor f, Functor g, Functor h, (:<:) f g) => (:<:) f (g :+: h) where<br /> inj = Inl . inj<br /></code><br />But Haskell, alas, cannot support this (even with -fglasgow-exts). Is there a symmetric solution in Haskell?Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-19983575507669403862008-02-26T17:29:00.004Z2008-02-27T09:51:08.782ZGreat minds think alikeOne of my favourite examples of the confluence of theory and practice is this pair of papers on exception handling.<br /><br />Nick Benton and Andrew Kennedy, <a href="http://dx.doi.org/10.1017/S0956796801004099" >Exceptional Syntax</a>, Journal of Functional Programming, 11(4):395--410, July 2001.<br /><br />Richard Carlsson, Björn Gustavsson, Patrik Nyblom <a href="http://portal.acm.org/citation.cfm?id=1022471.1022475" >Erlang's Exception Handling Revisited</a>, Erlang Workshop, Snowbird, Utah, September 2004.<br /><br />Both present exactly the same variant on traditional exception handling, but the first paper is driven by proof-theoretic concerns, while the second is entirely pragmatic. (Alas, the symmetry is marred by the fact that Benton and Kennedy also address pragmatics, though one can hardly fault them for that.)<br /><br />Both papers exhibit deep insight of different kinds, and both are a pleasure to read. A brilliant example of Curry-Howard in action!Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-56372462089245787532008-02-13T18:50:00.002Z2008-02-13T18:55:02.615ZLambda Calculus in a Can<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://alum.wpi.edu/~tfraser/Software/Arduino/lambdacan-can.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px;" src="http://alum.wpi.edu/~tfraser/Software/Arduino/lambdacan-can.png" border="0" alt="" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://alum.wpi.edu/~tfraser/Software/Arduino/lambdacan-parts.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px;" src="http://alum.wpi.edu/~tfraser/Software/Arduino/lambdacan-parts.png" border="0" alt="" /></a><br /><br />`You can get soup in a can. You can get bread in a can. Now the long wait is over! You can finally get Lambda Calculus in a can...Project LambdaCan takes [the Lambda Calculus] and implements it on a microcontroller better suited to the most mundane of tasks, like running a vending machine or microwave oven. And it sticks the microcontroller in a can that you can connect to your PC using a USB cable.'<br /><br />Spotted on <a href="http://lambda-the-ultimate.org/node/2661" >Lambda the Ultimate</a>.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-42083043694031011772008-02-06T09:48:00.000Z2008-02-06T10:17:02.215ZWeb Trend Map 2008<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://8.12.43.168/webtrendmap3/trendmap2008.html"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_cvcVu6XSdag/R6mDUtN4RZI/AAAAAAAAAAk/-fgeiF-ko40/s320/webtrendmap2008.jpg" border="0" alt="Web Trends Map 2008" id="BLOGGER_PHOTO_ID_5163802839515415954" /></a><!-- http://bp1.blogger.com/_cvcVu6XSdag/R6mDUtN4RZI/AAAAAAAAAAk/-fgeiF-ko40/s1600-h/webtrendmap2008.jpg http://bp1.blogger.com/_cvcVu6XSdag/R6mDUtN4RZI/AAAAAAAAAAk/-fgeiF-ko40/s320/webtrendmap2008.jpg -->`This time we’ve taken almost 300 of the most influential and successful websites and pinned them down to the greater Tokyo-area train map.'<br /><br />It reminds me of <a href="http://en.wikipedia.org/wiki/Simon_Patterson_%28artist%29">Simon Patterson</a>'s <a href="http://en.wikipedia.org/wiki/The_Great_Bear">The Great Bear</a>.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_cvcVu6XSdag/R6mFddN4RaI/AAAAAAAAAAs/KuD28Y3UJwc/s1600-h/patterson_great_bear.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://bp0.blogger.com/_cvcVu6XSdag/R6mFddN4RaI/AAAAAAAAAAs/KuD28Y3UJwc/s320/patterson_great_bear.jpg" border="0" alt="Simon Patterson's The Great Bear" id="BLOGGER_PHOTO_ID_5163805188862526882" /></a>Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-67324779513768810712008-01-22T11:08:00.000Z2008-01-22T11:45:43.739ZPOPL in San Francisco<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_cvcVu6XSdag/R5XSJJXakbI/AAAAAAAAAAc/lWhbXR1B3NM/s1600-h/robby-and-phil-at-palace-of-fine-arts.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://bp1.blogger.com/_cvcVu6XSdag/R5XSJJXakbI/AAAAAAAAAAc/lWhbXR1B3NM/s320/robby-and-phil-at-palace-of-fine-arts.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5158260002797556146" /></a><br />POPL in San Francisco was brilliant. My thanks to everyone who made it happen, particularly the authors and speakers. This year we tried an experiment, with three talks in an hour session (rather than three talks in an hour and a half, or four talks in two hours). I was delighted that all of the speakers worked hard to give a proper twenty minute talk, rather than cramming a thirty minute talk into twenty by speaking fast. Conor McBride deserves special mention for a superb performance of his pearl, 'Clowns to the left of me, jokers to the right'. The comments I received on twenty minute talks and on pearls were positive, and I hope both will become POPL traditions.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_cvcVu6XSdag/R5XSApXakaI/AAAAAAAAAAU/q09gfmgaySo/s1600-h/robby-and-phil-on-segways.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_cvcVu6XSdag/R5XSApXakaI/AAAAAAAAAAU/q09gfmgaySo/s320/robby-and-phil-on-segways.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5158259856768668066" /></a>One of the joys of the trip was sitting in the sun at Union Square, working on the blame calculus with Jacob Matthews, Amal Ahmed, and Robby Findler. Another was going on a Segway tour of Fisherman's Wharf with Robby. The photos show us on our Segways and in front of the Palace of Fine Arts.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-87857825629613745632008-01-22T10:54:00.000Z2008-01-22T11:29:00.601ZRepresentation PainSome representations are easier to use than others. Ease of use also seems to depend on purpose and inclination. S-expressions are excellent for many purposes, but the associative law is far easier to read in an infix notation. Compare<br /><code><br /> (= (+ x (+ y z)) (+ (+ x y) z))<br /></code><br />and<br /><code><br /> x + (y + z) = (x + y) + z.<br /></code><br />My taste puts S-expressions far above XML, but given the relative popularity of the two, I presume for some it is the exact opposite.<br /><br />Ezra Cooper and I observed the importance of the pain of representation in connection with mapping function calls into path names. If every function takes a fixed number of arguments, one can map a call directly into a path name. For example,<br /><code><br /> f(g(a,b), h(c))<br /></code><br />becomes<br /><code><br /> f/g/a/b/h/c<br /></code><br />although the second is less clear to read. We could map open and close brackets into the path<br /><code><br /> f/open/g/open/a/b/close/h/open/c/close/close<br /></code><br />but this so painful as to be worse than useless.<br /><br />There must be a psychological theory that can underpin such choices. A quick web search failed to turn up anything apposite, suggestions for the correct terms to search on would be welcome.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-66057117910079033672007-12-18T09:19:00.000Z2008-01-23T13:22:20.881ZJohnny Ball: A Betrayal of ScienceLast night, I took my family to see a Christmas lecture by Johnny Ball, famous as a television presenter that popularized mathematics with shows in the 1970s and 80s such as <em>Think of a Number</em>.<br /><br />The beginning of his talk was a beautiful introduction to square laws in the work of Galileo, Kepler, and Newton, with some lovely audience-participation demonstrations showing the value of experiment. Unfortunately, this was belied by the second half, a rant in denial of climate change that included statements such as 'The greens don't want modern society to work so they've decided to demonize carbon' and 'Carbon makes up only 1/3000 of the gases in the atmosphere. Can that have such a big effect? I don't think so'. No mention of the IPCC or the scientific consensus that contradicts his view.<br /><br />The danger in this is that he may leave youngsters feeling that scientific disputes are similar to political disputes, with no understanding of how the scientific method can establish truth independent of popular opinion.<br /><br />I gather his hosts, the University of Edinburgh and the Royal Society of Edinburgh, had no idea he was going to go off on this tangent. Going by the first half of his talk, he used to be capable of giving a truly wonderful introduction to science for young people. But now he should not be let near them; he has betrayed his trust.<br /><br />[Update: This incident was reported in the TES<br /><a href="http://www.tes.co.uk/search/story/?story_id=2559480">Johnny causes storm in lecture on climate change</a>.]Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-61012039485572195972007-12-17T09:44:00.000Z2007-12-17T09:54:46.867ZSpeculations on the Future of ScienceFrom Kevin Kelly, former editor of Wired.<blockquote>"Technology is, in its essence, new ways of thinking. The most powerful type of technology, sometimes called enabling technology, is a thought incarnate which enables new knowledge to find and develop news ways to know. This kind of recursive bootstrapping is how science evolves. As in every type of knowledge, it accrues layers of self-reference to its former state."</blockquote>Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-89845086026748649222007-12-14T16:53:00.001Z2007-12-14T17:01:48.437ZDroste<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://upload.wikimedia.org/wikipedia/commons/6/62/Droste.jpg"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px;" src="http://upload.wikimedia.org/wikipedia/commons/6/62/Droste.jpg" border="0" alt="" /></a><br />"The Droste effect is a Dutch term for a specific kind of recursive picture, one that in heraldry is termed mise en abyme."Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-52031806347164143182007-12-04T15:20:00.000Z2007-12-14T16:53:06.586ZArithmetic for listsHere are analogues of sum, product, and exponentiation for lists. Each takes two lists of values, of types a and b, and forms the list of all values of sum, product, and function (exponent) types.<br /><code><br />type Sum a b = Either a b<br />type Prod a b = (a,b)<br />type Exp a b = [(b,a)] -- represents functions from b to a<br /><br />(+++) :: [a] -> [b] -> [Sum a b]<br />xs +++ ys = map Left xs ++ map Right ys<br /><br />(***) :: [a] -> [b] -> [Prod a b]<br />xs *** ys = [ (x,y) | x <- xs, y <- ys ]<br /><br />(^^^) :: [a] -> [b] -> [Exp a b]<br />xs ^^^ [] = [ [] ]<br />xs ^^^ (y:ys) = [ (y,x):e | x <- xs, e <- xs^^^ys ]<br /></code><br />The first two of these are already built-in to Haskell, in the form of append and list-comprehensions. The third is also quite useful, and I suggest it should be added to the standard List module. For example, if you want to form a truth table for the list of variables in names, your can do so using [True,False]^^^names to form all 2^n mappings of names to truth variables (where n is the length of names).<br /><br />In case you doubt whether these actually correspond to sum, product, and exponentiation, here are Peano's definitions:<br /><code><br />m+0 = m<br />m+(n+1) = (m+n)+1<br /><br />m*0 = 0<br />m*(n+1) = (m*n)+m<br /><br />m^0 = 1<br />m^(n+1) = (m^n)*m<br /></code><br />And here are the above operations, rewritten to correspond to Peano's definitions:<br /><code><br />(+++) :: [a] -> [b] -> [Sum a b]<br />[] +++ ys = map Right ys<br />(x:xs) +++ ys = Left x : (xs +++ ys)<br /><br />(***) :: [a] -> [b] -> [Prod a b]<br />[] *** ys = []<br />(x:xs) *** ys = map f (ys +++ (xs *** ys))<br /> where<br /> f (Left y) = (x,y)<br /> f (Right p) = p<br /><br />(^^^) :: [a] -> [b] -> [Exp a b]<br />xs ^^^ [] = [ [] ]<br />xs ^^^ (y:ys) = map g (xs *** (xs ^^^ ys))<br /> where<br /> g (x,e) = (y,x):e<br /></code>Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-28123889760172908672007-12-03T13:21:00.000Z2007-12-03T13:25:13.199ZLambdacatsThanks to <a href="http://www.ccs.neu.edu/home/wand/">Mitchell Wand</a>.Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.comtag:blogger.com,1999:blog-9757377.post-56987701068552112432007-11-29T09:30:00.000Z2008-01-04T16:25:59.710ZAre our Civil Liberties being unduly eroded?[From the newsletter of the Royal Society of Edinburgh.]<br /><br />This Mock Trial, chaired by Dr Magnus Linklater FRSE, was staged at the Society on Monday 19 November, before a capacity audience, who acted as jurors. The protagonists were Baroness (Helena) Kennedy, QC, who led three witnesses, Shami Chakrabarti, Director of Liberty, Henry Porter, Novelist and Journalist and Roy Martin QC, Former Dean, Faculty of Advocates, arguing for the proposition; and Lord (Charlie) Falconer, PC QC, arguing to the contrary, leading Lord Elder, House of Lords, Alistair Bonnington, Solicitor to the BBC in Scotland and Lord McCluskey, former Solicitor General for Scotland. The event was supported by the Faculty of Advocates, Messrs Balfour & Manson and Messrs Simpson & Marwick, solicitors, and the Clark Foundation, to all of whom the Society is immensely grateful. This interesting and entertaining debate can now be viewed on the <a href="http://www.royalsoced.org.uk/events/video/mock_trial.htm">Society’s web page</a>.<br /><br />[The audience, in the role of jury, voted before and after the trial. The initial vote was 94 in favor, 33 against, 20 undecided; the final vote was 95 in favor, 45 against, 7 undecided.]Philip Wadlerhttp://www.blogger.com/profile/12009347515095774366noreply@blogger.com