smkl changed the topic of #ocaml to: OCaml 3.07 ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn, A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/, A free book: http://cristal.inria.fr/~remy/cours/appsem, Mailing List (best ml ever for any computer language): http://caml.inria.fr/bin/wilma/caml-list
CosmicRay has quit [Remote closed the connection]
mattam_ has joined #ocaml
mattam has quit [Read error: 60 (Operation timed out)]
Hipo has joined #ocaml
Demitar has quit [Read error: 60 (Operation timed out)]
<pattern> "Sadly, [Test Driven Development is] somewhat like teenage sex, everybody is talking about it, most are not doing it and those that are doing it, are doing it wrong."
mattam_ is now known as mattam
<Smerdyakov> Does anyone know why I would get this error in Coq when trying to execute Qed?
<Smerdyakov> Recursive call to hasType had not enough arguments
<mattam> wow
ChoJin has joined #ocaml
<ChoJin> hello
<ChoJin> anyone familiar with Map module ?
<Smerdyakov> mattam, I think it is somehow related to Omega.
<Smerdyakov> mattam, the problem goes away when I change the lemma to take as a hypothesis something that I was proving with Omega.
<Smerdyakov> ChoJin, probably familiar enough to answer most questions. Do you have one?
<ChoJin> yes :)
<ChoJin> I cannot believe there are no "size" function
<ChoJin> I would like to know the number of element in my map
<Smerdyakov> Well, you can calculate it in time proportional to the size of the map.
<Smerdyakov> Or you can keep track of it yourself.
<ChoJin> yes, but I don;t understand why this function is not provided
<ChoJin> (btw the computation should by log n)
<ChoJin> s/by/be
<Smerdyakov> ChoJin, should be log n? Why?
<ChoJin> oops
<ChoJin> too tired ;)
<ChoJin> sorry :)
<Smerdyakov> It necessarily would cost extra for every insert operation to keep track of the map size.
<Smerdyakov> I guess the OCaml developers decided to let you keep track of it yourself if you care.
<ChoJin> but they could implemented a size method
<ChoJin> which returns the size in linear time
<Smerdyakov> Yes, and so can you.
<ChoJin> yes of course :)
<ChoJin> but this is a standard library :)
<ChoJin> that's why I am surprised
<Smerdyakov> A size function that takes linear time is not something to be proud of.
<Smerdyakov> I wouldn't want to include one in a library I released.
<ChoJin> :)
<gl> heya chojin
<gl> /nick vect :)
<ChoJin> is there a better way to convert a char to string than String.make 1 my_char ?
<ChoJin> gl: :)
<Smerdyakov> ChoJin, I don't know one.
<mattam> Smerdyakov: I never had this problem, maybe you found a bug...
<Smerdyakov> mattam, OK
<gl> mail abuse@lri.fr
<mattam> :)
<pattern> <jemfinch|lambda> pattern: O'Caml *is* the ugliest of the statically typed FPLs, and that's based on such considerations as its lack of a quality standard library, its lack of type safety, its object system, and yes, its syntax.
<det> lack of type safety!?
<pattern> :(
<det> Obj.magic ?
<pattern> he did mention that before
<pattern> this is on #python
<pattern> <jemfinch|lambda> teratorn: O'Caml is highly dependent on a polymorphic compare, which isn't typesafe.
<Riastradh> What does he mean 'it isn't type-safe?' Magic (the generic term, not Obj.magic) isn't necessarily unsafe.
<pattern> <jemfinch|lambda> # compare (fun x -> x) (fun y -> y);;
<pattern> <jemfinch|lambda> Exception: Invalid_argument "equal: functional value".
<pattern> <jemfinch|lambda> pattern: People use O'Caml because it's *statically* typesafe.
<pattern> <jemfinch|lambda> pattern: compare *breaks* that expectation.
<Riastradh> I bet the garbage collector isn't type safe with what manipulation it does -- hey, the heap is _totally_ polymorphic, but the garbage collector gets to operate on its contents --.
<pattern> but please come to #python
<Riastradh> No, I don't care enough, and I'm too busy writing a macro expander.
<pattern> i don't want to have to paste the entire conversation here ;)
<ChoJin> he's true in at least one point: the ocaml syntax is not very nice
<pattern> i like it
<pattern> didn't use to when i started
<pattern> but it's grown on me
<ChoJin> :)
Hipo has quit ["leaving"]
<mattam> everyone likes it after a while
<Riastradh> Oh?
<mattam> no ?
<jesse_> ive gotten used to the syntax, now to get used to the language its self
<pattern> ristradh, prefers lisp, don't you ria?
<Smerdyakov> pattern, just come to #hprog. :)
<mattam> i've heard that happened several times.
<Riastradh> I do and I consider syntax a problem that was solved decades ago that people still insist on inflicting upon themselves.
<mattam> Riastradh: what's the solution ?
<Riastradh> S-expressions.
<mattam> ...
<mattam> well, i do not consider evacuating the problem a solution
<Riastradh> Eliminating the cause of the problem, i.e. having too much syntax, is not a good solution?
<mattam> basically it means, no need for a complex grammar, just write your syntax tree yourself so program analysis will be direct.
<mattam> Riastradh: if it means giving work to the programmer that a machine could do, it's not.
<Riastradh> More work?
<mattam> yes, at least in my experience, writting s-exprs never was a pleasure.
<mattam> i prefer indentation
<Riastradh> ...says he who had not ten minutes prior proclaimed that 'everyone likes it [OCaml's syntax] syntax after a while.'
<Riastradh> er, s/syntax after/after/1
<mattam> am i inconsistent somehow ?
* Smerdyakov keeps smashing his fists against Coq, but nothing will avail. Damn you, bastard program.
<mattam> i lowered my claim in the second sentence, saying:
<mattam> 'i've heard that happened several times.'
<Riastradh> How much code in S-expressions have you written?
<mattam> i don't know, some 3000 lines at most.
<Riastradh> How about in OCaml?
<mattam> much more :)
<Riastradh> Zigackly. So OCaml's syntax has had a _lot_ more time to 'grow on you.'
<mattam> sure
<pattern> i don't think i've written even 3000 lines of ocaml
<pattern> and i like the syntax
<pattern> but i only know a tiny bit of scheme
<pattern> i know a bunch of non-oo imperative languages, though, and i prefer ocaml's syntax over all of them
ski has joined #ocaml
ski has left #ocaml []
<ChoJin> I prefer haskell syntax :)
<pattern> i've heard good things about haskell
<pattern> but monads scare me
<ChoJin> the problem with haskell from my point of view, is this is too pure for me :)
<pattern> and i need highly optimal code for my project
<ChoJin> and too slow
<ChoJin> but I love "deriving" keyword from haskell
<pattern> what's that?
<ChoJin> and function overloading
<mattam> type classes again...
<ChoJin> for instance
<ChoJin> you define a type
<ChoJin> let's say a tree
<ChoJin> and you say "deriving Show"
<ChoJin> and now you can call print, on all value of this type
<ChoJin> it will print it as an haskell code
<ChoJin> like a basic pretty printer
<ChoJin> very useful to debug your code
<ChoJin> when you are too lazy to write your own pretty printer, because you just began something
<pattern> cool
<mattam> it is similar to Java's interfaces to give you an idea
<pattern> i don't know oop or any oo language, (un)fortunately
<ChoJin> ok, stupid question now, I use ocamlmakefile, I have a file "canonical.ml", I created a toplevel, but it doesn't like my "open Canonical" in the toplevel, although it works perfectly with the compiler
<pattern> but i hear java interfaces are like module signatures
<ChoJin> (dunno if I am clear)
<ChoJin> # open Canonical;;
<ChoJin> Unbound module Canonical
<ChoJin> (I wanted to use the toplevel as a pretty printer to debug some stuffs)
<pattern> did you #use "canonical.ml"?
<ChoJin> no :)
<ChoJin> thx ;)
<pattern> just a guess
<pattern> i'm a beginner, so take my advice w/a grain of salt ;)
buggs^z has joined #ocaml
<jesse_> what does use do?
<ChoJin> but that's wierd, it executed my "main"
<ChoJin> so why this file is not loaded by default ?
<pattern> which file?
<pattern> exactly how are you using the top level?
<ChoJin> canonical.ml :)
<ChoJin> ok, I have two files
<ChoJin> main.ml and canonical.ml
<ChoJin> to debug I created a toplevel with make top
<ChoJin> when I run the toplevel, of course it executes the code and then stop
<ChoJin> now I want to play a little bit with the toplevel, why canonical.ml is not loaded since all the code has been executed when I started the toplevel
<pattern> i've never used make top
<pattern> i just use the top level by executing "ocaml"
<pattern> and then #use "mysource.ml"
<pattern> just a guess, but perhaps normally you link canonical.ml, but when you make top it doesn't get linked
<pattern> i don't know anything about make top, though
<mattam> you can pass .cmo's and .cma's to your top level executable
<ChoJin> how can I have a toplevel executable which load every file of my project by default ?
<ChoJin> (I know, I'm a lazy guy, that's why I am using ocaml, faster to write working code ;) )
<mattam> i don't know, i rarely test more than one module at once :)
jesse_ has left #ocaml []
skew has joined #ocaml
<gl> ocamlmktop -custom -o footoplvl `ls *.cma *.cmo` -cclib <path/to/your/lib> -cclib -l<lib>
<gl> something like that
<gl> er. -L</path/to/your/lib>
<skew> I was wondering if I could write a function with a type like < .. > -> <x : int; ..>.
<Smerdyakov> I don't think you can, if you mean .. to be a variable of some sort.
<skew> I've been looking through the reference, but I can't see how to do that
<skew> Smerdyakov: yeah, I want to take arbitrary objects and modify them
<Smerdyakov> The layout of object types is too static to make it possible to know how to add a new field with a given name to any object, I think.
<skew> Smerdyakov: Ok. I was thinking about typing Python, or at least Python code
<Smerdyakov> That is a different world. :
<skew> Smerdyakov: And O'Caml is the only language I could think of with nice static types and objects.
<Smerdyakov> :)
ski has joined #ocaml
<ChoJin> "The trouble with doing something right the first time is that nobodyappreciates how difficult it was." -- Walt West
<ChoJin> :)
<ski> One must use self-type to make a (recursive) class extensible at "all levels". yes ?
buggs has quit [Connection timed out]
housetier has quit ["#breaks @ irc.highteq.de"]
<Smerdyakov> Beats me.
<ski> dang ! :)
<ChoJin> how can I create a 3-d array ?
<ChoJin> int array array array
<Smerdyakov> You did it. ;)
<Smerdyakov> Or use int array and calculate subscripts yourself.
<gl> Array.create i (Array.create j (Array.create k)) ? :)
<gl> (add an argument to the last 'create')
<ChoJin> gl: will it share elements ?
<ChoJin> it shares elements :(
<Smerdyakov> ChoJin, do you not know how to create an int array array array that doesn't share elements?
<ChoJin> that's my problem, yes :)
<Smerdyakov> Try Array.init instead of Array.make.
skew has left #ocaml []
<ChoJin> let a = Array.init 3 (fun i -> Array.create_matrix 3 3 0);;
<ChoJin> k it worked
<ChoJin> thx
wazze has quit ["Learning about how the end letters on French words are just becoming more and more silent, I conclude that one day the French]
Swynndla has joined #ocaml
lame has joined #ocaml
lame has left #ocaml []
ski has quit ["ircII EPIC4-1.0.1 -- Are we there yet?"]
__DL__ has joined #ocaml
__DL__ has quit [Client Quit]
Nutssh has joined #ocaml
jdmarshall has joined #ocaml
Kinners has joined #ocaml
Kinners has quit [Read error: 113 (No route to host)]
Demitar has joined #ocaml
ChoJin has quit ["Client exiting"]
phubuh has joined #ocaml
karryall has joined #ocaml
phj has joined #ocaml
rox has quit [calvino.freenode.net irc.freenode.net]
rox has joined #ocaml
Swynndla has quit ["Leaving"]
phj has quit [Read error: 104 (Connection reset by peer)]
Nutssh has quit ["Client exiting"]
_JusSx_ has joined #ocaml
housetier has joined #ocaml
tomasso has quit [Read error: 104 (Connection reset by peer)]
tomasso has joined #ocaml
The-Fixer has quit ["Goodbye"]
wazze has joined #ocaml
The-Fixer has joined #ocaml
_JusSx__ has joined #ocaml
_JusSx_ has quit [Read error: 110 (Connection timed out)]
_JusSx__ has quit [calvino.freenode.net irc.freenode.net]
voltron has quit [calvino.freenode.net irc.freenode.net]
mellum has quit [calvino.freenode.net irc.freenode.net]
Hadaka has quit [calvino.freenode.net irc.freenode.net]
shawn has quit [calvino.freenode.net irc.freenode.net]
The-Fixer has quit [calvino.freenode.net irc.freenode.net]
gl has quit [calvino.freenode.net irc.freenode.net]
smkl has quit [calvino.freenode.net irc.freenode.net]
rox has quit [calvino.freenode.net irc.freenode.net]
tomasso has quit [calvino.freenode.net irc.freenode.net]
Etaoin has quit [calvino.freenode.net irc.freenode.net]
cjohnson has quit [calvino.freenode.net irc.freenode.net]
skylan has quit [calvino.freenode.net irc.freenode.net]
Riastradh has quit [calvino.freenode.net irc.freenode.net]
Banana has quit [calvino.freenode.net irc.freenode.net]
phubuh has quit [calvino.freenode.net irc.freenode.net]
cmeme has quit [calvino.freenode.net irc.freenode.net]
TheDracle has quit [calvino.freenode.net irc.freenode.net]
housetier has quit [calvino.freenode.net irc.freenode.net]
jdmarshall has quit [calvino.freenode.net irc.freenode.net]
Maddas has quit [calvino.freenode.net irc.freenode.net]
srv has quit [calvino.freenode.net irc.freenode.net]
whee has quit [calvino.freenode.net irc.freenode.net]
Smerdyakov has quit [calvino.freenode.net irc.freenode.net]
wazze has quit [calvino.freenode.net irc.freenode.net]
buggs^z has quit [calvino.freenode.net irc.freenode.net]
mattam has quit [calvino.freenode.net irc.freenode.net]
themus has quit [calvino.freenode.net irc.freenode.net]
Vjaz has quit [calvino.freenode.net irc.freenode.net]
ejt has quit [calvino.freenode.net irc.freenode.net]
pattern has quit [calvino.freenode.net irc.freenode.net]
lam has quit [calvino.freenode.net irc.freenode.net]
anpanman has quit [calvino.freenode.net irc.freenode.net]
Defcon7 has quit [calvino.freenode.net irc.freenode.net]
_JusSx__ has joined #ocaml
The-Fixer has joined #ocaml
wazze has joined #ocaml
tomasso has joined #ocaml
housetier has joined #ocaml
rox has joined #ocaml
phubuh has joined #ocaml
jdmarshall has joined #ocaml
buggs^z has joined #ocaml
mattam has joined #ocaml
Etaoin has joined #ocaml
pattern has joined #ocaml
cjohnson has joined #ocaml
gl has joined #ocaml
lam has joined #ocaml
skylan has joined #ocaml
smkl has joined #ocaml
cmeme has joined #ocaml
anpanman has joined #ocaml
Riastradh has joined #ocaml
Banana has joined #ocaml
Hadaka has joined #ocaml
themus has joined #ocaml
Vjaz has joined #ocaml
TheDracle has joined #ocaml
ejt has joined #ocaml
shawn has joined #ocaml
Maddas has joined #ocaml
srv has joined #ocaml
whee has joined #ocaml
Smerdyakov has joined #ocaml
voltron has joined #ocaml
mellum has joined #ocaml
Defcon7 has joined #ocaml
jdmarshall has quit [Remote closed the connection]
housetier has quit [Read error: 110 (Connection timed out)]
Nutssh has joined #ocaml
housetier has joined #ocaml
CoolPops has joined #ocaml
Nutssh has quit ["Client exiting"]
karryall has quit ["home"]
bernard has joined #ocaml
<bernard> hi
<bernard> is it possible to write a program mixing C and caml ?
<Smerdyakov> Yes
<CoolPops> bernard: you can have your caml call C code or C code call caml.
<Smerdyakov> And the OCaml manual should tell you how.
<bernard> nice
<bernard> what's the best way to do it ?
<Smerdyakov> The best way to read the manual?
<bernard> I'd like to write a program with a friend, he knows caml and I know C
<mellum> bernard: Either do it manually, or use an interface generator like swig
<Smerdyakov> You shouldn't mix languages just ebcause one or both of you is too lazy to learn another language.
<Smerdyakov> Do you have a valid reason for wanting some OCaml code and some C code?
<mellum> But yeah, it's a lot of trouble. Just write the whole thing in Ocaml :)
<bernard> my friend would write the AI and I would write the GUI
<bernard> for a cards game
<Riastradh> So...why not write it all in OCaml?
<bernard> because he's not interested at all in writing GUIs and I don't know caml
<bernard> I guess learning ocaml is not trivial
<Riastradh> It may not be trivial but that doesn't make it not worth it.
<Demitar> Riastradh, not too many non-negations in that sentence. =)
<bernard> http://merjis.com/richj/computers/ocaml/tutorial/ch12/ : there is gtk/ocaml stuff, interesting
<Smerdyakov> bernard, that is a ridiculous way to do things. It only adds unnecessary complications.
<Riastradh> OK: it may not be trivial but it _is_ worth it.
<Smerdyakov> bernard, of course. OCaml is superior to C in every way that matters for application development.
<bernard> Smerdyakov: I've never programmed in ocaml
<Smerdyakov> bernard, I guessed that.
<bernard> Smerdyakov: do you think learning ocaml is easier than learning C ?
<ejt> does someone have time to help me with a bit of syntax please ?
<Smerdyakov> bernard, yes. Much easier.
<Smerdyakov> bernard, however, learning OCaml after you have hard-wired your brain to consider that all programming is like programming C could be very hard.
<bernard> Smerdyakov: I also program in PERL, so I don't consider than managing the memory in a low level is something mandatory to be a good language, if it's what you mean ;)
<Smerdyakov> Nah. Programming Perl and programming C are almost the same process.
<Smerdyakov> OCaml is much different.
<bernard> the tutorial in the topic is said to be "for C programmers"
<bernard> maybe I'll read it
<bernard> the fact that there exists a gtk lib for ocaml is a good argument that I haven't expected
<CoolPops> How do I make a function that will take multiple types: let multiple a b = a * b;; = int only, no floats aloud... how can I make it work for both?
<Riastradh> type int_or_float = Int of int | Float of float; val f : int_or_float -> int_or_float -> int_or_float
<Riastradh> s/val f/val multiple/1
<CoolPops> Riastradh: hm. that's a bit more than Haskell. Why do they do that?
<Riastradh> No typeclasses.
<CoolPops> et mul (a:int_or_float) (b:int_or_float) = a * b;; -> This expression has type int_or_float but is here used with type int
Smerdyakov has quit [Read error: 110 (Connection timed out)]
Smerdyakov has joined #ocaml
<CoolPops> s/et/let
<Smerdyakov> Gosh. Did I miss anything interesting?
<whee> * is still of type int -> int -> int, so you'd have to get the int out of the int_or_float type
<CoolPops> whee: you can't multiply floats?
<whee> with the *. function
<CoolPops> whee: hm. monads or * and *. :)
<Smerdyakov> Monads?!
_JusSx__ has quit ["Killed by BillGates (Windows Linux 98 -- jizz your pants!)"]
<whee> there's probably a way to get camlp4 to generate things to treat ints and floats equally to the programmer, but eeh
<gl> let mul = function (Int x, Int y) -> Int(x*y) | (Float i, Float j) -> Float(i*.j) | _ -> failwith "foobar!";;
<gl> (coolops)
<gl> A simple way to achieve what I guess you want
<CoolPops> I'm trying to learn a functional lang and have been learning a bit about Haskell and a bit about Ocaml ... also have played with Erlang for a bit.
<CoolPops> not certian which one I want to go full bore with and really learn in depth.
<whee> CoolPops: haskell is a bit more advanced with the type system and all, as well as with the included libraries (with ghc, anyway)
<whee> I have more fun with haskell when wanting to do neat things; erlang's great for other applications though
<Smerdyakov> CoolPops, why did you mention monads?
<gl> (you could replace "_ -> failwith ..." by other cases: "(Float x, Int y) -> Float(x*. (float_of_int y)) | ..."
<mellum> or you could stop insisting on writing such a silly function
<gl> :/
<Banana> either way overloading + polymorphism + type inference don't get along very well.
<CoolPops> Smerdyakov: I'm frustrated with them so I decided to stop playing with Haskell for a bit and play with Ocaml for a bit. Was comparing two things that I thought wasn't very nice in each lang.
<CoolPops> I like the fact that Ocaml will produce bytecode or binary code.
<Smerdyakov> CoolPops, pshaw. Monads are a stellar way to do stateful stuff in a pure functional setting.
<whee> monads are definitely more fun; I've rewritten old perl programs of mine using haskell and monads, and it ended up being shorter and cleaner :P
<CoolPops> Smerdyakov: in Haskell, I am at a brick wall that others think is easy but I havn't been able to deal with it. I read a file, now I want to take a simple IO String and use it in other places that accept a String...
<whee> CoolPops: have you read http://www.nomaware.com/monads/html/index.html ?
<Smerdyakov> CoolPops, you have to do it inside the monad.
<Smerdyakov> CoolPops, obviously you can't be allowed a function of type IO String -> String, or now you're back in the impure functional world and this can pollute all your code.
<CoolPops> whee: no I have been reading the tutorials. A Gentle Introduction, Yet Another Haskell Tutorial....
<CoolPops> Smerdyakov: so my whole app has to be in a monad?
<Smerdyakov> CoolPops, the parts that do imperative stuff have to be in the IO monad, yes.
<Smerdyakov> CoolPops, and anything that looks functional but calls functions that do imperative stuff must be imperative itself.
<CoolPops> Smerdyakov: what my app does is read's a comma delimited file, then parses that file, then runs through and creates a new file that is source code to interact with fixed width files, according to the input files definition.
<Smerdyakov> CoolPops, so you should write a function that parses the contents of a file to create the contents of a new file.
<Smerdyakov> CoolPops, these can be pure functional.
<Smerdyakov> CoolPops, then you write a thin IO wrapper around these in main that does the IO and calls your function in the middle of the process.
<CoolPops> Smerdyakov: yes, but how do I read the file? That has to be inside a do, which now gives me all IO String's.
<Smerdyakov> Get a version that gives you something like IO [String], e.g., the whole contents of the file.
<Smerdyakov> Inside the do, you can use the value like a [String] in passing it to a function that returns IO something.
<Smerdyakov> Using the "var <- function arg" notation.
* Etaoin is amazed how much #haskell and #ocaml talk about the other language while sticking in some comments about python as well
<ejt> how do I scope a record member ?
<ejt> eg. I have a function that takes a Unix.stats struct
<CoolPops> Etaoin: yes, this discussion should be on #haskell, sorry.
<ejt> and I want to dereference the st_size field
<Smerdyakov> CoolPops, do something like do { contents <- readTheFile ; newContents <- return (transformContents contents) ; output newContents }
<Smerdyakov> (All function names but return there are imaginary.)
<CoolPops> I do a lot of database programming, text processing and web based programming. Which would you spend your time learning? Ocaml or Haskell?
<Smerdyakov> Ocaml
<CoolPops> Smerdyakov: because?
<Smerdyakov> Imperative stuff is useful.
Demitar_ has joined #ocaml
_JusSx_ has joined #ocaml
Nutssh has joined #ocaml
<CoolPops> Smerdyakov: part of functional programming that was exciting to me was that with no side effects there is less chance of bugs. Seems that by introducing imperative features you cause side effects, thus taking away a major benefit of functional programming?
Demitar_ has quit [Read error: 104 (Connection reset by peer)]
<Riastradh> You need side effects at some level.
<Riastradh> Would you want to infect all of your code just to get, say, a random number?
<Riastradh> ...infect it all with the IO monad, that is.
<Riastradh> Or to print a debug message?
<CoolPops> It seems to me that Haskell is more popular, but OCaml has more libraries for it?
<Banana> CoolPops: what do you mean by more popular ? more people talk about it or more apps are developped with it ?
<CoolPops> Banana: hum. good point.
<Banana> i'm not very familiar with Haskell though.
<Banana> from what you said, many of your work express easily as side effects (text manipulation, db access, network).
<CoolPops> Banana: yes it does.
<Banana> turning them forcefully in a functionnal flavour would be a huge work.
<Banana> (and you might lose efficiency).
<Banana> ocaml grants you safety with its static typechecking and the generated code is really efficient.
<Maddas> Haskell has the safety, too.
<CoolPops> Banana: but one thing that made me want to learn functional programming is that the Haskell Tutorial says work can be cut dramatically, and bugs will decerease dramatically as well... and the one area they attributed that to was lack of side effects, or at least "controlled side effects" .. monads.
<Maddas> CoolPops: You'll probably get different answers depending on who you ask. I recommend trying both :-)
<Banana> CoolPops: if you come from java or perl or C then just switching to Ocaml would reduce code size/debugging time.
<Banana> ocaml is also a functionnal programming language, but it gives you imperative features (and objects) if you want to use them.
<Banana> I'm not telling you not to try Haskell. I just talk about the language I no better.
<Maddas> CoolPops: obviously asking in #ocaml about whether Haskell is better than OCaml isn't really going to give unbiased answers (which don't exist anyway), just like asking in #haskell whether OCaml is better.
<CoolPops> Banana: well, I've been learning Haskell for about 1 week but with my background, C/Python/PHP it would take me a few months to be comfortable with it and understand the basics. I was hoping to be able to run through a tutorial or two of Haskell and OCaml and decide which one I want to spend a few months using and learning but the more I learn about them the more I think that is not possible.
<CoolPops> Maddas: I was not asking which was better, I am sure they both have strengths and weaknesses.
<Maddas> Yes :)
<TheDracle> Try both :P
<CoolPops> TheDracle: I am.
<TheDracle> You're not going to get a good feel for which you prefer until you actually use both of them.
<Maddas> Yeah.
<CoolPops> Today I printed the book by O'Reilly, "Developing Applications with Objective Caml" ... I am beginning to work my way through it.
<TheDracle> OCaml has a shitty object structure, but other than that, it's a first class functional language :P
* CoolPops is on pg. 29
<TheDracle> Heh, I suppose that works for you.
<Maddas> You might miss the more interesting parts of a language if you only compare them on a basic level.
<TheDracle> I personaly can't go through programming books.
<TheDracle> I preffer to set a goal on producing a project of some type in that language, and then use bits and pieces of books to understand that language.
<TheDracle> Mostly because I probably have a severe case of ADD, I'm not sure :P
<Maddas> Understanding something doesn't mean that you can use it effectively :-)
<CoolPops> Maddas: yes, that's the conclusion I came to. I think because it looks like OCaml has recent support for Mysql, I'll spend a month or two with it and then maybe venture towards Haskell to give it a try. Maybe then Haskell will not be *so* foreign to me.
<TheDracle> Yeah, I've overlooked languages just based on the rhetoric behind them, only to find out later how amazingly simple some problems become in their syntax, even though they didn't have all of the fancy constructs. C++ for instance is a politicians dream! It has SO much bloated functionality, so many different programming paradigms, and it's shit.
<TheDracle> Everything has support for MySQL.
<CoolPops> TheDracle: the Haskell lib has'nt been updated since early 2002 and the author said it's in a complete rewrite, with no dates to completion.
<TheDracle> I don't believe putting all of this functionality in the standard API is always the best choice :P
<TheDracle> Java for example, lol.
<TheDracle> Which, I think is a decent language, but if its API continues to expand at the rate that it is currently..
<TheDracle> Besides, Perl is perfectly adept at being a database/cgi programming language.
<TheDracle> I'm not sure how often OCaml is used for cgi.
<Nutssh> Toss it in. Its the java libraries that make java used.
Nutssh has quit ["Client exiting"]
<TheDracle> Hm, I'm not so certain of that :P
<TheDracle> C++ has very few libraries, and it's also widely used.
<Maddas> He left.
<housetier> !start a programming language war
<mellum> C sucks. We should all be using Ada.
<Maddas> INTERCAL!!!~~
<housetier> ADA sucks
<housetier> ABAP4 is the way baby
<Maddas> Java2k baby.
<housetier> brainfuck honey
<Banana> Gentlemen, please.
<Demitar> As long as noone starts using OCaml.
<Demitar> Well then, how about a bf vs unlambda language war? :)
<Riastradh> All you need is X.
<housetier> still, my favorite is "whitespace"
<Riastradh> ...OK, you need X, (, and ).
<housetier> I never mastered c++ though
<Demitar> Kind of funny in retrospect. How I all of the sudden evolved a shell script into an ocaml program. Hints that I'm getting used to it. :)
karryall has joined #ocaml
CoolPops has quit ["thanks for the help today."]
_JusSx_ has quit ["BitchX: no this is NOT a cybersex client"]
_JusSx_ has joined #ocaml
buggs^z is now known as buggs
Nutssh has joined #ocaml
Nutssh has quit [Read error: 104 (Connection reset by peer)]
Nutssh has joined #ocaml
slashvar has joined #ocaml
<slashvar> Good evening
<karryall> hi
_JusSx_ has quit ["BitchX: it keeps going and going and going and going and..."]
Axioplase has joined #ocaml
<Axioplase> Hi!
<Axioplase> I think i need some help :)
<Axioplase> at the university, we wrote a function for an exercise. And now i have to use it, i do think i don't understand it, neithre how to use it :/
easy has joined #ocaml
easy has left #ocaml []
Nutssh has quit ["Client exiting"]
<karryall> Axioplase: sure, show the code
<Axioplase> let rec until f p x = if (p f) then x else f p (f x);;
<Axioplase> it is supposed to return the function so that until f p x= f^n(x), where n is the smallest integer so that p(f^n(x)) is true
<Axioplase> if that is what it does, I'm stuck on how to use it :/
<karryall> ben, rien de spécial c'est comme toutes les fonctions, y'a qu'a passer les arguments
<karryall> quelle université au fait ?
<Axioplase> Paris6 Jussieu
<karryall> arf
<Axioplase> ben le probleme, c est que je vois pas comment (p f) peut etre vrai... il me faut des arguments à f pour ca, non?
<karryall> t'es dans quel cycle ?
<Axioplase> Mias 2eme année. 2eme cours de caml
<karryall> en fait je pense que ca devrait etre (p x)
<Axioplase> haa :)
<TheDracle> .. Weird.
<karryall> et ca devrait etre else until f p (f x)
<karryall> si y'a pas de recursion, c'est pas tres utile
<Axioplase> a oui, j ai oublié de recopier le until là.
<Axioplase> (a pas de souris. recopie tout à la main pour eviter les exec -o + grep)
<karryall> bon, c'est plus clair avec (p x) ?
<Axioplase> oui oui. mais je reviens des que j ai un autre pb :)
<karryall> je croyais qu'on faisait plus de caml à P6 en 1er cycle
<karryall> c'est bien ...
Nutssh has joined #ocaml
<Axioplase> certes, mais le VBA rabaisse pas mal selon moi :/
<Axioplase> ok, i have my caml script, but it doesn't show any output. How can I have it print everything, as if I coded in the ocaml prompt ?
<karryall> urgl, quelle horreur
<Axioplase> (ie, i want "foo n;;" to print the result of foo(n) )
<Axioplase> ben, mon prog n affiche rien, je sais pas si il fait les bons calculs :)
<karryall> ben utilise le toplevel
<Demitar> Axioplase, how about "cat foo.ml|ocaml"? :)
<Axioplase> Demitar nice one :)
<slashvar> I don't clearly understand your problem, you want some output in you script, or you want to have the same output as the toplevel ?
<karryall> better: ocaml foo.ml
<Axioplase> karryall no. ocaml foo.ml doesn t print anything but errors when there are some.
<Axioplase> err. wait in fact, my script doesn t work anymore :)
<Axioplase> arg! stack overflow :)
<karryall> ah oui tiens
<karryall> ocaml < foo.ml alors
<Axioplase> de toute facon, je bloque sur mon prog là..
<Smerdyakov> English is better!
<Axioplase> a partirde la fonction until (je suppose), ilfautcalculer exp(x) a epsilon pres.
<Axioplase> sorry Smerdyakov
<Riastradh> Votre mère était un hamster et votre père a senti des baies du sureau, Smerdyakov, vous navét défilé!
<Axioplase> afaik, using the until function described above, i must calculate exp(x) with an error of epsilon. i know that i have let rec exp_approx x epsilon= *some code i m fighting with*;;
<karryall> hum
<Axioplase> be sure that I am thinking and writing at the same time, I am not having you doing it for me :)
<karryall> j'espere bien !
<Demitar> Smerdyakov, this way we can pretend they're discussing immensely interesting things. :)
slashvar has quit ["............"]
<Axioplase> let rec until f p x epsilon = if (p x) then x else x+ until f p (f x epsilon);;
<Axioplase> this is my new until
<Axioplase> let expo x epsilon = until expo (if x<epsilon then true else false) x epsilon;;
<Axioplase> and my new func. though it doesn't work (type a->b with int)
<karryall> oui mais non
<karryall> I think you shouldn't modify until
<Axioplase> err.. i don t use the exp(x)= sum (x^n/n!) :/
<Axioplase> k
<karryall> ben oui, ca rique pas de marcher !
<Axioplase> but i don't know where and how to use it, since i must give my "n" somewhere...
<karryall> x doesn't have to be float
<karryall> ... it could be a tuple for instance
<Axioplase> what about exp(1.2) then ?