caligula__ has quit [Read error: 110 (Connection timed out)]
onigiri has quit []
onigiri has joined #ocaml
rcloud has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: 145 (Connection timed out)]
ulfdoz_ is now known as ulfdoz
<Ringo48>
is there really no function to return the number of elements in a Map?
<thelema>
yes, there is not in the stdlib.
<thelema>
it's pretty trivial to fold across the map and count elements
orbitz has joined #ocaml
orbitz has quit [No buffer space available]
<julm>
Commit on OCAML's CVS brings new syntax :
<julm>
"As discussed at the latest consortium meeting: Syntactic sugar {x} for {x=x} in record expressions and patterns. Syntax { lbl=pat; _ } to mark record patterns where the user explicitly wants not to list all labels. Warning (activated by E, the fragile match warning) to signal record patterns without '; _' that fail to list all labels."
rcloud has quit ["Leaving"]
<Ringo48>
eh, just as easy to count them when I add them
palomer has quit [Read error: 110 (Connection timed out)]
onigiri has quit []
orbitz has joined #ocaml
orbitz has quit [Read error: 148 (No route to host)]
orbitz has joined #ocaml
orbitz has quit [Read error: 110 (Connection timed out)]
orbitz has joined #ocaml
julm has quit [Read error: 104 (Connection reset by peer)]
verte has joined #ocaml
julm has joined #ocaml
tmaeda is now known as tmaedaZ
orbitz has quit [Read error: 110 (Connection timed out)]
bzzbzz has joined #ocaml
orbitz has joined #ocaml
tmaedaZ is now known as tmaeda
caligula_ has quit [Read error: 54 (Connection reset by peer)]
caligula_ has joined #ocaml
orbitz has quit [Read error: 113 (No route to host)]
sporkmonger has quit []
julm has quit [Read error: 104 (Connection reset by peer)]
orbitz has joined #ocaml
julm has joined #ocaml
|Jedai| has quit [Read error: 113 (No route to host)]
orbitz_ has joined #ocaml
orbitz_ has quit [Read error: 60 (Operation timed out)]
orbitz_ has joined #ocaml
orbitz has quit [Read error: 110 (Connection timed out)]
orbitz_ has quit [Read error: 60 (Operation timed out)]
julm_ has joined #ocaml
julm has quit [Read error: 104 (Connection reset by peer)]
julm has joined #ocaml
julm_ has quit [Read error: 104 (Connection reset by peer)]
orbitz has joined #ocaml
orbitz has quit [Read error: 60 (Operation timed out)]
mattam has quit [Read error: 104 (Connection reset by peer)]
<Ringo48>
is it considered bad style to use exceptions to break out of iteration over a list?
<Ringo48>
I vaguely remember seeing it done in an ocaml tutorial I was reading, but can't remember if they said it was good or bad to do
orbitz has quit [Read error: 60 (Operation timed out)]
orbitz has joined #ocaml
_JusSx_ has joined #ocaml
orbitz_ has quit [No buffer space available]
verte has quit ["~~~ Crash in JIT!"]
<_JusSx_>
I would like to get an example of how to use Exlib's OptParse module. Do you know where can i find it?
verte has joined #ocaml
orbitz has quit [No buffer space available]
orbitz has joined #ocaml
orbitz has quit [Read error: 60 (Operation timed out)]
orbitz has joined #ocaml
orbitz has quit [Read error: 60 (Operation timed out)]
kaustuv_` has joined #ocaml
orbitz has joined #ocaml
orbitz has quit [Read error: 60 (Operation timed out)]
orbitz has joined #ocaml
julm__ has joined #ocaml
kaustuv_ has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
orbitz has quit [Read error: 113 (No route to host)]
orbitz has joined #ocaml
orbitz has quit [Read error: 60 (Operation timed out)]
orbitz has joined #ocaml
julm_ has quit [Read error: 110 (Connection timed out)]
julm__ has quit [Read error: 104 (Connection reset by peer)]
julm___ has joined #ocaml
orbitz_ has joined #ocaml
orbitz_ has quit [Read error: 145 (Connection timed out)]
orbitz_ has joined #ocaml
orbitz has quit [Read error: 113 (No route to host)]
orbitz has joined #ocaml
orbitz__ has joined #ocaml
itewsh has quit ["Quitte"]
orbitz_ has quit [Read error: 113 (No route to host)]
BiDOrD has quit [Read error: 110 (Connection timed out)]
orbitz_ has joined #ocaml
BiDOrD has joined #ocaml
orbitz has quit [Read error: 110 (Connection timed out)]
orbitz__ has quit [Connection timed out]
orbitz_ has quit [Read error: 113 (No route to host)]
orbitz has joined #ocaml
orbitz_ has joined #ocaml
orbitz__ has joined #ocaml
julm_ has joined #ocaml
julm___ has quit [Read error: 54 (Connection reset by peer)]
orbitz has quit [Read error: 113 (No route to host)]
orbitz has joined #ocaml
knightrage is now known as knight\zzz
orbitz has quit [Read error: 104 (Connection reset by peer)]
orbitz has joined #ocaml
orbitz_ has quit [Read error: 110 (Connection timed out)]
orbitz has quit [Read error: 60 (Operation timed out)]
orbitz has joined #ocaml
orbitz__ has quit [Read error: 113 (No route to host)]
olegfink has quit [Read error: 110 (Connection timed out)]
onigiri has joined #ocaml
mihamina has quit ["Leaving."]
orbitz has quit [Read error: 110 (Connection timed out)]
orbitz has joined #ocaml
orbitz has quit [Read error: 60 (Operation timed out)]
orbitz has joined #ocaml
orbitz has quit [Read error: 60 (Operation timed out)]
orbitz_ has joined #ocaml
orbitz has joined #ocaml
orbitz_ has quit [Read error: 60 (Operation timed out)]
olegfink has joined #ocaml
orbitz_ has joined #ocaml
onigiri_ has joined #ocaml
orbitz has quit [Read error: 110 (Connection timed out)]
onigiri has quit [Read error: 60 (Operation timed out)]
onigiri_ is now known as onigiri
hkBst has joined #ocaml
dyaso__ has quit [Read error: 110 (Connection timed out)]
orbitz_ has quit [Read error: 110 (Connection timed out)]
orbitz has joined #ocaml
Asmadeus_ has joined #ocaml
Asmadeus has quit [Read error: 110 (Connection timed out)]
orbitz has quit [Read error: 110 (Connection timed out)]
orbitz has joined #ocaml
Smerdyakov has joined #ocaml
Pepe_ has quit [Remote closed the connection]
orbitz_ has joined #ocaml
orbitz__ has joined #ocaml
orbitz has quit [Read error: 110 (Connection timed out)]
orbitz has joined #ocaml
orbitz_ has quit [Read error: 110 (Connection timed out)]
orbitz__ has quit [Read error: 60 (Operation timed out)]
orbitz_ has joined #ocaml
orbitz_ has quit [Read error: 145 (Connection timed out)]
orbitz has quit [Read error: 113 (No route to host)]
orbitz has joined #ocaml
orbitz has quit [Read error: 60 (Operation timed out)]
orbitz has joined #ocaml
orbitz has quit [Read error: 113 (No route to host)]
Beelsebob has joined #ocaml
<Beelsebob>
Hi, I'm a noob to ocaml, but am very familiar with Haskell, I'm trying to figure out how to partially apply an infix operator in ocaml, is it possible?
<mfp>
Beelsebob: let add_one = (+) 1
<Beelsebob>
ah duh
<Beelsebob>
I should have thought that
<thelema>
it's not too obvious. That's why we're here
<mfp>
indeed, you can only find it by accident if you don't know that (operator) is the function associated to the operator
<olegfink>
...and also that (*) is comment begin -- right paren :-)
Asmadeus_ is now known as Asmadeus
<Beelsebob>
how does one inform the interpreter of the need to look at a .mli file? I'm getting told 'Error: Unbound module type Test', do I just add it to the interpreter arguments?
<thelema>
you have a test.ml file?
<Beelsebob>
Test.mli
<thelema>
no .ml?
<thelema>
mli files aren't self-sufficient.
<Beelsebob>
well, my .ml is called Test1.ml
<Beelsebob>
and defines a module based on a signature in Test.mli
<thelema>
module signatures are kinda like interfaces, but don't treat them like that in the default case.
Amorphous has quit [Read error: 104 (Connection reset by peer)]
<thelema>
For most modules, they're just function/value hiding.
<thelema>
if you have test1.ml and test.mli, the compiler won't know they're related.
<thelema>
and you can't do anything with a test.mli file without a test.ml file (even if you're just defining types)
<thelema>
modules are what you work with, and they're defined in .ml files
orbitz has joined #ocaml
<Beelsebob>
so Test should be defined in a .ml too, even though it's just a signature?
<thelema>
mli files are almost an afterthoughth
<thelema>
*afterthought
<thelema>
modules aren't signatures. even if the syntax for types is the same in both.
<Beelsebob>
no, but Test is a signature
<thelema>
you need a module to do something. signatures are module types, and just like value types, you don't do anything with them, you do things with values of that type.
<Beelsebob>
yes, I got that, as I said, I have a signature in Test.mli, I have a module implementing it in Test1.ml, how do I inform the interpretter that the two are related?
<thelema>
If you want to define a module signature for only one module, put the signature in foo.mli and the module in foo.ml, and ocaml will do the right thing
<Beelsebob>
but it doesn't
<thelema>
if you want to define a module signature that'll apply to many modules, you have to define it within both the ml and mli of some other module as [module type Foo = sig ... end]
<Beelsebob>
Error: unbound module type Test
<thelema>
test != test1
<Beelsebob>
even if I name the latter Test.ml
<thelema>
as I said, foo.ml and foo.mli, not foo.ml and foo.mli
<thelema>
as I said, foo.ml and foo.mli, not foo1.ml and foo.mli
<thelema>
are you referencing your signature from within Test?
<Beelsebob>
module Test : Test = struct ....... end
<flux>
_jussx_, that looks ok, but I think you can shorten some of the code by using functions from StdOpt
<flux>
something like let option_database = OptParse.StdOpt.str_option ~metavar:"filename" ~default:"database.db"
<Beelsebob>
how does one extract a value from a record? I expected just to be able to use the field name as though it were a function, but that doesn't work.
<flux>
beelsebob, type t = { r : int } let mk_t z = { r = z } let get t = t.r
<Beelsebob>
ah, k
<flux>
beelsebob, note that if the record is defined in another module, the full syntax is
onigiri_ has joined #ocaml
julm_ has quit [Remote closed the connection]
<flux>
beelsebob, module M = struct type t = { r : int } end let mk_t z = { M.r = z } let get t = t.M.r
julm_ has joined #ocaml
<flux>
(only the first record in the pattern needs to be with full path)
albacker has joined #ocaml
<_JusSx_>
flux: well I didn't find OptParse.StdOpt.str_option... I have just read it again and it's ok for that code
<flux>
_jussx_, I just browse the file optParse.mli, one can easily find all functions
<_JusSx_>
flux> thanks
<Beelsebob>
is there a successor function for characters hidden somewhere?
<flux>
I don't think so
onigiri has quit [Read error: 60 (Operation timed out)]
onigiri_ is now known as onigiri
<flux>
you can somewhat reliably find such functions with grep 'char -> char' `ocamlc -where`/*.mli
<flux>
(cmigrep is more accurate but more difficult to use)
albacker has quit ["Leaving"]
<Beelsebob>
can data constructors not be partially applied?
<flux>
no, they must be applied in full
slash_ has joined #ocaml
Yoric[DT] has joined #ocaml
<_JusSx_>
I would like to create new print function that will print if a condition is true and won't if that condition is false. can you help me
<Beelsebob>
how does one convert a string into a string into a char list, I've found ExtString.String.explode, but that doesn't seem to be on my system
<Beelsebob>
List.of_enum (String.enum x) also seems to be suggested, but List.of_enum doesn't exist either
<Smerdyakov>
Are you saying you don't know how to implement such a function using just the standard library?
<Beelsebob>
I'm saying I'd be really surprised if said function didn't already exist
<Smerdyakov>
I think it's not in the standard library.
<Smerdyakov>
OCaml has a pretty minimal standard library.
<Beelsebob>
okay
<Smerdyakov>
Converting to a list is probably a pretty inefficient way of doing what you want to do.
<Smerdyakov>
In SML, at least, there are the usual higher-order functions defined directly over strings.
<flux>
maybe inefficient, but useful :)
<flux>
smerdyakov, how about pattern matching?
<Smerdyakov>
flux, only on string constants
<flux>
beelsebob, there is the batteries project, which builds on other libraries, to provide a larger 'standard' library
<flux>
beelsebob, one of the libraries it builds on is extlib..
<Beelsebob>
ah okay, it's another part of batteries
<Beelsebob>
fair enough
kaustuv_` has quit [Read error: 110 (Connection timed out)]
<Beelsebob>
ta, had already done something slightly different, but equally working
<Smerdyakov>
How on Earth did "ta" end up being used to abbreviate "thank you," anyway?
<albacker>
.t.hanky.a. :p
<Smerdyakov>
UNACCEPTABLE.
<flux>
:)
rcloud has joined #ocaml
Mr_Awesome has quit [Remote closed the connection]
julm_ has quit [Remote closed the connection]
julm_ has joined #ocaml
BiDOrD has quit []
_zack has joined #ocaml
<flux>
hmph, bluestorm isn't around. anyone else up for writing a camlp4 extension that would decorate all expressions with a call to function with current file name, line and column number?-)
Demitar has quit ["Ex-Chat"]
julm_ has quit [Read error: 104 (Connection reset by peer)]
julm_ has joined #ocaml
jeddhaberstro has joined #ocaml
julm__ has joined #ocaml
julm_ has quit [Read error: 131 (Connection reset by peer)]
julm__ is now known as julm
loltrader has joined #ocaml
* qwr
also thinks that char list is quite inefficient data structure
<flux>
performance doesn't always matter
<flux>
if it did, List.assoc wouldn't exist..
Mr_Awesome has joined #ocaml
ski_ has quit ["Lost terminal"]
verte has quit ["~~~ Crash in JIT!"]
Yoric[DT] has quit ["Ex-Chat"]
rcloud has quit [Remote closed the connection]
ski_ has joined #ocaml
Anarchos has quit ["Vision[0.9.7-H-090423]: i've been blurred!"]
tmaeda is now known as tmaedaZ
rcloud has joined #ocaml
Demitar has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Client Quit]
sporkmonger has joined #ocaml
f[x] has quit [Read error: 110 (Connection timed out)]
philtor has joined #ocaml
fschwidom has joined #ocaml
onigiri has quit [Read error: 105 (No buffer space available)]
Submarine has joined #ocaml
Yoric[DT] has joined #ocaml
ttamttam has joined #ocaml
knight\zzz is now known as knightrage
smimou has joined #ocaml
derdon has joined #ocaml
julm_ has joined #ocaml
julm has quit [Read error: 145 (Connection timed out)]
Alpounet has joined #ocaml
Alpounet has quit [Read error: 54 (Connection reset by peer)]
Ched has joined #ocaml
sporkmonger has quit [Read error: 104 (Connection reset by peer)]
Submarine has quit [Read error: 110 (Connection timed out)]
julm_ is now known as julm
Ched has quit ["Ex-Chat"]
Ched has joined #ocaml
Anarchos has joined #ocaml
<_JusSx_>
I'm trying to compile with ocaml -c (not linking) a file, main.ml, which depends on extlib. I run ocamlc -c main.ml -I/usr/lib/ocaml/site-packages/extlib/ but I got this error ile "main.ml", line 24, characters 4-29:
<_JusSx_>
Unbound value OptParse.Opt.value_option
<thelema>
does /usr/lib/ocaml/site-packages/extlib contain a file optParse.ml?
<_JusSx_>
thelema: no optParse.cmi
<_JusSx_>
and optParse.mli
<thelema>
ok. Just to make sure, site-packages is the right name, not site-lib?
<julm>
_JusSx_: put main.ml at the end
<_JusSx_>
ok i copied all .cmi files of site-packages in my current dir and now with ocamlc -c main.ml works
<_JusSx_>
so the problem is -I option
<julm>
it is position-sensitive indeed
dyaso__ has joined #ocaml
Beelsebob has left #ocaml []
<_JusSx_>
ocamlc read first current dir then default and then -I dir
dyaso__ has quit [Remote closed the connection]
<derdon>
I'm interested in OCaml for a few days, so I want to find out more about this language. What are the cons of it (I know already the pros)?
ttamttam has quit ["Leaving."]
jeddhaberstro has quit [Client Quit]
<julm>
derdon: I would say: no parallelism, minimal standard library, not a lot of bindings, and a preprocessor (camlp4) hard to use
<derdon>
julm: can you tell me more about the preprocessor? I am only familiar with interpreting languages
thrasibule_ has joined #ocaml
thrasibule has quit [Read error: 104 (Connection reset by peer)]
<julm>
well, OCAML's syntax being to as simple as, say, Lisp's, it make things harder; plus I much to often need to directly go to camlp4's sources to understand how to do what I want to do..
<julm>
-being to+being not
<julm>
it makes*
Snark has quit ["Ex-Chat"]
<derdon>
is camlp4 the name of OCaml's compiler?
<julm>
nope
<rcloud>
no parallelism is (for me) the worst part of the language
<julm>
camlp4 is a preprocessor
<julm>
ocamlc/ocamlopt are OCAML's compilers
* derdon
will ask wikipedia and google what a preprocessor really is
<rcloud>
well it has process level parallelism...
<julm>
derdon: something wich changes a source file before you feed it to the compiler
<derdon>
julm: okay. when do I need it for example?
Anarchos has quit ["Vision[0.9.7-H-090423]: i've been blurred!"]
<mfp>
derdon: that's a particularly simple one, but there are larger extensions like bitstring ("Erlang-style bitstrings and matching over bitstrings"), pa_do (delimited overloading) or sexplib (automatic generation of S-Exp serializers)
<mfp>
OCaml ships with a few standard extensions (from the top of my mind, list comprehensions, map/fold generators, cpp-like macros)
<derdon>
I started with OCaml yesterday, so I know nearly nothing about it. So first of all, the only thing I have to know now is that I can influence the parser with camlp4
<mfp>
camlp4 is an advanced topic
<mfp>
if you want to write your own syntax extensions, that is
fschwidom has quit [Remote closed the connection]
<mfp>
using existing ones is fairly easy, usually a matter of giving the -pp "camlp4o pa_some_extension.cmo" option to ocamlc/ocamlopt
albacker has quit ["Leaving"]
<derdon>
oh, that's good
<julm>
derdon: however one may be reluctant to pass through the camlp4 machinery (which makes things slower), to only do simple things (like what a copy/paste may solve)
<derdon>
yeah, I don't think that I wanna change OCaml's syntax
<derdon>
``alias ocaml_shell='rlwrap ocaml'`` is a really good idea, btw
derdon has quit []
hkBst has quit [Remote closed the connection]
julm_ has joined #ocaml
julm has quit [Read error: 104 (Connection reset by peer)]
smimou has quit ["bli"]
Ppjet6 has joined #ocaml
julm has joined #ocaml
qwr has quit [Remote closed the connection]
Ppjet6 is now known as Pepe_
qwr has joined #ocaml
julm_ has quit [Read error: 60 (Operation timed out)]
slash_ has quit [Client Quit]
thrasibule_ has quit [Read error: 60 (Operation timed out)]
thrasibule has joined #ocaml
shazam has joined #ocaml
shazam is now known as palomer
rcloud has quit [Read error: 104 (Connection reset by peer)]