<jstolarek>
I am trying to figure out whethere there is an Ocaml equivalent of Hoogle, Hayoo or Hackage
<jstolarek>
yup, that's what I was looking for
<companion_cube>
not really, sadly
<companion_cube>
it's very incomplet
<companion_cube>
e
<jstolarek>
still better than looking through the docs manually
<jstolarek>
will do for starters
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
<jstolarek>
what is the meaning of "module Foo = struct ... end" construct?
<jstolarek>
I know that with "module type Bar = sig ... end" I can create an abstract module signature
<jstolarek>
"module Foo = struct..." seems to create a concrete module implementation, but what is it's usefulness without the abstract signature?
<ollehar>
jstolarek: signature will be implicit. usefullness is namespace, I guess.
<ollehar>
and you can send it to functors.
<ollehar>
or first-class modules.
<ollehar>
compare with the Set.Make functor.
<ggole_>
jstolarek: namespacing, and the creation of a module value that can be refined with a signature, passed to a functor, etc
<_y>
jstolarek, plus, its signature can be specified in the .mli file associated to your .ml file (just like the type of a value in your .ml can be specified in your .mli and left implicit in your .ml)
<ggole_>
It can also be useful to create a module and dump a bunch of stuff in it with include
sdothum has joined #ocaml
copy` has joined #ocaml
* jstolarek
has not yet learned about functors
ubertaco has joined #ocaml
<ubertaco>
Hello again!
<ubertaco>
Mostly for the learning exercise, I sent that PR for the String.of/to_char_list methods. It got rejected, as folks in here predicted. Ah well, I learned a thing.
zpe has joined #ocaml
<Drup>
ubertaco: it wasn't rejected, someone who is not from the core team said he didn't find it a good idea ;)
<ubertaco>
oh
<companion_cube>
but it will still probably not be merged
<Drup>
(tbf, it would probably be rejected anyway, it's not a great idea ^^')
<ubertaco>
yeah, I didn't know I was re-adding a function that had previously been dropped. Whoops.
<Drup>
regardless of the fact that it was droped, "string as char lists" is a known anti-pattern that should be avoided
<ubertaco>
Ah, this sounds like a good learning opportunity
<Drup>
a char in a string is 1/8th of a word, a char in a list is 3 words (block header, the char, pointer to the rest of the list)
<ubertaco>
Ahh...that makes sense
<ubertaco>
thanks for explaining it to me, even though it sounds like it's pretty basic knowledge
<Drup>
I wouldn't say it's basic knowledge
<ubertaco>
I'm generally kinda bad at reasoning about space/time complexity sometimes; a side effect of growing up with Java and never really writing any C
silver has quit [Read error: Connection reset by peer]
<mrvn>
writing a quick parser is so much simpler with char lists than with strings though.
<mrvn>
WOuld be nice to have a pattern matchable enumeration over a string in stdlib.
<ubertaco>
mrvn: yeah, that was my major motivation for the to/of_char_list fns; I was writing toy parsers and kept wanting to pattern-match on a string in recursive functions (the = function | [] -> something | next::rest -> somethingelse kind)
<Drup>
mrvn: like, hum, sedlex *cough* ?
<Drup>
(or ocamllex, for that matter)
<mrvn>
too complex
<companion_cube>
like iterators?
<companion_cube>
oh wait
<ubertaco>
having never heard of sedlex, man that looks pretty cool
<mrvn>
never heart of sedlex either
dhil has quit [Ping timeout: 240 seconds]
<mrvn>
Error: Unbound module Sedlex
dhil has joined #ocaml
<Drup>
companion_cube: sedlex does use iterators :3
MercurialAlchemi has quit [Ping timeout: 244 seconds]
slash^ has quit [Read error: Connection reset by peer]
ubertaco has quit [Quit: Page closed]
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
agarwal1975 has joined #ocaml
zpe has joined #ocaml
cthuluh has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
dhil has quit [Ping timeout: 276 seconds]
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
ontologiae_ has quit [Ping timeout: 244 seconds]
orbifx1 has joined #ocaml
diphuser has quit [Ping timeout: 264 seconds]
orbifx1 has quit [Ping timeout: 264 seconds]
shinnya has joined #ocaml
<copy`>
Are values captured in utop? (like when I run `[1;2;3];;` can I access the list somehow)
johnelse has joined #ocaml
<copy`>
Oh, there's an open issue for that
LiamGoodacre has joined #ocaml
SpiceGuid has joined #ocaml
johnelse has quit [Ping timeout: 240 seconds]
diphuser has joined #ocaml
<LiamGoodacre>
Hi I'm currently reading this https://blogs.janestreet.com/introducing-incremental/ - I currently don't have any experience with OCaml; what do `~f` and `~f:(+.)` mean? I'm guessing that the `(+.)` bit means the addition function for floating point numbers?
<rgrinberg>
LiamGoodacre: you're right about `(+.)`. `~f` is just supplying a lablled argument `f` to a function.
<rgrinberg>
`~f` is usually reserved for functions, but it's just a convention
<rgrinberg>
e.g. try : let add ~x ~y = x + y in add ~x:100 ~y:200
SpiceGuid has quit [Quit: ChatZilla 0.9.92 [SeaMonkey 2.40/20160120202951]]
<LiamGoodacre>
oh interesting, thanks for your help :)
nicholasf has quit [Remote host closed the connection]
wtetzner_ has joined #ocaml
<LiamGoodacre>
rgrinberg what does it mean if the `:expr` part is missed off during function application? Does it "pun" the argument label with a variable in scope?
<ggole_>
Yep
diphuser has quit [Ping timeout: 260 seconds]
ggole_ is now known as ggole
<LiamGoodacre>
ggole awesome, thanks
SpiceGuid has joined #ocaml
tane has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 276 seconds]
SilverKey has quit [Quit: Halted.]
SilverKey has joined #ocaml
diphuser has joined #ocaml
SilverKey has quit [Quit: Halted.]
wtetzner_ has quit [Remote host closed the connection]
SilverKey has joined #ocaml
SilverKey has quit [Client Quit]
tane has quit [Quit: Leaving]
nicholasf has joined #ocaml
nicholasf has quit [Ping timeout: 244 seconds]
SpiceGuid has quit [Quit: ChatZilla 0.9.92 [SeaMonkey 2.40/20160120202951]]
gustav___ has quit [Quit: leaving]
rgrinberg has quit [Ping timeout: 276 seconds]
<ollehar>
maybe use stackoverflows new document feature to add some js_of_ocaml examples?
johnelse has joined #ocaml
andy__ has joined #ocaml
johnelse has quit [Ping timeout: 244 seconds]
fraggle_ has quit [Remote host closed the connection]
shinnya has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
fraggle_ has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
lol-icon has quit [Ping timeout: 240 seconds]
<flux>
given an Lwt_stream with an on_termination handler, is it possible to arrange the on_termination handler to be called without reading the whole stream though?
<flux>
in other words, is there a way to explicitly close an Lwt_stream.t?
slash^ has joined #ocaml
<flux>
let's say I open a gigabyte file and provide an Lwt_stream.t for it, and I would wish to close the fd once the Lwt_stream has been consumed (naturally using Lwt_stream.on_termination), while allowing the consumer of the stream to stop early..
tane has joined #ocaml
wtetzner has joined #ocaml
wtetzner has quit [Remote host closed the connection]
<flux>
nooo, I told you the last time, Gc is suitable only for memory-only-resources :)
nicholasf has joined #ocaml
<flux>
I don't want a system where my 1024 fds can be eaten up by a malicios client in 0.01 seconds
<mrvn>
it lets you close the file when the stream gets reaped
<flux>
nor do I want to call Gc.major every time I open an fd
<flux>
I suppose I could call Gc.major only when the server creation throws an exception and it would work (except at very high performance cost), but that would be ugly
nicholasf has quit [Remote host closed the connection]
<mrvn>
flux: the runtime should really do that internally.
<flux>
well, it still works only for fds
<companion_cube>
+1 flux, the GC is bad for IO resources
<flux>
what if you have an expensive external resource?
<flux>
let's say I have X bitmaps
<mrvn>
flux: then you make the cost for the resource tracking it high
<flux>
I will never see the memory runs out, but I do see gigabytes of memory allocated to the X server
<flux>
mrvn, and when do I rn Gc.major? I'm not going to get an exeption before the X server dies
<mrvn>
and nothing stops you from having a close function that releases the bitmap when you call it. The Gc is just a safety in case you forget.
<flux>
exactly, and that's how Gc.finalize should be used on resources
<flux>
except it should complain loudly when it happens
pyon is now known as lol-icon
<mrvn>
flux: I agree there
<companion_cube>
I think there's a warning now
<companion_cube>
if the GC collects a non closed fd
<mrvn>
companion_cube: no. FDs are just ints
<mrvn>
currently under unixes the FD just leaks.
<companion_cube>
channels
<companion_cube>
I meant channels
<mrvn>
other than stdin/out/err I've actually never used channels.
<ggole>
I think you can probably do OK if you design a system to support GCing resources. Oberon had GCable files, for example.
<ggole>
You could use some of the same tricks you use for memory: run a GC once you allocate a certain number or run out
<companion_cube>
mrvn: how do you read files?
<ggole>
Doesn't really work for things like X or a DB that aren't designed for that though
<companion_cube>
ggole: so when it reaches the max number of FDs it tries to collect?
<ggole>
I don't think it had a max number of FDs
<companion_cube>
every unix has a max number of FDs
MercurialAlchemi has joined #ocaml
<ggole>
Oberon was not a Unix.
<companion_cube>
that's like my n°1 error on Lwt
<companion_cube>
ah... thought it was a language :D
<ggole>
It was both, really
<mrvn>
companion_cube: Unix.
<companion_cube>
mrvn: but why?
rgrinberg has quit [Ping timeout: 244 seconds]
<companion_cube>
I mean, in some cases it's justified, but if you just want to simply read a file, it's simpler with channels
<mrvn>
you run it every so many allocations just like for memory.
<mrvn>
companion_cube: because when I have a trivial case I just pipe the file to stdin.
<mrvn>
no reason really. just never had the use case.
<companion_cube>
even for reading from stdin, it's easier with channels
<mrvn>
as said, I've used stdin
<companion_cube>
oh ok, you still use the stdin channel
<companion_cube>
how weird
<mrvn>
just never opened my own channel. so can't say what they do on close or not close.
pierpa has joined #ocaml
andy__ has joined #ocaml
cthuluh has quit [Quit: leaving]
cthuluh has joined #ocaml
ollehar has quit [Ping timeout: 264 seconds]
rgrinberg has joined #ocaml
darkf has quit [Quit: Leaving]
ygrek has joined #ocaml
nicholasf has joined #ocaml
nicholasf has quit [Ping timeout: 276 seconds]
andy__ has quit [Quit: Leaving]
test123 has joined #ocaml
test123 has quit [Client Quit]
SilverKey has joined #ocaml
wtetzner has joined #ocaml
SilverKey has quit [Remote host closed the connection]
andy__ has joined #ocaml
andy__ has left #ocaml [#ocaml]
yofu has joined #ocaml
<yofu>
Could someone point me to a sample project that uses 'ocamldep' to find dependencies in a `src` directory and builds to a `build` directory?
<yofu>
Specifically, I just move the files to `src` and add `-I src` to the ocamlbuild calls and change toto_c.o in _tags to src/toto_c.o, and get the error, "The external function `toto' is not available".
Orion3k has joined #ocaml
ygrek has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
Algebr` has joined #ocaml
yofu has quit [Quit: Leaving]
raphaelss has joined #ocaml
raphaelss has quit [Remote host closed the connection]
Algebr` has quit [Ping timeout: 240 seconds]
nicholas_ has joined #ocaml
nicholasf has quit [Ping timeout: 276 seconds]
silver has joined #ocaml
sh0t has quit [Remote host closed the connection]
axiles has quit [Quit: Quitte]
jackweirdy has joined #ocaml
Simn has quit [Quit: Leaving]
MercurialAlchemi has quit [Ping timeout: 260 seconds]
ggole has quit []
shinnya has joined #ocaml
rgrinberg has quit [Ping timeout: 276 seconds]
nicholasf has joined #ocaml
nicholas_ has quit [Ping timeout: 264 seconds]
nicholasf has quit [Read error: Connection reset by peer]