[Haskell-cafe] Re: what are the points in pointsfree?
Hello, Please view my claims with a healthy dose of scepticism: I know a little category theory, but only from the mathematical point of view, not as employed in computer science. Scott Brickner wrote: > Anyway, as I understood it, the "points" were the terminal objects of > the category in which you're working - in this case, pointed continuous > partial orders (CPO), and the points are effectively values in the > domain. Not quite. By a "point" /of X/ (X an object of your category) one usually means a morphism from the terminal object to X. The terminal object itself is essentially unique, and is the abstract version of "a space/set/type with only one point" (which you may call a point, if you like). I don't know what CPO is, but if it's anything like the category of Haskell types and functions, the terminal object is bound to be the type '()', having one value '()'. So in CPO, a "point" of X would be a function from '()' to X, corresponding to a particular value of type X (namely the value of the function at '()'). > Category theory got the term from topology, which got it from geometry. > So you could say "point" is "position without dimension" - but that's > just not the "point" we're talking about anymore. In the category of topological spaces, the terminal object is the one-point space, and the abstract point of X correspond directly to the usual points of X (its elements), just as in CPO. I would say that the concept of "point" is very similar. > So, the usage of "point" here refers a terminal object in the CPO > category, which means a value of some datatype - in this particular > case, a value in the domain of the function being defined. So when you > give a definition that uses patterns for the parameters, the variables > in the patterns get bound to the values in the domain of the function. > If you write the function in a higher-order style, where you don't bind > the values, your definition doesn't refer to the "point" at which it's > being evaluated, hence "point-free". Except for the "terminal object in the CPO category" part, I agree. Points are just values, and a point-free definition is one that does not mention specific points of its domain. Greetings, Arie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: what are the points in pointsfree?
No fair. Although I've a B.S. in Mathematics, I spent most of my time in complex analytic dynamical systems, rather than hanging with the algebraists. Except for a bit where I did some graph theory. Rather ironic. On 12/15/06, Scott Brickner <[EMAIL PROTECTED]> wrote: Donald Bruce Stewart wrote: >sdowney: > > >>i'm not naive enough to think they are the composition function, and >>i've gathered it has something to do with free terms, but beyond that >>i'm not sure. unless it also has something to do with fix points? >> >> > >The wiki knows all! :) > >http://haskell.org/haskellwiki/Pointfree > >1 But pointfree has more points! > >A common misconception is that the 'points' of pointfree style are the (.) >operator (function composition, as an ASCII symbol), which uses the same >identifier as the decimal point. This is wrong. The term originated in >topology, a branch of mathematics which works with spaces composed of points, >and functions between those spaces. So a 'points-free' definition of a function >is one which does not explicitly mention the points (values) of the space on >which the function acts. In Haskell, our 'space' is some type, and 'points' are >values. > > Hm. I've been lurking for a while, and this might be a bit of nit-picking as my first post, especially given I'm still a bit of a n00b in Haskell. I've been programming a long time, though - coming up on three decades now and virtually all of it really programming, no management. Anyway, as I understood it, the "points" were the terminal objects of the category in which you're working - in this case, pointed continuous partial orders (CPO), and the points are effectively values in the domain. The usage of "point" for terminal objects comes from the category of topological spaces, as you say,. and algebraic topology is where category theory found it's first big home - but that's not really what we're talking about here, is it? Category theory got the term from topology, which got it from geometry. So you could say "point" is "position without dimension" - but that's just not the "point" we're talking about anymore. So, the usage of "point" here refers a terminal object in the CPO category, which means a value of some datatype - in this particular case, a value in the domain of the function being defined. So when you give a definition that uses patterns for the parameters, the variables in the patterns get bound to the values in the domain of the function. If you write the function in a higher-order style, where you don't bind the values, your definition doesn't refer to the "point" at which it's being evaluated, hence "point-free". -- - What part of "ph'nglui bglw'nafh Cthulhu R'lyeh wagn'nagl fhtagn" don't you understand? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: what are the points in pointsfree?
so pointsfree is a step beyond leaving the domain unspecified. Actually, the domain is specified - a function written as f = g . h has the same domain as h has. my reading knowledge of haskell at this point far exceeds my ability to write haskell. but so far, it has seemed to me that functions written in the pf style are the most reuseable. from what you just told me, it's not an artifact of the pf style, but that maximally reusable functions will be expressible in a pointsfree style. that those functions embody a pattern of computation, without concern for the details. I don't see where reusability is affected either way. Many (all?) functions can be written in either style, and the definitions are equivalent. There are a few advantages I've seen to pf style: 1. Function definitions are shorter, and sometimes clearer. 2. It saves you from having to give points in the domain a name. 3. It can make reasoning about programs simpler. For example, if we know that reverse . reverse == id then anywhere we see reverse . reverse, we can replace it with id, without having to track any other variables. In particular, Richard Bird's book and articles use this to great effect for program transformation and derivation from specification ("Bird-Meertens formalism") The only disadvantage I know of is that it can lead to obfuscation, especially if Haskell hasn't twisted your brain yet (in a good way). -- Chad Scherrer "Time flies like an arrow; fruit flies like a banana" -- Groucho Marx ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: what are the points in pointsfree?
G'day all. Quoting Steve Downey <[EMAIL PROTECTED]>: > from what you just told me, it's not an artifact of the pf style, but > that maximally reusable functions will be expressible in a pointsfree > style. Not necessarily. (There's a fairly obvious reductio ad absurdum argument as to why: at least the primitives like "map" and "foldr" need to be expressed in a pointed way!) Pointsfree functions are not necessarily maximally reusable, but they're usually maximally refactorable. As an example, the associative law for monads looks like this in pointed style: (m >>= k1) >>= k2 = m >>= (\x -> k1 x >>= k2) Applying this law from left to right requires introducing a fresh variable, which involves checking for name clashes, even if only briefly, and introduces a new name that doesn't necessarily have a good "meaning". Applying the law from right to left might require a lot of fiddling with k1 to get it in the right form, and checking that the variable, x, is not free in m or k2. In point-free style, the associative law for monads looks like this: join . join = join . fmap join In either direction, this is almost trivial. Cheers, Andrew Bromage ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: what are the points in pointsfree?
the wiki wasn't half as clear. other tham covering the first half, that it doesn't mean the '.' function. so pointsfree is a step beyond leaving the domain unspecified. my reading knowledge of haskell at this point far exceeds my ability to write haskell. but so far, it has seemed to me that functions written in the pf style are the most reuseable. from what you just told me, it's not an artifact of the pf style, but that maximally reusable functions will be expressible in a pointsfree style. that those functions embody a pattern of computation, without concern for the details. On 12/14/06, Donald Bruce Stewart <[EMAIL PROTECTED]> wrote: sdowney: > i'm not naive enough to think they are the composition function, and > i've gathered it has something to do with free terms, but beyond that > i'm not sure. unless it also has something to do with fix points? The wiki knows all! :) http://haskell.org/haskellwiki/Pointfree 1 But pointfree has more points! A common misconception is that the 'points' of pointfree style are the (.) operator (function composition, as an ASCII symbol), which uses the same identifier as the decimal point. This is wrong. The term originated in topology, a branch of mathematics which works with spaces composed of points, and functions between those spaces. So a 'points-free' definition of a function is one which does not explicitly mention the points (values) of the space on which the function acts. In Haskell, our 'space' is some type, and 'points' are values. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe