flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.01.0 http://bit.ly/1851A3R | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
<ng__> what´s wrong?
<oriba> ng__, try this one: http://pastebin.com/bDr837uE
<ng__> oriba, why you put let n=12? and i try to run and appears a sintax error
<ng__> :(
tobiasBora has quit [Remote host closed the connection]
tobiasBora has joined #ocaml
<oriba> I doubt that there will be a syntax error. I just tried it again and it works.
<oriba> You may have made a mistake when copying the code to your toplevel
<oriba> the n=12 stuff is needed, because otherwise n is not bound, but used
<oriba> This would not be compiled
<oriba> using n without a binding to it, would mean a not-bounded value... so it could not be used but is used
<oriba> The pow function has just two lines
<ng__> oriba, yap i understand, sorry. i made a mistake with copy
<ng__> thank you
<oriba> :-)
<oriba> ng__, I need to go to bed. I wish you fun with OCaml :-) good night.
<ng__> oriba, thak you, i´m new with this language :) good night
tobiasBora has quit [Quit: Konversation terminated!]
oriba has quit [Quit: oriba]
mcclurmc has quit [Quit: Leaving.]
mcclurmc has joined #ocaml
Transhumanist has joined #ocaml
pkrnj has quit [Quit: Computer has gone to sleep.]
ng__ has quit [Ping timeout: 252 seconds]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
ocp has joined #ocaml
kizzx2 has joined #ocaml
kizzx2 has quit [Max SendQ exceeded]
kizzx2 has joined #ocaml
kizzx2 has quit [Max SendQ exceeded]
kizzx2 has joined #ocaml
boogie has quit [Remote host closed the connection]
q66 has quit [Quit: Leaving]
Transhumanist has quit [Quit: KVIrc 4.1.3 Equilibrium http://www.kvirc.net/]
Transhumanist has joined #ocaml
jpdeplaix has quit [Ping timeout: 245 seconds]
ocp has quit [Quit: Leaving.]
cesar_ has joined #ocaml
cesar_ is now known as Guest96193
ygrek_ has joined #ocaml
nikki93 has joined #ocaml
jpdeplaix has joined #ocaml
manud has quit [Quit: manud]
shinnya has quit [Ping timeout: 245 seconds]
Transhumanist has quit [Ping timeout: 260 seconds]
breakds has joined #ocaml
nikki93 has quit [Remote host closed the connection]
talzeus has quit [Remote host closed the connection]
derek_c has joined #ocaml
pkrnj has joined #ocaml
gour has joined #ocaml
<technomancy> so I think I got my ctypes stuff mostly sorted out from the mailing list
<technomancy> except this one function requires I return a null-terminated array of strings
<technomancy> as far as I can tell, that's impossible to represent in the OCaml type system, right?
boogie has joined #ocaml
ben_zen has quit [Ping timeout: 245 seconds]
kizzx2 has quit [Quit: Leaving.]
rwmjones has quit [Ping timeout: 248 seconds]
<pippijn> technomancy: string option array?
<pippijn> technomancy: or char ptr_t option array maybe..
<pippijn> technomancy: anyway, you should be able to do that
derek_c has quit [Ping timeout: 260 seconds]
nikki93 has joined #ocaml
derek_c has joined #ocaml
breakds has quit [Remote host closed the connection]
Snark has quit [Quit: leaving]
Kelet_ has joined #ocaml
Kelet has quit [Read error: Connection reset by peer]
Kelet_ is now known as Kelet
Transhumanist has joined #ocaml
ulfdoz has joined #ocaml
kizzx2 has joined #ocaml
Snark has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
ocp has joined #ocaml
oriba has joined #ocaml
nikki93 has quit [Remote host closed the connection]
ocp has quit [Ping timeout: 264 seconds]
ttamttam has joined #ocaml
Simn has joined #ocaml
jayprich has joined #ocaml
weie has quit [Quit: Leaving...]
Neros has quit [Ping timeout: 245 seconds]
yacks has quit [Quit: Leaving]
derek_c has quit [Ping timeout: 245 seconds]
derek_c has joined #ocaml
Transhumanist has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
djcoin has joined #ocaml
derek_c has quit [Quit: Lost terminal]
pkrnj has quit [Quit: Textual IRC Client: www.textualapp.com]
cdidd has joined #ocaml
jayprich has quit [Ping timeout: 248 seconds]
ygrek_ has quit [Ping timeout: 264 seconds]
arquebus has joined #ocaml
rwmjones has joined #ocaml
ontologiae has joined #ocaml
darkf_ has joined #ocaml
darkf has quit [Disconnected by services]
darkf_ is now known as darkf
gasche has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
skchrko has joined #ocaml
jayprich has joined #ocaml
talzeus has joined #ocaml
yezariaely has joined #ocaml
arquebus has quit [Quit: Konversation terminated!]
ygrek_ has joined #ocaml
ben_zen has joined #ocaml
talzeus has quit [Read error: Connection reset by peer]
ben_zen has quit [Ping timeout: 248 seconds]
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
beckerb has joined #ocaml
ocp has joined #ocaml
Transhumanist has joined #ocaml
avsm has quit [Ping timeout: 264 seconds]
avsm has joined #ocaml
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
mfp has joined #ocaml
ggole has joined #ocaml
zpe has joined #ocaml
skchrko has quit [Ping timeout: 245 seconds]
skchrko has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
ggole has quit [Read error: Connection timed out]
ggole has joined #ocaml
oriba has quit [Excess Flood]
darkf has quit [Quit: Leaving]
ollehar has joined #ocaml
boogie has quit [Remote host closed the connection]
jayprich has quit [Ping timeout: 245 seconds]
q66 has joined #ocaml
cantstanya has quit [Ping timeout: 240 seconds]
Drup has joined #ocaml
caseyjames has joined #ocaml
<caseyjames> hi anyone awake that could lend a hand with a function?
<caseyjames> I'm also willing to accept assistance from those of you who are asleep
* gour is probably of not help being ocaml noob
<Drup> gour: fine for me
<Drup> caseyjames: don't ask to ask :)
<gour> Drup: try refresh, not from the cache ;)
<companion_cube> caseyjames: just ask ^^
<Drup> gour: fine for me²
<gour> hmm...that's strange
<caseyjames> I am staring dumbfounded at my function which just now, after a week is working... my first ocaml function
<Drup> gour: this one is indeed 503. :)
<gour> the 1st one was for a friend using DW
<caseyjames> I would definitely appreciate some critique on the approach... is it well formed? https://gist.github.com/caseybasichis/6682692
<companion_cube> what is it supposed to do? It's not very clear from the names :)
<caseyjames> sorry it gathers up values matching a predicate into intervals a list of tuplets (start index, start value, end index, end value)
<Drup> caseyjames: as a side note, post your gist as .ml, not .txt. colors are good :]
<companion_cube> caseyjames: so it should return [[60, 62]; [50, 52]; [78, 80]] ?
<caseyjames> [(0, 60, 2, 62); (3, 50, 6, 80)]
<companion_cube> ah, it doesn't count decreasing intervals, ok
<companion_cube> that's the kind of function I would document if I were you ;)
<companion_cube> (for instance in the .mli if you wrote one)
<caseyjames> I definitely will. I'm worried the coding is bad... the (0,0,0,0) and other repeated elements... also the lingering suspicions that there is some sort of List.fold that knocks this down to a line
<companion_cube> caseyjames: if you're worried about readability, I would suggest you write a record type for itnervals
<companion_cube> type 'a interval = { first_idx : int; first : 'a; last_idx : int; last: 'a; }
<Drup> caseyjames: it's probably some sort of fold, yes, but it will not really help for readability
<companion_cube> it is indeed a fold_left, where the accumulator is a bit complicated
<caseyjames> I was thinking of doing it with records, but hadn't tried record update. I will transfer the code over once I test it a bit more. I'm cracking into OUnit tomorrow
<companion_cube> also, if you need to access elements by index very often, an array may be better than a list. But I can't judge from this snippet
boogie has joined #ocaml
<caseyjames> Do you have any experience with ocamlgraph?
<pippijn> I just used it once
<pippijn> for graphviz stuff
<pippijn> it's quite slow, so I didn't use it for actual work
Guest96193 has quit [Remote host closed the connection]
<pippijn> it's cute though, with functors everywhere
<caseyjames> Slow compared to BGL?
<pippijn> I don't know BGL
weie has joined #ocaml
<pippijn> I implemented my own graphs with arrays or bitsets where appropriate
<caseyjames> Ahh
<companion_cube> pippijn: is it really this slow?
<caseyjames> yes, i've been eyeballing the whole matrix approach... is that what bitsets are?
<companion_cube> I'd think the imperative implementation would be fast
<pippijn> companion_cube: the imperative implementation uses hashtables
<companion_cube> yes, so it should be quite fast
<pippijn> it's all very generic
<pippijn> it's "quite" fast
<companion_cube> but you can probably roll out an implementation for integers, based on bitsets
Drup has quit [Ping timeout: 260 seconds]
<pippijn> but at least an order of magnitude slower than the custom one
<companion_cube> that might be problems of inlining :(
<pippijn> companion_cube: the arrays are direct indexing with hashconsed objects
<pippijn> companion_cube: there is no hashing involved
<companion_cube> ah, so you have more information
<pippijn> yes
<companion_cube> but I still believe you could use ocamlgraph with a custom graph implementation
<pippijn> each object has a unique small integer identifier
<companion_cube> or even contribute a special graph implementation for hashconsed objects ^^
<pippijn> maybe
<pippijn> I might do it someday
<pippijn> the graph parts are no longer relevant to the performance, anyway
<pippijn> they used to be much slower, but I optimised other parts, so now the graphs may be implemented with the more elegant ocamlgraph abstraction
boogie has quit [Ping timeout: 245 seconds]
<caseyjames> I'm trying to wrap my head around how I would work an algorithm like this into a graph. If I were to have a edge from both parent to child and vice versa for every element contained in each interval, would I run it after the fact as a separate process?
<companion_cube> sorry, got to go to lunch
<pippijn> companion_cube: actually I quite like my array graphs, because they are immutable after initialisation
<pippijn> so I produce graphs on construction, and after that change their access modifier to immutable and can be sure they won't be modified
<caseyjames> is that just an adjacency matrix?
<companion_cube> I too have some matrix graph somewhere, to implement completion of partial orderings...
<pippijn> caseyjames: I have an adjacency matrix, as well
<ggole> ...same
<ggole> Keyed by integers, implying objects have to either map to or include one
<pippijn> right
<ggole> In theory that's less general: in practice, doesn't matter.
<ggole> (Or didn't for me.)
<pippijn> I have a finite and unchanging set of elements
<pippijn> so I can simply number them
<pippijn> the indices are private ints
<caseyjames> Do you then just have a suite of your own graph traversal tools and algorithms?
<pippijn> caseyjames: I don't need those
<pippijn> I just needed a graph, no tools
<ggole> Yeah, same. Just is_adjacent and iter_adjacent.
<pippijn> right
<ggole> And the obvious accessors.
* ggole time for food
<caseyjames> Its 3:24 am here sleep beacons. Thanks for the perspective
Yoric has joined #ocaml
ollehar has quit [Ping timeout: 248 seconds]
zzz_ has quit [Remote host closed the connection]
<mrvn> caseyjames: perfect time for a snack
zzz_ has joined #ocaml
ocp has quit [Quit: Leaving.]
Drup has joined #ocaml
caseyjames has quit [Ping timeout: 250 seconds]
Drup has quit [Ping timeout: 245 seconds]
kizzx2 has quit [Quit: Leaving.]
Neros has joined #ocaml
ben_zen has joined #ocaml
Drup has joined #ocaml
boogie has joined #ocaml
Neros has quit [Ping timeout: 260 seconds]
boogie has quit [Ping timeout: 260 seconds]
_andre has joined #ocaml
jayprich has joined #ocaml
Neros has joined #ocaml
Transhumanist has quit [Ping timeout: 248 seconds]
ben_zen has quit [Ping timeout: 248 seconds]
ollehar has joined #ocaml
ygrek_ has quit [Remote host closed the connection]
ygrek_ has joined #ocaml
Neros has quit [Ping timeout: 245 seconds]
boogie has joined #ocaml
boogie has quit [Ping timeout: 245 seconds]
ben_zen has joined #ocaml
ygrek_ has quit [Ping timeout: 246 seconds]
ben_zen has quit [Quit: leaving]
Simn has quit [*.net *.split]
tizoc has quit [*.net *.split]
ivan\ has quit [*.net *.split]
Cypi has quit [*.net *.split]
Khady has quit [*.net *.split]
reynir has quit [*.net *.split]
adrien has quit [*.net *.split]
mal`` has quit [*.net *.split]
Nahra has quit [*.net *.split]
orbitz has quit [*.net *.split]
gildor has quit [*.net *.split]
ski has quit [*.net *.split]
orbitz has joined #ocaml
ski has joined #ocaml
adrien has joined #ocaml
Cypi has joined #ocaml
tizoc has joined #ocaml
gildor has joined #ocaml
tizoc has quit [Changing host]
tizoc has joined #ocaml
Simn has joined #ocaml
ivan\ has joined #ocaml
Nahra has joined #ocaml
reynir has joined #ocaml
ivan\ has quit [Changing host]
ivan\ has joined #ocaml
mal`` has joined #ocaml
Nahra has quit [Changing host]
Nahra has joined #ocaml
reynir has quit [Changing host]
reynir has joined #ocaml
Khady has joined #ocaml
jayprich has quit [Ping timeout: 245 seconds]
mika1 has joined #ocaml
UncleVasya has joined #ocaml
boogie has joined #ocaml
boogie has quit [Ping timeout: 252 seconds]
rwmjones has quit [Ping timeout: 248 seconds]
ygrek_ has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
_andre has quit [Ping timeout: 260 seconds]
_andre has joined #ocaml
talzeus has joined #ocaml
rwmjones has joined #ocaml
<ggole> Am I missing something to print a substring?
<ggole> Yes I am.
bondar has joined #ocaml
ygrek_ has quit [Remote host closed the connection]
ygrek_ has joined #ocaml
<mrvn> String.sub?
boogie has joined #ocaml
<ggole> That's a bit wasteful, isn't it? Anyway, Pervasives.output was what I wanted.
<ggole> (Missed it since there's no 'print' in the name.)
boogie has quit [Ping timeout: 248 seconds]
jayprich has joined #ocaml
cdidd has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
zpe has quit [Ping timeout: 252 seconds]
Yoric has quit [Ping timeout: 245 seconds]
mika1 has quit [Quit: Leaving.]
cdidd has joined #ocaml
ygrek_ has quit [Remote host closed the connection]
ygrek_ has joined #ocaml
boogie has joined #ocaml
shinnya has joined #ocaml
boogie has quit [Ping timeout: 246 seconds]
talzeus has quit [Remote host closed the connection]
<ollehar> is there a shorthand notation for `string_of_int 12`?
<ollehar> like 12str
<ollehar> hm
<Simn> "12"
<ollehar> no, `string_of_int var`
<ollehar> :)
<adrien_oww> let f = string_of_int in
<adrien_oww> f 12
<adrien_oww> no? :P
<ggole> Python refugee?
rwmjones has quit [Ping timeout: 248 seconds]
UncleVasya has quit [Quit: UncleVasya]
<ollehar> ggole: me? no.
<ollehar> only sick of writing string_of_int thousand times a day
<ollehar> let (&) = string_of_int ?
<adrien_oww> you can
<adrien_oww> or List.rev_map
ttamttam has quit [Quit: ttamttam]
<companion_cube> ollehar: you may use Printf
<ggole> If you're always writing that in the toplevel, maybe put let str = string_of_int in .ocamlinit
<ggole> If not... suck it up, string_of_int is nice and readable.
<ggole> (IMHO.)
ttamttam has joined #ocaml
morolin has quit [Ping timeout: 264 seconds]
ttamttam has quit [Client Quit]
<ollehar> one could make a syntax extension, like
<ollehar> ^i str = ^ string_of_int str
<Drup> ollehar: you can do prefix operator starting by ! or ~
<companion_cube> ollehar: do you use it to print ints ?
<adrien_oww> you could try haskell
<adrien_oww> there's an operator for everything
<companion_cube> stop being sarcastic, adrien :)
<adrien_oww> well, I'm sure there's one to do int -> string
<adrien_oww> (well, it might be 'a -> string actually so that wouldn't be bad)
<Drup> ollehar: but tbh, it's not better than just "soi" as an alias ...
<ollehar> Drup: nice
<ollehar> yeah, guess you're right
<companion_cube> adrien_oww: there's a typeclass 'a -> string, yes
<adrien_oww> companion_cube: we only need to ask hnrgrgr a bit more :D
* companion_cube seldom needs string_of_int, because of {f,s,}printf
<Drup> adrien_oww: s/ask/whip/
<Drup> :]
rwmjones has joined #ocaml
<adrien_oww> Drup: let's ask nicely first :)
<ollehar> companion_cube: yeah, print = Print.sprintf could work nicely... thanks for the tips!
<adrien_oww> I often do "let sp = Printf.sprintf"
<companion_cube> ollehar: it's really useful if you want to wrap the string_of_int in a context, like an error message
<companion_cube> this way it's just sprintf "%d is a bad integer" i
ontologiae has quit [Ping timeout: 248 seconds]
snearch has joined #ocaml
snearch has quit [Read error: Connection reset by peer]
rwmjones has quit [Ping timeout: 248 seconds]
zpe has joined #ocaml
rwmjones has joined #ocaml
<ygrek_> "let sp = Printf.sprintf" is bad
Yoric has joined #ocaml
<ygrek_> sorry, disregard, I am confused
zpe has quit [Remote host closed the connection]
boogie has joined #ocaml
skchrko has quit [Ping timeout: 245 seconds]
Yoric has quit [Ping timeout: 245 seconds]
boogie has quit [Ping timeout: 260 seconds]
skchrko has joined #ocaml
cesar_ has joined #ocaml
cesar_ is now known as Guest573
Neros has joined #ocaml
tane has joined #ocaml
nikki93 has joined #ocaml
ollehar has quit [Ping timeout: 260 seconds]
<bernardofpc> "Keep OCaml and carry on"
<adrien_oww> :)
Guest573 has quit [Remote host closed the connection]
nikki93 has quit [Remote host closed the connection]
<ygrek_> the canonical way would be KEEP CAML AND CURRY ON
<reynir> lol
<technomancy> nice
<adrien_oww> anyone know if the text of the mailing-list announcement for 4.01 is available elsewhere?
beckerb has quit [Ping timeout: 260 seconds]
<reynir> adrien_oww: I can pastebin it...
<reynir> adrien_oww: http://pastebin.com/fU3QQ3fF
yezariaely has quit [Quit: Leaving.]
yezariaely has joined #ocaml
zpe has joined #ocaml
<adrien_oww> reynir: I'm interested in changing /topic
<adrien_oww> the bit.ly link points to it
<adrien_oww> but the sympa archives are often down
<adrien_oww> plus, if I could, I'd skip the url-shortener step
boogie has joined #ocaml
ontologiae has joined #ocaml
<reynir> adrien_oww: I guess I can host it on my website if you prefer that
<adrien_oww> I can do it too but that should be on ocaml.org
nikki93 has joined #ocaml
Drup has quit [Ping timeout: 240 seconds]
nikki93 has quit [Remote host closed the connection]
ollehar has joined #ocaml
ontologiae has quit [Quit: WeeChat 0.4.0]
djcoin has quit [Quit: WeeChat 0.4.1]
ygrek_ has quit [Ping timeout: 260 seconds]
nikki93 has joined #ocaml
boogie has quit [Remote host closed the connection]
cantstanya has joined #ocaml
jbrown has quit [Ping timeout: 268 seconds]
Anarchos has joined #ocaml
wmeyer has quit [Remote host closed the connection]
boogie has joined #ocaml
<technomancy> any Async pros around? I need to make an Async call inside a callback whose API I don't control, so I need to turn it into a blocking call.
<technomancy> what I'd like to do is just "park" the thread until a given Ivar gets filled
<technomancy> I can't just bind to a Deferred since I need the callback to return the value I get from the async call
yacks has joined #ocaml
<mrvn> so make a Deferred that sets a condition and then wait for it.
<technomancy> sure; not seeing how that's done in the docs
<technomancy> specifically the "wait for it" part =)
<mrvn> technomancy: see the Condition module in the docs
<technomancy> mrvn: thanks; looks promising
<technomancy> this looks a bit like a promise; is that a decent analogy?
<mrvn> In your case you could also just use a mutex. Lock it before the async code, unlock it Deferred in the async call and lock it again. The second lock will block till the defereed runs.
mika1 has joined #ocaml
<technomancy> I think a Condition is better because it conveys a value
<technomancy> feels like I'd need a side-channel with a mutex
<mrvn> you mean for the return value of the async call?
<technomancy> right
<mrvn> makes total sense. you would need a ref otherwise.
nikki93 has quit [Remote host closed the connection]
Drup has joined #ocaml
zpe has quit [Remote host closed the connection]
<technomancy> so... once I get my value, I Condition.signal c value
<technomancy> but in my consumer I do Condition.wait c |> Deferred.peek and get None every time
<technomancy> even if I hard-code my signal value to a known string
<mrvn> but it blocks?
* technomancy inserts a sleep to tell
<technomancy> ok, so it doesn't actually block. hrm.
<mrvn> well, I guess you are doing something wrong
<technomancy> I agree =)
<technomancy> shouldn't Deferred.peek (Condition.wait c) never return None?
darkf has joined #ocaml
<orbitz> how come?
jayprich has quit [Quit: jayprich]
<technomancy> my understanding is that wait would never return until the deferred is filled
<technomancy> but obviously my understanding is flawed somehow
<orbitz> No, wait returns a defered
<technomancy> so... it doesn't wait?
<orbitz> No, how could it?
<mrvn> wait should wait till the condition is signaled. With what you signal it is your problem.
<orbitz> Condition.wait c >>= Deferred.peek (* should never return None *)
<technomancy> by parking the thread?
<orbitz> technomancy: why would you want to park a thraed i nASync?
<technomancy> orbitz: because I have to work with an API that isn't async
<mrvn> orbitz: scrollback. it's in a callback that isn't async
<orbitz> Sure, but that is disticnt from calling Deferred.peek on somethin, why would you call Deferred.* in the code running in a thread somewhere?
<technomancy> would be nice to have more than 3 lines of docs on Condition =\
<orbitz> Dodesn't Async have a "run in thread and give me back the deferred" function?
<orbitz> In_thread.run (fun () -> my_blocking_call ()) >>= fun result -> ...
<technomancy> what I need is the other way around
<technomancy> I'm writing a callback that has return an actual value directly
<technomancy> but the value has to be fetched over an async network call
<mrvn> don't you have a sync equivalent to the async function?
<orbitz> ok so you are running in a thread a fucntion which kick soff something running in async land?
<technomancy> I'd have to rewrite all my networking code to do that =\
<orbitz> so your whole program is Async, and then you call In_thread.run ... and that thing you run calls back to asomething in Async?
<technomancy> orbitz: not sure about "in a thread"; I'm writing a custom completion function for readline: file:///home/phil/readline.html#IDX340
<orbitz> i can't acess thign son your file system afaik :)
<technomancy> haha
<technomancy> oops
<orbitz> but anyways
<orbitz> you have an async program
<orbitz> and you run some blocking thing with In_thread.run, and that thing you call has to call back to something in Async again, is that correct or not?
<technomancy> right; except my blocking thing is an ffi call, not In_thread.run
<orbitz> you're calling a blocking thing from Async without running it through a thread?
<mrvn> technomancy: you haven't said why you need to do the network stuff async
<orbitz> the Async scheduler will be stuck in that case so how do you expect that to owrk?
<technomancy> orbitz: I assume you can yield to the scheduler
<orbitz> technomancy: this doesn't sound likea good idea
<mrvn> technomancy: unless it is multithreaded
<orbitz> technomancy: ocaml-core mailing list or caml-list are probably good place to ask. I don't know how to solve your program, I suspect you'll at least need to run your blocking call in a thread first
<technomancy> unfortunately I don't really control the execution context =\
<orbitz> which execution context?
<mrvn> technomancy: you haven't said why you need to do the network stuff async
<technomancy> orbitz: the foreign readline call
<technomancy> well... maybe I can drop the whole thing in a thread
<orbitz> technomancy: i'm not saying you should, i'm saying doing a blocking ffi not In_thread.run is a bad idea in async, since it will block the entire async
<orbitz> which is what In_thread.run does for you...
<technomancy> so there's no way to manually yield then
<technomancy> mrvn: started using it just because it's mostly well-documented
<mrvn> technomancy: what would yield give you? That doesn't tell the scheduler when to wake you up again
<orbitz> technomancy: How hard is it to write a coroutine in C without an ocaml ffi in there...
<technomancy> mrvn: I was assuming that's what Condition.wait did
<orbitz> no, it just waits
<orbitz> and blocks
<technomancy> orbitz: I'd have to actually learn C for that
Yoric has joined #ocaml
<technomancy> part of the point of OCaml is to avoid that =)
<orbitz> technomancy: I'm not telling you to do taht
<technomancy> (for me anyway)
<mrvn> technomancy: just do the network stuff sync and the problem goes away.
<orbitz> i'm giving you an idea why "can't i just yield" is really ahrd
<technomancy> orbitz: ah, gotcha
<technomancy> my only other experience with a non-concurrent runtime is elisp, which lets you yield to other async processes pretty easily, but I understand the context is very different
yezariaely has quit [Quit: Leaving.]
<orbitz> you're in C code which is quite idfferent
nisstyre has joined #ocaml
<technomancy> mrvn: async is a really good fit for the rest of this program though
<orbitz> what doe sthe callback you want to pass actually do?
<technomancy> orbitz: queries a repl server for a list of possible completions: http://p.hagelb.org/readline.ml.html
<orbitz> how complicated is that API?
<technomancy> I'm writing a fast-launching repl client for lumbering clojure programs
<technomancy> ~500 lines so far
<orbitz> technomancy: I'm sure you can do waht you want in some way, I'm sure it's scarey. And I'm also sure I have no ide ahow
<technomancy> doing this without async would mean either keeping two sockets open or wrapping the regular socket in async-ness
<orbitz> or just making a new socket ofr each connection
<orbitz> readline is humantime afterall...
<technomancy> hm; yeah... the scope of what I'd need to support just completion messages is much reduced from the full protocol support
<technomancy> I could look into just implementing a tiny slice of the protocol
<technomancy> still need to figure out how to construct a null-terminated string array for readline though, which sounds like even crazier magick
Yoric has quit [Ping timeout: 245 seconds]
nikki93 has joined #ocaml
<orbitz> Well, the way I implement protocols is a pure parsing part, and then yo ucan toss any sync/async layr on top
<orbitz> technomancy: doesn't ocaml-ctypes handle all that for you?
<technomancy> orbitz: it supports a pretty limited set of array operations
<orbitz> ok
<technomancy> I think it only works with arrays where you pass the array and the size as separate args
<technomancy> which you can't do if you need to return an array
<orbitz> isn't taht what ptr_opt gives you in ocaml-ctypes?
nikki93 has quit [Remote host closed the connection]
<orbitz> None -> NULL?
<technomancy> yeah, but I need an array of strings, not string options
<technomancy> so it needs to be non-homogeneous afaict
<orbitz> ptr_opt isn't a string option AFAIK
pozzy has quit [Quit: Page closed]
<pippijn> (non-homogenous = heterogenous)
<technomancy> heh; right
<orbitz> "Construct a pointer type from an existing type (called the reference type). This behaves like Ctypes.ptr, except that null pointers appear in OCaml as None"
<technomancy> huh; maybe that would work then
<orbitz> i think it's the point of the construct :)
Yoric has joined #ocaml
mika1 has quit [Quit: Leaving.]
paddymahoney has quit [Ping timeout: 252 seconds]
ng_ has joined #ocaml
<ng_> http://en.wikipedia.org/wiki/Bell_number someone give to me an idea how can i recursively made this?
<mrvn> I would recomend doing it recursively. :)
<tane> the recursive eq. is given there?
<ng_> but, how can i do?
<tane> b0 and b1 are given as 1
<ng_> yes, and after?
<mrvn> ng_: have you done factorial or fibonacci numbers recursively?
<ng_> mrvn, yes
<tane> what is the problem then?
mika1 has joined #ocaml
<mrvn> so you do it the same way except with the other formula
<ng_> the problem is the algorithm , it´s a little confuse, i have no idea how i do recursively
<mrvn> which part?
<ng_> well, everything :/
<Drup> ng_: do you have problem understanding this equation http://upload.wikimedia.org/math/2/6/a/26a066ff5c2d27f20b7204dda0359338.png ?
zpe has joined #ocaml
<ng_> well, i´m a little confuse because i use with 1/e
<mrvn> The second one with 1/e isn't recursive.
Kakadu has joined #ocaml
<mrvn> No B(x) on the right side.
<ng_> yes, so the idea of factorials are similar right?
<mrvn> you can compute factorial recursively. But that has nothing to do with the bell number
zpe has quit [Ping timeout: 248 seconds]
gour has quit [Disconnected by services]
gour_ has joined #ocaml
Snark has quit [Quit: leaving]
<ng_> mrvn, man, i m completely lost, can i show to you my code of factorial and you give me one idea how i do?
<ng_> i m new in functional language, sorry :/
<mrvn> you said you already did factorial recursively
mika1 has quit [Quit: Leaving.]
<ng_> only what i did
<ng_> and now?
<Kakadu> ng_: It's rather slow implementation
<mrvn> now you use it
<ng_> but how? create a new list?
<Kakadu> waht was original problem?
<mrvn> what list? there is no list
<ng_> Kakadu, the original problem is the bell numbers
<mrvn> ng_: by the way, how do you plan to do a sum from 0 to infinity? That would take rather long.
<mrvn> you realy don't want to use the second formula.
<mrvn> ng_: Maybe do that triangle thing further down.
<Kakadu> Ah, formulae exsits!
<Kakadu> I can't see any problem than
<ng_> mrvn, well i dont know
<mrvn> it's a complicated formula for a first timer.
<Kakadu> mrvn: have you recommeded to test himself on factorial impllementation?
<mrvn> You have the sum, which is a recursion, the "x over y", which takes 2 recursions and then the recursion in the formula itself.
<mrvn> Kakadu: scroll up
<mrvn> I wouldn't be surprised if something like B(6) already takes too long to compute.
<mrvn> .oO(Ok, maybe not 6 but something small)
<Drup> ng_: you should implement a naive recursive fibonnaci first
<ng_> ok, but what is the best way?
<ng_> Drup, ok
<ng_> and then?
<mrvn> ng_: hardcode an array of results.
<mrvn> if you want to compute it the triangle thing seems pretty simple.
<Drup> ng_: just do it and see if it help your brain to cope with recursion :]
<ng_> Drup, ok, i will try. mrvn : how?
<mrvn> ng_: you follow the 5 steps from the wiki
<ng_> mrvn, ok, i will try and sooner i will back
<ng_> thanks!!
ng_ has quit [Quit: Leaving]
<tane> even naively implemented it works fast enough :)
shinnya has quit [Ping timeout: 240 seconds]
<mrvn> tane: the recursive one?
<tane> ja
Kakadu has quit []
_andre has quit [Quit: leaving]
mcclurmc has quit [Quit: Leaving.]
ggole has quit []
tane has quit [Ping timeout: 240 seconds]
ollehar has quit [Ping timeout: 260 seconds]
gour_ is now known as gour
paddymahoney has joined #ocaml
gour has left #ocaml []
ollehar has joined #ocaml
Yoric has quit [Ping timeout: 260 seconds]
nikki93 has joined #ocaml
BiDOrD_ has quit [Remote host closed the connection]
tane has joined #ocaml
BiDOrD has joined #ocaml
<technomancy> ooh just realized the solution to my blocking async problem
<technomancy> have my program shell out to itself =)
gereedy has quit [Ping timeout: 245 seconds]
<companion_cube> :D
Yoric has joined #ocaml
<technomancy> I always thought that blocking operations could be implemented in terms of non-blocking ones but not vice versa
<technomancy> because you can always fall back to polling if you just don't care about efficiency
<technomancy> but I guess without the ability to yield you can't poll
<mrvn> I'm pretty sure you can sleep, so just sleep for 0 seconds.
<technomancy> the only sleep I'm seeing in the async codebase is Core.Std.Unix.sleep, which probably doesn't involve the scheduler
<technomancy> maybe it's called something else
<adrien> which scheduler?
<adrien> Unix.sleep most probably releases the GC lock
<technomancy> adrien: async's scheduler, rather
<technomancy> trying to make an async call from a function whose API I don't control; has to be blocking
<adrien> then Unix.sleep is probably not the right one
<mrvn> adrien: the async implementation ones
reynir is now known as not_reynir
<adrien> but that has to be such a function
<technomancy> right; I feel like there's got to be something
<technomancy> just don't know what it's called
not_reynir is now known as reynir
ben_zen has joined #ocaml
<technomancy> according to https://ocaml.janestreet.com/ocaml-core/latest/doc/async_core/index_values.html there's a do_nothing function, but according to rgrep there is not =\
<technomancy> huh; maybe things are spread out over multiple repos or something
<technomancy> yeah, this checkout is missing basically everything
tianon has quit [Quit: "I'm a very important man. I've got a tower!"]
ikudrautsau has joined #ocaml
ikudrautsau has left #ocaml []
gereedy has joined #ocaml
tianon has joined #ocaml
wwilly has joined #ocaml
<wwilly> bonsoir
<companion_cube> hello
nikki93 has quit [Remote host closed the connection]
ollehar has quit [Read error: Operation timed out]
<Anarchos> hi wwilly
rwmjones has quit [Read error: Connection reset by peer]
ikudrautsau has joined #ocaml
tane has quit [Quit: Verlassend]
nikki93 has joined #ocaml
rwmjones has joined #ocaml
jbrown has joined #ocaml
<wwilly> je viens de capté un petite erreur: http://caml.inria.fr/svn/ocaml/release/4.01.0/lex/main.ml
<wwilly> dans let usage = "usage: ocamlex [options] sourcefile"
<wwilly> c'est pas ocamlex mais ocamllex
<wwilly> ...
<companion_cube> bugtracker is your friend ^^
rwmjones has quit [Read error: Connection reset by peer]
<wwilly> oui c'est une contribution de fou
rwmjones has joined #ocaml
boogie has quit [Remote host closed the connection]
ikudrautsau has left #ocaml []
wwilly has quit [Remote host closed the connection]
nikki93 has quit [Remote host closed the connection]
Tamae has joined #ocaml
gereedy has quit [Ping timeout: 245 seconds]
Transhumanist has joined #ocaml
gereedy has joined #ocaml
nikki93 has joined #ocaml
Kelet has quit [Quit: Leaving]
Guest595 has quit [Remote host closed the connection]
nikki93 has quit [Remote host closed the connection]
Yoric has quit [Ping timeout: 245 seconds]
kay_ has joined #ocaml
nikki93 has joined #ocaml
Simn has quit [Quit: Leaving]
Kelet has joined #ocaml
ahill-89 has joined #ocaml
boogie has joined #ocaml
ahill-89 has quit [Quit: leaving]
dezzy has quit [*.net *.split]
nickmeharry has quit [*.net *.split]
tristero has quit [*.net *.split]
stomp has quit [*.net *.split]
Armael has quit [*.net *.split]
pr has quit [*.net *.split]
johnelse has quit [*.net *.split]
chris2 has quit [*.net *.split]
IbnFirnas has quit [*.net *.split]
fds has quit [*.net *.split]
boogie has quit [*.net *.split]
Drup has quit [*.net *.split]
skchrko has quit [*.net *.split]
q66 has quit [*.net *.split]
Obfuscate has quit [*.net *.split]
ccasin has quit [*.net *.split]
tov has quit [*.net *.split]
mrvn has quit [*.net *.split]
mathieui has quit [*.net *.split]
paddymahoney has quit [*.net *.split]
yacks has quit [*.net *.split]
dtg has quit [*.net *.split]
so has quit [*.net *.split]
wormphlegm has quit [*.net *.split]
CissWit has quit [*.net *.split]
ohama has quit [*.net *.split]
zarul has quit [*.net *.split]
ggherdov has quit [*.net *.split]
_habnabit has quit [*.net *.split]
tauntaun has quit [*.net *.split]
bobry has quit [*.net *.split]
technomancy has quit [*.net *.split]
k4nar has quit [*.net *.split]
thelema_ has quit [*.net *.split]
patronus has quit [*.net *.split]
noplamodo has quit [*.net *.split]
vbmithr has quit [*.net *.split]
xaimus has quit [*.net *.split]
nikki93 has quit [*.net *.split]
cantstanya has quit [*.net *.split]
Neros has quit [*.net *.split]
cdidd has quit [*.net *.split]
mfp has quit [*.net *.split]
brendan has quit [*.net *.split]
lenstr has quit [*.net *.split]
xenocons_ has quit [*.net *.split]
bitbckt has quit [*.net *.split]
aggelos_ has quit [*.net *.split]
pr has joined #ocaml
dezzy has joined #ocaml
nickmeharry has joined #ocaml
pr has quit [Changing host]
pr has joined #ocaml
stomp has joined #ocaml
tristero has joined #ocaml
pango_ has joined #ocaml
aggelos_ has joined #ocaml
bitbckt has joined #ocaml
xenocons_ has joined #ocaml
lenstr has joined #ocaml
brendan has joined #ocaml
mfp has joined #ocaml
cdidd has joined #ocaml
Neros has joined #ocaml
cantstanya has joined #ocaml
nikki93 has joined #ocaml
fds has joined #ocaml
chris2 has joined #ocaml
Armael has joined #ocaml
johnelse has joined #ocaml
boogie has joined #ocaml
paddymahoney has joined #ocaml
Drup has joined #ocaml
yacks has joined #ocaml
skchrko has joined #ocaml
q66 has joined #ocaml
dtg has joined #ocaml
ohama has joined #ocaml
zarul has joined #ocaml
so has joined #ocaml
Obfuscate has joined #ocaml
ggherdov has joined #ocaml
ccasin has joined #ocaml
_habnabit has joined #ocaml
tov has joined #ocaml
mrvn has joined #ocaml
mathieui has joined #ocaml
xaimus has joined #ocaml
vbmithr has joined #ocaml
noplamodo has joined #ocaml
patronus has joined #ocaml
thelema_ has joined #ocaml
technomancy has joined #ocaml
bobry has joined #ocaml
k4nar has joined #ocaml
tauntaun has joined #ocaml
wormphlegm has joined #ocaml
CissWit has joined #ocaml
pango has quit [Ping timeout: 248 seconds]
Drup has quit [Quit: Leaving.]