gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
<vext01> i much prefer begin/end
<_habnabit> they both have their place
<_habnabit> I wouldn't use begin/end in all circumstances
<vext01> _habnabit: thanks for the help
<vext01> i am off to bed for now
<_habnabit> nooooo problem
<JoeyA> Can ;; only be used to terminate let statements at the top-level?
<_habnabit> I don't understand the question
<JoeyA> I'm wondering why this is a syntax error: http://codepad.org/h2KasK5I
<JoeyA> with End_of_file -> None ;;
<_habnabit> oh, yeah, you can't do that
<_habnabit> you need an 'in'
<JoeyA> I can "get it to work" by just changing ;; to in. I was wondering what exactly ;; is for.
<_habnabit> ;; is only necessary in the toplevel AFAICT
<_habnabit> it's the only time I ever type it
<JoeyA> Thanks
<JoeyA> Revised (works now): http://codepad.org/mSMQKgMa
<_habnabit> hooray
<JoeyA> This is my first OCaml program (reads lines and prints them out). Anyone have constructive criticisom?
<JoeyA> however that's spelled
<JoeyA> criticism
<_habnabit> criticism
<JoeyA> (including my choice of paste bin)
<_habnabit> the `str` variable isn't necessary; you can put the try-with in between the `match` and `with`
<JoeyA> Ooh, hpaste supports OCaml. I don't think I noticed it the first time I looked.
<JoeyA> Why the begin and end?
iago has quit [Quit: Leaving]
<_habnabit> actually, I don't remember
<_habnabit> they're not necessary in this case, but there is some other case I ran into where they were
<JoeyA> Okay
<_habnabit> but I just got in the habit of `match begin`
Xizor has quit [Ping timeout: 260 seconds]
<JoeyA> I'm going to wait until I find a case where it is an issue.
emmanuelux has quit [Read error: Connection reset by peer]
<JoeyA> I can't think of a case where it would be, since match ... with ... and let ... in ... are pretty unambiguous.
<JoeyA> Maybe I can think of an example inspired by C's ternary operator: (a ? b : c) ? d : e
<JoeyA> Here, the parens are needed because ?: is right-associative in languages that have it (except in PHP...)
<_habnabit> heh
<JoeyA> Not sure such an example is possible with let ... in ..., since there's nothing before the let.
<JoeyA> let ... in effectively acts like parenthesis, I think.
<JoeyA> Thanks for the input.
<JoeyA> What's the difference between let and val?
emmanuelux has joined #ocaml
oriba has quit [Quit: oriba]
<JoeyA> Why aren't semicolons needed after the first two let definitions here? http://paste.pound-python.org/show/19515/
<_habnabit> your final ;; isn't necessary either
<JoeyA> Even if I say let ($) f g = f g let some x = Some x (no newline), it still works.
<JoeyA> However, if I remove the ;; after the big let definition, I get a syntax error.
<_habnabit> oh, that's because you're calling loop () directly
<_habnabit> you can do `let () = loop ()` to call it
<JoeyA> So at the toplevel, it implicitly throws in ;; if it sees a let without a corresponding in?
<_habnabit> at the toplevel you need a ;; at some point
milosn has quit [Ping timeout: 265 seconds]
<_habnabit> but both at the toplevel and when writing a module, `in` isn't necessary after a let
<_habnabit> (only in the outermost scope of a module, though)
milosn has joined #ocaml
raphscallion has joined #ocaml
raphscallion has quit [Remote host closed the connection]
raphscallion has joined #ocaml
emmanuelux has quit [Quit: @+]
Tobu has quit [Ping timeout: 260 seconds]
TaXules has quit [Ping timeout: 252 seconds]
TaXules has joined #ocaml
emmanuelux has joined #ocaml
wtetzner has quit [Ping timeout: 276 seconds]
JoeyA has quit [Quit: Leaving]
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
Tobu has joined #ocaml
JoeyA has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
emmanuelux has quit [Read error: Connection reset by peer]
raphscallion has quit [Quit: raphscallion]
raphscallion has joined #ocaml
b4284 has joined #ocaml
fantasticsid has joined #ocaml
emmanuelux has joined #ocaml
emmanuelux has quit [Read error: Connection reset by peer]
emmanuelux has joined #ocaml
tmaedaZ has quit [Ping timeout: 260 seconds]
tmaedaZ has joined #ocaml
emmanuelux has quit [Read error: No route to host]
smerz has quit [Read error: Connection reset by peer]
Xizor has joined #ocaml
fantasticsid has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
datkin has quit [Ping timeout: 245 seconds]
tmaedaZ is now known as tmaeda
lihaitao has joined #ocaml
JoeyA has quit [Quit: Leaving]
cdidd has quit [Ping timeout: 244 seconds]
ulfdoz has quit [Read error: Operation timed out]
Tianon has quit [Ping timeout: 264 seconds]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
zcero has joined #ocaml
Xizor has quit []
BiDOrD has joined #ocaml
pango is now known as pangoafk
ankit9 has joined #ocaml
larhat has quit [Quit: Leaving.]
ftrvxmtrx_ has quit [Quit: Leaving]
<adrien> morning
Cyanure has joined #ocaml
ggherdov has joined #ocaml
larhat has joined #ocaml
larhat has quit [Ping timeout: 264 seconds]
larhat has joined #ocaml
larhat has quit [Client Quit]
zcero has quit [Quit: Lost terminal]
ankit9 has quit [Quit: Leaving]
tufisi has joined #ocaml
Cyanure has quit [Remote host closed the connection]
ankit9 has joined #ocaml
JoeyA has joined #ocaml
larhat has joined #ocaml
hto has quit [Quit: Lost terminal]
<JoeyA> I installed ocaml-core from https://bitbucket.org/yminsky/ocaml-core on Ubuntu by running sudo ./build-and-install , but I still get an unbound module error if I say open Core.Std . How do I tell ocaml that I have libraries in /usr/local/lib/ocaml ?
larhat has quit [Read error: Connection reset by peer]
larhat has joined #ocaml
hto has joined #ocaml
cago has joined #ocaml
<JoeyA> ocamlopt -I /usr/local/lib/ocaml/3.12.1/core echo.ml works. Isn't there a way to get it to search all of /usr/local/lib/ocaml like it does /usr/lib/ocaml ?
<JoeyA> (where echo.ml opens Core.Std)
<flux> usually people use ocamlfind/findlib for that
<flux> ocamlfind ocamlopt -linkpkg -package whateveristhepackagename echo.ml
larhat1 has joined #ocaml
larhat has quit [Read error: Connection reset by peer]
Cyanure has joined #ocaml
<JoeyA> Thanks. I had to change it to ocamlfind ocamlopt -thread -package core echo.ml , though (drop -linkpkg, add -thread)
<JoeyA> flux: ^
<flux> hmm
<flux> and you got an executable binary?
<flux> maybe ocamlfind has advanced so that it no longer needs linkpkg?
<flux> (the -thread switch I can understand, not the dropping of -linkpkg :))
<JoeyA> If I keep -linkpkg, I get these errors:
<JoeyA> gcc: error: lib/libcore.a: No such file or directory
<JoeyA> gcc: error: lib/libbin_prot.a: No such file or directory
<flux> hmm, interesting
raphscallion has quit [Quit: raphscallion]
larhat has joined #ocaml
larhat1 has quit [Read error: Connection reset by peer]
larhat has quit [Client Quit]
b4284 has left #ocaml []
djcoin has joined #ocaml
JoeyA has quit [Quit: Leaving]
larhat has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
eni has joined #ocaml
Tobu has joined #ocaml
ggherdov has quit [Remote host closed the connection]
xenocons_ has joined #ocaml
<xenocons_> can one #load a bytecode file from within a module
<eni> i get a syntax error on this one : http://paste.pocoo.org/show/583409/ but i can't see what's happening.
<Ptival> eni: missing "then"?
<eni> ah
<eni> thanks
<Ptival> (some of your parenthesing is unnecessary too)
<Ptival> you can drop them at if (...) and at let ret = (...) in
<Ptival> you can also drop some for pairs, but that's more slippery
<Ptival> and you don't need the ";;" in a file :)
<eni> if i don't put begin end, then emacs doesn't display them right.
<xenocons_> ah lol
<eni> Ptival, i'm using tuareg.
<mrvn> eni: What are you trying to do? Get the n-th item out of a tree?
<xenocons_> hopefully your tree isnt too big
<eni> mrvn, yes; xenocons_ why?
<eni> too much rec calls?
<mrvn> eni: then your recursive call is wrong
<xenocons_> not tail recursive afaik
<xenocons_> could be wrong though
<eni> mrvn, it worked on a simple example
<mrvn> eni: try one with a few levels of Branch.
<eni> mrvn, i think you are right.
<mrvn> eni: your "i" already contains the mycount and then you add it again.
<Ptival> indeed
<eni> you are right.
<eni> :)
<mrvn> eni: I would also change the return type in one of two ways: type res = Found of 'a | Count of int or exception Found of 'a
<mrvn> eni: If you found the item you don't need the count and if not then you don't need the item.
<xenocons_> http://codepad.org/qeyZRnI2 this isn't going to work right :)
<eni> exception Found is good :)
<mrvn> xenocons_: forgot the struct ... end?
<xenocons_> sorry i mean, is it possible to #load within a module =
<mrvn> xenocons_: include
<xenocons_> ahh
<mrvn> eni: Yeah, lets you return a simple int for normal cases and then aborts the whole recursion in one go when it finds something.
<mrvn> eni: Also lets you sue List.fold_left in the Branch case
<eni> yes
<eni> i could still use List.fold_left nope?
<mrvn> eni: without raise that wouldn't abort once it found the item
<eni> yes, but fold_left could still be used without using the exception you mentioned.
<mrvn> eni: it would be wastefull
s_p has joined #ocaml
Fnar has joined #ocaml
lihaitao has quit [Ping timeout: 240 seconds]
lihaitao has joined #ocaml
<s_p> In my lib.ml file I have an include statement include Num. However when I try to run this file in the interactive session it fails with the following error - Error: Reference to undefined global `Num'. Is there a way I can use the file both as a compilation unit and in the interactive session ?
<Ptival> s_p: can you #load or #use Num first?
xenocons_ has quit [Ping timeout: 245 seconds]
<s_p> Ptival: I can load or use it only by its full path. I guess it solves the problem if I first load it.
<s_p> Ptival: Thank you.
Zedrikov has joined #ocaml
Hussain has joined #ocaml
Hussain is now known as Guest36663
fschwidom has joined #ocaml
avsm has joined #ocaml
iago has joined #ocaml
Guest36663 is now known as Hussaind
ankit9 has quit [Ping timeout: 276 seconds]
ankit9 has joined #ocaml
ankit9 has quit [Ping timeout: 276 seconds]
ankit9 has joined #ocaml
_andre has joined #ocaml
Kakadu has joined #ocaml
s_p1 has joined #ocaml
s_p has quit [Ping timeout: 252 seconds]
emmanuelux has joined #ocaml
cdidd has joined #ocaml
iago has quit [Ping timeout: 265 seconds]
iago has joined #ocaml
jamii has joined #ocaml
raphscallion has joined #ocaml
silver_ has quit [Read error: Connection reset by peer]
err404 has joined #ocaml
silver has joined #ocaml
silver_ has joined #ocaml
silver_ has quit [Read error: Connection reset by peer]
iago has quit [Ping timeout: 265 seconds]
fschwidom has quit [Ping timeout: 252 seconds]
fraggle_laptop has joined #ocaml
ankit9 has quit [Quit: Leaving]
NougatRillettes has left #ocaml []
NougatRillettes has joined #ocaml
err404 has quit [Remote host closed the connection]
agarwal1975 has joined #ocaml
lihaitao has quit [Quit: Ex-Chat]
rwmjones has quit [Quit: Terminated with extreme prejudice - dircproxy 1.2.0]
rwmjones has joined #ocaml
smondet has joined #ocaml
iago has joined #ocaml
Kakadu has quit [Quit: Page closed]
agarwal1975 has quit [Quit: agarwal1975]
fschwidom has joined #ocaml
Tobu has quit [Ping timeout: 260 seconds]
fschwidom has quit [Remote host closed the connection]
Tobu has joined #ocaml
eni has quit [Ping timeout: 260 seconds]
larhat has quit [Quit: Leaving.]
emmanuelux has quit [Read error: Connection reset by peer]
raphscallion has quit [Quit: raphscallion]
emmanuelux has joined #ocaml
Kakadu has joined #ocaml
Kakadu has quit [Read error: Connection reset by peer]
Kakadu has joined #ocaml
err404 has joined #ocaml
Kakadu has quit [Client Quit]
Kakadu has joined #ocaml
Cyanure has quit [Remote host closed the connection]
ftrvxmtrx has quit [Quit: Leaving]
pollux has joined #ocaml
err404 has quit [Quit: Ex-Chat]
ulfdoz has joined #ocaml
Cyanure has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 245 seconds]
ulfdoz_ is now known as ulfdoz
tmaeda is now known as tmaedaZ
emmanuelux has quit [Read error: Connection reset by peer]
krktz has quit [Ping timeout: 245 seconds]
cago has quit [Quit: Leaving.]
emmanuelux has joined #ocaml
krktz has joined #ocaml
tmaedaZ is now known as tmaeda
avsm has quit [Quit: Leaving.]
eni has joined #ocaml
eni has quit [Ping timeout: 240 seconds]
cyphase has quit [Read error: Connection reset by peer]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.2]
letrec has quit [Ping timeout: 240 seconds]
Tobu has quit [Ping timeout: 272 seconds]
fraggle_laptop has quit [Remote host closed the connection]
Tobu has joined #ocaml
j2d2j2d2 has left #ocaml []
<foocraft_> Hi all. What's the recommended package manager for use with OCaml? (unless, of course, getting packages manually is the best way so far)
<foocraft_> findlib seems good, but I'm curious what everyone else uses and why.
<_habnabit> findlib by itself isn't really a package manager
<adrien> findlib's use is not as a package manager
<adrien> it's as a tool to let you compile against installed libs easily
<adrien> need to build against lablgtk? ocamlfind ocamlopt -package lablgtk2 -c foo.ml
<foocraft_> Oh okay, so is there something like pip for python or lieningen for clojure, for Ocaml?
<_habnabit> odb.ml
<adrien> godi too
<adrien> and more
<adrien> barbra.ml?
<Drakken> odb and godi seem to be the main ones right now.
<Drakken> odb is more popular here on irc, but as of a few months ago, I think only godi had ocamlnet, which is the big networking lib.
cdidd has quit [Ping timeout: 260 seconds]
cdidd has joined #ocaml
diego_diego has joined #ocaml
diego_diego has quit [Client Quit]
<adrien> odb and godi also have slightly different goals
<thelema_> odb is able to install ocamlnet with --sudo
<thelema_> (iirc, the limitation is in ocamlnet's 'make install' target)
iago has quit [Ping timeout: 265 seconds]
ivan\ has quit [Ping timeout: 240 seconds]
ivan\ has joined #ocaml
<NougatRillettes> foocraft_: if you are on Arch, you can try AUR too.
NougatRillettes has quit [Quit: http://puddingcie.tumblr.com/]
Hussaind has quit [Remote host closed the connection]
cyphase has joined #ocaml
Cyanure has quit [Ping timeout: 260 seconds]
iago has joined #ocaml
avsm has joined #ocaml
pangoafk has quit [Ping timeout: 260 seconds]
joeyadams has joined #ocaml
pangoafk has joined #ocaml
pangoafk is now known as pango
joeyadams has quit [Client Quit]
joeyadams has joined #ocaml
ftrvxmtrx has joined #ocaml
Xizor has joined #ocaml
emmanuelux has quit [Ping timeout: 264 seconds]
<joeyadams> Is there a way to read chars from stdin without stopping at a newline? Something like C's fread?
<joeyadams> I guess I found what I wanted: val input : in_channel -> string -> int -> int -> int
<thelema_> joeyadams: exactly
avsm has quit [Quit: Leaving.]
dsheets has quit [Quit: Leaving.]
<malouin_> how do I use BatPrint.printf?
<malouin_> From the documentation it seemed like
<malouin_> BatPrint.printf p"{%{int Set.t}}\n" ...
<malouin_> was the right idea, but a) I have no idea how that works and b) Error: Unbound value p
<malouin_> the example in the documentation "test_printf.ml" does not work for me either. Do I have to pass some flags to allow syntax extensions or something?
<thelema_> you do need batteries syntax extensions
<thelema_> if you're using ocamlfind, use -package batteries.syntax -syntax camlp4o
<thelema_> (i think)
<malouin_> ok
joeyadams has quit [Read error: Operation timed out]
<thelema_> malouin_: working?
<malouin_> haven't quite gotten it yet.
<malouin_> I'm trying to integrate it with my precarious build system
mcclurmc has quit [Excess Flood]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
<malouin_> for some reason ocamlbuild/ocamlfind can't find Batteries implementation, but it can find Batteries_uni
emmanuelux has joined #ocaml
<malouin_> ok, I got it working except that I can only print basic types like int list, but not int Set.t: Unbound value Set.t_printer
smerz has joined #ocaml
<malouin_> maybe that is asking too much?
ulfdoz has quit [Ping timeout: 252 seconds]
eni has joined #ocaml
Anarchos has joined #ocaml
<adrien> doubt it
<adrien> ocamlfind doesn't do magic
iago has quit [Ping timeout: 244 seconds]
<thelema_> malouin_: if you compile with threads, you can open Batteries, in 1.4, no threads requires Batteries_uni
<thelema_> malouin_: as for printing sets... I thought we had a Set.t_printer, I guess we need to add that.
Submarine has quit [Remote host closed the connection]
<malouin_> aaaah I see.
<thelema_> I don't use this style printing much; I just make my own printers by composing Foo.print functions and using Printf's %a format
<_habnabit> thelema_, how do you do that, again? I've forgotten what you had to do
<malouin_> thelema_: I get it!
<malouin_> printf p"%a\n" (Set.print Int.print) my_set
<thelema_> malouin_: yup, that's what I do. You don't need the syntax extension for that at all.
<thelema_> _habnabit: as malouin_ found
<_habnabit> ah
<_habnabit> but the p isn't necessary?
djcoin has joined #ocaml
_andre has quit [Ping timeout: 252 seconds]
_andre has joined #ocaml
<thelema_> yes.
<thelema_> _habnabit: the p is only necessary for things like p"{%{int Set.t}}\n"
<thelema_> maybe hcarty knows how to use the p-printing in batteries to print sets
larhat has joined #ocaml
jamii has quit [Read error: Connection reset by peer]
dsheets has joined #ocaml
_andre has quit [Quit: leaving]
Cyanure has joined #ocaml
emmanuelux has quit [Quit: @+]
tmaeda has quit [Ping timeout: 240 seconds]
Cyanure has quit [Remote host closed the connection]
Kakadu has quit [Quit: Konversation terminated!]
tmaeda has joined #ocaml
iago has joined #ocaml
Anarchos has quit [Quit: Page closed]
hexreel has quit [Ping timeout: 260 seconds]
smondet has quit [Remote host closed the connection]
cixaxa has joined #ocaml
tufisi has quit [Ping timeout: 276 seconds]
Tobu has quit [Ping timeout: 260 seconds]
Tobu has joined #ocaml
Zedrikov has quit [Ping timeout: 240 seconds]
TaXules has quit [Ping timeout: 260 seconds]
s_p1 has quit [Quit: Leaving.]
Xizor has quit []
djcoin has quit [Quit: WeeChat 0.3.2]
zzz_` has joined #ocaml
mehdid_ has joined #ocaml
pippijn_ has joined #ocaml
reynir_ has joined #ocaml
milosn has quit [*.net *.split]
vext01 has quit [*.net *.split]
fraggle_ has quit [*.net *.split]
mehdid has quit [*.net *.split]
jave has quit [*.net *.split]
pippijn has quit [*.net *.split]
zzz_ has quit [*.net *.split]
alvis has quit [Ping timeout: 260 seconds]
datkin has joined #ocaml
alvis has joined #ocaml
milosn has joined #ocaml
vext01 has joined #ocaml
fraggle_ has joined #ocaml
jave has joined #ocaml
tmaeda is now known as tmaedaZ