gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml Meeting 2011 http://bit.ly/eaZi1C | OCaml 3.12.0 http://bit.ly/aNZBUp
ulfdoz has quit [Ping timeout: 276 seconds]
ulfdoz_ is now known as ulfdoz
<philtor> Ok, so you have to do: ocamlfind install json-tc ./lib/json-tc/* to install it...
<philtor> So now I try: ocamlfind ocamlopt -o example1 -linkpkg -package json-tc -syntax camlp4o example1.ml
<philtor> And get:
<philtor> ocamlfind: When using -syntax, the META variable 'preprocessor' must be set
mnabil has quit [Ping timeout: 240 seconds]
<philtor> I see this in the META file: archive(syntax, preprocessor) = "pa_json_tc.cmo"
<iris1> philtor: how did you figure out that this was part of json-tc?
<philtor> iris1: I'm basically following the instructions here for building the example: https://github.com/avsm/ocaml-json-tc
<philtor> $ ocamlfind ocamlopt -o example1 -linkpkg -package json-tc -syntax camlp4o example1.ml
douknoukem has joined #ocaml
<iris1> philtor: I am sorry, I just realized that you are talking about something other than my is_none question... Sorry for butting in...
<avsm1> philtor: try -package json-tc.syntax ?
<philtor> avsm1: ok, so now I tried: ocamlfind ocamlopt -o example1 -linkpkg -package json-tc.syntax -syntax camlp4o example1.ml
<philtor> avsm1: and I get: File "ghost-location", line 3, characters 18--24:
<philtor> Error: Unbound type constructor number
<philtor> which I suspect means that it didn't find the extension?
happy4crazy has left #ocaml []
<philtor> (I'm using 3.12, BTW)
<avsm1> in addition to -package json-tc
<avsm1> you need both
<philtor> ok.
<avsm1> one is for the p4 addition, the other for the runtime library
<avsm1> email me if you cant get it to work; im afk from now
<philtor> ocamlfind ocamlopt -o example1 -linkpkg -package json-tc.syntax -package json-tc -syntax camlp4o example1.ml ?
<philtor> avsm1: after that I get: File "ghost-location", line 3, characters 18--24:
<philtor> Error: Unbound type constructor number
<philtor> (same error)
<philtor> ok...
andreas1 has joined #ocaml
smerz has quit [Quit: Ex-Chat]
andreas has quit [Ping timeout: 260 seconds]
ymasory has quit [Quit: Leaving]
DOUK has joined #ocaml
douknoukem has quit [Ping timeout: 240 seconds]
<iris1> FTR, pattern matching on the option value worked fine. Thank you!
<EM03> hmmm I would really love to use ocaml on these upcoming projects
astory has joined #ocaml
<astory> is there a let x = e where y expression in ocaml, or do I have to reorder bits?
sepp2k has quit [Quit: Leaving.]
happy4crazy has joined #ocaml
<happy4crazy> quick beginner syntax question
<happy4crazy> if you want to write an ocaml script, and begin foo.ml with #load "unix.cma"
<happy4crazy> why does the rest of the program need to begin with e.g. let _ = ...
<happy4crazy> without the let _ = ... I get a syntax error
<happy4crazy> minimal example:
<happy4crazy> #load "unix.cma"
<happy4crazy> print_string "heyo"
<happy4crazy> vs
<happy4crazy> let _ = print_string "heyo"
wuj has joined #ocaml
wuj has quit [Excess Flood]
wuj has joined #ocaml
impy has quit [Ping timeout: 250 seconds]
wuj has quit [Read error: Operation timed out]
astory has left #ocaml []
happy4crazy has left #ocaml []
wuj has joined #ocaml
wuj has quit [Ping timeout: 260 seconds]
vivanov has quit [Ping timeout: 252 seconds]
wormphlegm has quit [Quit: leaving]
vivanov has joined #ocaml
ymasory has joined #ocaml
vivanov has quit [Ping timeout: 260 seconds]
vivanov has joined #ocaml
arubin has quit [Quit: arubin]
ymasory has quit [Quit: Leaving]
everyonemines has quit [Quit: everyonemines]
philtor has quit [Ping timeout: 250 seconds]
Associat0r has quit [Quit: Associat0r]
dnolen has joined #ocaml
hto has joined #ocaml
dnolen has quit [Quit: dnolen]
hto has quit [Ping timeout: 246 seconds]
jamii has joined #ocaml
hto has joined #ocaml
jamii has quit [Ping timeout: 252 seconds]
jamii has joined #ocaml
eye-scuzzy has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
hto_ has joined #ocaml
jamii has quit [Ping timeout: 252 seconds]
hto has quit [Ping timeout: 250 seconds]
philtor has joined #ocaml
jamii has joined #ocaml
philtor has quit [Ping timeout: 250 seconds]
impy has joined #ocaml
ygrek has joined #ocaml
hto_ has quit [Ping timeout: 258 seconds]
Znudzon has joined #ocaml
larhat has joined #ocaml
ftrvxmtrx has joined #ocaml
sku has joined #ocaml
jamii has quit [Ping timeout: 264 seconds]
everyonemines has joined #ocaml
<everyonemines> Is there an easy way to get the location of the program being run?
<adrien> Sys.getcwd + Sys.argv.(1)
<adrien> Filename.concat (Sys.getcwd ()) (Filename.dirname (Sys.argv.(0))
<adrien> 0, not 1, sorry
<everyonemines> ah thanks
<everyonemines> Is there better documentation for figuring that sort of thing out than the Library Reference?
edwin has joined #ocaml
<adrien> it's more or less language-independant unix stuff so it's probably not going to be mentionned in language books, there a book for objective caml and unix but I can't remember the name
jamii has joined #ocaml
<everyonemines> Unix stuff? It's supposed to work on windows too, though./
<everyonemines> I guess you mean ocaml takes its conventions from unix.
<adrien> "system" would be more appropriate than "unix" I guess, and that is shared between both (and more)
<zorun> hello
jamii has quit [Ping timeout: 252 seconds]
<adrien> everyonemines: http://ocamlunix.forge.ocamlcore.org/ , it covers unix stuff, which is a superset of what you can use with the stdlib/unix on windows
<adrien> hi zorun
<everyonemines> thanks
jamii has joined #ocaml
<everyonemines> adrien: actually I think you need Filename.concat (Sys.getcwd ()) (Filename.dirname (Sys.argv.(0)));;
<everyonemines> and then you need to remove the extra / in the middle
<everyonemines> er nm, that's just a missing parenthesis
<everyonemines> so I guess I wanted Filename.concat (Sys.getcwd ()) (Str.string_after(Filename.dirname (Sys.argv.(0))) 1);;
vivanov has quit [Ping timeout: 252 seconds]
jamii has quit [Ping timeout: 260 seconds]
everyonemines has quit [Ping timeout: 240 seconds]
zerny has joined #ocaml
zerny has quit [Remote host closed the connection]
ikaros has joined #ocaml
zerny has joined #ocaml
zerny has left #ocaml []
jamii has joined #ocaml
jamii has quit [Ping timeout: 250 seconds]
sku has quit [Ping timeout: 246 seconds]
sku has joined #ocaml
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 250 seconds]
jamii has joined #ocaml
jamii has quit [Ping timeout: 240 seconds]
jderque has joined #ocaml
jamii has joined #ocaml
eye-scuzzy has quit [Read error: Operation timed out]
hto has joined #ocaml
eye-scuzzy has joined #ocaml
andreas1 is now known as andreas
boscop_ is now known as boscop
tensai_cirno has joined #ocaml
_andre has joined #ocaml
jamii has quit [Ping timeout: 276 seconds]
jamii has joined #ocaml
vivanov has joined #ocaml
jamii has quit [Ping timeout: 260 seconds]
vivanov has quit [Read error: Connection reset by peer]
hto has quit [Ping timeout: 240 seconds]
jamii has joined #ocaml
DOUK has left #ocaml []
ikaros has quit [Quit: Leave the magic to Houdini]
avsm1 has quit [Quit: Leaving.]
ygrek has quit [Ping timeout: 246 seconds]
sepp2k has joined #ocaml
redfire has joined #ocaml
<redfire> hi
<redfire> does anyone know how to build the following string : "foo\"bar" with the character '"' inside it ?
<redfire> because the escape character '\' doesn't seem to work in Ocaml
<sgnb> redfire: works for me
<sgnb> redfire: or maybe you mean "\"foo\\\"bar\""
<redfire> you're right...
<redfire> stupid mistake...
<redfire> thank you :-)
edwin has quit [Remote host closed the connection]
eye-scuzzy has quit [Quit: leaving]
ygrek has joined #ocaml
jamii has quit [Ping timeout: 250 seconds]
jamii has joined #ocaml
Truc[Akka] has joined #ocaml
jderque has quit [Quit: leaving]
mnabil has joined #ocaml
redfire has quit [Quit: leaving]
mnabil has quit [Ping timeout: 276 seconds]
tensai_cirno has quit [Quit: WeeChat 0.3.4]
mnabil has joined #ocaml
dnolen has joined #ocaml
crystal-cola has joined #ocaml
<crystal-cola> type nat = Succ of nat ;;
<crystal-cola> let rec nonnat = Succ nonnat in nonnat ;;
<crystal-cola> why is this allowed?
<thelema> why not?
<crystal-cola> because it stops data types in ocaml being inductive types
<thelema> it's needed to have cyclic immutable data structures
<crystal-cola> it seems like, maybe this is more harm than good?
<crystal-cola> I guess not
<thelema> it's your own fault if you misuse it.
<crystal-cola> hahaha
<thelema> recursive values aren't too different fundamentally from recursive functions
<thelema> and it's easy enough to fail to use recursion properly and make a broken program
<crystal-cola> I see
dnolen has quit [Quit: dnolen]
zorun has quit [Read error: No route to host]
mnabil has quit [Ping timeout: 250 seconds]
ymasory has joined #ocaml
Poet_ has joined #ocaml
Znudzon has quit [Ping timeout: 252 seconds]
mnabil has joined #ocaml
Truc[Akka] has quit [Quit: Want to be different? Try HydraIRC -> http://www.hydrairc.com <-]
ftrvxmtrx has quit [Ping timeout: 252 seconds]
Associat0r has joined #ocaml
mnabil has quit [Ping timeout: 240 seconds]
hto has joined #ocaml
happy4crazy has joined #ocaml
Oejet has joined #ocaml
mnabil has joined #ocaml
hto has quit [Ping timeout: 250 seconds]
happy4crazy has left #ocaml []
avsm1 has joined #ocaml
larhat has quit [Quit: Leaving.]
ftrvxmtrx has joined #ocaml
Poet_ has quit [Ping timeout: 264 seconds]
avsm1 has quit [Quit: Leaving.]
Associat0r has quit [Quit: Associat0r]
edwin has joined #ocaml
ymasory has quit [Read error: Connection reset by peer]
ymasory has joined #ocaml
sepp2k has quit [Ping timeout: 252 seconds]
sepp2k has joined #ocaml
EM03 has quit [Quit: EM03]
chegibari has joined #ocaml
<chegibari> Hello
<chegibari> I read that people use exceptions for flow control in ocaml (this is reflected by the lack of many function returning option typee, if compared to haskell or F#)
<chegibari> why is it so? Are ocaml exceptions particularly lightweight?
<thelema> yes, ocaml exceptions are quite lightweight
<chegibari> thanks
<chegibari> is "camomile" ok for processing unicode strings?
<thelema> yes
<chegibari> is there anything more standard?
<thelema> no
<chegibari> ok
<chegibari> double thanks :)
<thelema> you're welcome
oriba has joined #ocaml
<chegibari> do people use reflection in ocaml?
eikke has joined #ocaml
<thelema> not much reflection possible, as types are not present at runtime
<thelema> Here's the interface to what reflection is possible: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Obj.html
<thelema> It's not documented, as you have to know the internals to use it, and it's quite unsafe
<chegibari> right, I just found someting here http://lambda-the-ultimate.org/node/1169
joewilliams_away is now known as joewilliams
<chegibari> I'm liking ocaml more than F#
eye-scuzzy has joined #ocaml
astertronistic has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
jamii has quit [Ping timeout: 260 seconds]
sku has quit [Ping timeout: 246 seconds]
DimitryKakadu has joined #ocaml
sku has joined #ocaml
<chegibari> thanks again
<chegibari> have a nice day
<chegibari> bye!
chegibari has quit []
astertronistic has quit [Quit: Leaving]
jderque has joined #ocaml
sheets1 has left #ocaml []
ftrvxmtrx has joined #ocaml
EM03 has joined #ocaml
EM03 has quit [Changing host]
EM03 has joined #ocaml
ygrek has quit [Ping timeout: 246 seconds]
Poet_ has joined #ocaml
oriba has quit [Quit: Verlassend]
philtor has joined #ocaml
Associat0r has joined #ocaml
philtor has quit [Ping timeout: 246 seconds]
elehack has joined #ocaml
Fullma has joined #ocaml
lamawithonel has joined #ocaml
ymasory_ has joined #ocaml
hto has joined #ocaml
vivanov has joined #ocaml
smerz has joined #ocaml
DimitryKakadu has quit [Remote host closed the connection]
zorun has joined #ocaml
ikaros has joined #ocaml
Smerdyakov has joined #ocaml
ymasory_ has quit [Quit: Leaving]
sku has quit [Remote host closed the connection]
Oejet has quit [Quit: Leaving.]
Oejet has joined #ocaml
sku has joined #ocaml
SoftTimur has joined #ocaml
ftrvxmtrx has quit [Read error: Connection reset by peer]
_andre has quit [Quit: leaving]
hto has quit [Read error: Operation timed out]
mnabil has quit [Ping timeout: 263 seconds]
sku has quit [Remote host closed the connection]
ftrvxmtrx has joined #ocaml
sku has joined #ocaml
jderque has quit [Quit: leaving]
edwin has quit [Remote host closed the connection]
mnabil has joined #ocaml
SoftTimur has quit [Quit: Leaving.]
lopex has joined #ocaml
elehack has quit [Quit: Farewell, programs.]
avsm has joined #ocaml
hto has joined #ocaml
sku has quit [Remote host closed the connection]
sku has joined #ocaml
Poet_ has quit [Quit: Download IceChat at www.icechat.net]
sku has quit [Quit: Leaving]
eikke has quit [Ping timeout: 252 seconds]
Oejet has left #ocaml []
crystal-cola has quit [Quit: leaving]
everyonemines has joined #ocaml
<everyonemines> I'm trying to install PCRE on OS X but I get
<everyonemines> ocamlfind: dllpcre_stubs.so: No such file or directory
<everyonemines> so I changed makefile.config to static linking
<everyonemines> but now I get
<everyonemines> ocamlfind: libpcre_stubs.a: No such file or directory
<hcarty> everyonemines: You best bet may be to email the author, Markus Mottl - http://www.ocaml.info/
<hcarty> everyonemines: There is often a lack of OSX folks around here
<everyonemines> Mostly linux?
<hcarty> Yes
<everyonemines> The way apple is going I might end up going to linux.
<everyonemines> It's improved, I understand.
<Smerdyakov> Linux is great.
<Smerdyakov> I rarely have any problems with it.
<hcarty> And good
<everyonemines> OS X has its advantages, though
<Smerdyakov> Apple is pure evil, though.
<Smerdyakov> With those programming language restrictions for iPhone apps
<hcarty> everyonemines: (begin joking flame)No it doesn't!(end joking flame)
<everyonemines> Well, I think Apple did a good job on the standard applications, like Mail. Yeah yeah, I know, I should be using a command line email program.
<avsm> what version of ocaml, what version of macos x?
<everyonemines> A lot of it, though, is because of the OS X developer community, which came from earlier mac versions.
<everyonemines> avsm: 10.5 and 3.12
<avsm> intel or ppc?
<everyonemines> seriously? intel.
<everyonemines> I don't think you can run 10.5 on ppc.
<avsm> of course you can
<everyonemines> huh
<avsm> uname -m ? is it x86_32 or 64
<avsm> it works fine for me out of the box
<avsm> click-2:pcre-ocaml-release-6.2.2 avsm$ make
<avsm> click-2:pcre-ocaml-release-6.2.2 avsm$ find . | grep so
<avsm> ./lib/dllpcre_stubs.so
<brendan> fink's ocaml-pcre should work too
<avsm> yup, and macports
ulfdoz has quit [Ping timeout: 252 seconds]
<everyonemines> avsm: I don't grep that file.
<everyonemines> Where did you dl from?
<everyonemines> ...do I have the windows version or something?
<everyonemines> I entered find . | grep so and get nothing.
<everyonemines> Just redownloaded from author's site.
<everyonemines> I don't know what's up with that.
avsm has quit [Quit: Leaving.]
brendan has left #ocaml []
brendan has joined #ocaml
mnabil has quit [Ping timeout: 240 seconds]
andreas has quit [Ping timeout: 240 seconds]
ikaros has quit [Quit: Leave the magic to Houdini]
mnabil has joined #ocaml
Smerdyakov has quit [Quit: Leaving]
philed has quit [Ping timeout: 246 seconds]
<everyonemines> Now I messed something up with regular expressions, and even the library examples aren't working.
<everyonemines> Str.split_delim (regexp " ") " abc "
<everyonemines> Error: Unbound value regexp
<hcarty> everyonemines: Str.split_delim (Str.regexp " ") " abc "
<everyonemines> ahhhh
<hcarty> Or Str.(split_delim (regexp " ") " abc ") if you want to play with 3.12 syntax
<everyonemines> I had opened it before and didn't realize.
impy has quit [Quit: impy]
wuj has joined #ocaml
<hcarty> everyonemines: The toplevel can bite you that way :-)
<everyonemines> To be honest the documentation could probably be clearer.
<hcarty> everyonemines: Which parts?
<hcarty> OCaml's documentation is definitely lacking in some areas, but it's excellent in others
<hcarty> The distinction is probably not well advertised
<everyonemines> Well, in the library reference, examples would be more helpful than the -> 'a array -> unit type stuff.
<everyonemines> Most of the functions have no examples.
<hcarty> I agree that examples are useful, but the types provide a huge amount of information.
<hcarty> More than a set of examples would
<hcarty> They take a bit more to get used to
<hcarty> than example code
<hcarty> But once you know what they mean the type signature of a function is a useful and concise reference.
<hcarty> All that said, the official OCaml distribution is sadly lacking in example code.
<everyonemines> It could be on a separate page, or you could have links for pages for functions.
<hcarty> My guess is that part of the reason there are few/no examples in the documentation is that users may be expected to understand the concepts behind the functions already
<everyonemines> No I get the concepts, but which input is which is hard for me to figure out from the signature.
<hcarty> everyonemines: Is there a function in particular you have in mind?
<everyonemines> no
<everyonemines> I'm not stuck on anything, it's just annoying.
Amorphous has quit [Ping timeout: 260 seconds]
<everyonemines> I think a lot of people would get stuck, though.
<hcarty> I'm used to it at this point, but I actually filed a bug report about this when I first started out with OCaml :-)
<hcarty> Most, if not all, of the stdlib functions which have potentially mismatched arguments have short examples of how to call them
<everyonemines> The other day I wanted to know how to find the process directory. Well you want Sys.argv but how should you know that?
<everyonemines> "The command line arguments given to the process" isn't very clear.
<hcarty> That is probably a C holdover
<everyonemines> The way you add libraries in the compiler isn't very intuitive either. It would be better to automatically detect #load statements, wouldn't it?
<hcarty> Not necessarily
<hcarty> You can load different implementations of a library with the same module names, for example.
<hcarty> And ocamlfind/findlib provides a nice way to load or link libraries
<everyonemines> Yeah, but you need to know to look for them and then download and compile them.
<hcarty> Batteries does a lot to help with discoverability of functions
<hcarty> You could use GODI, which builds OCaml + libraries
<hcarty> Beyond that, there is the oasis-db project (currently under heavy development) which will give the OCaml world a CPAN-like infrastructure
impy has joined #ocaml
<hcarty> The OCaml community is smaller than the communities around many other languages (Perl, Python, Haskell)
<everyonemines> Yeah, I realize that some of this is just # of developers available.
<everyonemines> In terms of stuff / size ocaml is impressive.
<everyonemines> There's also another benefit to size, which is that google will bring up people with your question.
<hcarty> The combination of Batteries and ocamlfind and oasis-db will hopefully help lower the initial levels of frustration people feel with the language.
<everyonemines> ...I don't think newcomers will be installing stuff like that. Or are you saying it will be available prepackaged?
<hcarty> Prepackaged for Debian and Fedora at least :-)
<everyonemines> Anyway, I originally mentioned example code for the library functions. That doesn't take so long to make does it?
<hcarty> Other operating systems would be up to volunteers using those OSs
<hcarty> It doesn't take long to make, but people have other work to do
<hcarty> There are several tutorials available
<hcarty> And libraries like Batteries which extend the standard library and come with a large set of examples.
<hcarty> The language authors don't have a lot of time to spend on OCaml so their focus tends to be on improving and extending the compiler itself.
Amorphous has joined #ocaml
<everyonemines> well, it is a nice compiler
<everyonemines> It also seems like there's some fragmentation, between SML, ocaml, F#
<everyonemines> I'm not sure there's much point to that division.
<hcarty> SML is from a different heritage, as I understand it. OCaml and SML share a common theoretical parent somewhere in their history, but they are and (always?) have been independent languages.
<hcarty> F# is Microsoft's "embrace and 'extend'" take on OCaml
<everyonemines> yeah, I know how MS is
<hcarty> The SML world has a lot of different implementations, but at this point OCaml only has one implementation.
<hcarty> From the outside, SML and OCaml look interchangable. From the inside, they look slightly less so.
<hcarty> everyonemines: Have fun with OCaml, however you end up going about it.
<everyonemines> what do you do with it?
vivanov has quit [Ping timeout: 264 seconds]
dnolen has joined #ocaml
wuj has quit [Ping timeout: 260 seconds]
lamawithonel has quit [Read error: Connection reset by peer]
joewilliams is now known as joewilliams_away
joewilliams_away is now known as joewilliams
wuj has joined #ocaml
lamawithonel has joined #ocaml
smerz has quit [Quit: Ex-Chat]
wuj has quit [Ping timeout: 240 seconds]
philtor has joined #ocaml