From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.science.mathematics.categories/5413 Path: news.gmane.org!not-for-mail From: Mike Stay Newsgroups: gmane.science.mathematics.categories Subject: Re: additions Date: Wed, 23 Dec 2009 10:06:15 -0800 Message-ID: References: Reply-To: Mike Stay NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1261595411 25474 80.91.229.12 (23 Dec 2009 19:10:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Dec 2009 19:10:11 +0000 (UTC) To: Steve Vickers Original-X-From: categories@mta.ca Wed Dec 23 20:10:04 2009 Return-path: Envelope-to: gsmc-categories@m.gmane.org Original-Received: from mailserv.mta.ca ([138.73.1.1]) by lo.gmane.org with esmtp (Exim 4.50) id 1NNWau-0005Rf-6V for gsmc-categories@m.gmane.org; Wed, 23 Dec 2009 20:10:00 +0100 Original-Received: from Majordom by mailserv.mta.ca with local (Exim 4.61) (envelope-from ) id 1NNWLx-0002Jr-Oo for categories-list@mta.ca; Wed, 23 Dec 2009 14:54:33 -0400 In-Reply-To: <85E4A5AE-3C86-450A-BFFC-4760E40B89F1@cs.bham.ac.uk> Original-Sender: categories@mta.ca Precedence: bulk Xref: news.gmane.org gmane.science.mathematics.categories:5413 Archived-At: On Wed, Dec 23, 2009 at 3:19 AM, Steve Vickers wrote: > Dear Mike, > > Of course, in functional programming the applications of categories go far > beyond lambda terms. > > (1) At a fairly elementary level, the treatment of list types in functional > programming languages... > (2) More advanced, Haskell has made important use of monads as a programming > technique... > So it could be that the best way forward is to teach them Haskell first... Thanks, everyone for your replies! Many of you suggested the same approach as Steve, functional programming and monads. At Google, however, we use Java, C++ and Python (collectively "JCP") for programs that run on our servers and JavaScript for programs that run in our webpages. So there's not a lot of call for learning a functional programming language either. On the wikipedia page for monads in functional programming, I see these examples: * I/O--JCP aren't functional; side effects are easy. * Maybe--This one's really exception handling, built into JCP. * Identity--so trivial it's never used. * Lists--built into JCP as arrays, together with the function "map"; the rest of the data structures are in the standard libraries, too. Monads and catamorphisms certainly give a more unified picture, but still not enough benefit to a programmer to justify the investment in learning category theory. * State & environment--as before, JCP aren't functional. State and environment are easy to come by. * Continuation passing style transformation--useful for functional language compiler writers for turning recursive programs into iterative ones that don't consume the stack. Very small audience. Continuations are also useful for coroutines and "threadless actors", but malicious code can consume all the resources--in this model, there's no preemptive multitasking; it's all voluntary. JCP are eagerly evaluated. One monad that isn't on the wiki page is for making a program be lazily evaluated. That can come in handy sometimes, but still doesn't justify learning category theory. I suppose the strongest argument I've heard for learning functional programming (and thereby justifying learning category theory) is that functional programs are much easier to test: there's no inaccessible state to worry about setting up properly. Monads allow the functional programmer to do easily all these things he's used to from imperative programming, while gaining the benefits of easy testability. Other reasons I've received involve solving problems in specialized domains. I think if I have a long enough list of these, I could probably convince my friends of category theory's utility. -- Mike Stay - metaweta@gmail.com http://math.ucr.edu/~mike http://reperiendi.wordpress.com [For admin and other information see: http://www.mta.ca/~cat-dist/ ]