<MaskRay>
maybe i need `let rec sep = ... and (ll,l',lr) = go .. and (rl,r',rr) = go ..'
<MaskRay>
however, the non-variable let binding is forbidden
<MaskRay>
looking forward to know how to circumvent this limitation: let rec (ll,l',lr) = ...
<larsrh>
When I define a `module type' in an .mli file and create a module of that type in a .ml file, is there some possibility to avoid duplication of already defined types?
<larsrh>
e.g. if I have an alias in the .mli file, it seems that I have to repeat that in the implementation
<flux>
I think it's possible with the new signature extraction thingy to write the common stuff into a separate .ml-file and include the signature of that in the .mli file and the implementation in the .ml-file, but that's perhaps a bit heavy
<adrien>
hmm? what's this?
<adrien>
I'm very interested into that because I have a .ml, a .mli and a pack's .mli; and they all have the same stuff
Submarine has quit [Ping timeout: 240 seconds]
rwmjones has quit [Ping timeout: 252 seconds]
Qrntzz has quit [Read error: Operation timed out]
Qrntzz has joined #ocaml
avsm has joined #ocaml
rwmjones has joined #ocaml
Tobu has quit [Read error: Operation timed out]
Tobu has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
cdidd has joined #ocaml
_andre has joined #ocaml
Tobu has joined #ocaml
Tobu has quit [Ping timeout: 252 seconds]
Tobu has joined #ocaml
Tobu_ has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
Tobu_ has quit [Read error: Connection reset by peer]
Tobu has joined #ocaml
<larsrh>
flux: so no "canonical" solution then?
Tobu has quit [Ping timeout: 272 seconds]
letrec has joined #ocaml
Tobu has joined #ocaml
antegallya has quit [Quit: Leaving.]
Tobu has quit [Ping timeout: 252 seconds]
Tobu has joined #ocaml
Qrntzz has quit [Changing host]
Qrntzz has joined #ocaml
Qrntzz has quit [Changing host]
Qrntzz has joined #ocaml
<MaskRay>
# #load "pa_comprehension.cmo";;
<MaskRay>
Error: Reference to undefined global `Camlp4'
<adrien>
#camlp4;;
<adrien>
I never know if a require in the META file wouldn't be enough
<MaskRay>
i have no camlp4 installed but a similar package called camlp5
<adrien>
camlp4 comes with ocaml itself
asmanur3 has quit [Quit: WeeChat 0.3.6]
<MaskRay>
then how to load it?
<MaskRay>
frustrated
<adrien>
12:54 adrien : #camlp4;;
<adrien>
:-)
<MaskRay>
Unknown directive `camlp4'.
* MaskRay
just wants to use list comprehension
<adrien>
oh, sorry; I was thinking you already had topfind in effect
<adrien>
#use "topfind";;
<adrien>
#camlp4;;
<adrien>
#require "pa_comprehesion";;
<adrien>
(assuming it is how it is named)
<adrien>
running "ocamlfind list | grep -i comprehension" should show the exact name
<MaskRay>
#require "batteries.pa_comprehension";; does the trick
<adrien>
:-)
<MaskRay>
what a nightmare to use libraries in ocaml ...
<adrien>
it can be a bit try-and-see with libraries names but once you have the names, you're good
<MaskRay>
why doen't the well-designed lovely camel language combined with a full-fledged and amicable libraries
<ousado>
syntax extensions and libraries are not really the same thing
Tobu has quit [Ping timeout: 272 seconds]
<adrien>
MaskRay: it also has to do with me not knowing which exact package you wanted to use and not being terribly used to camlp4
Tobu has joined #ocaml
<MaskRay>
in hasekll, enabling an extension or loading an library is only one line
avsm has quit [Quit: Leaving.]
<MaskRay>
quite a few high-order functions are missing from the standard library, e.g. uncurry(though this is included in batteries) curry zipWith
<adrien>
the stdlib is meant to be light; that's why
<MaskRay>
why does List.combine report Invalid_argument provided the two lists are not equally long
<MaskRay>
is there a counterpart of haskell's zipWith (discarding redundant elements in the longer list)
<adrien>
because it needs to match each element in the first list with an element from the second list
<ousado>
how does haskell know they are redundant?
<adrien>
"redundant" or after the length of the first list?
<MaskRay>
yes, when the shorter list's elements are exhausted
<adrien>
I don't know if there's a builtin or a library providing it; let zip_with a b = let rec aux accu a b = match (a, b) with | h1 :: q1, h2 :: q2 -> aux ((h1, h2) :: accu) q1 q2 | _ -> List.rev accu in aux [] a b
<adrien>
untested but it type-checks
<MaskRay>
zipWith will continuously pair heads from l1, l2 until one of l1,l2 is []
<adrien>
ah, Ctrl+l to redraw syntax highlighting in vim is pretty nice ;p
<MaskRay>
this is only an illustration of `it just works in ocaml, though not conveniently'
Gustou has joined #ocaml
<adrien>
as far as I'm concerned, I find it much harder to remember a big list of readily-usable simple functions than to rewrite them when I need them
<adrien>
it's also a difference in opinions
Submarine has joined #ocaml
<MaskRay>
i'll search via hoogle when i need a general polymorphic function. this search engine will give functions according to your input type signatures
<hcarty>
adrien: Is ctrl+l a built-in, or something added to vim?
letrec has quit [Remote host closed the connection]
avsm has joined #ocaml
avsm has quit [Client Quit]
fantasti` has joined #ocaml
<adrien>
hcarty: built-in
fantasticsid has quit [Ping timeout: 245 seconds]
ocp has joined #ocaml
letrec has joined #ocaml
emias_ is now known as emias
<thelema>
flux: batteries has *three* lazy lists: BatSeq, BatLazyList, BatEnum
emias has quit [Quit: Changing server]
emias has joined #ocaml
ocp has quit [Ping timeout: 255 seconds]
groovy2shoes has joined #ocaml
<hcarty>
adrien: That's pretty cool. I hope I remember that the next time code folding + OCaml source highlighting breaks for me.
<adrien>
in ten minutes? :P
<hcarty>
adrien: :-)
<hcarty>
adrien: It tends to hold together for me in shorter source files, but for anything longer than a few hundred lines... yes, it's going to happen quickly.
<adrien>
hcarty: well, the setting to increase the number of lines used for highlighting has been pointed out on the caml-list
groovy2shoes has quit [Quit: Computer has gone to sleep]
groovy2shoes has joined #ocaml
ankit9 has quit [Quit: Leaving]
groovy2shoes has quit [Quit: Computer has gone to sleep]
<adrien>
am I the only one annoyed that vim and the ocaml plugin word wraps with long strings? like I have a 100 char string, it'll cut it at the end of the line and will continue on the next line, _with_ an indentation
<thelema>
adrien: what are you doing with such long strings?
<adrien>
long texts :P
<thelema>
apparently...
<adrien>
in C, I would have used the string-litterals syntax: "foooo bar " "baz, wee" "eee"
<adrien>
I'm not sure what to use in ocaml; using (^) seems ugly
fantasti` has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<thelema>
adrien: ropes concatenate very well
<adrien>
well, for this thing, it's really hand-written text for descriptions; I'd like the full string to exist at compilation ='(
<thelema>
you could use a string list
<adrien>
I sometimes do that with String.concat but it doesn't feel very nice either; my current strings are maybe 40 to 140 chars but only start at the 20th column
<thelema>
?? concat? why concat them?
<adrien>
because I need to ;-)
<thelema>
you can't work with them as a list?
<adrien>
description texts in graphical interfaces ='(
<thelema>
ah well... I guess vim needs better string wrapping
milosn has quit [Read error: Connection reset by peer]
<bnwr>
adrien: I guess you can set formatoptions and change the ocaml plugin to make strings comments
<adrien>
hmmm, it also word wraps comments iirc
<bnwr>
yeah, it would be good to have a "string literal" category in formatoptions
milosn has joined #ocaml
mcclurmc_ has quit [Excess Flood]
mcclurmc has joined #ocaml
groovy2shoes has joined #ocaml
<adrien>
gildor: btw, oasis has made a friend who is running netbsd happy :-)
groovy2shoes has quit [Quit: Computer has gone to sleep]
trhodes has joined #ocaml
<bobry>
ocaml-bitstring's bug tracker is so ocamlish; a bug in Makefile spotted two years ago, patch attached, still not merged into upstream
emmanuelux has joined #ocaml
<thelema>
bobry: poke rwmjones; he fixed another bug recently.
<thelema>
bobry: the bitstring mailing list is a good place to get his attention. Although I think he does come out of hiding here occasionally
<bobry>
:)
<bobry>
okay, thanks, thelema
trhodes has quit [Quit: Coyote finally caught me]
avsm has joined #ocaml
<f[x]>
let the patch mature - why so hurry?
<thelema>
f[x]: lol
<f[x]>
every project should have a dusty cellar with good old patches sitting around
<thelema>
ocaml has plenty of old issues in its tracker
<f[x]>
yep, that's where we should draw our inspiration and strength in beliefs from
<thelema>
:)
<adrien>
unfortunately, the patches in ocaml's cellar have been disappearing quite quickly recently =/
<adrien>
this is definitely not sustainable and bugs might soon be an endangered species =/
<thelema>
yes, I've been pleasantly surprised at the effect the recent flaming had.
<adrien>
and the new commiters :-)
oriba has joined #ocaml
letrec has quit [Ping timeout: 240 seconds]
letrec has joined #ocaml
xorAxAx has joined #ocaml
<xorAxAx>
hi, given a file A where type x = ...; and another file with type y = A.x -- how can i pass values of type y to functions accepting values of type x?
Cyanure has quit [Ping timeout: 252 seconds]
<xorAxAx>
anybody?
ulfdoz has joined #ocaml
<bnwr>
xorAxAx: if the type equality is exposed, there shouldn't be aby problem
<xorAxAx>
bnwr: how can i expose it?
<bnwr>
(exposed in the interface of the module that defines type y)
<bnwr>
if not, you can define a y_of_x function
<bnwr>
external x_of_y : A.x -> y = "%identity"
antegallya has joined #ocaml
<xorAxAx>
ok, thanks, i just exposed the type equality
<bnwr>
you can expose the equality by putting "type y = A.x" in the .mli file associated to the "other file"
<bnwr>
although you should only expose this equality if it makes sens for the user to know it
<xorAxAx>
my current approach is impure enough, i dont care :)
<xorAxAx>
how can i expose a ref value?
<bnwr>
everything you put in the mli is exposed
<xorAxAx>
ah, val name
<bnwr>
alternatively, not having an mli at all makes all the value accessible
<bnwr>
the mli can only hide things, if it is not here, nothing is hidden
<bnwr>
(if it is there but empty, everything is hidden)
<xorAxAx>
"val varname" is a syntax error in an mli file
<xorAxAx>
how do i expose something without specifying the type?
Submarine has joined #ocaml
<bnwr>
val varname : type
<bnwr>
you can't expose without exposing the type
MaskRay has quit [Quit: leaving]
<bnwr>
if you don't know the type of something, there is no way you can use it, hence you might as well hide it
<bnwr>
maybe what you want to do is expose its type, but have the type abstract
pango has quit [Ping timeout: 245 seconds]
Ralith has quit [Ping timeout: 276 seconds]
pango has joined #ocaml
Ralith has joined #ocaml
ikaros has joined #ocaml
Ralith has quit [Ping timeout: 248 seconds]
ftrvxmtrx has quit [Quit: Leaving]
shawn has quit [Ping timeout: 248 seconds]
silver_ has joined #ocaml
Xizor has joined #ocaml
ocp has joined #ocaml
ocp has quit [Remote host closed the connection]
EmmanuelOga has joined #ocaml
_andre has quit [Ping timeout: 252 seconds]
_andre has joined #ocaml
ulfdoz_ has joined #ocaml
letrec has quit [Ping timeout: 252 seconds]
ulfdoz has quit [Ping timeout: 252 seconds]
ulfdoz_ is now known as ulfdoz
avsm has quit [Quit: Leaving.]
The_third_bug has joined #ocaml
The_third_man has quit [Disconnected by services]
Submarine has quit [Quit: Leaving]
The_third_man has joined #ocaml
jamii has joined #ocaml
_andre has quit [Ping timeout: 272 seconds]
_andre has joined #ocaml
EmmanuelOga has quit [Ping timeout: 244 seconds]
Drup has joined #ocaml
EmmanuelOga has joined #ocaml
dsheets has joined #ocaml
_andre has quit [Ping timeout: 244 seconds]
asdfhjkl has joined #ocaml
_andre has joined #ocaml
idest0 has joined #ocaml
Ralith has joined #ocaml
hockpa2e has joined #ocaml
_andre has quit [Ping timeout: 240 seconds]
_andre has joined #ocaml
oriba has quit [Quit: oriba]
probst has joined #ocaml
iago has joined #ocaml
emmanuelux has quit [Quit: @+]
emmanuelux has joined #ocaml
antegallya has quit [Remote host closed the connection]
The_third_man has quit []
The_third_bug has quit []
iago has quit [Quit: Leaving]
mdelaney has joined #ocaml
probst has left #ocaml []
Ralith has quit [Ping timeout: 260 seconds]
The_third_man has joined #ocaml
Drup has quit [Quit: Leaving.]
zorun has quit [Ping timeout: 252 seconds]
zorun__ has joined #ocaml
antegallya has joined #ocaml
iago has joined #ocaml
<adrien>
shouldn't Bigarray.Array1.map_file allow me to map huge files? mmap() fails with ENOMEM (Cannot allocate memory) for a 160GB file (laptop with 3GB of memory but 64bit)
hockpa2e has quit [Quit: Leaving]
<flux>
adrien, strace it if it comes from the OS?
<ousado>
adrien: "No memory is available, or the process's maximum number of mappings would have been exceeded."
<ousado>
maybe the latter?
<adrien>
flux: strace shows mmap() fails with ENOMEM
<flux>
adrien, good, now it becomes a non-ocaml-issue 8-)
<adrien>
hahaha
<flux>
maybe there are some limits somewhere
<adrien>
maybe not
<adrien>
[ENOMEM] MAP_FIXED was specified, and the range [addr,addr+len) exceeds that allowed for the address space of a process; or, if MAP_FIXED was not specified and there is insufficient room in the address space to effect the mapping.
<flux>
(that can be modified)
<adrien>
so I'm wondering if MAP_FIXED is used or not
<flux>
strace should tell that?
<adrien>
right!
<adrien>
MAP_PRIVATE
<flux>
btw, there was this 16 M string size limit on 32-bit platforms. what was the limit on 64 bit?
<flux>
probably not relevant for mmap, though
<adrien>
much bigger
<adrien>
but it would be a failure from ocaml and not from mmap
silver_ has quit [Remote host closed the connection]
twittard has quit [Quit: twittard]
antegallya has quit [Quit: Leaving.]
antegallya has joined #ocaml
mdelaney has joined #ocaml
_andre has quit [Ping timeout: 240 seconds]
rossberg_ has quit [Ping timeout: 245 seconds]
rossberg_ has joined #ocaml
twittard has joined #ocaml
<adrien>
bah!
<adrien>
I had that line in a loop:
<adrien>
(if i mod 1_000_000_000 = 0 then print_stats ());
<adrien>
i going from 0 to 1_000_000_001
<adrien>
it was making my code take 1 minute 33 seconds instead of 38 seconds
<adrien>
(and that's with a notable initialization time)
Ralith has joined #ocaml
<adrien>
and print_stats takes almost no time; the issue really seems to be i mod 1_000_000_000
<thelema>
modulo is expensive to do 1E9 times
<adrien>
in the loop, I also use a reference, read from a file-backed bigarray, and do a number of tests; I really didn't expect modulo to rank _that_ high
<larsrh>
What can be the reason if I cannot refer to a module from another file?
<larsrh>
even if I compiled the module before the other file
<thelema>
larsrh: no .cmi for that other file, include directory, wrong name?
<larsrh>
thelema: why do I need an interface for the other file?
<larsrh>
I have an interface and an implementation for my module
<thelema>
you need a compiled interface - if you compile a .ml, the compiler will make a .cmi if you have no .mli
<thelema>
otherwise you need to compile the .mli to get your .cmi
<larsrh>
well, the other file doesn't compile, so the compiler isn't able to generate anything out ouf it
<larsrh>
Do I need to adhere to some naming convention?
<thelema>
then you don't have a .cmi file, so the file using it can't use values from that source.
<thelema>
your filename is the name of your module.
<larsrh>
right
<thelema>
foo.ml defines values in module Foo
<thelema>
don't use - in filenames
<larsrh>
I have module PosDatalog both in posdatalog.ml and posdatalog.mli
<larsrh>
both of these files compile cleanly
<larsrh>
then, in test.ml, I try to "open PosDatalog", which fails
<thelema>
posdatalog.ml defines a module Posdatalog, PosDatalog is defined by posDatalog.ml
<thelema>
capitalization matters for non-initial letters
<thelema>
(except on windows)
<thelema>
(and maybe osx)
<larsrh>
great, thanks
<larsrh>
is camel case even standard practice in OCaml?
<thelema>
I use _ for identifiers and camel case for module names
Snark has quit [Quit: Quitte]
<larsrh>
okay, next problem
<larsrh>
PosDatalog is actually a module using interface Datalog
<larsrh>
so, in the mli, I wrote module PosDatalog : sig include Datalog ...
jamii has quit [Quit: Leaving]
<thelema>
you don't need to put "module Foo" inside the file foo.ml
<larsrh>
this works so far, but when I add a type declaration in the sig and copy the same declaration into the implementation, I get "The field `rel' is required but not provided"
<larsrh>
but that's not possible for module types, right?
<thelema>
?? include is possible for module types
<thelema>
but you have to include from a module type, not a module
<thelema>
if you want to include the interface of a module, `include module type of Foo`
<larsrh>
I think I understood it now
<larsrh>
thanks a lot
antegallya has quit [Read error: Connection reset by peer]
antegallya has joined #ocaml
ftrvxmtrx has joined #ocaml
Ralith has quit [Ping timeout: 255 seconds]
Ralith has joined #ocaml
twittard has quit [Remote host closed the connection]
twittard has joined #ocaml
twittard_ has joined #ocaml
jrslepak_ has left #ocaml []
<adrien>
I think I'd need C to make this faster; I have to minimize read calls and for that I want the widest integers but I can't use unboxed integers because of the loss of precision and then the GC allocations hammer the perf
<thelema>
floats are good enough as ints up to 2^53
twittard has quit [Ping timeout: 260 seconds]
twittard_ is now known as twittard
<adrien>
would Bigarray.float32 be unboxed?
<thelema>
adrien: I assume you're running on a 32-bit platform
<adrien>
or even float64 if I can access the bits
<adrien>
nope: 64bit
<thelema>
ah, I misunderstood.
blackdog_ has quit [Remote host closed the connection]
twittard has quit [Quit: twittard]
blackdog_ has joined #ocaml
<ousado>
adrien: maybe not a practical idea for the moment, but ATS might be an option
ulfdoz has quit [Ping timeout: 245 seconds]
<adrien>
that would be a good excuse to try ATS actually
<adrien>
probably not tonight though but I think I'll have a look at it =)
<ousado>
it's pretty awesome for interfacing C
<Qrntzz>
ATS is translated to C before compilation, why wouldn't it be
<ousado>
well.. how many typesafe languages actually use exactly the same memory layout as C?
<ousado>
let me count..
mdelaney has quit [Read error: Operation timed out]
blackdog_ has quit [Remote host closed the connection]
blackdog_ has joined #ocaml
mcclurmc has quit [Excess Flood]
mcclurmc has joined #ocaml
mdelaney has joined #ocaml
blackdog_ has quit [Quit: Leaving]
mdelaney has quit [Quit: mdelaney]
mdelaney has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
dsheets has quit [Quit: Leaving.]
asdfhjkl has quit [Quit: Leaving]
dsheets has joined #ocaml
Xizor has quit []
mdelaney has quit [Quit: mdelaney]
edwin has quit [Remote host closed the connection]
everyonemines has joined #ocaml
EmmanuelOga has quit [Ping timeout: 244 seconds]
letrec has joined #ocaml
cdidd has quit [Quit: Leaving]
cdidd has joined #ocaml
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 252 seconds]
companion_cube has quit [Read error: Operation timed out]