gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.0 http://bit.ly/aNZBUp
rgrig has joined #ocaml
jeddhaberstro has joined #ocaml
rks has quit [Quit: foo]
vk0 has quit [Ping timeout: 264 seconds]
vk0 has joined #ocaml
joewilliams is now known as joewilliams_away
vk0 has quit [Ping timeout: 245 seconds]
vk0 has joined #ocaml
joewilliams_away is now known as joewilliams
Modius has quit [Quit: I'm big in Japan]
rgrig has quit [Quit: Leaving]
avsm has quit [Quit: Leaving.]
Amorphous has quit [Ping timeout: 265 seconds]
Amorphous has joined #ocaml
khia0 has joined #ocaml
khia0 has left #ocaml []
drunK has quit [Remote host closed the connection]
bzzbzz has quit [Quit: leaving]
jeddhaberstro has quit [Remote host closed the connection]
jeddhaberstro has joined #ocaml
thelema_ has joined #ocaml
sgnb` has joined #ocaml
adrien__ has joined #ocaml
iris1_ has joined #ocaml
cthuluh_ has joined #ocaml
maskd- has joined #ocaml
sohum_ has joined #ocaml
sohum_ has quit [Changing host]
sohum_ has joined #ocaml
shachaf_ has joined #ocaml
ftrvxmtrx_ has joined #ocaml
ftrvxmtrx has quit [*.net *.split]
sohum has quit [*.net *.split]
thelema has quit [*.net *.split]
cthuluh has quit [*.net *.split]
iris1 has quit [*.net *.split]
adrien has quit [*.net *.split]
sgnb has quit [*.net *.split]
maskd has quit [*.net *.split]
shachaf has quit [*.net *.split]
iris1_ is now known as iris1
ulfdoz has joined #ocaml
deech has joined #ocaml
adrien__ is now known as adrien
larhat has joined #ocaml
sohum_ is now known as sohum
joewilliams is now known as joewilliams_away
jmcarthur has joined #ocaml
shachaf_ is now known as shachaf
Yoric has joined #ocaml
rks has joined #ocaml
deech has quit [Ping timeout: 240 seconds]
ulfdoz has quit [Read error: Operation timed out]
Snark has joined #ocaml
jeddhaberstro has quit [Quit: jeddhaberstro]
ygrek_ has joined #ocaml
kerneis has joined #ocaml
tmaeda has quit [Ping timeout: 276 seconds]
tmaeda has joined #ocaml
jsk-away is now known as jsk
ygrek_ has quit [Ping timeout: 245 seconds]
Yoric has quit [Quit: Yoric]
ikaros has joined #ocaml
valross has quit [Quit: Ex-Chat]
<albacker> this is meant to work, why is that? http://pastebin.com/k68rPsbt
<flux> albacker, hmm, what should it do?
<flux> albacker, you're not actually telling it to read from a file, are you?
<flux> unfortunately the standard library doesn't seem to come with an equivalent for read_int to channels
BiDOrD_ has joined #ocaml
BiDOrD has joined #ocaml
BiDOrD__ has quit [Read error: Connection reset by peer]
BiDOrD_ has quit [Ping timeout: 250 seconds]
<albacker> so how do i read an int from a channel? (without reading the whole file)
<flux> a character at a time..
<f[x]> extlib IO.read_i32
<flux> sounds like it reads binary?
<flux> and it sounds like albacker wants to read a series of digits representing an integer
<flux> (but extlib (or batteries) might have something else related)
ftrvxmtrx_ has quit [Ping timeout: 265 seconds]
<flux> albacker, the function sadly seems too long to write ad-hoc to irc in one line, so you need to do some development ;). input_char is nice, and possibly functions like let is_digit ch = ch >= '0' && ch <= '9' and let digit_of_char ch = Char.ord ch - Char.ord '0' will help
<albacker> ouch :/
<albacker> so i'll have to loop til i get spaces :/
<albacker> ok htanks :)
<flux> one problem with standard in_channel is that it doesn't have an "undo get" operation
<flux> nor a peek function
<flux> but perhaps it doesn't matter in your application
<albacker> doesn't matter :) thanks
ftrvxmtrx_ has joined #ocaml
Yoric has joined #ocaml
ttamttam has joined #ocaml
zubeen has joined #ocaml
Yoric has quit [Ping timeout: 255 seconds]
ftrvxmtrx_ has quit [Quit: Leaving]
_andre has joined #ocaml
avsm has joined #ocaml
sgnb` is now known as sgnb
Yoric has joined #ocaml
ftrvxmtrx has joined #ocaml
cthuluh_ is now known as cthuluh
avsm has quit [Quit: Leaving.]
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
larhat has quit [Quit: Leaving.]
cthuluh has quit [Quit: reboot]
cthuluh has joined #ocaml
maskd- is now known as maskd
init1 has joined #ocaml
Yoric has quit [Read error: Connection reset by peer]
Yoric has joined #ocaml
th5 has joined #ocaml
rks has quit [Quit: aw]
<kaustuv> orbitz: if your option desc starts with a space, then it won't put the first word with the flag. It basically aligns from the first space onwards.
<kaustuv> (very delayed, so apologies)
rgrig has joined #ocaml
rgrig has left #ocaml []
rgrig has joined #ocaml
BiDOrD_ has joined #ocaml
BiDOrD__ has joined #ocaml
BiDOrD has quit [Read error: Connection reset by peer]
BiDOrD_ has quit [Ping timeout: 240 seconds]
Man_of_Wax has quit [Ping timeout: 255 seconds]
Man_of_Wax has joined #ocaml
<ikaros> anyone around that wants to help an ocaml noob with an easy question?
Snark has quit [Ping timeout: 244 seconds]
<rgrig> here's some help for an irc noob: ask, don'r ask about asking.
Snark has joined #ocaml
rgrig has quit [Quit: Leaving]
<ikaros> well.. http://ocaml.pastebin.com/VyZnK4U7 imagine this class.. so i wanted to let the method 'len' call 'dot' on itself.. but it wont work this way
<ikaros> what am i doing wrong :)
<kaustuv> ikaros: method len = sqrt(self#dot)
<kaustuv> actually,
<kaustuv> method len x = sqrt (self#dot x)
<ikaros> yea but in fact i dont need parameter x because it always should dot itself
<ikaros> so how would i do this?
<ikaros> or is my approach totally wrong for somethink like a math vector of ints?
<ikaros> something*
<kaustuv> in that case just do: method len = sqrt (self#dot coords)
<kaustuv> if you've used Java or C++ before, I can explain what's going on in more familiar terms
<ikaros> ok then i have to change the dot method to "method dot (x:int array) " right?
<ikaros> yea im used to c
<ikaros> c++
<ikaros> what i am missing is something like an equivalent to "this" in c++
<kaustuv> this and self are the same thing
<ikaros> i thought so but i cant pass it as parameter here
<kaustuv> you shouldn't be passing "this" as parameter in most normal cases
<ikaros> ok =) how would i elegantly design a vector like this in ocaml?
<kaustuv> One sec.
<ikaros> ok
<kaustuv> It is not entirely satisfactory because what you are trying to do (pass a reference to this) is generally not the way objects are used in ocaml -- self is a static reference to the class, not a dynamic reference to the instance
<ikaros> interesting
<ikaros> the solution
<ikaros> ok thanks for the help
<ikaros> so innerdot is just a local function that cant be called from outside? like a private method in c++
<kaustuv> exactly
ccasin has joined #ocaml
<ikaros> if i wanted to declare more of those local functions i could just 'and' them right?
<kaustuv> Yes. But remember that you can't recurse between methods and these local functions
<ikaros> ok
<kaustuv> I would recommend reading the objects tutorial, particularly this section: http://caml.inria.fr/pub/docs/manual-ocaml/manual005.html#toc33
<ikaros> yea i read some of it before but i will continue.. was just hanging with the "this" problem :)
<ikaros> thanks alot kaustuv !
avsm has joined #ocaml
<kaustuv> hmm... I might be wrong about self actually. This seems to work:
<kaustuv> method len = sqrt (float (self#dot self))
<kaustuv> I guess I need to read that tutorial myself some more.
joewilliams_away is now known as joewilliams
<ikaros> didnt work when i tried
<ikaros> strange
<kaustuv> typechecks and works as advertised
Man_of_Wax has quit [Remote host closed the connection]
<kaustuv> by the way, I am *pretty* sure you don't want val mutable there. The array itself is mutable in the sense that you can change what's in it, but you wouldn't want to allow the array to be replaced by another one with a different dimension
<kaustuv> Of course, outside the class it's a moot point.
<ikaros> ok so i will change that too
<ikaros> oh guess the problem was the missing float when i tried this
BiDOrD__ has quit [Quit: BiDOrD__]
th5 has quit [Quit: th5]
<f[x]> any ocaml libs for mq systems except for ocaml-stomp by mfp and beanstalkd client?
<mfp> f[x]: clients? you can probably use the memcache client with some MQ broker that uses that protocol
ftrvxmtrx has quit [Quit: Leaving]
<f[x]> will have this possibility in mind, thanks
kaustuv has left #ocaml []
<mfp> f[x]: going the STOMP route gives you the most flexibility, as there are more brokers with diff functionality (ocaml-stomp knows about RabbitMQ's, ActiveMQ's and ocamlmq's STOMP dialects, and has got a mid-level API to work with other brokers)
* f[x] currently looks at zeromq, need to get know what to choose from
<mfp> if you go the memcache route, there's kestrel and starling
<mfp> what are your reqs?
<mfp> IIRC, you have to do persistence yourself if you go 0mq
jmcarthur has quit [Quit: WeeChat 0.3.0]
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 245 seconds]
joewilliams is now known as joewilliams_away
<f[x]> I need some persistence, not 100% safe, but not fully RAM-based
<mfp> which msg rates do you expect? also, only queueing or also topic (= broadcast) subscriptions?
<f[x]> ruby?? hell no
<mfp> and footprint hehe (ActiveMQ was 100-200MB only to boot)
<mfp> starling is deprecated by kestrel
<mfp> yes, shouldn't have mentioned it :P
<f[x]> I think long queues with low rates, will need to evaluate anyway
<f[x]> gtg
<mfp> RabbitMQ tends to choke on large queues because it keeps all the data in mem (at least until very recently, I think the last version might be able to save to disk); IIRC beanstalkd also keeps everything in mem
<mfp> cu f[x], would like to know if you find anything interesting (I went as far as implementing my own MQ system, but would replace it if there's anything better around)
joewilliams_away is now known as joewilliams
ygrek_ has joined #ocaml
ttamttam has quit [Remote host closed the connection]
avsm has quit [Ping timeout: 264 seconds]
ftrvxmtrx has joined #ocaml
joewilliams is now known as joewilliams_away
mikemc has quit [Remote host closed the connection]
joewilliams_away is now known as joewilliams
ztfw has joined #ocaml
ski_ has joined #ocaml
ski has quit [Ping timeout: 240 seconds]
ski_ is now known as ski
<orbitz> 0mq isnt' really an MQ IMO
<orbitz> it's just messaging, liek in erlang
<orbitz> mfp: i sthe common way to rate limit on a queue at teh client side to unsubscribe onec its concurrent limit has been reached then subscribe again once ready for more?
<mfp> orbitz: usually (in particular, in ocamlmq) the client consumes at the rate it wants, and the broker performs rate control by stopping further sends when there are more than N unACKed messages
<orbitz> what if I have N listeners on a queue but each one can rate limit itself idfferently?
<mfp> each can block independently
<orbitz> where is N set?
<mfp> the prefetch field in the SUBSCRIBE message
<mfp> e.g. you have clients A and B, A sets prefetch=100, B=200, then the server S starts sending
<orbitz> ok so each SUBSCRIBTION can say hold on after youev' sent me N
<mfp> A and B get alternating msgs, until A has got 100 unACKed msgs, then B receives the remaining msgs, until it also blocks
<mfp> yes, prefetch is per-subscription, not global
<mfp> so a client can have different prefetch limits for diff subscriptions
yezariaely has joined #ocaml
srcerer has quit [Read error: Connection reset by peer]
<orbitz> thanks
<mfp> np
<orbitz> ocamlmq seems pretty robust for the small amount of work I want it to do
<mfp> it's quite small, so I doubt there are many bugs :)
<orbitz> that's the hope :)
<mfp> if you ask me, it's probably less buggy than ActiveMQ or RabbitMQ
<mfp> RabbitMQ's STOMP adapter sucks (I read on their ML, which I rarely check, that they're replacing it)
ftrvxmtrx has quit [Quit: Leaving]
<orbitz> honestly i think it's hard to build an AMQP implemetnation that isnt' evry buggy
<orbitz> ocamlmq is exacty what i want it to be, especially since i replaced backend with hashtable. I am using it on a VM where RAM is precious so really lightweight MQ fo rmy component sto use is needed
<mfp> AMQP is huge compared to the little functionality exposed through STOMP in RabbitMQ's case
<mfp> and I read somewhere that it _lacks_ obvious features like ACK timeout
<orbitz> hah
<orbitz> is ack timeout infinite by default (0.)?
<mfp> so you have both unused features (not exposed by the STOMP adapter) plus associated bugs and missing features, plus overall bloat
<mfp> yes
<mfp> it's infinite by default, but I don't remember if ack-timeout: 0. was interpreted as such (it should, otherwise the msg would not be deliverable and this would be a bug)
<orbitz> dt when dt > 0. -> Lwt_unix.with_timeout dt (fun () -> sleep)
<orbitz> looks like it just sleeps
<orbitz> ?
<mfp> sleep is a Lwt task
<mfp> which will be canceled elsewhere when you get the ACK
<orbitz> if dt is 0.0 it just acllse sleep
<orbitz> so sounds like it' sinfinite
<orbitz> on 0.
<mfp> there's no bug then :)
<orbitz> how do you like Lwt?
<mfp> for this kind of stuff, I love it
<mfp> it makes things so easy since you know when context switches can happen
<mfp> so there's no pb using shared state
<orbitz> yeah
Yoric has quit [Quit: Yoric]
<orbitz> I do alo fo Python hacking and on a recent project I was divided between gevent and Twisted, but one of the big problems presented to me with gevent is you don't knwo when the context switch will happen
<orbitz> and Python offers you almost no facility to ensure invalid state isn't representable in yoru program
<orbitz> so you can easily make your day bad
<mfp> and it's very easy to express these things involving timeouts and tasks being canceled elsewhere (which is tricky, if possible at all, with threads)
<mfp> you see people going crazy for node.js heh
<mfp> having to write the lambdas manually sure is a PITA compared to lwt.syntax
<orbitz> Hah yeah
<orbitz> gevent tries to hide that for you by making any socket call implicitly (possibly) context switch
<orbitz> which sounds nice at first but i'm not convinced it's the right thing to do
<mfp> only sockets? what about other event sources?
<mfp> starting with Lwt_unix.sleep
<orbitz> I'm not sure what other API it exposes, but it is orientated for sockets fromw hat I see
<orbitz> oh i think it has a sleep
<orbitz> it does monkey patching too
infoe is now known as ninegrid
boscop_ is now known as boscop
Modius has joined #ocaml
ulfdoz has joined #ocaml
srcerer has joined #ocaml
srcerer has quit [Read error: Connection reset by peer]
_andre has quit [Quit: *puff*]
sohum has quit [Ping timeout: 245 seconds]
sohum has joined #ocaml
sohum has quit [Changing host]
sohum has joined #ocaml
srcerer has joined #ocaml
<flux> mfp, it's hardly PITA compared to manual CPS, though
yezariaely has left #ocaml []
Snark has quit [Quit: Ex-Chat]
<kerneis> event-driven programming in not that different from cps
drunK has joined #ocaml
<albacker> this is the read_int that i coded today. is there any suggestions? http://pastebin.com/qjmHN9YH
<kerneis> albacker: looks good
<kerneis> but you are aware read_int already exists, aren't you?
<albacker> kerneis: someone here told me it didn't.
<albacker> i saw on the doc to be sure.
<albacker> read_int was there to read from stdin only.
<kerneis> for sure
<kerneis> read_int uses int_of_string, and you should do the same IMHO
<kerneis> (stopping on the first non-digit seems weird)
<albacker> let read_int () = int_of_string(read_line())
<albacker> what if there are 2 ints separated by ' ' (space) ?
<kerneis> use read_string (or scanf, or whatever) to get a string formated as you like
<kerneis> and then, stick with int_of_string
<albacker> my function sucks then.
<kerneis> no
<kerneis> it's just better to reuse what exists
<kerneis> (and it would probably be more efficient, since int_of_string uses a C function, but this shouldn't matter a lot)
<kerneis> just like you would use strtol in C, rather than rewritting it
<kerneis> it doesn't make your implementation bad, just useless
<flux> forgot about (f)scanf, it should work without consuming the rest of the line
<albacker> i know what you mean.
ftrvxmtrx has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 260 seconds]
ztfw has quit [Remote host closed the connection]
ftrvxmtrx has joined #ocaml
lpereira has joined #ocaml
valross has joined #ocaml
ygrek_ has quit [Ping timeout: 245 seconds]
mattam has quit [Ping timeout: 245 seconds]
rks has joined #ocaml
avsm has joined #ocaml
ulfdoz has quit [Ping timeout: 260 seconds]
lpereira has quit [Quit: Leaving.]
ikaros has quit [Quit: Leave the magic to Houdini]
init1 has quit [Quit: Quitte]
hto has joined #ocaml