flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
oriba has quit ["Verlassend"]
_zack has quit ["Leaving."]
chickenzilla has quit [Read error: 110 (Connection timed out)]
love-pingoo has quit ["Connection reset by pear"]
Yoric[DT] has quit ["Ex-Chat"]
angerman has joined #ocaml
thelema has quit [Read error: 60 (Operation timed out)]
angerman has quit [Client Quit]
slash_ has quit ["leaving"]
hkBst has quit [Read error: 104 (Connection reset by peer)]
willb has joined #ocaml
angerman has joined #ocaml
angerman_ has joined #ocaml
angerman has quit [Read error: 145 (Connection timed out)]
sporkmonger has joined #ocaml
sporkmonger has quit []
angerman_ is now known as angerman
thelema has joined #ocaml
det has quit [Read error: 60 (Operation timed out)]
det has joined #ocaml
pogma has quit [Read error: 60 (Operation timed out)]
pogma has joined #ocaml
pogma has left #ocaml []
wsmith84 has joined #ocaml
jeddhaberstro has joined #ocaml
jeddhaberstro has quit []
wsmith84 has quit [Remote closed the connection]
wsmith84 has joined #ocaml
ched__ has joined #ocaml
ched_ has quit [Read error: 110 (Connection timed out)]
NyNix has joined #ocaml
NyNix_ has joined #ocaml
Stefan_vK has quit [Read error: 104 (Connection reset by peer)]
Stefan_vK has joined #ocaml
alexyk has joined #ocaml
<alexyk> how do I refer to the non-option arguments, such as file names, after Arg.parse?
hcarty_ has joined #ocaml
NyNix has quit [Read error: 104 (Connection reset by peer)]
<alexyk> since hcarty is in, repeat! :) how do I refer to the non-option arguments, such as file names, after Arg.parse?
<thelema> alexyk: there's an argument to arg.parse that acts on non-option arguments
<alexyk> thelema: hmm... al in turn?
<thelema> anon_fun
<thelema> val parse : (key * spec * doc) list -> anon_fun -> usage_msg -> unit
<thelema> What most people do in anon_fun is accumulate the strings in a list
<thelema> (fun s -> rest := s :: !rest)
<alexyk> ah ok... there's also Rest of (string -> unit)
<thelema> yes, but that works more like --
<thelema> i.e. cat -- -2.txt
hcarty has quit [Read error: 110 (Connection timed out)]
<alexyk> I waited a bit after -- :) btw, googled this: http://linuxgazette.net/issue99/stellingwerff.html -- anyone uses Gnuarg?
* thelema wrote his own - arg2
<thelema> it's also more gnu-compatible than Arg, but it also features optional arguments. (with code to run / default values)
<thelema> arg only allows -o val, this code allows -o v1 v2 v3, with any or all optional.
funebre has joined #ocaml
funebre has quit [Client Quit]
<alexyk> thelema: interesting... is it in godi?
<thelema> never used godi.
<alexyk> thelema: then where? :)
* thelema pushes to github
<thelema> hmm, maybe I'll push this larger project where I use it.
<alexyk> thelema: yum!
<thelema> it's got lots of code I wrote when I was but a little ocamler, fresh from perl
<thelema> hmm, the oldest dates on these files are from Feb 2004, but I know the project is much older than that.
* thelema loves the type we ended up with:
<thelema> val parse :
<thelema> keywords:(switch * spec list * (spec * (unit -> unit)) list *string) list ->
<thelema> others:(string -> unit) ->
<thelema> usage:string ->
<thelema> descr:string ->
<thelema> notes:string ->
<thelema> unit
<thelema> no mainstream language even comes close to (switch * spec list * (spec * (unit -> unit)) list * string ) list
<thelema> I'll admit that gnuarg has a nice usage creator...
<thelema> but ours wins
<thelema> example usage in testgraph.ml
<alexyk> thelema: awesome! going to clone...
<thelema> I'm glad you enjoy the code. I've not touched it in years, and would probably find tons of things needing rewriting.
<alexyk> so is it s graph library?
<thelema> only bipartite graphs, I'm afraid.
<thelema> that was all I needed.
<alexyk> yeah -- I am learning how to use ocamlgraph now
<thelema> I looked into that once, but had already written my own library, so...
Demitar has quit [Read error: 110 (Connection timed out)]
<thelema> I tried a bunch of implementations, and spent way too much time functorizing everything.
<thelema> otoh, I learned a bunch about functors that way.
seafood has quit [Read error: 60 (Operation timed out)]
alexyk has quit []
seafood has joined #ocaml
<kaustuv> I've finally come across a non-trivial use case for private type abbreviations: http://pastebin.com/d7a7010aa
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
<thelema> kaustuv: sometime you'll have to explain the big deal with that code. It seems to just look up old values by hashtbl. Maybe a blog post - I sleep now. bye
petchema_ has joined #ocaml
petchema has quit [Read error: 110 (Connection timed out)]
infoe|wk has quit [Read error: 110 (Connection timed out)]
kaustuv_ has joined #ocaml
kaustuv has quit [Read error: 104 (Connection reset by peer)]
Yoric[DT] has joined #ocaml
Camarade_Tux has joined #ocaml
wsmith84 has quit [Read error: 110 (Connection timed out)]
chicco has quit [Read error: 111 (Connection refused)]
m3ga has quit ["disappearing into the sunset"]
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
kaustuv_ is now known as kaustuv
seafood_ has joined #ocaml
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
seafood has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit ["Ex-Chat"]
Alpounet has joined #ocaml
ttamttam has joined #ocaml
s4tan has joined #ocaml
filp has joined #ocaml
ilor_ has joined #ocaml
OChameau has joined #ocaml
ilor has quit [Read error: 110 (Connection timed out)]
_zack has joined #ocaml
angerman has quit [Read error: 110 (Connection timed out)]
hkBst has joined #ocaml
ilor_ has quit [Read error: 113 (No route to host)]
det has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has joined #ocaml
seafood_ has quit []
seafood has joined #ocaml
angerman has joined #ocaml
jlouis has joined #ocaml
angerman has quit [Client Quit]
jlouis__ has joined #ocaml
jlouis has quit [Read error: 104 (Connection reset by peer)]
Stefan_vK1 has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
Yoric[DT] has quit ["Ex-Chat"]
Stefan_vK has quit [Read error: 110 (Connection timed out)]
peper has quit [Read error: 60 (Operation timed out)]
jlouis__ has quit [Read error: 60 (Operation timed out)]
angerman has joined #ocaml
sporkmonger has joined #ocaml
angerman has quit [Client Quit]
seafood has quit []
infoe|wk has joined #ocaml
hcarty_ is now known as hcarty
<thelema> yor: global_replace didn't come through right on your side?
<thelema> drat, gone.
Alpounet has quit [Read error: 110 (Connection timed out)]
angerman has joined #ocaml
filp has quit ["Bye"]
Alpounet has joined #ocaml
Waleee has joined #ocaml
jlouis has joined #ocaml
NYnix has joined #ocaml
NYnix has quit [Client Quit]
wsmith84 has joined #ocaml
<hcarty> thelema: Could you look at the Bigarray patch I submitted for Batteries?
det has joined #ocaml
love-pingoo has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
slash_ has joined #ocaml
det has quit [Read error: 104 (Connection reset by peer)]
det_ has joined #ocaml
jlouis has quit [Remote closed the connection]
jlouis has joined #ocaml
gim has quit [Remote closed the connection]
th5 has joined #ocaml
gim has joined #ocaml
wsmith84 has quit [Read error: 110 (Connection timed out)]
Walee has joined #ocaml
alexyk has joined #ocaml
jlouis has quit [Connection timed out]
Waleee has quit [Read error: 110 (Connection timed out)]
Walee has quit [Read error: 104 (Connection reset by peer)]
orionr has joined #ocaml
<orionr> Hello. I'm having a problem with a function. I'm getting the error This expression is not a function, it cannot be applied. Would anyone mind taking a look?
<mrvn> your forgot a ;
<mrvn> -r
Waleee has joined #ocaml
<orionr> mrvm: else Printf.printf("%s" (List.hd(Z))) board((List.tl (Z)))
<orionr> its complaining about that line.
<orionr> mrvn: board: is a rec function
<mrvn> orionr: "%s" is not a function, you can not apply the argument (List.hd(Z)) to it.
<mrvn> orionr: you don't write f(x,y,z), just f x y z in ocaml.
<Waleee> that's completly optional, if there haven't been some fundamental changes to ocaml since 3.10 (haven't tried 3.11 yet) ... you just have to remember that if you use f(x,..,z) in the decleration you have to use it in the function calls
<mrvn> Waleee: not optional at all. f (x,y,z) calls f with one argument, the triple (x,y,z).
<mrvn> f x y z is 3 arguments x, y and z.
Camarade_Tux has quit ["Leaving"]
<orionr> mrvn: why doesn't Printf.printf("%s" "hello world"); work? Thats pretty much the same reason why I'm having this problem.
<mrvn> orionr: because ("%s" "hello world") means passing the argument "hello world" to the function "%s" and that is not one.
<mrvn> Loose the () and it works
th5 has quit []
funebre has joined #ocaml
robocop has joined #ocaml
<robocop> hello.
<robocop> when i "read" my code with : "ocaml nums.cma code.ml"; how I can compile it with ocamlopt ?
<mrvn> Prime directives: Protect the innocent. Uphoald the law. Write more ocaml programs.
<robocop> "ocamlopt nums.cma code.ml -o test" doen't work.
<mrvn> ocamlopt nums.cmxa code.ml?
<robocop> mrvn: this is dosn't work.
<mrvn> why not?
<robocop> "/usr/bin/ocamlopt: don't know what to do with types.cmo."
<mrvn> and you did use the cmxa?
<robocop> I create types.cmo with : "ocamlc -c types.ml"
<robocop> I have got file cmxa
<mrvn> you can not mix bytecode and binary
<mrvn> ocamlopt -c types.ml gives you types.cmx
<robocop> Ho, okey
<robocop> thanks, i'm going to test.
Waleee has quit [Read error: 145 (Connection timed out)]
<orionr> mrvn: what does Exception: Failure "tl". generally mean?
angerman has quit []
Waleee has joined #ocaml
<orionr> If i run List.tl on an empty list?
<mrvn> orionr: that the list was too short
<mrvn> An empty list has no tail
<orionr> If i did that on an empty list that would cause that to occur?
<mrvn> the _ -> raise (Failure "tl")
<mrvn> You know what exceptions are, right=
<mrvn> ?
s4tan has quit []
<orionr> Not really lol. Errors?
<orionr> like it threw an exception.
<mrvn> not 100% but usualy.
slash_ has quit ["leaving"]
<mrvn> If you do something wrong with the standard lib it will raise an exception.
<orionr> I'm trying to go through a list and print each element.
<totom> use List.iter
<mrvn> don't use hd/tl for that. Use pattern matching.
<mrvn> let loop list = match list with [] -> () (* all done *) | x::xs -> Printf.printf "%s " x; loop xs
<orionr> totom: I would but this program has to be done completely recursively lol
<mrvn> List.iter is tail recursive
<mrvn> let loop = function [] -> () (* all done *) | x::xs -> Printf.printf "%s " x; loop xs
<mrvn> let loop = List.iter (Printf.printf "%s ")
<mrvn> (to give3 forms of the same thing)
<orionr> we can't use loops. It have to be completely recursive. but i guess i could have List.iter being called recursivly
<mrvn> orionr: loop is just a name. It is called recursive
<mrvn> let print_string_list = List.iter (Printf.printf "%s ")
<mrvn> oh, s/let/let rec/ abov. sorry.
<robocop> And, if I've got a function in types.ml; to use the function with code.ml, how i can do with ocamlopt ?
<mrvn> Types.foo
<robocop> what ?
<mrvn> if you want it nice: let print_string_list list = List.fold_left (fun sep x -> Printf.printf "%s\"%s\"" sep x; "; ") "[" list; Printf.printf "]"
<mrvn> robocop: To use function foo from types.ml use Types.foo
<robocop> yes mrvn.
<robocop> but to compile ?
<robocop> ocamlopt types.ml code.ml -o test ?
<mrvn> ocamlopt -o myprog types.ml foo.ml
<mrvn> or ocamlopt -c types.ml && ocamlopt -c code.ml && ocamlopt -o code types.cmx code.cmx
<mrvn> But at that point write yourself a Makefile.
<robocop> yes.
<robocop> ocamlbuild ?
chickenzilla has joined #ocaml
<mrvn> can't hurt to learn it if youhave the time
<orionr> mrvn: I'm still getting an error about types on this line. Does this look wrong ? Printf.printf "%s" (List.hd(Z))
<mrvn> Z is wrong
<orionr> mrvn: I think its because i have this on that one line.
<orionr> Printf.printf "%s" (List.hd(Z)) board((List.tl (Z)))
<mrvn> cut&paste it in the toplevel and it will underline the bad part.
<mrvn> "%s" is one string, why do you pass it 2 further arguments?
<orionr> I want to then call the board function then.
<orionr> I don't want to pass that to printf.
<mrvn> ;
<mrvn> How else is ocaml to know you are done with that expression?
Mr_Awesome has quit [Remote closed the connection]
<orionr> yea duh sorry.
<mrvn> and again, don't use hd/tl there.
alexyk has quit []
chickenzilla has quit [Client Quit]
chickenzilla has joined #ocaml
<orionr> mrvm: what i'm doing should work i believe though. I'm printing the head each time and then passing the tail back in this rec function.
<mrvn> orionr: at some point the list is empty and then List.tl will fail
<orionr> if have an if statement before that saying if(Z =[]) then Printf.printf("\n");
<orionr> s/if/i/
<mrvn> then it is just bad code.
<orionr> Why is that?
<mrvn> and buggy. you need begin/end or () after the then so the if works for both printf and board.
<mrvn> orionr: "match" is generally used for this kind of thing.
<orionr> So I should use List.iter as you talked about before?
<mrvn> It does the if, hd and tl in one easy to read construct.
<mrvn> orionr: List.iter would replace the whole function in one go.
<mrvn> orionr: I'm assuming this is some class asignment, right? And they want you to write your own List.iter.
<orionr> mrvn: I have a list like [[hello][world]] and i want to beable to print that out but it has to be done completely recursively.
<orionr> mrvm: yea its for a class.
funebre has quit []
Waleee1 has joined #ocaml
Waleee1 has left #ocaml []
<mrvn> orionr: You can do it with the "if" if you add begin/end. But if you had "match" in class already than read up on that.
<mrvn> Poll: Do you use begin/end or () for sequenzes or expressions?
ttamttam has left #ocaml []
alexyk has joined #ocaml
<love-pingoo> begin/end
<love-pingoo> not a very successful poll
orionr has quit [Remote closed the connection]
<alexyk> did anyone look at the D language? Somehow it looks the right kind of "to the metal" -- maybe it's better to write extensions in D than in C?
<alexyk> I've noticed as the D reference compiler dmd was ported to Mac recently
willb has joined #ocaml
alexyk has quit [Read error: 104 (Connection reset by peer)]
<flux> apparently the compiler isn't open enough. I don't know about its license, though.
alexyk_ has joined #ocaml
<flux> (I don't particularly care, if the program written in it can be distributed under the author's terms)
<flux> in any case, bindings should be very thin, and C compiler is defacto, whereas D is far from it
<flux> so I'd use the tool that has better availability
<flux> perhaps I would change my opinion if good Ocaml bindings (especially regarding GC) for D turned up..
slash_ has joined #ocaml
alexyk_ has quit [Read error: 104 (Connection reset by peer)]
kaustuv_ has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
Yoric[DT] has joined #ocaml
itewsh has joined #ocaml
Snark has joined #ocaml
prime2 has joined #ocaml
<Alpounet> I don't really much like the D programming language.
Amorphous has quit [Read error: 104 (Connection reset by peer)]
Walee has joined #ocaml
robocop has left #ocaml []
<Yoric[DT]> Good thing you're coding in OCaml :)
<Yoric[DT]> thelema: I believe I've found how to do the generation of batteries.mli a tad more cleanly.
_zack has quit ["Leaving."]
Stefan_vK has joined #ocaml
Stefan_vK has quit [Client Quit]
Stefan_vK has joined #ocaml
<hcarty> Yoric[DT]: Do you think you will have time to review the Bigarray patch I submitted before the beta 1 deadline?
Waleee has quit [Read error: 110 (Connection timed out)]
Stefan_vK has quit [Client Quit]
<Yoric[DT]> hcarty: arf, my bad.
<Yoric[DT]> Where is it, again?
<Yoric[DT]> (sorry, last few weeks have been quite busy for me)
<Yoric[DT]> Thanks.
<hcarty> Not at all a problem. They have been here as well.
<hcarty> Thank you for taking the time to look at it
<Yoric[DT]> I'll try and review this this evening.
<Yoric[DT]> Thanks for writing it.
<hcarty> I am happy to do so
<Yoric[DT]> Well, time to go and eat something, though.
<Yoric[DT]> Talk to you later.
wsmith84 has joined #ocaml
Amorphous has joined #ocaml
Stefan_vK1 has quit [Read error: 110 (Connection timed out)]
ttamttam has joined #ocaml
ttamttam has quit [Read error: 104 (Connection reset by peer)]
ttamttam has joined #ocaml
<hcarty> Yoric[DT]: Enjoy your meal
robocop has joined #ocaml
<robocop> re
<robocop> Do you know if thre is a implementation of ocaml for mathematic ?
<robocop> Whithout type int and float but with a type "num" for exemple
wsmith84 has quit [Read error: 113 (No route to host)]
<Yoric[DT]> robocop: er, probably yes, depends on what you mean.
<robocop> infiny arythmetic precision ?
<robocop> *arithmetic
<Yoric[DT]> Infinite is not possible.
<Yoric[DT]> Arbitrary is possible, though.
<robocop> yes
<robocop> sorry :)
<Yoric[DT]> So, yes, there's at least one library.
<Yoric[DT]> At the moment, I can't remember the name but I've used it once.
<robocop> module nums ?
ppsmimou has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]> No, it's not part of the standard distribution.
<robocop> yes.
Walee has quit []
<love-pingoo> Bignum
<love-pingoo> Big_int
<love-pingoo> you'd need to define your own syntactic sugar, but if you use only big_ints (and don't mix with int and float) it should be fairly simple
<love-pingoo> oh, I see Nat also (arbitrary positive integers)
itewsh has quit [Remote closed the connection]
<Yoric[DT]> Nah, it's something else.
<Yoric[DT]> Sorry, can't remember the name for the moment.
<Yoric[DT]> Maybe libmp, or something such.
<love-pingoo> what's wrong with big_num?
itewsh has joined #ocaml
jft has joined #ocaml
<jft> hi
<jft> can anyone help me with an error i am receiving?
<jft> i have a comparison expression that will not return an int, but i want it to return an int
<jft> if(5>3) then (5+1);;
<totom> you have to put an "else"
<jft> This expression has type int but is here used with type unit
<totom> if 5<3 (even if that won't happen) you happen to return unit since you don't have a else clause
<totom> so your "then" and your "else" don't return the same type
<totom> you have to unify them
<jft> ok, i will try that, thank you
robocop has quit ["Leaving."]
<jft> ok, thank you that worked, i was testing a bigger function that had that statement in it
Demitar has joined #ocaml
<mrvn> jft: think of it as "if" having an implicit "else ()"
seafood has joined #ocaml
sporkmonger has quit []
ilor has joined #ocaml
Snark has quit ["Ex-Chat"]
wsmith84 has joined #ocaml
seafood has quit [Connection timed out]
<gildor> ertai_: I have some question (and proposal for ocamlbuild on windows)
<gildor> ertai_: Is this normal that it is so slow (or do you have an idea how to speed up things)
sporkmonger has joined #ocaml
ttamttam has left #ocaml []
prime2 has quit ["leaving"]
sitaktif has quit [Read error: 104 (Connection reset by peer)]
hkBst has joined #ocaml
sitaktif has joined #ocaml
sporkmonger has quit []
love-pingoo has quit ["Connection reset by pear"]
Alpounet has quit ["Ex-Chat"]
anryx has joined #ocaml
<wsmith84> Has anybody here had a look at F#?
<wsmith84> How does it compare to OCaml?
<wsmith84> thelema: How do you find F#'s libraries compared to what you want to build with Batteries?
Camarade_Tux has joined #ocaml
chickenzilla` has joined #ocaml
chickenzilla has quit [Nick collision from services.]
chickenzilla` is now known as chickenzilla
xevz has quit [calvino.freenode.net irc.freenode.net]
xevz has joined #ocaml
Hadaka has quit [Read error: 60 (Operation timed out)]
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
Naked has joined #ocaml
Naked is now known as Hadaka
willb has quit [Read error: 110 (Connection timed out)]