From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.science.mathematics.categories/5441 Path: news.gmane.org!not-for-mail From: Mike Stay Newsgroups: gmane.science.mathematics.categories Subject: Re: additions Date: Tue, 29 Dec 2009 15:17:05 -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 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1262182378 11943 80.91.229.12 (30 Dec 2009 14:12:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Dec 2009 14:12:58 +0000 (UTC) To: categories@mta.ca Original-X-From: categories@mta.ca Wed Dec 30 15:12:51 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 1NPzHx-0001T7-2j for gsmc-categories@m.gmane.org; Wed, 30 Dec 2009 15:12:37 +0100 Original-Received: from Majordom by mailserv.mta.ca with local (Exim 4.61) (envelope-from ) id 1NPyuH-0001lW-1O for categories-list@mta.ca; Wed, 30 Dec 2009 09:48:09 -0400 In-Reply-To: <4B347567.9070603@bath.ac.uk> Original-Sender: categories@mta.ca Precedence: bulk Xref: news.gmane.org gmane.science.mathematics.categories:5441 Archived-At: 2009/12/25 Carsten F=FChrmann : > I used the term "functional [programming] language" on purpose (as > opposed to "functional programming style"), because of your statement > >> So there's not a lot of call for learning a functional programming >> language either. > > which I feel might be wrong. OK, I worded that badly. I think there are lots of reasons to learn functional programming, and once you're doing functional programming, then you need to learn category theory to do it well. Most of the code we've got is not functional, and the languages we work with make it hard to use higher-order functions and closures. So there's some resistance to overcome in convincing people to use functional style. > I meant that JavaScript is a functional > programming language in the same way in which ML/OCaml/F#, Lisp, and > Scheme are (just uglier, slower, and running in a sandbox called > "browser"). These are considered functional languages by many, and > their categorical semantics has been studied. (Well, the semantics of > idealized versions.) JavaScript is just riddled with some syntactic > and semantic ugliness that makes it unattractive for formal study, but > that doesn't make it un-functional in principle. The syntax of those languages certainly encourages functional composition over imperative programming, and they make it easy to construct closures and higher-order functions. However, none of them are purely functional like Haskell. I suppose I don't see the point of making the distinction between functional and imperative unless you really can't cause side-effects. >> I'm not sure what you mean by "the whole monad business does not >> apply". There are lots of monads, each doing something different. >> There are several monadic parsers I know of in JavaScript, for >> instance. Here's a monad for making JavaScript be lazily evaluated >>instead of eager: >> function e(x) { return function() { return x; } } >> function m(x, y) { return function () { return x()(y()); } } > > Doesn't very fact that JavaScript allows you to write down the > delaying monad give away its functional-language nature? And doesn't I could write down the delaying monad in Java, too, but it would be much larger. If the only feature you require of a functional language is that the syntax makes it *possible* to create closures, then nearly any programming language will fit the bill. If it has to be easy, then Java and C/C++ are not functional, while Scheme, ML, JavaScript and Perl are. On the other hand, if you say that it should be hard to use the imperative style in a functional language, then Scheme and ML are functional, while Perl and JavaScript are not. > the existence of monadic parsers in JavaScript underpin that it might > be beneficial for real-life programmers to learn some functional > programming? Sure. See above. > By "monad business" I meant using monads to introduce side effects to > lazy languages like Haskell, I could have been clearer there. > > Categorically, your monad is of a different kind, as I shall now > sketch. (Just in case anyone is interested.) Thanks, that _was_ interesting! I suppose what I'm really looking for is cool algorithms like the one described in Backhouse's paper "Fusion on Languages" (thanks, Neel!) where they either wouldn't have been discovered without category theory, or where category theory is the only decent way to understand the algorithm. > Happy holidays, > Carsten Thanks! To you, too. --=20 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/ ]