Re: [Haskell-cafe] Doing some things right
On Saturday 29 December 2007 07:18:28 Peter Verswyvelen wrote: Jon Harrop wrote: However, both F# and Scala have the potential to dwarf all of these languages in the not-so-distant future. I believe F# will do so in 2008 but Scala will take 2-3 years because they have far fewer resources to develop essential tools like working IDE plug-ins. I agree on that. IMHO, having looked at both F# and Scala, these seem like the most pragmatic languages, adding functional programming on top of industry proven imperative/OO technologies. F# is certainly pragmatic and I'm hugely impressed with the work they're doing. I'm undecided about Scala. It seems to be going in research directions that solve new problems at the (grave) expense of usability. In particular, it seems to have forgotten many of the lessons taught by languages like OCaml and Haskell. Furthermore, if F# really becomes an officially supported Microsoft product as promised, this will indeed have the potential of rapidly becoming popular. It is also possible that C# will get more and more functional features as it is currently doing, and hence either become a monster or remain very popular in the industry... Yes. Microsoft have already employed half a dozen people to work on F# full time, so I think there is no question that they are putting their money where their mouth is. And what do you think about Sun's Fortress? I kind of liked that language a lot too, but it was way too early to use it. I have only read a presentation about Fortress and not actually tried to use it. While I think it is nice that Sun are trying to do something specfically for technical users, I think they would get a lot more out of an industrial-strength implementation of ML like F#. What I like about Haskell is that the language progresses faster than I can learn it ;-) (which might be one of the reasons people don't like it, but hey, it's a *research* language, it must advance!) As much as I like the languages, I would really like to ship commercial software for them (e.g. libraries for visualization) but the current generation of implementations basically make this impossible. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Doing some things right
? Kay's definition of OOP necessarily implies imperative behaviour. OCaml has purely functional object update IIRC. That's OK, but it doesn't seem to agree with Kay's definition. Erlang definitely does. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Specializing classes with classes
G'day all. Quoting alex [EMAIL PROTECTED]: (Presumably you meant instance Alg Sometype, instance Vec Sometype etc.) Yes, most likely. Obviously I didn't try to compile the code. Now I know what they meant what they meant by leave your OO at the door. To be fair, Haskell typeclasses are no less OO than DCOM or CORBA, and have similar limitations. Haskell gives you interface inheritance, with a couple of things that were easy to implement to make your life a bit easier. And, of course, the inability to declare a subclass and get the superclass instances for free is considered by pretty much everyone to be a limitation which will be fixed, once the tricky cases are worked out. Cheers, Andrew Bromage ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell-cafe reply-to etiquette
Albert Y. C. Lai [EMAIL PROTECTED] writes: B. This mailing list sets the List-Post header: List-Post: mailto:haskell-cafe@haskell.org Progressive mail clients honour this, e.g., Evolution. Thus you are given three buttons: I'm rather tied to my MUA, and while I'm not complaining (and Gnus lets me conpensate for different practices on a list-by-list basis), it's really the list management software, mailman, that should allow individual subscribers to configure the headers. So for people unhappy with the current situation, you can either fix mailman, or, for extra credit, write a better replacement in Haskell :-) -k -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Specializing classes with classes
alex wrote: Hi, I am new to everything Haskell and am stumped on an aspect of Type Classes. I would like to do this: class Foo t where hi :: t - Bool class Foo t = Bar t where hi x = True But using GHC 6.8.1 on PPC I get this error: `hi' is not a (visible) method of class `Bar' You can't do that. (Well, you just discovered that!) When you say class Foo t = Bar t, what you're saying is that no type can belong to Bar until it belongs to Foo first. And that is all. Remember, in Haskell any given type can belong to any number of classes all at once. All the definition there says is that you have to add a type to Foo before you can add it to Bar. You still have to write two [seperate] instance declarations. It's not like OOP where every Bar *is* a Foo. They remain seperate. You just need to have one before you can have the other. Beyond that, they share nothing. [Well, the default methods for Bar can mention methods in Foo. But that's about it.] One might hope, for example, that you could define a Vector class, and make it so that anything that is a member of Vector is automatically a member of Num. Sadly, this is impossible. Even if each instance declaration is identical but for the type names, you must still write out each definition seperately. Pitty... ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Doing some things right
Luke Palmer wrote: OO is orthogonal to functional. Erlang is pure functional, Lisp is a bastard child... 1. Wasn't Lisp here first? (I mean, from what I've read, Lisp is so old it almost predates electricity...) 2. I'm curios as to how you can have a functional OO language. The two seem fundamentally incompatible: - FP could be defined as programming without mutable state. - In OOP we have the definition: An object has identity, state and behaviour. That a state has an *identity* more or less demands *mutable* state. So OOP is programming with mutable state inside objects, and FP is programming without mutable state. Hmm... 3. I know very little about Erlang, but the Haskell wiki claims it is not pure functional. (This agrees with the small amount of Erlang I do know.) http://www.haskell.org/haskellwiki/Comparison_of_functional_programming_languages ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Doing some things right
On Dec 29, 2007 10:32 AM, Andrew Coppin [EMAIL PROTECTED] wrote: Luke Palmer wrote: OO is orthogonal to functional. Erlang is pure functional, Lisp is a bastard child... 1. Wasn't Lisp here first? (I mean, from what I've read, Lisp is so old it almost predates electricity...) Before the concepts of OO, functional, and imperative? Well, certainly before OO -- the other two... perhaps. 2. I'm curios as to how you can have a functional OO language. The two seem fundamentally incompatible: See O'Caml, O'Haskell. I'd call those OO functional languages. You may reject state from OO and still have something which is quite close to OO. But it's a matter of minor semantics now I think... 3. I know very little about Erlang, but the Haskell wiki claims it is not pure functional. (This agrees with the small amount of Erlang I do know.) I don't know any erlang. Someone in freenode.net#erlang things erlang is pure functional :-) Luke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
On Sat, 29 Dec 2007 01:42:54 +0200, Jonathan Cast [EMAIL PROTECTED] wrote: Here is how I want print to be in Haskell print :: (a-b) - (a-b) with print = id, but the following side effect: - I want to call the print function today, and get the value tomorrow. Sorry, simply couldn't resist: Put a very long timing loop in the middle. Well, that kind of loop won't work. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
On Sat, 29 Dec 2007 02:08:14 +0200, Jonathan Cast [EMAIL PROTECTED] wrote: How can one make portable dynamic libraries then ? If by portable you mean, works on /both/ OSs, then GHC-specific should be portable enough for you... By portable I mean: works on the same machine, with the same OS, but with different Haskell implementation. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
On Sat, 29 Dec 2007 13:01:44 +0200, Cristian Baboi [EMAIL PROTECTED] wrote: On Sat, 29 Dec 2007 02:08:14 +0200, Jonathan Cast [EMAIL PROTECTED] wrote: How can one make portable dynamic libraries then ? If by portable you mean, works on /both/ OSs, then GHC-specific should be portable enough for you... By portable I mean: works on the same machine, with the same OS, but with different Haskell implementation. I should have used compatible. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Sending bottom to his room
In The Implementation of Functional Programming Languages by S.P. Jones, section 2.5.3, page 32 it is written: Eval [[*]] a b = a x b Eval [[*]] _|_ b = _|_ Eval [[*]] a _|_ = _|_ but in section 2.5.2 it is said that _|_ is an element of the value domain. What business does it have on the left side of the '=' ? Can you help me send him to his room ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Sending bottom to his room
Sorry, I think a and b are from the value domain. On Sat, 29 Dec 2007 13:14:09 +0200, Cristian Baboi [EMAIL PROTECTED] wrote: In The Implementation of Functional Programming Languages by S.P. Jones, section 2.5.3, page 32 it is written: Eval [[*]] a b = a x b Eval [[*]] _|_ b = _|_ Eval [[*]] a _|_ = _|_ but in section 2.5.2 it is said that _|_ is an element of the value domain. What business does it have on the left side of the '=' ? Can you help me send him to his room ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Doing some things right
Luke Palmer wrote: On Dec 29, 2007 10:32 AM, Andrew Coppin [EMAIL PROTECTED] wrote: 1. Wasn't Lisp here first? (I mean, from what I've read, Lisp is so old it almost predates electricity...) Before the concepts of OO, functional, and imperative? Well, certainly before OO -- the other two... perhaps. I actually meant before Erlang, O'Camal and Haskell. ;-) 2. I'm curios as to how you can have a functional OO language. The two seem fundamentally incompatible: See O'Caml, O'Haskell. I'd call those OO functional languages. You may reject state from OO and still have something which is quite close to OO. But it's a matter of minor semantics now I think... Right. So a language where you have objects and methods, it's just that all objects are immutable? 3. I know very little about Erlang, but the Haskell wiki claims it is not pure functional. (This agrees with the small amount of Erlang I do know.) I don't know any erlang. Someone in freenode.net#erlang things erlang is pure functional :-) And I met somebody who thinks assembly is a pure OO language. ;-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Sending bottom to his room
On Dec 29, 2007 11:14 AM, Cristian Baboi [EMAIL PROTECTED] wrote: In The Implementation of Functional Programming Languages by S.P. Jones, section 2.5.3, page 32 it is written: Eval [[*]] a b = a x b Eval [[*]] _|_ b = _|_ Eval [[*]] a _|_ = _|_ but in section 2.5.2 it is said that _|_ is an element of the value domain. What business does it have on the left side of the '=' ? I don't know the book you're talking about, but I suspect that this is not a definition of a function in a language, but rather the denotational semantics for a function. Just as mathematics is allowed to categorize all turing machines into two categories (those that halt and those that do not), even though to actually do this is impossible, so too can mathematics talk about what a function returns when given _|_, even though it is impossible in general to know when you actually do have _|_ or you're just waiting for a value. However, if you saw something like this: Eval [[*]] a b = a x b Eval [[*]] _|_ b = b Eval [[*]] a _|_ = a Then you would have cause for alarm, since this is not a monotone function (am I using that term correctly?). Luke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Doing some things right
Andrew Coppin [EMAIL PROTECTED] wrote: Luke Palmer wrote: OO is orthogonal to functional. Erlang is pure functional, Lisp is a bastard child... 2. I'm curios as to how you can have a functional OO language. The two seem fundamentally incompatible: By writing an object that takes a parameter in its constructor (eg. Int) and has a member of type () - Int, you have a closure, which is a let binding. Then you most likely have expression nesting, and you're done. You can, of course, also take a C struct and call the whole thing a chunk or whatever, but that's beside the point. In Java, you have inner classes, which make writing in a functional style verbose and ugly, but quite straight-forward. Heck, you can even use reflection to only allow non-sideeffect stuff. Any sufficiently restricted subset of any high-level assembler is an awkward implementation of your favourite declarative language. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Sending bottom to his room
On Sat, 29 Dec 2007 13:30:03 +0200, Luke Palmer [EMAIL PROTECTED] wrote: On Dec 29, 2007 11:14 AM, Cristian Baboi [EMAIL PROTECTED] wrote: In The Implementation of Functional Programming Languages by S.P. Jones, section 2.5.3, page 32 it is written: Eval [[*]] a b = a x b Eval [[*]] _|_ b = _|_ Eval [[*]] a _|_ = _|_ but in section 2.5.2 it is said that _|_ is an element of the value domain. What business does it have on the left side of the '=' ? I don't know the book you're talking about, but I suspect that this is not a definition of a function in a language, but rather the denotational semantics for a function. Yes. Eval is the thing that do that. Just as mathematics is allowed to categorize all turing machines into two categories (those that halt and those that do not), even though to actually do this is impossible, so too can mathematics talk about what a function returns when given _|_, even though it is impossible in general to know when you actually do have _|_ or you're just waiting for a value. What confused me is the Eval seems to be defined by recursion, but maybe it is not. It would have been clear if it was written Eval [[*]] env = x where x is extended to handle _|_ The recursivity I was talking about is: Eval([[\x.E]], env) a = Eval([[E]], env[x=a]) Eval([[E1 E2]],env) = Eval([[E1]],env) (Eval([[E2]],env)) It appears as if lambda calculus is defined by lambda calculus. These are equations that Eval must satisfy, but the text call '=' 'define' ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Missing join and split
Mitar wrote: Hi! On Dec 28, 2007 5:51 PM, Lihn, Steve [EMAIL PROTECTED] wrote: Since regex is involved, it is specific to (Byte)String, not a generic list. Oh, this gives me an interesting idea: making regular expressions more generic. The new regex-base API is fairly generic. If you look at the classes in regex-base's Text.Regex.RegexLike: class Extract source = RegexLike regex source where matchAll :: regex - source - [MatchArray] matchOnce :: regex - source - Maybe MatchArray matchCount :: regex - source - Int matchTest :: regex - source - Bool matchAllText :: regex - source - [MatchText source] matchOnceText :: regex - source - Maybe (source, MatchText source, source) you can see that the regex type parameter is fully abstract, and that the source being searched is also fully abstract. The reason for having those specific class methods is to allow for the instance to expose the most efficient way to do each operation. You could make an instance for string seaching (e.g. KMP or BM searching). Pretty much any search or find operation could be made into an instance of RegexLike. The main constraint is that the MatchArray/MatchText use Int indexing and the Extract instance wants to be able to do lookup with this: type MatchOffset = Int type MatchLength = Int type MatchArray = Array Int (MatchOffset, MatchLength) type MatchText source = Array Int (source, (MatchOffset, MatchLength)) class Extract source where before :: Int - source - source after :: Int - source - source empty :: source extract :: (Int, Int) - source - source One benefit is that all the RegexContext instances are implemented by using just the above class methods, so all the polymorphic match/matchM will immediately work. If there is ever a strong need for going beyond the range of Int indexing, then one could either make new variants of the classes, or add methods to the existing ones. But if you are searching over 2GB of something, then perhaps have this generic type class API is not the top priority. Would not it be interesting and useful (but not really efficient) to have patterns something like: foo :: Eq a = a - ... foo (_{4}'b') = ... which would match a list with four elements ending with an element 'b'. Or: foo (_+';'_+';'_) = ... which would match a list with embedded two ';' elements. (Last _ matched the remaining of the list.) OK, maybe guards are not the proper place to implement this as would add a possibility to make a really messy Haskell programs. But extending regular expressions to work on any list of elements with type implementing Eq would be realy powerfull. And then we could use split in many other than just text processing contexts. Of course, the problem in both cases is implementing something like regular expressions efficiently, especially on lists, but this is why there are smart people around. :-) Mitar ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Sending bottom to his room
Cristian Baboi [EMAIL PROTECTED] wrote: It appears as if lambda calculus is defined by lambda calculus. Yes. id (lambda calculus) = lambda calculus. You might try to point back to yourself when being asked who you are to see the advantage of this technique. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Sending bottom to his room
On Sat, 29 Dec 2007 16:01:51 +0200, Achim Schneider [EMAIL PROTECTED] wrote: Cristian Baboi [EMAIL PROTECTED] wrote: It appears as if lambda calculus is defined by lambda calculus. Yes. id (lambda calculus) = lambda calculus. You might try to point back to yourself when being asked who you are to see the advantage of this technique. The next question is if id is well defined. There is such a function ? How many of them ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Missing join and split
Albert Y. C. Lai wrote: Mitar wrote: I am really missing the (general) split function built in standard Haskell. I do not understand why there is something so specific as words and lines but not a simple split? The same goes for join. Don't forget Text.Regex.splitRegex. Which is just: matchRegexAll p str = matchM p str {- | Splits a string based on a regular expression. The regular expression should identify one delimiter. This is unsafe if the regex matches an empty string. -} splitRegex :: Regex - String - [String] splitRegex _ [] = [] splitRegex delim str = case matchRegexAll delim str of Nothing - [str] Just (firstline, _, remainder, _) - if remainder == then firstline : [] : [] else firstline : splitRegex delim remainder Inlining the matchRegexAll/matchM means this is 8 lines of code. Any given split function is very short, but there are enough design choices that I think the best library is none at all; the user can write exactly what they want in = 10 lines of code. Though now that I look at it again, I think I like splitRegex :: Regex - String - [String] splitRegex _ [] = [] splitRegex delim strIn = loop strIn where loop str = case matchM delim str of Nothing - [str] Just (firstline, _, remainder) - if null remainder then [firstline,] else firstline : loop remainder slightly better. I'll eventually update the unstable regex-compat. -- Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Newbie question: can laziness lead to space compression?
My apologies if this has been beat to death before, I'm still new to Haskell. But I was wondering if it is possible that lazy evaluation could lead to space compression, especially under heavily persistant usage patterns? Here's the argument I'm making. Say we have a tree-based Set with, say, 1024 values in it. For ease of math we'll assume that it's perfectly balanced. Say each node in the tree takes 5 words of memory. So in an eager language (for example, Ocaml), adding a new node to this tree requires the allocation of 10 new nodes, or 50 words of memory. In Haskell, what would happen (as I understand it) is that just a new lazy thunk would be allocated- say, 10 words of memory. Conceptually, we could think of the returned value as the original tree plus a small delta. The lazy implementation is using 40 fewer words of memory than the eager implementation. Note that the benefit isn't *big*- we're talking about 40 words of memory when the main data structure is taking up 5K plus words of memory- so it's less than 1% different. But there is a (small) upside in memory usage at least occassionally, right? Brian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Sending bottom to his room
Cristian Baboi [EMAIL PROTECTED] wrote: On Sat, 29 Dec 2007 16:01:51 +0200, Achim Schneider [EMAIL PROTECTED] wrote: Cristian Baboi [EMAIL PROTECTED] wrote: It appears as if lambda calculus is defined by lambda calculus. Yes. id (lambda calculus) = lambda calculus. You might try to point back to yourself when being asked who you are to see the advantage of this technique. The next question is if id is well defined. There is such a function ? How many of them ? None at all. A thing is nothing but itself and won't ever be anything else, identity is implied by existence. I used id = (\x - x) just as an arbitrary fixed point you can also recurse around to point back to lambda calculus, instead of eval. After all, id(eval) = eval, even if the first one is a compiler, the second one is an interpreter and the third one is your mind. you can also say (define (id x) (unquote (quote x))) or, in the esoteric domain, where -1 people can be in an elevator, (define (id x) (quote (unquote x))). If you dare, you can also write (define (id x) (car (cons x '())) It really doesn't matter, if you don't use map or fold or write or whatever you can just write x, and if you don't write an interpreter or something that needs to interpret on runtime, you can just write your code instead of eval. http://mitpress.mit.edu/sicp/full-text/sicp/book/node77.html In a moonlit night, turn your back to the screen and meditate about the funny annotated taichi pictured on top of the page. It pictures the unity in transcendence not the equivalence of opposites, by the way. You might also say that any expression of any axiomatic system revolves around the system in the void. Hell breaks loose here: http://en.wikipedia.org/wiki/Image:Lambda.svg Sorry, I got a significant part of my logic from a philosophy lexicon. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Sending bottom to his room
id is well defined and there is only one of them. On Dec 29, 2007 3:13 PM, Cristian Baboi [EMAIL PROTECTED] wrote: On Sat, 29 Dec 2007 16:01:51 +0200, Achim Schneider [EMAIL PROTECTED] wrote: Cristian Baboi [EMAIL PROTECTED] wrote: It appears as if lambda calculus is defined by lambda calculus. Yes. id (lambda calculus) = lambda calculus. You might try to point back to yourself when being asked who you are to see the advantage of this technique. The next question is if id is well defined. There is such a function ? How many of them ? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Newbie question: can laziness lead to space compression?
Am Samstag, 29. Dezember 2007 16:00 schrieb Brian Hurt: My apologies if this has been beat to death before, I'm still new to Haskell. But I was wondering if it is possible that lazy evaluation could lead to space compression, especially under heavily persistant usage patterns? Here's the argument I'm making. Say we have a tree-based Set with, say, 1024 values in it. For ease of math we'll assume that it's perfectly balanced. Say each node in the tree takes 5 words of memory. So in an eager language (for example, Ocaml), adding a new node to this tree requires the allocation of 10 new nodes, or 50 words of memory. In Haskell, what would happen (as I understand it) is that just a new lazy thunk would be allocated- say, 10 words of memory. Conceptually, we could think of the returned value as the original tree plus a small delta. The lazy implementation is using 40 fewer words of memory than the eager implementation. Note that the benefit isn't *big*- we're talking about 40 words of memory when the main data structure is taking up 5K plus words of memory- so it's less than 1% different. But there is a (small) upside in memory usage at least occassionally, right? Oh yes. Imagine how much memory an eager language would need for [1 .. ]. But laziness can also induce space leaks. That's not too uncommon either. Finding out when which case applies is the art to be learned. Brian Cheers, Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Re: Re[2]: Wikipedia on first-class object
Jonathan Cast wrote: On 28 Dec 2007, at 3:13 PM, Ben Franksen wrote: Bulat Ziganshin wrote: Hello Yitzchak, Thursday, December 27, 2007, 12:10:21 PM, you wrote: In particular, two functions are equal only if they produce the same value for every input, and in general it is impossible for a computer to check that. for a computer is superfluous here. people are not smarter than computers and can't do anything that's impossible for computers I don't think my computer can be sorry, but I know I can be. And don't forget that there are 'undecidable' problems. Which I have never yet seen decided by a person... In many cases, equality of functions has been decided by humans, as has termination of programs. Of course this doesn't prove that humans can, in principle, decide equality for any pair of functions. But neither has the opposite been proved. Cheers Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Re: Re[2]: Wikipedia on first-class object
Ben Franksen wrote: In many cases, equality of functions has been decided by humans, as has termination of programs. Of course this doesn't prove that humans can, in principle, decide equality for any pair of functions. But neither has the opposite been proved. Interesting... So you're claiming that humans have powers of deduction beyond what computers possess? ;-) Note that no theorum claims that a computer can never tell whether a given pair of functions are equivilent. The theorum is that a computer will never be able to tell for *every possible* pair of functions, that's all. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Andrew Coppin [EMAIL PROTECTED] wrote: Interesting... So you're claiming that humans have powers of deduction beyond what computers possess? ;-) They would be programming us if otherwise, wouldn't they? -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Interesting data structure
What you described has a Java parallel: In the first program, I am reading on-demand from a database - just reading, not making any changes. This is similar to EJB's entity bean. Usually EJB requires XA driver to preserve database state across the cluster, but in your read-only case, this is not needed. HDBC puts you into the IO monad. You need to get yourself out of IO monad if you believe your code is pure. In the second, I am requesting computations to be evaluated externally, in order to take advantage of a grid of machines. This is similar to J2EE's clustering, where beans can sit on any node of the cluster and be accessed via RMI. The ability to handle (de)serialization is the key here. Java's solution is proprietary, while Microsoft dot NET has choosen SOAP to request computation over network. Network calls will also put you into the IO monad, which has to be hidden in your case.. If you came up with a solution, it might have invented the H2EE. Steve ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: FFI question -- was: [Haskell-cafe] New slogan for haskell.org
On Fri, 2007-12-21 at 10:25 +0100, Gour wrote: On Thu, 20 Dec 2007 03:41:21 + Duncan Coutts [EMAIL PROTECTED] wrote: In gtk2hs we use both. We use c2hs for all function calls and we use hsc2hs to help us write Storable instances for a few structures. It looks that c2hs does more than hsc2hs and misses less than hsc2hs. Why not equip c2hs to do the rest and have one complete tool instead of the two uncomplete ones? (I understand that time-factor could be the reason.) The reason hsc2hs does the structure bits well is because it asks the C compiler about the sizes and offsets of field members. This means it is always accurate. For c2hs to do the same it has to calculate the sizes, offsets and alignments of types itself and it requires a lot of work and testing to make sure this is always 100% accurate. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Re: Re[2]: Wikipedia on first-class object
Hello Ben, Saturday, December 29, 2007, 7:14:47 PM, you wrote: for a computer is superfluous here. people are not smarter than computers and can't do anything that's impossible for computers I don't think my computer can be sorry, but I know I can be. i've about smartness, but well. i, your computer, is really sorry and? it's only question of *your* perception. when you hear a'm sorry from the man - you think that he does it. when you hear ABSOLUTELY THE SAME from the computer - you *belive* that some man was programmed it to speak. if you will believe that computers have free will and people are directed by God/spirits - you conclusions will be just opposite the same true for thinking. it's you who believe that people are smart by itself but computers are smart only in the bounds they programmed by people. you may believe that human wisdom is created by the Creator (or Natural Selection, if you believe in Science Religion) or, opposite, you may believe that computers are smart creatures but you select mean point. why? only because it's pleasant for people to believe in their free will, creativeness, smartness and don't believe in computers' ones. nevertheless, there is no difference between acts of creating people by Natural Selection and cresating computers by engineering And don't forget that there are 'undecidable' problems. Which I have never yet seen decided by a person... In many cases, equality of functions has been decided by humans, as has termination of programs. Of course this doesn't prove that humans can, in principle, decide equality for any pair of functions. But neither has the opposite been proved. yes, it's great example of unfair treatment of computers vs people! let's see - computers don't have general method of checking function equivalence. and you conclude that computers are limited in their abilities. but the people don't have it too! moreover, if some way will be discovered - it should use mathematic notation which can be used by computers too, so this immediately means that it's impossible! but you don't want to notice it! instead, you notice that humans can do it in some particular cases. and you absolutely doesn't notice that computers can do the same. there is no general algorithm to find algorithm of checking f.e., humans can only do it by try-and-try method so where is real difference? it's in what we have formal math model for computers which allows to prove some theorems about them but we doesn't have model for humans. does this really mean that they are smarter? why you don't believe that Martians are smarter than humans only because we don't know anything about them? moreover, with assumption that humans are physical creatures and strictly obey to the rules of physical world (and that's common assumption for Science - are you believe in it) and with standard Physics assumption that any physical objects may be described by mathematical equations you immediately draw conclusion that humans are not smarter than computers and both doesn't have free will. people aren't sorry by free will, it is some circumstances together with their education that force them to sorry - exactly like virus in your computer may force it to say please give me a choke. this is that your experience say, are you agree? you never hear that anyone say sorry without some previous cause as you have never seen computer saying give me choke without previously been infected by a virus. it's only you that believe that some of them does it by free will (but not without any reason) and some doesn't it only because they are programmed by some external activity. where is the real difference? ;) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Bulat Ziganshin [EMAIL PROTECTED] wrote: only because it's pleasant for people to believe in their free will, creativeness, smartness and don't believe in computers' ones. Let's see... Hey, pipeline, there's an jnz eax! we can either jump to the address or continue, what do you think? I think we should jump, eax is zero and I don't want to get redesigned. It's all about natural selection, it seems. Heretics get burned in both worlds. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Achim, Saturday, December 29, 2007, 8:40:05 PM, you wrote: Interesting... So you're claiming that humans have powers of deduction beyond what computers possess? ;-) They would be programming us if otherwise, wouldn't they? oh, well. God created humans, humans created computers. God has created our programs (psychics), we does the same for computers but what's a programming? without me, computer will never print hello world. but without him, i will never write this letter - only its ability to easily transfer mail between continents forced me to do it next. can you compile this hello world program down to assembler? humans often says about things that they can do but computer can't but they forget that computers was created exactly to do things that we can't. billion of computations per second is beyond our abilities just imagine compiling of this program without pencil and paper and you will draw conclusion that computers have power of deduction that humans definitely doesn't have. and it's only one aspect which doesn't take into account duration of human life (of course if we want to say about *real humans* and not abstract mathematical model of immortals), difference between people's abilities (it's common mistake to compare abilities of one concrete computer with MAXIMUM of abilities of all people, including whose in all future generations), don't take into account that human by itself, at the moment of birth doesn't know anything about mathematics and even can't speak - he is programmed by society to acquire these skills so, computers are definitely more advanced devices - they was created to. we (humanity) just don't yet finished development of the program which at some moment will make them able to further develop itself without our help. if you believe that human is superior to computer you should also believe that bacterium is superior to human -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
On 12/29/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: just imagine compiling of this program without pencil and paper and you will draw conclusion that computers have power of deduction that humans definitely doesn't have. and it's only one aspect which doesn't take into account duration of human life (of course if we want to say about *real humans* and not abstract mathematical model of immortals), difference between people's abilities (it's common mistake to compare abilities of one concrete computer with MAXIMUM of abilities of all people, including whose in all future generations), don't take into account that human by itself, at the moment of birth doesn't know anything about mathematics and even can't speak - he is programmed by society to acquire these skills I haven't been following this thread, but anyone interested in this question might want to read Daniel Dennett's essay Fast Thinking, in his book _The Intentional Stance_. so, computers are definitely more advanced devices - they was created to. we (humanity) just don't yet finished development of the program which at some moment will make them able to further develop itself without our help. if you believe that human is superior to computer you should also believe that bacterium is superior to human The only thing that computers can do that humans can't is to work without getting bored. Cheers, Tim -- Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in doubt It's mad to be in love with someone else / When you're in love with him, she's in love with me / But you know as well as I do I can never think of anyone but you -- Pet Shop Boys ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Achim, Saturday, December 29, 2007, 9:22:40 PM, you wrote: I think we should jump, eax is zero and I don't want to get redesigned. It's all about natural selection, it seems. Heretics get burned in both worlds. for me, natural selection is the Nature's process of thinking. if you need to solve some problem you know some ways to try it. these ways wasn't discovered by you, you just learnt them in the school. and their creators don't started from scratch - they used some previous, more general methods. but where may be the PRIMARY source of wisdom? it may be only natural selection - this process generates *random* ideas and check them against some conditions. it's even not important what are these particular conditions - anyway, this turns at the last end into the general mechanism of solving problems, which in turn leads into development of general mechanism that makes mechanisms to solve problems - it's human. their mind was created to solve problems of survival and reproduction (it's the particular problem solved by natural selection) but this mind was created so general that it was used as general mechanism of solving problems in any other areas. humans was just first creatures of n.s. whose mind becomes so general that it can be programmed to solve other types of problems. it's impossible to use bears to program computers, build bridges and teach students you can compare this to birth of programming languages - the first ones was created to solve particular problems but this idea turned out to be so useful that these languages was started to be used outside initial goal -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Tim, Saturday, December 29, 2007, 9:42:48 PM, you wrote: The only thing that computers can do that humans can't is to work without getting bored. ok, please compute 2^2^30 before continuing discussion. it seems that you just use i'm too bored and i can't as synonyms. if computer will answer i'm too bored to any question he can't answer - will it be enough to give him human rights? -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object
On 12/29/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Tim, Saturday, December 29, 2007, 9:42:48 PM, you wrote: The only thing that computers can do that humans can't is to work without getting bored. ok, please compute 2^2^30 before continuing discussion. it seems that you just use i'm too bored and i can't as synonyms. if computer will answer i'm too bored to any question he can't answer - will it be enough to give him human rights? Well, that's why I recommended the Dennett essay. The difference between I'm too bored and I can't is actually an interesting philosophical question, and people have written about it in detail before. Cheers, Tim -- Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in doubt Instant gratification takes too long.--Carrie Fisher ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Re: Re[2]: Wikipedia on first-class object
Ben Franksen wrote: Of course this doesn't prove that humans can, in principle, decide equality for any pair of functions. But neither has the opposite been proved. Premise: The human should still give the reasoning behind his/her decisions. The reasoning should be within a proof system chosen a priori, i.e., chosen before you answer any equality questions, uniform over all such questions, not amended ad hoc as you encounter new questions. Then by incompleteness some answers are not supported by any reasoning within the chosen proof system. It is not that some proof is out there and the prover is too limited to find it. It is that among all valid proofs, none says yes and none says no. This is independent of the wit of the prover. Now, you can refuse the premise, and I outline my reply. (A) The human should still give the reasoning behind his/her decisions. If you don't give the reasoning, well, to quote famous words, that is theology, that is not mathematics. (Can computers do theology? I don't think anyone cares. We have enough human theologians as is, even in this mailing list, even in this thread, theologians attributing near-divine power of induction and deduction to humans. No, we don't need computers to become additional theologians.) (B) The reasoning should be within a proof system chosen a priori. Mathematicians do change their rules. It is part of their job: to explore what happens if you assume something more, or something less. But every time they do so, they have to convince their peers of the merit. (If you don't have to convince of merits, well, even a computer can randomly change rules.) But if you do this, you deviate from the original subject matter. The original subject matter is: can we decide equality questions? The deviation is: can we decide quality questions? It is really a different question. You should first use quality judgement to fix a proof system, then use the proof system to decide equality questions. Can computers be programmed to decide quality questions? That hasn't been ruled out. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Tim, Saturday, December 29, 2007, 9:42:48 PM, you wrote: so, computers are definitely more advanced devices - they was created to. we (humanity) just don't yet finished development of the program which at some moment will make them able to further develop itself without our help. if you believe that human is superior to computer you should also believe that bacterium is superior to human The only thing that computers can do that humans can't is to work without getting bored. and was i meant here is that humans are too imperfect computers. computer may consume electric power directly. just imagine whole line of producing food for humans - it's efficiency is far, far less computers don't make mistakes, don't sleep, don't have their own goals that differ from goals of their society. humans are just transitive model between animals and computers - being created as animals, they are used as computers. sooner or later we will be replaced by more perfect models. we do this replacement just now, we do it yourselves believing that it's to make our lives easier. but it's lie - we still work 8 hours a day. the real consequence of using machines more and more is the growth of productivity. at the last end, humans will be replaced by computers even in intellectual jobs and humans will become the same as animals now -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[4]: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Tim, Saturday, December 29, 2007, 10:07:15 PM, you wrote: ok, please compute 2^2^30 before continuing discussion. it seems that Well, that's why I recommended the Dennett essay. The difference between I'm too bored and I can't is actually an interesting philosophical question, and people have written about it in detail before. oh, Dennett isn't only source of wisdom. i proposed you this task because i've my own understanding of it. as i've said in other letter, both computers and humans may be described using mathematics and therefore equivalent - as far as we say about theoretical immortal man and Turing machine -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Missing join and split
On Fri, Dec 28, 2007 at 04:24:38PM +0100, Benja Fallenstein wrote: On Dec 28, 2007 3:55 PM, David Roundy [EMAIL PROTECTED] wrote: On Dec 28, 2007 9:51 AM, Benja Fallenstein [EMAIL PROTECTED] wrote: If you use intercalate to join, I would presume that you would want to use an inverse of it to split. I'd write it like this: Of course, there is no inverse to intercalate Right; I misspoke. What I meant was that you would want a split such that intercalate a (split a xs) = a for finite, total (a,xs) (and, since it's achievable, even for infinite xs). Of course, (split a xs = [xs]) satisfies that, but if we add the requirement that split is also supposed to do its job :-) then I think split is fully specified except for whether (split a [] = []) or (split a [] = [[]]). The latter seems better to me; e.g., it satisfies split a (x ++ a ++ y) = split a x ++ split a y Yes, the latter is what darcs' linesPS does. so if you want to use a logical approach, perhaps you'd want to define split first, and then define your join as the inverse of split. If your join comes out as being intercalate, I suppose it's six of one, half a dozen of the other :-) Well, your intercalate \n is not the same as unlines and the inverse of intercalate \n is not the same as lines, nor is its inverse (with ) the same as words. It is true that intercalate is the same as unwords, however. So it does seem like the prelude doesn't really give us any hints as to what would be a useful generic join/split pair. -- David Roundy Department of Physics Oregon State University ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Achim, Saturday, December 29, 2007, 8:40:05 PM, you wrote: Interesting... So you're claiming that humans have powers of deduction beyond what computers possess? ;-) They would be programming us if otherwise, wouldn't they? oh, well. God created humans, humans created computers. God has created our programs (psychics), we does the same for computers If you find the one who brought the topic to god, shoot him. At least if HE isn't just the universe. The main difference is whether something can program itself, which puts computers right next to a mechanical clock and the universe possibly to a massively concurrent mega-machine, with many, many, many threads, but I'm guessing there. but what's a programming? without me, computer will never print hello world. but without him, i will never write this letter - only its ability to easily transfer mail between continents forced me to do it Encoding behaviour information in a way that gets executed by an entity. That enough? next. can you compile this hello world program down to assembler? Yes. Definitely. At least if you don't make me abandon the kernel and talk to the hardware itself and would remember what int20 function write was. Try writing a program that makes me say hello world as many times as you press my nose. humans often says about things that they can do but computer can't but they forget that computers was created exactly to do things that we can't. billion of computations per second is beyond our abilities Nope, they aren't. Try teaching a computer to catch a ball, you'll be surprised how many numbers you can crunch. don't take into account that human by itself, at the moment of birth doesn't know anything about mathematics and even can't speak - he is programmed by society to acquire these skills Kind of, no. The programming to learn to survive in its surroundings and to reproduce is in the genes. so, computers are definitely more advanced devices - they was created to. we (humanity) just don't yet finished development of the program which at some moment will make them able to further develop itself without our help. if you believe that human is superior to computer you should also believe that bacterium is superior to human I think we are superior to bacteria, yes, although you might argue that amoeba are practically immortal, and, as cockroaches, survived for a far longer time with nearly no change in their genes. It's a bit like with kids: As long as you don't want them to be independent and reward them for it, they won't be. Unlike kids, though, computers don't have the possibility to look at the next computer and compute something along the lines of hey, I like his mmap much more than my implementation, I'm not obeying my programmer any more. It's really comparing touring machines to mere evolutionary reprogrammed meta-programming neural nets featuring a few magnitudes more synapses than there are atoms in the universe, that is. Apples and bananas might work in a fruit salad, but... humans have a tendency to believe everything they don't understand is superior, dumb or nuts, even if it's themselves. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Tim, Saturday, December 29, 2007, 9:42:48 PM, you wrote: The only thing that computers can do that humans can't is to work without getting bored. ok, please compute 2^2^30 before continuing discussion. it seems that you just use i'm too bored and i can't as synonyms. if computer will answer i'm too bored to any question he can't answer - will it be enough to give him human rights? Stack overflow. Please feed more ram into iteration processor. I love you. Please buy me more RAM. Wanna see pr0n? You know I care about your questions, and you know it. Want me to send spam to earn money fast to buy me ram? They never get bored pleasing their master. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[4]: [Haskell-cafe] Re: Wikipedia on first-class object
On 12/29/07, Bulat Ziganshin [EMAIL PROTECTED] wrote: oh, Dennett isn't only source of wisdom. i proposed you this task because i've my own understanding of it. as i've said in other letter, both computers and humans may be described using mathematics and therefore equivalent - as far as we say about theoretical immortal man and Turing machine He's not the only source of wisdom, but as a rule, it does tend to be good to be as familiar as possible with what has been written before on a subject that you're talking about. Isn't that one of the reasons this mailing list exists, after all? :-) Cheers, Tim -- Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in doubt ...It's wonderful that I can trust you not to spit in my milk, but what's the point if you're going to drink from the bottle? -- Sarah Barton ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Achim, Saturday, December 29, 2007, 9:22:40 PM, you wrote: I think we should jump, eax is zero and I don't want to get redesigned. It's all about natural selection, it seems. Heretics get burned in both worlds. for me, natural selection is the Nature's process of thinking. if you need to solve some problem you know some ways to try it. And, pray, what problem does the nature wants to solve that it thinks in the way of all history until now? -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Sending bottom to his room
On 29 Dec 2007, at 6:39 AM, Cristian Baboi wrote: On Sat, 29 Dec 2007 13:30:03 +0200, Luke Palmer [EMAIL PROTECTED] wrote: On Dec 29, 2007 11:14 AM, Cristian Baboi [EMAIL PROTECTED] wrote: In The Implementation of Functional Programming Languages by S.P. Jones, section 2.5.3, page 32 it is written: Eval [[*]] a b = a x b Eval [[*]] _|_ b = _|_ Eval [[*]] a _|_ = _|_ but in section 2.5.2 it is said that _|_ is an element of the value domain. What business does it have on the left side of the '=' ? I don't know the book you're talking about, but I suspect that this is not a definition of a function in a language, but rather the denotational semantics for a function. Yes. Eval is the thing that do that. Just as mathematics is allowed to categorize all turing machines into two categories (those that halt and those that do not), even though to actually do this is impossible, so too can mathematics talk about what a function returns when given _|_, even though it is impossible in general to know when you actually do have _|_ or you're just waiting for a value. What confused me is the Eval seems to be defined by recursion, but maybe it is not. It would have been clear if it was written Eval [[*]] env = x where x is extended to handle _|_ The recursivity I was talking about is: Eval([[\x.E]], env) a = Eval([[E]], env[x=a]) Eval([[E1 E2]],env) = Eval([[E1]],env) (Eval([[E2]],env)) It appears as if lambda calculus is defined by lambda calculus. These are equations that Eval must satisfy, but the text call '=' 'define' Right. There's a convention in CS that any object may be defined by giving a list of conditions, to which is implicitly added the understanding that the object in question is in some sense the `least' object satisfying those conditions. So Eval is `defined' by those equations in the sense that its graph is the least relation closed under the equations given. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Re: Re[2]: Wikipedia on first-class object
On 29 Dec 2007, at 10:14 AM, Ben Franksen wrote: Jonathan Cast wrote: On 28 Dec 2007, at 3:13 PM, Ben Franksen wrote: Bulat Ziganshin wrote: Hello Yitzchak, Thursday, December 27, 2007, 12:10:21 PM, you wrote: In particular, two functions are equal only if they produce the same value for every input, and in general it is impossible for a computer to check that. for a computer is superfluous here. people are not smarter than computers and can't do anything that's impossible for computers I don't think my computer can be sorry, but I know I can be. And don't forget that there are 'undecidable' problems. Which I have never yet seen decided by a person... In many cases, equality of functions has been decided by humans, as has termination of programs. Of course this doesn't prove that humans can, in principle, decide equality for any pair of functions. But neither has the opposite been proved. It hasn't been proved that we can't build a device that can decide equality for arbitrary functions, either. It's simply that no one has ever succeeded in imagining a definition of `decidable' that includes that particular relation. I rather strongly suspect that anything decidable by humans must be decidable in some sense... jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
On 29 Dec 2007, at 11:40 AM, Achim Schneider wrote: Andrew Coppin [EMAIL PROTECTED] wrote: Interesting... So you're claiming that humans have powers of deduction beyond what computers possess? ;-) They would be programming us if otherwise, wouldn't they? I don't know... I'm probably more religious than most people on this list, but I think humans are capable of duplicating anything found in nature, including eventually ourselves; the only question is whether with computers we've succeeded in doing so for the entire /deterministic/ portion of our minds. I'm rather inclined to think we have. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
On 29 Dec 2007, at 5:01 AM, Cristian Baboi wrote: On Sat, 29 Dec 2007 02:08:14 +0200, Jonathan Cast [EMAIL PROTECTED] wrote: How can one make portable dynamic libraries then ? If by portable you mean, works on /both/ OSs, then GHC-specific should be portable enough for you... By portable I mean: works on the same machine, with the same OS, but with different Haskell implementation. Ah, you can't. But, again, what are you trying to do? Re-compiling your software for each implementation seems like a perfectly reasonable thing to do, given the differences between them. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Re: Re[2]: Wikipedia on first-class object
I'm sure you're at least half-joking, but I'll try to answer you seriously. the same true for thinking. it's you who believe that people are smart by itself but computers are smart only in the bounds they programmed by people. you may believe that human wisdom is created by the Creator (or Natural Selection, if you believe in Science Religion) or, opposite, you may believe that computers are smart creatures That's not about belief. That's about choosing the right model. When I deal with computers, I need some model to predict their behaviour. The model which states that both computer and software it's running is very suitable. It allows me to know what to expect from the computer. Moreover, when my expectations fail, it allows me - by following the programmer's thoughts - to localize this failure and work around it. Of course, it doesn't predict everything - when I was working on Windows, it was even more unpredictable than my present computer - but it gives good results. On the other hand, there is no such model for humans. Well, it's quite possible we just haven't find it - or, possibly, were programmed by Creator or Flying Spaghetti Monster or whoever else to find it - but it's totally irrelevant. As far as the only model to describe and - for some extent - predict the behaviour of human beings is the one stating that humans have free will - we should use this model and don't really bother about Creators or Flying Spaghetti Monsters etc. Of course, we should continue looking for such theory (it would simplify everything a lot if find it), but that doesn't mean we ALL should study human psychology or sociology or whatever. where is the real difference? ;) The real difference is something we normally don't bother ourselves. We don't need to know if, say, electron really exists, but we need a theory to tell us how to work with electricity. We don't need to know if germs really exist, but we need a theory that tells us to pasteurize milk. Etc. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Re: Wikipedia on first-class object
The only thing that computers can do that humans can't is to work without getting bored. It's always interesting to compare computers and humans, especially computer scientist seem to do that :) But since it seems that plants use some kind of quantum coherence just to do photosynthesis (see http://en.wikipedia.org/wiki/Photosynthesis#Quantum_mechanical_effects), I would not be surprised that our human brain also uses some clever (quantum?) tricks to achieve what it does, tricks which might not be simulated by a regular computer, no matter how fast it runs. But didn't Gödel proved that already somehow with its incompleteness theory? Nah I'm just mixing up things here ;) Okay, enough of that, I'm getting seriously off topic here, and I don't know at all what quantum coherence is, it just sounds cool ;-) Cheers, Peter ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object
computers don't make mistakes, don't sleep, don't have their own goals that differ from goals of their society. To Computers Be The Glory! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object
ok, please compute 2^2^30 before continuing discussion. Just for the record: I don't think your computer is able to compute 2^ (2^30). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object
On 29 Dec 2007, at 2:18 PM, Miguel Mitrofanov wrote: ok, please compute 2^2^30 before continuing discussion. Just for the record: I don't think your computer is able to compute 2^(2^30). Certainly not at the moment (not with memory loads the way they are now). jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Achim, Saturday, December 29, 2007, 10:16:39 PM, you wrote: The only thing that computers can do that humans can't is to work without getting bored. ok, please compute 2^2^30 before continuing discussion. it seems that you just use i'm too bored and i can't as synonyms. if computer will answer i'm too bored to any question he can't answer - will it be enough to give him human rights? Stack overflow. Please feed more ram into iteration processor. I love you. Please buy me more RAM. Wanna see pr0n? You know I care about your questions, and you know it. Want me to send spam to earn money fast to buy me ram? They never get bored pleasing their master. oh, my english is so bad that's hard to speak about philosophy anyway, your computer can and you cannot. where human are perfect is in searching descriptions what don't humble them. saying that we may be dumber than computer is one more thing that people can't do :D Well, they would be programming us if they weren't, wouldn't they? -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Bulat Ziganshin wrote: Hello Achim, Saturday, December 29, 2007, 8:40:05 PM, you wrote: Interesting... So you're claiming that humans have powers of deduction beyond what computers possess? ;-) They would be programming us if otherwise, wouldn't they? oh, well. God created humans, humans created computers. God has created our programs (psychics), we does the same for computers (blah blah) Please, Amateur Philosophy is that way - Please respect others who have signed up to Haskell-Cafe to discuss Haskell and not meaningless drivel. - -- Tony Morris http://tmorris.net/ Hey! We had 40,000 lines of C# here yesterday, but now there are 40 lines of... Dear God, what is a catamorphism? -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHdrCymnpgrYe6r60RAgltAKDHnogRxCbf8nwwiwJB0fHrLUf/VgCgjB1P zFsq5r4ziArpQxoTcXDV9oE= =vxiL -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Bulat Ziganshin [EMAIL PROTECTED] wrote: computers don't make mistakes, don't sleep, don't have their own goals that differ from goals of their society. Of course not. It would be a different society if their goals would differ. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Achim, Saturday, December 29, 2007, 10:12:21 PM, you wrote: Interesting... So you're claiming that humans have powers of deduction beyond what computers possess? ;-) They would be programming us if otherwise, wouldn't they? oh, well. God created humans, humans created computers. God has created our programs (psychics), we does the same for computers If you find the one who brought the topic to god, shoot him. i don't know who was created humans. if you will find someone who says that he definitely know - pray to him, he should be a God :) meanwhile, i will use term God because it's not worse than any else :) At least if HE isn't just the universe. great! what is the difference between YOUR terms God and universe? i think you believe that God means having free will and universe should obey to some (physical) laws. and now is The Question - how you can prove that universe obey to some set of laws and doesn't behave at free will? i contend that in order to prove it you should check result if EVERY action in the universe during all its lifetime. you cannot. so lack of God is just the assumption which cannot be proved, you just believe in it and shout out any heretics - it's natural for any religion ;) The main difference is whether something can program itself, which puts computers right next to a mechanical clock well, my computer programs itself each time i use compiler. can you program itself? if you believe that you can, try to program himself to say hello world as many times as i press your nose :))) if you succeed, try to program yourself to take off your clothes and go to a street. impossible. you was programmed by society to never, never do it. likewise, you was programmed by Nature to not hold hot objects and so on. but what's a programming? without me, computer will never print hello world. but without him, i will never write this letter - only its ability to easily transfer mail between continents forced me to do it Encoding behaviour information in a way that gets executed by an entity. That enough? where execution method is defined by internals of entity? :) so when computer displayed your letter, he programmed me to make this exact answer? yes, this program was specific to my internal structure, but it was the program. and you was programmed by my letter to write exactly the answer you have wrote i still believe that humans are God's compilers of his programs to the language of physical particles. one of God's idea was computers and he at the last end programmed humans to build them. great work! next. can you compile this hello world program down to assembler? Yes. Definitely. At least if you don't make me abandon the kernel and talk to the hardware itself and would remember what int20 function write was. congratulations: you are about as smart as computer! :) there are not many people that can be compared with them ;) Try writing a program that makes me say hello world as many times as you press my nose. it's easy, really easy if human is programmed from scratch. you have already programmed to say hello as the answer to many various signals - giving you a hand, saying hello, looking into your eyes moreover, your Programmers was left many open-doors that may be used to reprogram you in any particular way. i can kill you if you will not do what he stated, can put you into prison, can give you money or can satisfy you (well, if you are blue ;) well, i personally can't do it, but it means that *i* am a limited Programmer, not that you are bad Computer. you *can* be programmed and you really programmed like all the people around. you was learnt how to behave in each situation, how to solve problems, what should be your goals and what you should never do. i already said that Nature created more and more animals which was computers limited to survival until it was created *universal* computer which may be programmed to solve any problem and civilization use humans in exactly this way. civilization programs people in the way it needs and they execute its program. but because this computer was created on the element base of animal, it is rather strange. in order to make you write program, civilization should let you believe that you will get instead food, heat, relations - all the things that was need for animal. it's the very strange way of programming, but nevertheless it works. are you ever seen trained animal that does all his tricks but get his reward only once a month? look at the mirror (as i do :) humans often says about things that they can do but computer can't but they forget that computers was created exactly to do things that we can't. billion of computations per second is beyond our abilities Nope, they aren't. Try teaching a computer to catch a ball, you'll be surprised how many numbers you can crunch. my english isn't good enough, probably you are saying that there are still things that people does better than
[Haskell-cafe] Re: Wikipedia on first-class object
Peter Verswyvelen [EMAIL PROTECTED] wrote: The only thing that computers can do that humans can't is to work without getting bored. It's always interesting to compare computers and humans, especially computer scientist seem to do that :) Hm. More importantly, only humans try to write a general Eq and Ord instances over different domains. But since it seems that plants use some kind of quantum coherence just to do photosynthesis (see http://en.wikipedia.org/wiki/Photosynthesis#Quantum_mechanical_effects), I would not be surprised that our human brain also uses some clever (quantum?) tricks to achieve what it does, tricks which might not be simulated by a regular computer, no matter how fast it runs. But didn't Gödel proved that already somehow with its incompleteness theory? Nah I'm just mixing up things here ;) That's more closely related to information hiding, emergent complexity and stuff. http://www.wolframscience.com/nksonline/toc.html which doesn't really explain anything, just that most explanations are dead wrong. Okay, enough of that, I'm getting seriously off topic here, and I don't know at all what quantum coherence is, it just sounds cool ;-) You have my vote for the creation of comp.lang.philosophy. Or comp.lang.esoteric.teabagswinging, if you prefer. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
And, pray, what problem does the nature wants to solve that it thinks in the way of all history until now? May be it's calculating sqrt(2)? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Getting links to Haddock documentation in Hackage
Some packages[1] have links on their Hackage pages to the haddock generated documentation for each exported module[2]. However, many[3] don't. What's the secret to getting this generated documentation to work with Hackage? Even packages for which `runhaskell Setup.lhs haddock` runs don't (always) get the magic links. Cheers, AGL [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bzlib-0.4.0.1 [2] http://hackage.haskell.org/packages/archive/bzlib/0.4.0.1/doc/html/Codec-Compression-BZip.html [3] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/tar-0.1.1.1 -- Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org 650-283-9641 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[6]: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Tim, Saturday, December 29, 2007, 10:27:46 PM, you wrote: oh, Dennett isn't only source of wisdom. i proposed you this task because i've my own understanding of it. as i've said in other letter, both computers and humans may be described using mathematics and therefore equivalent - as far as we say about theoretical immortal man and Turing machine He's not the only source of wisdom, but as a rule, it does tend to be good to be as familiar as possible with what has been written before on a subject that you're talking about. Isn't that one of the reasons this mailing list exists, after all? :-) and you are his prophet? :) fear the man who was read only one book - it was said about Bible but true for anyone who believe that any particular compilation is better than originals -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Achim, Saturday, December 29, 2007, 10:27:21 PM, you wrote: for me, natural selection is the Nature's process of thinking. if you need to solve some problem you know some ways to try it. And, pray, what problem does the nature wants to solve that it thinks in the way of all history until now? making the Superhero who will kill'em all. and it's already very close Natural Selection is process of allocation limited resources between self-developed creatures, be it in economics (as described by Adams), between animals (described by Darwin), or between societies with some conditions (which met in all these 3 situations) this leads to developing these creatures into the direction of better utilizing the resources and displace their competitors out of world. so they become more and more developed in this aspect, but because it's very general process, such features as psychics/intelligence, technical superiority and culture are developed (they are really just aux. instruments to reach the main and only goal) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
Am Samstag, 29. Dezember 2007 20:15 schrieb Bulat Ziganshin: Hello Tim, Saturday, December 29, 2007, 10:07:15 PM, you wrote: ok, please compute 2^2^30 before continuing discussion. it seems that Well, that's why I recommended the Dennett essay. The difference between I'm too bored and I can't is actually an interesting philosophical question, and people have written about it in detail before. oh, Dennett isn't only source of wisdom. i proposed you this task because i've my own understanding of it. as i've said in other letter, both computers and humans may be described using mathematics and therefore equivalent - as far as we say about theoretical immortal man and Turing machine The advantages of computers over humans are quantitative. For example, a computer can do calculations faster than a human. But the “advantages” of humans over computers are qualitative. For example, a computer cannot be creative. I love my children. My laptop isn’t able to do that. Best wishes, Wolfgang ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[4]: [Haskell-cafe] Re: Wikipedia on first-class object
as i've said in other letter, both computers and humans may be described using mathematics Erm... What do you really mean by may? I'm pretty sure you can't give such description right now - otherwise you should already have several Nobel prizes. It seems reasonable that even if such description is theoretically possible, no human would ever read it - despite that it can be dropped to the Earth from UFO. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Re: Re[2]: Wikipedia on first-class object
In many cases, equality of functions has been decided by humans, as has termination of programs. Of course this doesn't prove that humans can, in principle, decide equality for any pair of functions. But neither has the opposite been proved. It hasn't been proved that we can't build a device that can decide equality for arbitrary functions, either. I'm sure it can be proved that any mathematical problem can be reduced to equality of two functions, so our ability to decide it contradicts Goedel theorem. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
Please, Amateur Philosophy is that way - Please respect others who have signed up to Haskell-Cafe to discuss Haskell and not meaningless drivel. It wasn't intended for me, but I'd like to apologize. I'll try to stop now, but I'm not sure I'd be able to. I need a mathematical description of myself to know for sure. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Achim, Saturday, December 29, 2007, 11:31:07 PM, you wrote: computers don't make mistakes, don't sleep, don't have their own goals that differ from goals of their society. Of course not. It would be a different society if their goals would differ. why computers are never placed in prison? each man has its own goals which are not equivalent to the goals of society. crime is just a way for human to reach his goals while abandoning goals of this particular society (and that's why crime in different societies may mean different things). but why such difference exist? because humans aren't society animals, they was created as individuals with their own needs. society try to program them but this process isn't 100% reliable because programming interface to humans is really very, very complex (imagine Windows API after 4*10^9 years of development ;) computers start from scratch, they are programmed directly and they will be (and already does) programmed to just reach society's goals. they are like ants, which are also programmed (by Nature) to be society animals and whose goals (therefore) don't differ from goals of their entire society -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Achim, Saturday, December 29, 2007, 11:47:50 PM, you wrote: It's always interesting to compare computers and humans, especially computer scientist seem to do that :) Hm. More importantly, only humans try to write a general Eq and Ord instances over different domains. you have seen only humans that was programmed to this task. you can program computer to the same problem. i think that the problem is our limitations as bad programmers - not computer's as a bad performer :) at least, you can start with program that generates random texts of increasing length. this program is so smart that it can print solution for any problem that has limited length - well, if computer will not be bored :D -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Bulat Ziganshin [EMAIL PROTECTED] wrote: And, pray, what problem does the nature wants to solve that it thinks in the way of all history until now? making the Superhero who will kill'em all. and it's already very close Damn, I do continue making the mistake assuming that you got all that stuff out of a book neither you nor the author understood. Darwin knew what fit means. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Jonathan Cast: Miguel Mitrofanov wrote: ... Just for the record: I don't think your computer is able to compute 2^(2^30). Certainly not at the moment (not with memory loads the way they are now). Oh, you know, there are always some ways to increase the work efficiency. For example, a long time ago, in Soviet Union, they discovered that one guy, Stakhanov, worked 24 hours per day. And could participate in the Party meetings. So, they asked him: Comrade, how can you do that?! And he answered: It is very simple, I just get up one hour earlier. So, switch your computer earlier, and you will be able to compute 2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^ (right assoc.) as well. Jerzy Karczmarczuk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[6]: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Miguel, (i returned to cafe) as i've said in other letter, both computers and humans may be described using mathematics Erm... What do you really mean by may? can I'm pretty sure you can't give such description right now - otherwise you should already have several Nobel prizes. for description of computer? :) i mean that if humans are *physical* creatures then their behavior should obey physic laws which is described in mathematical language. so we should either recognize that mathematics can't be used to describe physical world (i.e. so-called Nature Laws are not exist) or that human, as any other physical object, obeys to these mathematical equations but according to your logic, anyone who says that Nature obeys to the laws, should publish all these laws immediately? It seems reasonable that even if such description is theoretically possible, no human would ever read it - despite that it can be dropped to the Earth from UFO. it's true for whole Science - we can't read so-called Nature Laws from original, we can just believe in their existence and make assumptions about them based on experiments. but all our experiments (facts) are just finite of points - how we can draw whole function by several points? assumptions, assumptions... and we already know beautiful examples of scientists being wrong in their assumptions. to be exact, the whole history of science is history of replacing old wrong assumptions with new ones. even most well-known laws of Newtonian physics become obsolete just 300 years later so... my opponents use double-thinking at 100% - they believe in Nature Laws and free will, they love Science but sure that it cannot describe human. i don't mean personalities - it's just set of beliefs that society gives to each of us. moreover, every man should believe that he is thinking, but he should never really think and draw his own conclusion different from orthodox ones. it's double-thinking again. but society learn us that double-thinking is inferior (noone knows that is inferiority but we should avoid it). here set of beliefs obviously makes self-contradict and because we are teached to not be self-contradict, this at last end requires some personal selection. are you prefer to be self-contradict or not think, or something else - fortunately, society doesn't programmed us ho to make this choice. it's up to every one of us :) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Bulat Ziganshin [EMAIL PROTECTED] wrote: Hello Achim, Saturday, December 29, 2007, 11:47:50 PM, you wrote: It's always interesting to compare computers and humans, especially computer scientist seem to do that :) Hm. More importantly, only humans try to write a general Eq and Ord instances over different domains. i think that the problem is our limitations as bad programmers - not computer's as a bad performer :) Neither. It's just like trying to get marmalade == True to typecheck. You might do it in C to circumvent type checking, but still will not get any sense out of it. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Bulat Ziganshin writes: why computers are never placed in prison? But they do! One of my students last year was a convict, living quite permanently in the Centre Pénitencier de Caen [I am *serious*.] For his 'Licence' project he needed a reasonable computer, and our department agreed to lend him one. We have chosen a really nasty, impolite computer, and we sent it to prison. Some time ago, it was pardoned, but unfortunately, the student is still there... (He will do his Master diploma, so it is possible that we send another computer to jail.) Now, Bulat, if you try to tell me that this was not what you meant, I will be shocked. Jerzy Karczmarczuk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Wolfgang, Sunday, December 30, 2007, 12:04:22 AM, you wrote: The advantages of computers over humans are quantitative. For example, a computer can do calculations faster than a human. But the “advantages” of humans over computers are qualitative. For example, a computer cannot be creative. I love my children. My laptop isn’t able to do that. one more trick to convince yourself is to use words which doesn't have exact meanings. are you have human-independent description of love? creativity? when i run fractal-displaying program, it draws other fractal each time. is it creative enough for you? when i power on my computer, each time it connects to computer of ISP. may be, it's not true love for you but at least they are more permanent than most people :D from my, scientist's POV, love is social need that made animal's groups more survival-able. animals what loves each other has more chances in Game of Live survival was never goal for computers so they cannot love each other like you can't fly and eat electricity power (or solar energy). are these features also qualitative? -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Achim, Sunday, December 30, 2007, 12:32:51 AM, you wrote: And, pray, what problem does the nature wants to solve that it thinks in the way of all history until now? making the Superhero who will kill'em all. and it's already very close Damn, I do continue making the mistake assuming that you got all that stuff out of a book neither you nor the author understood. hm, if you can't understood me - it's better for your self-respect to believe that i don't understand something. you are God, of course? :) Darwin knew what fit means. ? btw, are you read Darwin books? in the first one he often said about nature economics and i'm pretty sure that he drawn his idea from the Adam's one -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
Could you please agree to disagree? It was fun for a while, but it gets annoying now. Cheers, Daniel Am Samstag, 29. Dezember 2007 22:52 schrieb Bulat Ziganshin: Hello Achim, Sunday, December 30, 2007, 12:32:51 AM, you wrote: And, pray, what problem does the nature wants to solve that it thinks in the way of all history until now? making the Superhero who will kill'em all. and it's already very close Damn, I do continue making the mistake assuming that you got all that stuff out of a book neither you nor the author understood. hm, if you can't understood me - it's better for your self-respect to believe that i don't understand something. you are God, of course? :) Darwin knew what fit means. ? btw, are you read Darwin books? in the first one he often said about nature economics and i'm pretty sure that he drawn his idea from the Adam's one ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object
Hello Peter, Saturday, December 29, 2007, 11:12:44 PM, you wrote: But since it seems that plants use some kind of quantum coherence just to do photosynthesis (see http://en.wikipedia.org/wiki/Photosynthesis#Quantum_mechanical_effects), would not be surprised that our human brain also uses some clever (quantum?) tricks to achieve what it does, tricks which might not be simulated by a regular computer, no matter how fast it runs. why it can't be simulated in computers? these effects are described in mathematics languages using formulas which can be executed on computer moreover, quantum effects are not dedicated to plants and animals. they can be used in computers like any other physical effects -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[6]: [Haskell-cafe] Re: Wikipedia on first-class object
and we already know beautiful examples of scientists being wrong in their assumptions. to be exact, the whole history of science is history of replacing old wrong assumptions with new ones. even most well-known laws of Newtonian physics become obsolete just 300 years later That's completely wrong (sorry, I know, I was going to stop). Newton laws are definitely not obsolete - the only thing that happened to them is that bounds of their applicability area were refined. Moreover, there is no scientific theory that was obsoleted by something new - AFAIK even flogiston theory is still here. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Wikipedia on first-class object
Daniel Fischer [EMAIL PROTECTED] wrote: Could you please agree to disagree? I fear Bulat decided to a long time ago. I agree to shut up. -- (c) this sig last receiving data processing entity. Inspect headers for past copyright information. All rights reserved. Unauthorised copying, hiring, renting, public performance and/or broadcasting of this signature prohibited. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] An interesting monad: Prompt
I posted the current version of this code at http://ryani.freeshell.org/haskell/ On 12/28/07, Thomas Hartman [EMAIL PROTECTED] wrote: Would you mind posting the code for Prompt used by import Prompt I tried using Prompt.lhs from your first post but it appears to be incompatible with the guessing game program when I got tired of reading the code and actually tried running it. best, thomas. 2007/12/4, Ryan Ingram [EMAIL PROTECTED]: Ask and ye shall receive. A simple guess-a-number game in MonadPrompt follows. But before I get to that, I have some comments: Serializing the state at arbitrary places is hard; the Prompt contains a continuation function so unless you have a way to serialize closures it seems like you lose. But if you have safe points during the execution at which you know all relevant state is inside your game state, you can save there by serializing the state and providing a way to restart the computation at those safe points. I haven't looked at MACID at all; what's that? {-# LANGUAGE GADTs, RankNTypes #-} module Main where import Prompt import Control.Monad.State import System.Random (randomRIO) import System.IO import Control.Exception (assert) Minimalist functional references implementation. In particular, for this example, we skip the really interesting thing: composability. See http://luqui.org/blog/archives/2007/08/05/ for a real implementation. data FRef s a = FRef { frGet :: s - a , frSet :: a - s - s } fetch :: MonadState s m = FRef s a - m a fetch ref = get = return . frGet ref infix 1 =: infix 1 =: (=:) :: MonadState s m = FRef s a - a - m () ref =: val = modify $ frSet ref val (=:) :: MonadState s m = FRef s a - m a - m () ref =: act = act = modify . frSet ref update :: MonadState s m = FRef s a - (a - a) - m () update ref f = fetch ref = \a - ref =: f a Interactions that a user can have with the game: data GuessP a where GetNumber :: GuessP Int Guess :: GuessP Int Print :: String - GuessP () Game state. We could do this with a lot less state, but I'm trying to show what's possible here. In fact, for this example it's probably easier to just thread the state through the program directly, but bigger games want real state, so I'm showing how to do that. data GuessS = GuessS { gsNumGuesses_ :: Int , gsTargetNumber_ :: Int } -- a real implementation wouldn't do it this way :) initialGameState :: GuessS initialGameState = GuessS undefined undefined gsNumGuesses, gsTargetNumber :: FRef GuessS Int gsNumGuesses = FRef gsNumGuesses_ $ \a s - s { gsNumGuesses_ = a } gsTargetNumber = FRef gsTargetNumber_ $ \a s - s { gsTargetNumber_ = a } Game monad with some useful helper functions type Game = StateT GuessS (Prompt GuessP) gPrint :: String - Game () gPrint = prompt . Print gPrintLn :: String - Game () gPrintLn s = gPrint (s ++ \n) Implementation of the game: gameLoop :: Game Int gameLoop = do update gsNumGuesses (+1) guessNum - fetch gsNumGuesses gPrint (Guess # ++ show guessNum ++ :) guess - prompt Guess answer - fetch gsTargetNumber if guess == answer then do gPrintLn Right! return guessNum else do gPrintLn $ concat [ You guessed too , if guess answer then low else high , ! Try again. ] gameLoop game :: Game () game = do gsNumGuesses =: 0 gsTargetNumber =: prompt GetNumber gPrintLn I'm thinking of a number. Try to guess it! numGuesses - gameLoop gPrintLn (It took you ++ show numGuesses ++ guesses!) Simple unwrapper for StateT that launches the game. runGame :: Monad m = (forall a. GuessP a - m a) - m () runGame f = runPromptM f (evalStateT game initialGameState) Here is the magic function for interacting with the player in IO. Exercise for the reader: make this more robust. gameIOPrompt :: GuessP a - IO a gameIOPrompt GetNumber = randomRIO (1, 100) gameIOPrompt (Print s) = putStr s gameIOPrompt Guess = fmap read getLine If you wanted to add undo, all you have to do is save off the current Prompt in the middle of runPromptM; you can return to the old state at any time. gameIO :: IO () gameIO = do hSetBuffering stdout NoBuffering runGame gameIOPrompt Here's a scripted version. type GameScript = State [Int] scriptPrompt :: Int - GuessP a - GameScript a scriptPrompt n GetNumber = return n scriptPrompt _ (Print _) = return () scriptPrompt _ Guess = do (x:xs) - get -- fails if script runs out of answers put xs return x scriptTarget :: Int scriptTarget = 23 scriptGuesses :: [Int] scriptGuesses = [50, 25, 12, 19,
[Haskell-cafe] Re: Wikipedia on first-class object
Bulat Ziganshin writes: Hello Peter..., you wrote: But since it seems that plants use some kind of quantum coherence just to do photosynthesis... would not be surprised that our human brain also uses some clever (quantum?) tricks to achieve what it does, tricks which might not be simulated by a regular computer, no matter how fast it runs. why it can't be simulated in computers? these effects are described in mathematics languages using formulas which can be executed on computer moreover, quantum effects are not dedicated to plants and animals. they can be used in computers like any other physical effects I suggest that you read something on 'quantum computing'. And some other stuff as well, so that you don't use such formulations as formulas which can be executed on computer. Computers don't execute formulae! A mathematical formula may be non-constructive, or very difficult/impossible to algorithmize. Concerning quanta, the simulation of quantum processes on classical archi- tectures may be and usually is extremely inefficient. So inefficient that your simulation loses sense. No classical system can compute, say, a Fourier transform in constant (in fact, infinitely small) time, quantum system do it (in a sense) constantly. Quantum behaviour is not an effect, but conditions our understanding of *measurement*. We don't really know what is quantum information. So, please, don't trivialize an awfully complicated problem. Jerzy Karczmarczuk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] More newbie typeclass confusion...
Hi there. If someone can tell me why I am getting type ambiguity in the following code: class (Ord s, Num s) = Scalar s where zero :: s class Metric m where delta :: Scalar s = m - m - s (=~):: m - m - Bool (/~):: m - m - Bool (=~) a b= (delta a b) = zero (/~) a b= not (a =~ b) I will scream. The error I get compiling is: Ambiguous type variable `s' in the constraint: `Scalar s' arising from a use of `delta' at test.hs:13:23-31 Probable fix: add a type signature that fixes these type variable(s) If I change Scalar to Num, and zero to 0 within the class Metric, then it works. I don't get it. zero is defined in the Scalar class, and delta returns a Scalar, and Scalar derives Ord, so where's the ambiguity? Thanks. I will understand Haskell eventually... =) Make the switch to the world's best email. Get the new Yahoo!7 Mail now. www.yahoo7.com.au/worldsbestemail ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Specializing classes with classes
On Dec 28, 2007, at 10:18 PM, [EMAIL PROTECTED] wrote: Quoting alex [EMAIL PROTECTED]: I would like to do this: class Foo t where hi :: t - Bool class Foo t = Bar t where hi x = True This is arguably one of the most requested features in Haskell. The only reason why it hasn't been implemented yet is that some of the corner cases are a little subtle. Really? This code doesn't even really make any sense to me. In order to be an instance of Bar, t has to already be an instance of Foo, implying that the function hi is already defined for t. What would the function in this example do? instance Foo Wibble where hi x = False instance Bar Wibble myFunc :: Wibble - Bool myFunc x = hi x ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] More newbie typeclass confusion...
On 29 Dec 2007, at 9:31 PM, alex wrote: Hi there. If someone can tell me why I am getting type ambiguity in the following code: class (Ord s, Num s) = Scalar s where zero :: s class Metric m where delta :: Scalar s = m - m - s (=~):: m - m - Bool (/~):: m - m - Bool (=~) a b= (delta a b) = zero (/~) a b= not (a =~ b) I will scream. The error I get compiling is: Ambiguous type variable `s' in the constraint: `Scalar s' arising from a use of `delta' at test.hs:13:23-31 Probable fix: add a type signature that fixes these type variable(s) If I change Scalar to Num, and zero to 0 within the class Metric, then it works. I don't get it. zero is defined in the Scalar class, and delta returns a Scalar, and Scalar derives Ord, so where's the ambiguity? delta is polymorphic in s; that is, it works for any value of type s in the class Scalar, and has some definition that (presumably) uses the value zero. (And I assume other methods of Scalar). Its value is thus some arbitrary function of the methods of Scalar (and its super classes); to call it, you need a specific type so the function can be supplied with the methods to use. The code is still ambiguous if you switch to Num, but since newcomers to Haskell are frequently confused by Haskell's approach to numeric computations, Haskell 98 has a solution for this case; ambiguous type variables which are constrained to be instances of Num get `defaulted' to particular numeric types. So the ambiguity goes away. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] More newbie typeclass confusion...
On Dec 30, 2007 3:43 AM, Jonathan Cast [EMAIL PROTECTED] wrote: On 29 Dec 2007, at 9:31 PM, alex wrote: Hi there. If someone can tell me why I am getting type ambiguity in the following code: class (Ord s, Num s) = Scalar s where zero :: s class Metric m where delta :: Scalar s = m - m - s Just to clear up common confusion: the caller chooses s here, not the delta function. So delta has to work for any choice of s the caller chooses (as long as it is an instance of Scalar). (=~):: m - m - Bool (/~):: m - m - Bool (=~) a b= (delta a b) = zero What instance of Scalar do you want delta to return here? There's no way for the compiler to deduce that information. What you probably want is a fundep or associated type, associating a single choice of scalar for each metric: class (Scalar (Field m)) = Metric m where type Field m :: * delta :: m - m - Field m ... instance Metric Double where type Field Double = Double delta = (-) ... Luke ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object
G'day all. Tim Chevalier wrote: The only thing that computers can do that humans can't is to work without getting bored. Quoting Bulat Ziganshin [EMAIL PROTECTED]: ok, please compute 2^2^30 before continuing discussion. it seems that you just use i'm too bored and i can't as synonyms. No, I don't think he did. But I also disagree with the original statement. A computer can get bored if it has to, but you do have to take a broad definition of bored. It usually only comes up in the context of real-time systems or problems for which only worst-case exponential algorithms are known. If the system is in danger of getting overloaded, or the worst-case is in danger of being triggered, systems can be programmed to start approximating, skimming or even dropping unimportant work. Cheers, Andrew Bromage ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Wikipedia on first-class object
G'day all. Quoting Wolfgang Jeltsch [EMAIL PROTECTED]: I love my children. My laptop isn’t able to do that. Neither am I, especially since I've never met them. Cheers, Andrew Bromage ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] encountering another STM problem .. teething problems ; ^)
On Dec 30, 2007, at 1:09 , Galchin Vasili wrote: main = do {atomic (r - (createR 1); putR r 1)} Strangely I am not getting a type error rather a syntax on the - in main. ?? To use - you need to open another do block: main = do {atomic (do {r - (createR 1); putR r 1})} -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED] system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED] electrical and computer engineering, carnegie mellon universityKF8NH ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe