systems changed the topic of #ocaml to: http://icfpcontest.cse.ogi.edu/ -- OCaml wins | http://www.ocaml.org/ | http://caml.inria.fr/oreilly-book/ | http://icfp2002.cs.brown.edu/ | SWIG now supports OCaml| Early releases of OCamlBDB and OCamlGettext are available | Caml Weekly news http://pauillac.inria.fr/~aschmitt/cwn/
mattam_ has quit ["leaving"]
asquii has joined #ocaml
<thedark> i need to create an array, but i cant imagine a way to do it in a functional way. the problem is that the position of the array were the data has to be depends on the data.
<thedark> (in other words, the indice is a function of the data, but the data cannot be guessed with the indice)
<Riastradh> Index, not indice.
<thedark> u'r right, index
asqui has quit [Read error: 110 (Connection timed out)]
asquii is now known as asqui
<Smerdyakov> thedark, you can make a list first.
<thedark> i've already made an array with all the data in it
<thedark> but of course each data need to be "moved" in the correct place
<exa> so you're done. forget about doing everything in a functional way :)
<Riastradh> Each datum.
lus|wazze has quit ["Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Univ]
<exa> hey Riastradh knows latin singulars and plurals :P
<thedark> lol
<Riastradh> exa, yeah, but unfortunately I don't know Latin.
<exa> it's typical pointer jumping problem no worries thedark
<exa> Riastradh: good for you
<Riastradh> -Good- for me?
<thedark> exa ??
<exa> pun intended people
<exa> I mean, what if you knew latin!
<exa> hehe
<Riastradh> I'd have taken over the world by now!
<exa> LOL
<thedark> so how would u solve my problem?
<exa> anyway, sometimes functionaly way of doing it sucks
<Riastradh> You'd all be my slaves and you'd assist me in donning my toga!
<exa> sad but true :)
<exa> functional
<Riastradh> ...except in a lazy language like Haskell.
<exa> errr
<exa> Errrr
<Riastradh> ...where you can reference items in the array in its definition before it's defined.
<exa> Well even in haskell the code you write can suck QUITE a bit
<exa> Well you can use list comprehensions of course
<thedark> shit, it would have been a matter of second to write the thinf i need in C :(
<exa> It looks like math
<Riastradh> let lazy arr = Array.init size (\i -> ...get data from arr...) in ...
<exa> thedark: tell me the algorithm
<exa> yea so it's pointer jumping
<exa> incidentally I don't think it'd be easier in Haskell. JUST slower (^_^)
<exa> haskell is damn slow
<exa> it's like java
<thedark> i have an array full of data, a function that takes on of those data and returns an index, and i want all of the data in the good index
<exa> it really annoyed me in a project where i needed to do simple processing over some files
<Riastradh> exa, are you trolling or are you just misinformed about a 'language's speed?'
<exa> type f : 'a array -> int -> int? uh?
<exa> Riastradh: no I'm not trolling
<exa> Riastradh: it's really inefficient I decided
<exa> Riastradh: It doesn't matter how well you program that is
<Riastradh> OK, then I seek to correct you: languages -aren't slow or fast-. The language itself has absolutely -NOTHING- to do with speed.
<exa> Riastradh: I will have to disagree Riastradh
<Riastradh> It's the -implementations- whose speeds may be desirable or undesirable.
<Riastradh> Someone could write a -REALLY- fast optimizer for Java, which compiled to native code on some über fast RISC machine, and it would go really fast; or they could use some slow, shoddily built Java compiler (bytecode compiler) with a slow VM.
<exa> Riastradh: Actually that's not correct because of a very very subtle point
<Riastradh> Tell me of this 'very subtle point.'
<exa> You actually know what I'm going to say
<exa> But let me hint you into it
<exa> Why is Java slow? Is it only because of the implementation?
<exa> Is it because it has a stupid huge VM and terrible IDEs?
<exa> Or is it because its bytecode isn't well thought?
<exa> It's called pragmatics. And by way of it semantics.
<exa> And another very very subtle point that's called performance
<thedark> exa :val table_representants_aux : code_correcteur -> representant array = <fun>
<thedark> val index_of_representant : representant -> code_correcteur -> int = <fun>
<thedark> that is what i have now
<Riastradh> exa, uh, rephrase without asking a question to answer my question.
<exa> Performance depends on actual characteristics of the hardware
<exa> Any implementation that ignores those characteristics is doomed to fail
<exa> However...
<exa> If the semantics and pragmatics will not allow a high performance implementation you will never have it
<exa> That's why I think Java's problem is not only in implementation. It's in language specification
<exa> And I do think Java's designers are idiots
<exa> Anyway, the really subtle point here is "pragmatics"
<exa> Although semantics of general purpose PLs allow you to write high performance programs if you resort to all sorts of nasty tricsk.... "pragmatics" can effectively block you from doing that
<thedark> how can i create an array so i can modifiy it after the creation?
<exa> Therefore all those tricks like "tree deforesting" etc. are irrelevant
<exa> thedark: OK let's get to your problem :P
* exa tries to make sense of the code snippet
<Riastradh> thedark, what is your exact problem?
<thedark> i've made those 2 functions :
<thedark> val table_representants_aux : code_correcteur -> representant array = <fun>
<thedark> val index_of_representant : representant -> code_correcteur -> int = <fun>
<exa> thedark: the elements of an array are mutable so you shouldn't have a problem modifying an array after creating it
<exa> especially after creating it :)
<Riastradh> thedark, and...?
<thedark> now i want to create another array, and to put each data of the first array into the second array at the index given by my function index_of_representant
<exa> thedark: you should use a function like the one Riastradh suggested
<exa> thedark: think about it a little
<Riastradh> What function did I suggest?
<exa> but you first need to invert things
<exa> ah
<exa> thedark: write an imperative code, easiest
<exa> thedark: do you want it to be quite functional then?
<thedark> i want it to work:)
<thedark> i dont understand how to create an array that i'll be able to modify later on
<Riastradh> Arrays are by default mutable.
<exa> Array.iter (fun x -> array2.( index x ) <- x ) array1
<exa> yea you shouldn't have a problem
<exa> just use it in a let scope
<exa> that's all
<exa> just use :)
<thedark> but how do i initialize it?
<exa> Just fill with zeros my dear
<thedark> but will i be able to put my type representant in it after that?
<Riastradh> Does 'index' access array2?
<exa> Then use an iteration as the above
<exa> Ah
<exa> It prolly accesses array1
<exa> I just tried to write something abstract off the top of my confused head
<exa> Didn't he say he determines the index of the element via a function?
<thedark> yes i did
<Riastradh> Oh, right.
<exa> right, solved. :)
<exa> Man, I did 4-5 hard iteration code today but I think I learnt a lot hehe
<Riastradh> Can you not do it backwards and get the value from the index in array1?
<thedark> but still, how do i create the array? Array.make n 0 ?
<exa> thedark: Yea
<exa> let a = Array.make ..... in .....
<exa> it's good enough :)
<thedark> ok i'm trying it:)
<exa> Riastradh: To be honest, monads and default lazy unboxed data values annoyed me a lot in haskell
<exa> Riastradh: But I dig the language's syntax. :)
<Riastradh> What annoyed you about monads?
<thedark> exa: it's not working, because the array has been created to receive ints, and i want to put "representants" in it
<exa> The way it can give rise to counter-intuitive bugs
<Riastradh> Elaborate, please.
<Riastradh> (exa)
<exa> It's actually not too different from simple minded imperative programming
<Riastradh> Yes it is.
<Riastradh> Very different, in fact.
<exa> But it makes you deal with 10-lines of compiler error messages
<exa> Riastradh: I know it's different
<Riastradh> Monads are merely ways to express computations.
<exa> But it's not different enough to make a difference
<exa> Riastradh: I know what a monad is
<Riastradh> I don't see how it is similar at all to simple-minded imperative programming.
<exa> I wrote enough monadic code to write higher order monadic functions etc.
<Smerdyakov> exa, if you'd just stop making errors, you wouldn't have to worry about error messages.
<Riastradh> Uh, wow.
<Riastradh> What an achievement: higher order monadic functions.
<exa> The way it looks is certainly like that. And the way it works isn't too different either.
<exa> Riastradh: It's not an achievement, I just wanted to say I'm not clueless about monads
<Riastradh> Elaborate, please, about how it is similar to imperative programming.
<exa> First in form
<exa> Second in design
<exa> That's it
<Riastradh> You haven't elaborated at all.
<exa> It's not some category theoretical way of expressing my programs. And I'm not satisfied with it.
<Riastradh> Don't rephrase; elaborate.
<exa> It's the same old shit in a way that allows it to run in a pipeline. That's all the difference to it.
<exa> And I do think the semantics isn't all that different
<Riastradh> You're rephrasing again, damnit. What of 'elaborate' don't you understand?
<exa> I read an entire book about algol 68 semantics last year... I think the semantics of a monad isn't different at all from an imperative program
<Riastradh> Elaborate!
<exa> But yes, it protects you from side effects, right/
<thedark> what about just telling me how to initialize an array with something else than ints? :)
<exa> I don't think that's the case
<Smerdyakov> It makes everything explicit, exa.
<Riastradh> ELABORATE!
<Smerdyakov> You can begin to use equational reasoning about the whole business.
<exa> Yes, it takes everything to the semantics level
<Riastradh> thedark, Array.make size <whatever initial value>
<Smerdyakov> Including using it with things without monadic type, to treat them purely functionally.
<exa> But from the programmer's point of view not much has changed, except for a very nice form of type safety
<Smerdyakov> Programmers don't reason about programs?
<Riastradh> exa, I beg you to -elaborate- on how monad stuff is simplistic imperative programming!
<exa> Would you be surprised if I say I cared about the message passing facet of a PL more than the functional facet?
<Smerdyakov> You aren't helped in understanding by looking at a function's type and knowing it relies on no "IO" or other "state"?
<mellum> I've heard haskell has this "monads" stuff, but I've never used it... is there something similar in Ocaml?
<thedark> Riastradh : i want to put this : type representant = {rep: F2Lin.vecteur ; poidsmin: int } in the array, and i dont understand how to achieve this
<exa> You can obviously write similar code, but it is not well supported. It will look clumsy when compared to haskell
<exa> OK, let me try to make my case
<exa> So, what do you understand by "message passing facet" of a PL?
<Smerdyakov> mellum, no. You can define your own monads, but in Haskell, the runtime system/libraries/whatever are designed so that monads are the ONLY way you can do IO and such, so it would be very different.
<mellum> thedark: you need a variable of that type as second argument
<exa> And what do you understand by a program being "functional"?
<mellum> thedark: or use an initializer function that returns them
<Riastradh> exa, 'message passing' is sending some symbol with arguments or something to a value and letting it do stuff.
<Riastradh> Letting the value do stuff with the symbol and arguments and such, that is.
<exa> My belief is that: if a program is sequential minded, it is still imperative.
<thedark> mellum: ok:)
<exa> So a sequential construct such as a linked list is not so much functional.
<exa> Does this thought sound weird to you?
<mellum> exa: yes :)
<Riastradh> Yes, very.
<exa> Nice
<Smerdyakov> It sounds weird to me. It's based on an entirely nonstandard definition of "functional."
<exa> Because it's meant to.
<mellum> oh well, I'm going to bed now... bye
<Riastradh> Imperative programming isn't about 'sequences' -- it's about imperatives, commands.
<exa> All PL's can be analyzed to the degree of parallelism it permits.
<exa> Riastradh: Ah
<Riastradh> 'Do this. Do that. Quux this. Fibble that.'
<Smerdyakov> WTF is quux?
<exa> Riastradh: But what is the semantics of an imperative program?
<Riastradh> A metasyntactic variable name.
<Riastradh> exa, uh, that depends on the program.
<exa> Riastradh: It is what passes on the cpu-memory pipe
<exa> Riastradh: In fact a "sequence" of such passes
<exa> Riastradh: A strictly sequential kind of programming
<exa> Riastradh: No
<exa> Riastradh: That's not correct
<exa> Imperative means sequential
<exa> I suggest you think about it
<Riastradh> Uh, no, 'imperative,' by definition in the English language, means a command.
<exa> Hacks like "threading" etc. doesn't really change that meaning
<exa> Riastradh: But in PL's the semantics comes down to something else
<Smerdyakov> exa, I think I'm seeing the tiny point that you're getting at, but... so what? Why are you talking about this?
<Riastradh> Merely because imperatives occur in sequences has nothing to do with the fact that sequences are inherently imperative.
<exa> Anyway, it's a very theoretical point so I don't expect anybody to appreciate it easily
<exa> Smerdyakov: I think it isn't a tiny point
<exa> The semantics of an imperative language is the same thing as a monad
<exa> So in monadic programming you are in command of entire semantics
<exa> Good thing
<Smerdyakov> It fits in a line. It is "tiny" to me.
<exa> I agree
<exa> But does it really make it different from imperative programming?
<exa> My answer to that question is a resounding NO
<Smerdyakov> Yes. You might have a point if you were more exact about using a specific monad.
<exa> And some haskell programmers have already observed subtle effects of this OBVIOUS fact
<exa> They have observed that side-effects can be emulated in complex monadic code
<exa> Say 3 layers deep
<exa> I can't remember the exact names and places :)
<exa> But it was very significant to me, because I knew it
<Smerdyakov> I mean, the boring unit monad isn't exactly emulating imperative programming. ;)
<exa> The thing is when you "go monadic" you've locked yourself in the same sequential prison as in the lowly C language.
<exa> I dislike that
<exa> So it's not a forward way of thinking at all.
<Smerdyakov> What's your concrete better suggestion?
<exa> Contrary to popular opinion
<exa> Of course those are my thoughts
<exa> Smerdyakov: I wish I knew :)
<exa> Smerdyakov: It smells like some category theoretical construction but I can't tell
<Smerdyakov> OK..... It appears that I leave this conversation thoroughly nonplussed.
<exa> Smerdyakov: I just know that the resulting program should run well on shared-nothing parallel machines in a proper parallel implementation
<exa> There is this Arrows work
<exa> In haskell community
<exa> That might be something :)
<Smerdyakov> OK.... the whole point of an IO monad is dealing with hardware that is inherently sequential.
<exa> Obviously when you have more than a linear chain of function compositions you have something going on :)
<exa> Good
<Smerdyakov> I think you may be confusing what its purpose is.
<exa> And that's what makes it essentially imperative I argue.
<Smerdyakov> So?
<exa> No I'm not confused about that
<Riastradh> No, you're going the wrong way.
<exa> Do you know what the primary aim of a functional language is?
<Riastradh> Sequences are -NOT- inherently imperative; imperative programs instead generally occur in sequences.
<Smerdyakov> Primary aim of a functional language? I don't think you can name one that is shared by all.
<exa> In a famous lecture "Von Neumann bottleneck" phrase was coined
<exa> The aim of functional PLs is to free programming of that bottleneck
<Smerdyakov> Go ahead and ask everyone implementing functional languages and _then_ come back and say that with assurance. :P
<exa> A construct that doesn't help that is simply "semantic sugar" IMO and not to be taken too seriously
<Riastradh> Explain this 'Von Neumann bottleneck.'
<exa> Monads are a pretty way of "assignment"
<Smerdyakov> Until that time, your speculations about unified goals seem pretty fluffy.
<exa> Smerdyakov: People have stepped back from this claim because they have failed to achieve that
<exa> Smerdyakov: Do you know who gave that famous talk?
<Smerdyakov> I, for one, know that that isn't _my_ goal in choosing to use functional languages.
<Smerdyakov> No, and I don't really think that's too relevant. I'm sure you'll share it with us, nonetheless.
<exa> No it's VERY relevant
<Smerdyakov> I use functional languages because of the main features given in definitions of functional languages:
<Smerdyakov> Higher order functions make for great compositional features
<exa> it doesn't matter what you use functional languages for
<Smerdyakov> Reasoning about functional programs is easier
<exa> There was a very bold research agenda once upon a time
<exa> That's a secondary issue I believe
<exa> They can have really nice static semantics
<Smerdyakov> Frankly, I think I can choose my own priorities if I wish....
<exa> Of course you can
<exa> But you can't say that this was not an important priority in research in the past
<Riastradh> People preferring to write and enjoying writing functional programs is -secondary-?
<exa> GHC PVM version is the fruit of that direction. Something to be applauded.
<Smerdyakov> exa, excuse me, but what is the importance of past research priorities in THIS conversation besides giving you a chance to show off knowledge?
<exa> Backus talked about "Von Neumann bottleneck" in his 78 Turing Award lecture
<exa> It's basically this: the von neumann architecture works by sending data back and forth through a pipe between cpu and memory
<exa> That is C and Pascal languages
<exa> Those languages are tied to that particular architecture
<Smerdyakov> I think Riastradh's request for information has expired. :P
<exa> We need a language that is not dependent on that architecture to perform
<exa> That was a very big goal.
<exa> But is it easy? No.
<Smerdyakov> exa... you are really, truly just talking to yourself now.
<exa> Riastradh: No I don't mean people are secondary
<exa> Riastradh: But in the design of a functional PL, that seems to me a secondary goal because it has already been achieved quite well
<exa> That was my point
<exa> Thank you for listening
thedark has quit [Read error: 60 (Operation timed out)]
<Riastradh> I don't see at all how that relates to monads being inherently imperative.
<exa> Am I a mad language designer who still hopes we can design a real parallel programming language? Yes
<exa> And I believe that language will be functional in nature
<exa> Riastradh: You can't?
<exa> All right
<Riastradh> No, not at all; you finished talking about monads ten minutes ago.
<exa> Read this, seems to be a nice expositio of the matter: http://zax.mine.nu/personal/projects/2001/aspects/progstyle.pdf
<Riastradh> And began rambling about this bottleneck and some silly definition of 'functional.'
<Smerdyakov> exa, the point is that IO monads are designed to work with sequential devices. Your hopes and dreams for non-sequential devices are not relevant to how well monads solve that problem.
<exa> Monads programming _is_ "von Neumann style"
<exa> And the heart of imperative programming _is_ "von Neumann style"
<exa> If you can't see this point, think about the organization of your PC, the imperative constructs and the relation among them. Thank you.
<Smerdyakov> You'e welcome.
<Riastradh> Psychologists must envy you for your ability to be vague.
<exa> Smerdyakov: I see Monads' importance to be wildly exaggerated
<Smerdyakov> exa, lovely. No one made any "importance" judgment in the conversation that you refuted.
<exa> So you might find it also strange that I believe ocaml's monadic programming support doesn't really make it less powerful/expressive :)
<Smerdyakov> I miiiiiiight.... if I had any idea what you're talking about.
<Riastradh> I'm still waiting for you to explain how 'sequence -> imperative' and not the other way around.
<exa> But anyway, I'm not purporting my assessment of monads to be the absolute truth. It's just opinion of an amateur language designer.
<Riastradh> Oh, after you made wildly outlandish and self-righteous claims about sequences vs imperatives, monads, and the definition of 'functional.'
<Riastradh> I'm -still- waiting for you to explain how 'sequence -> imperative.'
<exa> Riastradh: So you believe you are much more qualified about commenting on programming language features? That's fine. People have opinions.
<Smerdyakov> exa, I'm just wondering: are you autistic?
<Riastradh> No, I never made such claims.
<exa> Smerdyakov: Is that a way of attemping at condescension?
<exa> Smerdyakov: I am hoping that is not how you discuss ideas
<Riastradh> I asked unanswered questions -- e.g., 'how do you figure that "sequence -> imperative?"'
<exa> Riastradh: I am aware of your question
<Riastradh> Answer it, then.
<Smerdyakov> exa, no, it's a way of asking if you're autistic. Your conversational patterns remind me of those of someone I know who is autistic.
<exa> Riastradh: First I should hear from Smerdyakov
<exa> Smerdyakov: I am very tired ATM
<exa> Smerdyakov: But I have a very good command of English if you are curious
<Riastradh> I thought he might have been lagged, but apparently he isn't.
<Riastradh> exa, uh, autism has nothing to do with your command of English.
<exa> Smerdyakov: And I have quite sophisticated analytical and social skills.
<exa> But I wonder why do I have to prove I'm not mentally ill
<Smerdyakov> Yeah, I think they're not mutually exclusive. It's just the injection of obsessions, and assumptions that other people understand them without mention.
<exa> Well you'll see I'm not an autistic if I answer in manner you deserve
<exa> Anyway
<exa> Let me try to answer Smerdyakov
<exa> Pardon me, Riastradh
<Smerdyakov> You shouldn't view it as an insult from me, because I'm schizophrenic and proud of it. :-)
<exa> Smerdyakov: good for you
<Riastradh> I pardon you, but only if you will at some point answer my question, which you have been avoiding for the past half hour.
<exa> Riastradh perhaps misunderstood what I meant by sequences. By sequences of course I mean mathematical sequences.
<exa> For instance a sequence of function compositions
<exa> Or a sequence of numbers.
<exa> Or a sequence of commands
<Riastradh> I understand perfectly well what sequences are, and there is no need to remind me of what they are.
<exa> The algorithmic essence of these, it *seems* to me are the same
<exa> But you will suggest that the evaluation order can be different in monadic code than imperative code.
<exa> Right I know that
<Riastradh> No, no, no, no, no. Answer my question: how do you figure that 'sequence -> imperative?'
<Smerdyakov> exa, the validity of your point isn't questioned. What I think is strange is your judgment of its importance and relevance to the original conversation, which had to do with how well monads solve the problem they solve, I think.
<exa> I'm trying to tell it. As I said, for instance, combined with a lazy evaluation scheme you can create a pipelining effect.
<exa> But that is the only operational difference I can see, and it's not much of a difference IMHO because of the way we think of monads is still "von Neumann style"
<exa> So the fact that I'm making references to fuzzy entities like "style" might seem to invalidate my argument
<exa> But it doesn't :)
<exa> Smerdyakov: I'm not sure if I understood your concern well enough. Sleep is gaining weight :)
<Riastradh> exa, I beg of you to answer my question.
<exa> Riastradh: I believe I have already answered it
<Smerdyakov> My point is:
<Riastradh> What was your answer?
<Smerdyakov> I claim that the original point of the conversation was:
<Smerdyakov> Monads are a good way of plopping Von Neumann style computations into a functional program.
<exa> Riastradh: Whenever there is a "strictly sequential" kind of programming, you can profitably view it as an imperative program
<Smerdyakov> making what you have said somewhat off-topic
<exa> The binds between von Neumann architecture and imperative languages is much stronger than you think Riastradh
<exa> That is the point
<Riastradh> GAH! You're -STILL- just rephrasing and not explaining or elaborating!
<exa> Riastradh: You don't have to agree
<Smerdyakov> exa, do you see my concern now?
<exa> Smerdyakov: Yes
<Riastradh> PLEASE, stop rephrasing!!
<exa> Smerdyakov: So, what does that make them?
<Smerdyakov> exa, eh? You'll have to be more specific.
<exa> Smerdyakov: They are just a nice way of abstracting over von Neumann style programs
<Smerdyakov> Okeydokey.
<exa> Smerdyakov: But then people use it for arrays and all sorts of stuff. Yeah, that's really cool.
* Riastradh explodes.
<exa> But what is it when you abstract over x? It's likely you have the qualities of x....
<Smerdyakov> Yeah, that's sort of unfortunate, but, hey, you never _need_ arrays. :-)
<exa> Right
<exa> What do you plan to use instead?
<Smerdyakov> Instead in what situation/
<exa> To answer that you'll have to solve the greater puzzle in functional PL design IMHO
<exa> Because the answer to that is also the answer to what can replace von Neumann style programming
<exa> BTW, I didn't find a solution yet :/
<exa> And I don't claim I can
<exa> I just see what *isn't* the solution
<Smerdyakov> OK.
* Riastradh continues to explode, hoping some chunks will hit exa.
<exa> When the authors of Haskell claimed in their reference manual, "ah, monads looks like imperative programs but they aren't! really" they weren't conscious of what they were saying.
<Smerdyakov> Chunk party!
<exa> They were bogged down in the superficial beauty of its semantics.
<exa> Over and done.
<Riastradh> exa, before you can claim that you must answer my question.
* Smerdyakov hands exa a chunk.
<exa> Riastradh: I take it that you have written many monadic programs is that right?
<Riastradh> I have.
<exa> Riastradh: Should I also show you by way of rhetoric that they were not different in philosophy from other von Neumann style programming?
* Smerdyakov debates the appropriateness of adding "chunk party" to the topic. I think that would not go over well with the culture here. :-)
<Riastradh> I haven't the faintest idea what this 'von Neumann style' is.
<Smerdyakov> Riastradh, "sequential processing"
<exa> AKA imperative programming Riastradh
<Riastradh> exa, explain why.
<exa> I explained it. Read the reference I linked to.
<exa> Contents
<exa> 1. Abstract
tdo has joined #ocaml
<exa> 2. Imperative vs. Functional
<exa> Programming
<exa> 3. Hardware and the von Neumann bottleneck
<Riastradh> My case is: nothing except dots in the first dimension is not a sequence. Lines are sequences of those dots. Geometric shapes are sequences of lines. Lambda-Calculus programs are sequences of beta-reductions.
<exa> 4. Improving FP performance
<exa> 4.1 Graph Reduction Systems
<exa> 4.2 Vectorization
<Smerdyakov> Riastradh, now you're talking rubbish. :D
<exa> That looks quite relevant
<Riastradh> Smerdyakov, how so?
<Smerdyakov> Riastradh, sequences are usually defined as functions from the naturals to some set
<Smerdyakov> Riastradh, this makes a line definitely not a sequence
<exa> By sequence we mean a linear chain of dependencies usually
<exa> Like the successor function on integers
<Riastradh> Smerdyakov, but they are sequences of an infinite number of points.
<Smerdyakov> Riastradh, no. I take it you don't know basic set theory? :-)
<tdo> how would you transform a string "011100001100....0110001" into a list of arrays containing n bits each?
<Riastradh> Is \x -> x + 1 not a functional program?
<Riastradh> Smerdyakov, no, I don't.
<Smerdyakov> It sure is!
<tdo> please, tell me theres an ocaml scanf:)
<Smerdyakov> Riastradh, it's possible to prove that there is no sequence that contains every real number from 0 to 1.
stefp has quit [Read error: 110 (Connection timed out)]
<Smerdyakov> Riastradh, using the definition of sequence from above.
<Smerdyakov> Riastradh, the same thing works for any nontrivial line segment.
<Riastradh> Are infinite sequences impossible?
<Smerdyakov> No. Every sequence is infinite.
<exa> If one doesn't understand Backus's legendary article, he is not likely to appreciate any single point I made.
<Smerdyakov> But their ranges have to be countable sets.
<exa> tdo: string?
<tdo> exa: well i want the user to type in 01100110.....01111000
<tdo> and my program should transform it into a list of arrays
<tdo> with each array containing n bits
<exa> tdo: there is a Scanf module as well as Printf module :)
<exa> tdo: Those come in couples you know ;)
<tdo> :)
<Riastradh> tdo, what is n?
<tdo> the size of those arrays in the list...
<exa> Smerdyakov: Thank you for forcing me to formalize my point.
<Riastradh> Um, yes, but where do you get n from?
<tdo> Riastradh: from my program
<exa> Smerdyakov: Although I couldn't accomplish that given limited computational resources *Ahem*
<Smerdyakov> exa, your point is infinite? :-)
<exa> Smerdyakov: Ah, who knows how mind represent thoughts. It's probably discrete (^_^)
<Smerdyakov> I think it would be interesting to try to prove that your point is not compressible into a finite program. ;P
<exa> I don't think it's that non-trivial
<exa> (^_^)
<exa> Good night. I'm dying of sleep.
<Smerdyakov> Good night.
<exa> (That's of course a meaningful expression in my native language)
exa has quit [Read error: 104 (Connection reset by peer)]
* Riastradh watches exa's departure with a face of utter confusion and bewilderment.
<tdo> so what functions should i use to do what u want?
<tdo> i dont know how to start :(
<Smerdyakov> First, explode the string into a list.
<Smerdyakov> Then, it had better be obvious, or you need some serious remedial help =)
<tdo> well... i'm really new to ocaml:)
<Smerdyakov> Well, it couldn't hurt to master a good-sized pure functional subset first.
<tdo> i've done some scheme a few years ago...
<tdo> and thats all:)
lament has joined #ocaml
<Smerdyakov> I mean pure functional subset of Caml.
<tdo> goodnite all. its too late to think !
<lament> Smerdyakov: wow!
<lament> Smerdyakov: what are you doing here? I thouht you hated Ocaml
<Smerdyakov> lament, nopers.
<Smerdyakov> lament, I don't use it yet, but I will soon.
Smerdyakov has quit ["sleep"]
tdo has quit [Read error: 60 (Operation timed out)]
Kinners has joined #ocaml
__DL__ has quit [Read error: 104 (Connection reset by peer)]
foxster has quit [Read error: 104 (Connection reset by peer)]
foxster has joined #ocaml
polin8 has joined #ocaml
foxster has quit [Read error: 104 (Connection reset by peer)]
rhil is now known as rhil_bed
<async> does anyone here use gwml (or gwm)?
foxster has joined #ocaml
reltuk has quit [Read error: 104 (Connection reset by peer)]
foxen has joined #ocaml
foxster has quit [Read error: 104 (Connection reset by peer)]
reltuk has joined #ocaml
mattam has joined #ocaml
TachYon has joined #ocaml
lament has quit ["I WILL NEVER WIN AN EMMY"]
TachYon has quit [Remote closed the connection]
TachYon26 has joined #ocaml
docelic|sleepo is now known as docelic
d-bug has joined #ocaml
karryall has quit ["ERC vVersion 3.0 $Revision: 1.328 $ (IRC client for Emacs)"]
d-bug has left #ocaml []
Kinners has left #ocaml []
__DL__ has joined #ocaml
wax has joined #ocaml
reltuk has quit []
polin8 has quit [calvino.freenode.net irc.freenode.net]
polin8 has joined #ocaml
Smerdyakov has joined #ocaml
Smerdyakov has quit [Client Quit]
mattam_ has joined #ocaml
karryall has joined #ocaml
systems has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
systems has quit [Killed (NickServ (Nickname Enforcement))]
systems has joined #ocaml
systems has quit ["Client Exiting"]
gene9 has joined #ocaml
<gene9> Yurik: hi
stefp has joined #ocaml
<Yurik> gene9: hi
thedark has joined #ocaml
gene9 has quit [Read error: 104 (Connection reset by peer)]
lambda has joined #ocaml
thedark has quit []
lambda has left #ocaml []
rpw has joined #ocaml
reltuk has joined #ocaml
reltuk has quit [Read error: 104 (Connection reset by peer)]
docelic is now known as docelic|away
mattam has joined #ocaml
karryall has quit ["tcho"]
mattam_ has quit [Read error: 110 (Connection timed out)]
rhil_bed is now known as rhil
reltuk has joined #ocaml
TachYon26 has quit [Remote closed the connection]
karryall has joined #ocaml
gorgias has joined #ocaml
gorgias has quit ["Client exiting"]
_FandeZzik has joined #ocaml
_FandeZzik has left #ocaml []
rpw has quit ["Lost terminal"]
thedark has joined #ocaml
foxen has quit [Read error: 104 (Connection reset by peer)]
foxster has joined #ocaml
jao has joined #ocaml
<thedark> how do u explode a string into a list of arrays of 3 chars?
<emu> tnt
<Riastradh> thedark, first explode it into a list of chars, then split that into arrays of three characters.
<Riastradh> Although...why would you want arrays and not tuples?
<thedark> because i need arrays to be consistent with other functions
lus|wazze has joined #ocaml
themus has quit [Read error: 60 (Operation timed out)]
* Riastradh is very confused about what ` does in OCaml.
thedark has left #ocaml []
<karryall> polymorphic variant syntax ... and that's all I think
<lus|wazze> yup
<Riastradh> OK, and polymorphic variants are...?
<karryall> like variants except you don't have to define them before using them
<karryall> the type is determined by what polymorphic variants you're using
<Riastradh> Example?
<lus|wazze> let rec lng x = match x with `Null -> 0 | `Cons (_,b) -> 1 + lng b;;
newbie has joined #ocaml
<newbie> hi
newbie is now known as Hirs
<Riastradh> Is there a reason why someone would use a class type instead of a virtual class with all virtual methods or vice versa?
<Hirs> can any one help me to understand this piece of code?
<Hirs> | SendMessage (int, room_message) -> buf_int16 buf 39;
<Hirs> buf_int buf int;
<Hirs> buf_message buf room_message
<Hirs> being:
<Hirs> let buf = Buffer.create 1000
<Hirs> and:
<Hirs> let buf_message buf m =
<Hirs> match m with
<Hirs> ServerMessage s -> buf_int8 buf 0; buf_string buf s
<Hirs> | PublicMessage (n, s) -> buf_int8 buf 1; buf_int buf n; buf_string buf s
<Hirs> | PrivateMessage (n,s) -> buf_int8 buf 2; buf_int buf n; buf_string buf s
<Hirs> I'm lost :(
<Riastradh> What's wrong with that code?
<Riastradh> Or what does OCaml think is wrong with it?
<Hirs> I can't understand it :)
<Riastradh> Oh.
<Riastradh> OK, how well do you know OCaml?
<Hirs> my knowledge of ocaml is Very basic
<Riastradh> OK, why don't you start out with something a bit simpler, then?
<Hirs> very very basic
<Hirs> well I would prefer to convert to C :)
<Riastradh> Ewww, don't do that.
<Hirs> but OCaml is different from all languages I know
<Riastradh> And...?
<Riastradh> What languages are those, by the way?
<Hirs> I still doesn't understand its syntax
<Riastradh> C, C++, Java, and C#?
<Hirs> C/C++, Deplhi, java...
<Hirs> yes
<Riastradh> OK, I was close.
<Hirs> yes :)
<reltuk> pattern matching is new to me...
<reltuk> then I saw it being used in C++ functional programming...
<Riastradh> People going out into the programming world with knowledge of only C, C++, Java, Pascal, or C# are the cause of most of the bad code today. Why do you not want to learn OCaml?
<reltuk> functional programming in C++ tripped me out anyways though...
<Hirs> Riastradh: I have nothing against OCaml, but I am doing a program in C++ wich have to do the same of that OCaml code...
<Riastradh> Why are you rewriting it in C++?
<Hirs> because I know C++ better than OCaml and I Ignore if there is a binding of the QT library of OCaml
<Riastradh> But why don't you learn OCaml?
<Hirs> perhaps my next project is in OCaml, but btw I want to finish that in C++ :)
<Riastradh> 'That' being what?
<Hirs> that projecyt
<Hirs> that project
<Riastradh> What project?
<Hirs> an mldonkey GUI :)
<karryall> Hirs: there is no binding of QT for ocaml
<Riastradh> But why don't you write it in OCaml?
<karryall> (but there's a GTK binding)
<Riastradh> There -are- GUI libraries for OCaml.
<Hirs> karryall: the mldonkey project has a GUI in OCaml with GTK
<Hirs> but I don't like it
<Riastradh> So write another one in OCaml.
<Hirs> so I started to write a new one
<Hirs> I have done a lot of work until now, I will not change the language...
<karryall> aren't there already zillions of mldonkey front-ends ?
<Hirs> for Linux there are 3
<Hirs> but platero is the best :p
<Hirs> so... no one can help me? :(
<Riastradh> Not if you're just going to be changing OCaml code to C++ code.
<karryall> what's the problem exactly
<Hirs> the problem is that I don't understand that piece of code to convert it to C++
<Riastradh> Er, but if you like platero, why aren't you using it?
<Hirs> I am a programer of platero :)
<Hirs> but still needs some more develop :)
<karryall> like, I don't understand what this 5000 LOC program is doing, could you explain it to me ? :)
<Hirs> do you refer to mldonkey?
<karryall> I mean, mldonkey is a very big program, it's kinda hard telling you what a 10 line sample does
<Hirs> no, I only need a few lines I pasted before
<karryall> well, it seems to be about stuffing some data in a buffer
<Hirs> I am trying to understand the SendMessage (int, room_message) function
<Hirs> I supose int is an integer...
<karryall> that's not a function
<Hirs> but room_message ...
<Hirs> procedure?
<Riastradh> No, SendMessage is a constructor.
<karryall> it's a constructor
<Hirs> ok
<Hirs> and what -> buf_int16 buf 39 does on that constructor?
<karryall> it does nothing with the constructor itself
<Hirs> buf is "declared" as let buf = Buffer.create 1000
<karryall> but in case the argument matches the SendMessage constrcutor
<karryall> the buf_int16 buf 39 is executed
<karryall> buf is a string buffer
<karryall> buf_int16 is a function that is probably storing a 16bit integer in this buffer (just guessing from the name)
<Hirs> and the buf 39?
<Hirs> if the args are correct, will create a 16bit integer buffer....
<karryall> buf is the buffer
<karryall> 39 is an integer between 38 and 40
<Hirs> ¬¬
<Hirs> yeah I know...
<karryall> it stores 39 in the buffer, that's all
<Hirs> ooh.. that make sense!
<Hirs> and then will add buf_int buf int; and buf_message buf room_message to the buffer?
<Hirs> so we have a 39 + <an integer> + <room_message>
<karryall> exactly
<Hirs> in the buffer
<Hirs> ok, now the problem is in room_message
<Hirs> let buf_message buf m =
<Hirs> match m with
<Hirs> ServerMessage s -> buf_int8 buf 0; buf_string buf s
<Hirs> | PublicMessage (n, s) -> buf_int8 buf 1; buf_int buf n; buf_string buf s
<Hirs> | PrivateMessage (n,s) -> buf_int8 buf 2; buf_int buf n; buf_string buf s
<karryall> there's a 8bit integer
<Hirs> I supose PublicMessage is also a constructor...
jao_ has joined #ocaml
<karryall> and then a string or an int and a string, it depends
<Hirs> for example if I want a PublicMessage the buffer will contain: 39 + <an int> + 1 + <an int> + <string>
<Hirs> what the let statement do?
<karryall> it introduces a binding (ie a definition)
<karryall> that's the definition of the buf_message function
<Riastradh> let x = y in ...
<Riastradh> is like in C:
<Riastradh> { type x = y; ... }
jao has quit [Read error: 110 (Connection timed out)]
<Riastradh> Is there a reason why one might prefer to use a class type or a virtual class with all virtual methods?
<karryall> you've already said that :)
<Riastradh> I know, and no one answered.
<Hirs> thnaks for your help
<Hirs> thanks :)
Hirs has quit ["SaNVirC para KVirc (http://sanvirc.sourceforge.net) (Linux Inside)"]
lament has joined #ocaml
jao_ has quit ["leaving"]