mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.0 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
Smerdyakov has joined #ocaml
Submarine has quit [Read error: 110 (Connection timed out)]
yminsky has joined #ocaml
Cygal` is now known as Cygal
seafoodX has joined #ocaml
rhz has joined #ocaml
<rhz> do functions always have to be declared in the same order in which they get called in ocaml?
<Smerdyakov> I don't understand the question.
<rhz> i mean say function f calls function g. Does function g need be be defined earlier than f?
slipstream-- has quit [Connection reset by peer]
<rhz> by earlier i mean higher up in the source code file
<Mr_Awesome> yes
<Smerdyakov> You might achieve Zen-like enlightenment by reading about mutually-recursive definitions.
<Mr_Awesome> (unless theyre mutually recursive)
<rhz> probably
<Smerdyakov> But don't expect to find a way to simulate that willy-nillyness that, for instance, C allows.
<rhz> or haskell
<Mr_Awesome> what willy-nillyness, in particular?
<Mr_Awesome> i much prefer haskell's way of handling this issue
yminsky has quit []
<Smerdyakov> Haskell's particular rules are very dependent on lazyness for their reasonableness.
seafoodX has quit []
slipstream-- has joined #ocaml
<abez> Maximum Willyness can be achieved via the Marshal module
<Smerdyakov> I feel fine considering Marshal not to be part of OCaml. :-)
<rhz> come to think of it, i suppose if one makes all the functions in an ocaml source file mutually recursive then you get williynilliyness like haskell
<rhz> but clearly this is not intended
<abez> rhz: you could just put them in a module with a signature, or you could let the function names be references to functions
<rhz> ah ok. I'm an ocaml beginner. don't know that much about modules
Cygal has quit [Remote closed the connection]
seafoodX has joined #ocaml
netx has quit ["Leaving"]
yminsky has joined #ocaml
yminsky has quit []
jos has joined #ocaml
david_koontz has quit ["Leaving"]
<jos> Hi. Anybody have experience with rocaml? I'm trying to export some Ocaml functions to Ruby and am running into linking problems
<jos> Specifically, I can't seem to fix this one: undefined symbol: caml_tuplify2
<jos> It looks like it is part of the compiler; it doesn't appear in any of the .a's
netx has joined #ocaml
<seafoodX> Anyone here ever used the Format library of OCaml?
<jos> Not me, I'm a Ruby guy
visage has joined #ocaml
shawn has joined #ocaml
visage has quit []
Archville has quit ["Artificial Intelligence is no match for Natural Stupidity."]
jos has quit ["leaving"]
shawn has quit ["This computer has gone to sleep"]
<rhz> whats the simplest way to convert between (char list) and string?
shawn has joined #ocaml
<seafoodX> rhz: You probably want to write a custom function for it.
kosmikus has quit [Read error: 104 (Connection reset by peer)]
kosmikus has joined #ocaml
leo037 has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
<tsuyoshi> extlib has a function for that, I think...
<tsuyoshi> yeah
<tsuyoshi> val explode : string -> char list
<tsuyoshi> explode s returns the list of characters in the string s.
<tsuyoshi> val implode : char list -> string
<tsuyoshi> implode cs returns a string resulting from concatenating the characters in the list cs.
<tsuyoshi> (from ExtString.String)
shawn has quit ["This computer has gone to sleep"]
<seafoodX> tsuyoshi: Who wrote extlib?
shawn has joined #ocaml
<tsuyoshi> uh.. I think it was three different people
<tsuyoshi> Nicolas Cannasse (ncannasse@motion-twin.com)
<tsuyoshi> Brian Hurt (brian.hurt@qlogic.com)
<tsuyoshi> Yamagata Yoriyuki (yori@users.sourceforge.net)
love-pingoo has joined #ocaml
kelaouchi has quit ["leaving"]
flux-_ is now known as flux
kelaouchi has joined #ocaml
Cygal has joined #ocaml
oracle1 has quit [anthony.freenode.net irc.freenode.net]
love-pingoo has quit [anthony.freenode.net irc.freenode.net]
Demitar has quit [Read error: 110 (Connection timed out)]
love-pingoo has joined #ocaml
oracle1 has joined #ocaml
seafoodX has quit []
love-pingoo has quit ["Connection reset by pear"]
fmardini has joined #ocaml
m3ga has joined #ocaml
_blackdog has joined #ocaml
seafoodX has joined #ocaml
love-pingoo has joined #ocaml
Mr_Awesome has quit ["time to impregnate a moth"]
love-pingoo has quit [Remote closed the connection]
fmardini has quit []
_blackdog has left #ocaml []
fmardini has joined #ocaml
rhz has quit ["Leaving"]
slipstream-- has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
seafoodX has quit [Remote closed the connection]
seafoodX has joined #ocaml
fmardini has quit []
fmardini has joined #ocaml
Sparkles has joined #ocaml
Sparkles has quit [Client Quit]
Sparkles has joined #ocaml
Sparkles has quit [Client Quit]
Sparkles has joined #ocaml
Sparkles has quit [Client Quit]
fmardini has quit []
Sparkles has joined #ocaml
love-pingoo has joined #ocaml
Cygal has quit [Read error: 104 (Connection reset by peer)]
Cygal has joined #ocaml
b00t has joined #ocaml
Demitar has joined #ocaml
romanoff1 has joined #ocaml
fmardini has joined #ocaml
harlos has joined #ocaml
b00t has quit [Remote closed the connection]
Smerdyakov has quit [Read error: 110 (Connection timed out)]
pango has quit [Remote closed the connection]
fmardini has quit []
pango has joined #ocaml
romanoff1 has quit [Remote closed the connection]
Cygal has quit [Remote closed the connection]
Cygal has joined #ocaml
bluestorm has joined #ocaml
seafoodX has quit []
shawn has quit ["This computer has gone to sleep"]
leo037 has quit ["Leaving"]
harlos has quit [Connection reset by peer]
harlos has joined #ocaml
Smerdyakov has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
Icebreaker has quit []
<mnemonic> hi people :)
<mnemonic> I will leave this channel because I no longer program in OCaml
<mnemonic> I changed to Erlang
<mnemonic> :)
mnemonic has left #ocaml []
<flux> naah, I don't program in haskell, yet I irc(/idle) on the channel ;) - perhaps I should consider #erlang also, the language is interesting..
<abez> Well it shares something ocaml, a tiny standard lib.
<flux> I haven't looked, but I'd expect it to be better - ocaml standard library isn't that great, IMHO
<flux> but fortunately there are loads of third party libraries, and they are easy to use, with ocamlfind
leo037 has joined #ocaml
<abez> chicken scheme is a very popular scheme right now mainly because they have a lot of libs available for it, and they are easy to install. They have a CPAN like repository.
<abez> OCaml seems to be coming along
<abez> but I'm unaware of a CPAN like repo for OCaml
<flux> true. I simply use debian/ubuntu repos, which are quite versatile..
<flux> but that obviously doesn't work for everyone
<abez> ubuntu and ocaml is pretty nice
Cygal has quit [Remote closed the connection]
Cygal has joined #ocaml
slipstream-- has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
_blackdog has joined #ocaml
_blackdog has left #ocaml []
Cygal has quit [Connection timed out]
Cygal has joined #ocaml
rwmjones has quit ["Closed connection"]
shawn has joined #ocaml
rwmjones has joined #ocaml
Submarine has joined #ocaml
Cygal has quit [Connection timed out]
david_koontz has joined #ocaml
shawn has quit ["This computer has gone to sleep"]
shawn has joined #ocaml
Smerdyakov has quit [Remote closed the connection]
Smerdyakov has joined #ocaml
shawn has quit [Read error: 110 (Connection timed out)]
piggybox has joined #ocaml
piggybox_ has quit [Read error: 110 (Connection timed out)]
<gaja> Hey all. I have a function that I am trying to convert from lisp but I get a type related problem. I'd like to know what it is all about. http://ocaml.pastebin.com/m3a6545ef
<Smerdyakov> I bet you'll see the problem if you read the manual's description of 'function
<Smerdyakov> Also, if you find the error message mystifying, it's worth pasting it here so that we can help you learn to interpret such messages.
<gaja> Ok, trying to find the part about 'functions right now. Here's the error message. "This expression has type int -> 'a list but is here used with type 'a list".
<Smerdyakov> The "'function" in my previous line was because of the infamous QWERTY problem of the apostrophe being too close to "enter."
<Smerdyakov> I just meant to single-quote a keyword like so: 'function'
<Smerdyakov> Now, do you understand what the error message means?
shawn has joined #ocaml
<gaja> Ahh... Well no. I'm reading about higher order functions right now and thought that you wouldn't need to do anything special to pass it around like you would in lisp. The error boggles me though.
<Smerdyakov> Do you understand that it's telling you that a certain expression must have one type but actually has another?
<gaja> Yeah, that part is clear. I have assumed that I need to specify which type generate_list has but am a bit unsure.
<Smerdyakov> No, that's not right.
<Smerdyakov> Do you understand what "int -> 'a list" means?
<gaja> The function takes an int and returns a list with yet undefined content.
<Smerdyakov> Yup. And you can see which expression is supposed to have that type but doesn't?
<gaja> Generate list seems to. Ahh.. is this because ocaml doesn't know what (fn start) would evaluate to?
<Smerdyakov> The error message will give you an exact range of characters in the source file.
<Smerdyakov> It will be narrower than the whole function definition.
<Submarine> Smerdyakov, AAAH YOU YES YOU
<Smerdyakov> And I can tell you that the presence of 'a isn't the problem, and that your problem really has nothing to do with static typing. The problem would only become apparent in Lisp when you go to test the function.
<Submarine> Smerdyakov, You seem to be the kind of person who uses SAT solvers.
<Smerdyakov> At the same time, the type error message is quite helpful for finding the problem.
<Smerdyakov> Submarine, nope, but I'm around enough people who do that maybe I can help.
<Submarine> Smerdyakov, Would you happen to know of a SAT solver that somehow tries to "minimize" (obviously, not fully minimize) the instanciation?
<Submarine> like, if it chose variables A, D, E
<Submarine> but really B and F don't matter
<Submarine> then it should give me A, D and E but not B and F in the instanciation
<Smerdyakov> No, sorry.
<gaja> Smerdyakov: It complains about generate_list (fn start) (fn) (n-1). I've used the same function for generating pascals triangle with the lisp version. The only difference was that you need funcall and #'() syntax for the function.
<Smerdyakov> Well, you're using different keywords whose semantic difference you haven't quite understood.
<Smerdyakov> Do you see that the error message means that something you did somewhere else implies that the expression you just listed returns a function, when you really want it to return a list?
<gaja> That much is true. I'm just beginning to learn ocaml.
leo037 has quit [Read error: 104 (Connection reset by peer)]
leo037 has joined #ocaml
leo037 has quit [Remote closed the connection]
leo037 has joined #ocaml
<gaja> Ahh... Yeah. Now that ain't right. =/ I thought the second type was a function too. My bad. Does this have to do with my using the function keyword?
<Smerdyakov> Yes. Did you find the manual section on it yet?
<Smerdyakov> If you're having trouble finding it, just ask for help; but knowing how to use the manual is much more useful in the long term than getting a direct answer now.
<Smerdyakov> It should be extremely easy to find.
<gaja> No. I had misstakenly thought that using function was equivalent with doing a match with. But when I think about it you would need to remove the n from the definition to have it work as expected no?
<Smerdyakov> That's right.
<gaja> I haven't really understood how the manual is constructed yet. I found the index and looked at "functions as values". I just didn't see the details though.
<gaja> Thanks for helping out, and thanks more for making me work for it. That's the kind of help I appreciate most.
<Smerdyakov> You are probably looking in the tutorial section if there is a section with that heading. You want the reference section.
<Smerdyakov> In particular, you want Part II. Were you looking in Part I?
<Smerdyakov> And there's also the keyword index.
<gaja> Yeah, looks it.
<gaja> functional values are mappings from values to values? Seems a bit undescriptive to me.
<Smerdyakov> Well, it's written by non-native English speakers.
<Smerdyakov> But everyone with FP experience is going to know what it means anyway, and people without FP experience won't get it with any short description. :)
<gaja> Hehe.. Well I do get it sort of. Now I likely won't forget about using 'function' the right way again.
<gaja> Looking forward to making lots of errors in the future.
Mr_Awesome has joined #ocaml
shawn has quit ["This computer has gone to sleep"]
<gaja> Hmm.. another question. List.map only maps on one list right? Is there a way to map over several lists so that the mapped function works with the head of each list as arguments? Like map (+) [1; 2; 3] [4; 5; 6] would return [5; 7; 9].
<Smerdyakov> The OCaml type system can't support any function that could be used in both ways.
<Smerdyakov> However, for the special case of 2 lists, you will find something in the standard library.
<gaja> Ok. Awsome. Will search for it.
<gaja> Hehe.. I was just a screen above it.
noteventime has joined #ocaml
shawn has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
leo037-2 has joined #ocaml
leo037-2 has quit ["Ex-Chat"]
pantsd has joined #ocaml
Smerdyakov has quit ["Leaving"]
clog has joined #ocaml
seafoodX has quit []