ttamttam has quit [Read error: Connection reset by peer]
ttamttam has joined #ocaml
ttamttam has quit [Read error: Connection reset by peer]
ttamttam has joined #ocaml
hkBst has quit [Ping timeout: 248 seconds]
ontologiae has quit [Ping timeout: 248 seconds]
ontologiae has joined #ocaml
mcclurmc has quit [Ping timeout: 240 seconds]
hcarty_ has joined #ocaml
<hcarty_>
avsm: What is your opinion on oasis vs obuild? I see that you have both implemented for cohttp.
<invariant>
How exactly can you know in advance whether executing map (compose f g) xs is faster than doing compose (map f ) (map g) xs? Doesn't this depend on the architecture?
<adrien_oww>
if in doubt about performance, benchmark
<adrien_oww>
no other way to know
<invariant>
In general, rewriting/reordering of any kind would need a cost model.
<invariant>
I think gcc has something like that.
<invariant>
adrien_oww, so, basically gcc just has a billion tests somewhere which they compile into gcc as some static data?
<adrien_oww>
or have done in the past
<adrien_oww>
probably
<invariant>
Ideally such information about cost models should come from the CPU vendors.
<invariant>
adrien_oww, do you know about The Silver Searcher?
<adrien_oww>
no
<invariant>
It's like grep, only intended to search for developer related information (so, it skips binary files, etc., and it has some limits which make it incomplete, but run much faster).
<adrien_oww>
ah, right; I think I have seen it mentionned a few weeks ago
<adrien_oww>
ag, no?
<invariant>
adrien_oww, well, if you ever have to wait for grep or rgrep, you could install it and solve that problem.
<invariant>
adrien_oww, there is also an emacs mode for it.
<invariant>
adrien_oww, but perhaps you are more of a vim person.
<invariant>
adrien_oww, yes
<adrien_oww>
I use "git grep"
<invariant>
It also runs in parallel.
<invariant>
It's basically what happens when someone solves a problem completely.
<adrien_oww>
my disk doesn't :P
<invariant>
Yeah, but not everything is in git.
<adrien_oww>
(run in parallel)
<invariant>
Anyway, free advice.
<thomasga>
hcarty: obuild is much better :p
<invariant>
adrien_oww, I don't think it does anything on the disk in parallel, or rather, I don't expect it to be so.
BiDOrD has quit [Ping timeout: 255 seconds]
<adrien_oww>
my point was that the bottleneck in my workloads is the disk, not the cpu
<adrien_oww>
thomasga: aren't you supposed to favor ocp-build? :P
<thomasga>
well the question was to compare oasis to obuld :)
gnuvince has quit [Ping timeout: 248 seconds]
<hcarty_>
thomasga: :-)
<adrien_oww>
:-)
<adrien_oww>
have there been so many things that have bothered you with oasis?
_andre has joined #ocaml
<adrien_oww>
I mean, with ocamlbuild directly, I've been very frustrated at times and have had issues I haven't been able to solve
<adrien_oww>
but not with oasis
<hcarty_>
Are there any ocp-indent folks here? I have a bug in the latest version from opam but I'm not sure if it's been fixed/reported yet.
<invariant>
In general, I think ocamlfind is a good tool, but then a gigantic mess was built on top of those by lots of people.
<djcoin>
:)
<invariant>
In particular ocamlbuild.
<hcarty_>
thomasga: Do you have any insight into the future of oasis vs obuild vs ocp-build vs Jane St's to-be-released build tool? I fear build tool fatigue :-)
<invariant>
AltGr_, configure your IRC client and you would know?
<adrien_oww>
invariant: ocamlbuild was _NOT_ build on top of ocamlfind
<invariant>
adrien_oww, oh, even worse.
<invariant>
What's the point of building tools when nobody reuses them?
<rks_>
hello AltGr_ :)
<invariant>
Tools/libraries ideally.
<invariant>
I'd hope that Jane St has anyone competent working on it.
<adrien_oww>
invariant: ocamlbuild is currently inside the compiler sources
<adrien_oww>
ocamlfind is outside
<adrien_oww>
chicken-egg
<invariant>
Since I'd hope that it passes management, I can only imagine that it will be aligned with what I want too.
<invariant>
adrien_oww, and ocamlbuild couldn't be separated out?
<thomasga>
(report from hcarty_)
<adrien_oww>
invariant: it could but it wasn't
<rks_>
thomasga: what's handle incorrectly here?
<rks_>
handled*
<hcarty_>
thomasga: Thanks
<invariant>
OCaml has one of the best module systems, but then it appears it's not being used.
<invariant>
I mean: practice what you teach.
<invariant>
(to whoever wrote the ocaml compiler)
<hcarty_>
rks_: The closing )
<invariant>
They teach at university that you need to write maintainable software and then they themselves don't.
<rks_>
hcarty_: you want it aligned with L ?
<hcarty_>
rks_: Yes
<invariant>
Anyway, that's something I don't comprehend.
<rks_>
yeah why not, ok
<hcarty_>
rks_: That's how it is indented elsewhere by ocp-indent
<rks_>
but hcarty_, let's say then
<rks_>
that you dont pass "l" as an argument
<hcarty_>
I would still want the closing ) lined up
<rks_>
but "(a_really_long_expression which_is_longer_than_40c and_returns_a_list)"
<rks_>
so you put that argument on its own line
<rks_>
what should it be aligned with
<rks_>
the L, or the s ?
<hcarty_>
I would probably want that indented one level from the closing function )
<rks_>
sure (the other choice would just be awful :-')
<rks_>
but that doesn't seem coherent hcarty_ :-'
<AltGr>
well after some time working on ocp-indent
<hcarty_>
I want consistently matched open/close delimiters
<rks_>
(all that to say: I like the way it's indenting atm)
<AltGr>
it starts out looking like a consistent, simple problem
<AltGr>
but it really isn't :)
<hcarty_>
AltGr: That seems likely!
<AltGr>
well I'm checking which version I'm on right now because I do have the ')' aligned with the 'L'
<hcarty_>
AltGr: 1.0.1 here
<invariant>
Fast indentation is perhaps sort of hard.
<invariant>
It just depends on the assumptions you can make.
<invariant>
And the dependencies you are willing to use.
<invariant>
It is probably faster to copy the buffer in an editor to some external process written in mlton and then do all the work there for big buffers.
<invariant>
ocp-indent likely does something like that.
<invariant>
But even then, there are lots of ways to hide latency in Emacs, if one really wanted.
<hcarty_>
AltGr: Thanks!
<AltGr>
featuring ocamldoc code indentation
<invariant>
There is no excuse for slow code on modern machines.
<AltGr>
invariant: yeah, we actually use a modified version of the ocaml lexer, and keep an indentation stack while going through the tokens
<invariant>
I think a good way to write an indenter is to write a DSL to describe indentation transformations and then to compile that to fast, but unreadable code.
<invariant>
So, it would be a 2D language.
<invariant>
I don't think anyone has ever done that before and it would make a good student project.
<invariant>
This way, bug reports, can be turned into patches for the indenter.
<AltGr>
gtksourceview uses XML language definitions
<invariant>
AltGr, yeah, that sounds like a good and fast backend.
<AltGr>
(but not compiled)
<invariant>
How much work it currently is to add new indentation rules now?
<invariant>
is it currently*
<AltGr>
depends what kind
<AltGr>
but the cost is growing a bit too much to my taste, to tell the truth
mcclurmc has joined #ocaml
ssbr has quit [Read error: Connection reset by peer]
ssbr has joined #ocaml
BiDOrD has joined #ocaml
troydm has quit [Read error: Operation timed out]
troydm has joined #ocaml
dwmw2_gone is now known as dwmw2
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 245 seconds]
gustav_ has quit [Remote host closed the connection]
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
thomasga has quit [Quit: Leaving.]
rixed has joined #ocaml
darinmorrison has joined #ocaml
thomasga has joined #ocaml
ssbr has quit [Read error: Connection reset by peer]
hkBst has quit [Ping timeout: 248 seconds]
hkBst_ has joined #ocaml
hkBst_ has quit [Changing host]
hkBst_ has joined #ocaml
hcarty_ has quit [Quit: Page closed]
mapf has joined #ocaml
lucasaiu has joined #ocaml
lucasaiu has left #ocaml []
cyball has quit [Ping timeout: 245 seconds]
notk0 has joined #ocaml
<notk0>
hello, there is the Lambda.switch case in OCaml
<notk0>
and it has consts, and blocks
<notk0>
I assume consts are the match cases
<notk0>
and blocks are the code to execute for each case?
fraggle_ has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
BiDOrD_ has quit [Ping timeout: 260 seconds]
BiDOrD has joined #ocaml
ollehar1 has joined #ocaml
<notk0>
is it possible to reduce some parentheses for such an expression ?
<notk0>
let cps_consts = List.map2 (
<notk0>
fun (ci, t) bt ->
<notk0>
ci,term t ( KLam (fresh_intermediate_variable (), (snd bt) ))
<notk0>
)
<notk0>
lam_cases.LL.consts cps_blocks in
BiDOrD has quit [Ping timeout: 245 seconds]
BiDOrD has joined #ocaml
<adrien_oww>
I think the ones around "sdn bt" can be removed but that's it
<adrien_oww>
otherwise, create a named function
<avsm>
just pattern match the (snd bt) away
<avsm>
fun (ci, t) (_,bt) ->
arduinoob has quit [Quit: Lost terminal]
<notk0>
oh that works?
<Kakadu>
avsm: but parenteses count will be the same!
<adrien_oww>
notk0: sure
<notk0>
thank you it works :P
<notk0>
parentheses count is the same but more readable
<notk0>
anyone here good with continuations?
<Kakadu>
Can somebody point me an _oasis based package which uses C++ compiler to build stubs?
<adrien_oww>
Kakadu: besides the need to set CC=g++ (or anything similar), there shouldn't be a difference
* Kakadu
is looking for something similar
<Kakadu>
heh, in 2010 oasis was not supporting C++ source files
<notk0>
I am looking at the lambda_switch code and what does sw_consts and sw_blocks represent?
<notk0>
sw_consts are the constructors and blocks the code to execute in case of a match?
<notk0>
and lambda_switch =
<notk0>
{ sw_numconsts: int;
<notk0>
sw_consts: (int * lambda) list;
<notk0>
sw_numblocks: int;
<notk0>
sw_blocks: (int * lambda) list;
<notk0>
sw_failaction : lambda option}
cago has left #ocaml []
mika1 has quit [Quit: Leaving.]
Kakadu has quit []
ttamttam1 has quit [Quit: ttamttam1]
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
ollehar has joined #ocaml
mye has joined #ocaml
notk0 has quit [Quit: Leaving]
kaustuv has left #ocaml []
ttamttam has joined #ocaml
<def-lkb>
notk0: lambda_switch makes the distinction between constant constructors (without arguments, like None) and constructors with arguments (like Some v)
<def-lkb>
constant constructors are represented as integers, so I guess sw_consts is a list associating the code to execute to a particular integer value
<def-lkb>
blocks are represented as pointers to a memory area with a tag and one or more words/values : sw_blocks works the same way except that there is one more indirection and the dispatch is done on the tag value
awm22 has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.9.2]
ollehar has quit [Ping timeout: 248 seconds]
Kakadu has joined #ocaml
awm22 has quit [Quit: Leaving.]
cdidd has quit [Read error: Connection reset by peer]
gnuvince has joined #ocaml
thomasga has quit [Quit: Leaving.]
<ollehar1>
can't a function have type 'a -> unit? I get unbound type parameter
<Kakadu>
it can
<ollehar1>
like
<ollehar1>
type op = {
<ollehar1>
fn : 'a -> unit
<ollehar1>
}
<Kakadu>
type 'a op = ...
<companion_cube>
fn : 'a . 'a -> unit;
<rks_>
companion_cube: please, stop saying suck things
<rks_>
such*
<rks_>
(oh well)
<ollehar1>
Kakadu: ah, thanks
mcclurmc has quit [Ping timeout: 245 seconds]
<zorun>
companion_cube: is that a valid syntax?
<zorun>
looks like it is
<zorun>
what does it mean?
<companion_cube>
rks_: what's the point?
<companion_cube>
zorun: it means exactly that, "forall 'a. 'a -> unit"
<companion_cube>
so basically that's a function that ignores its first argument ;)
<companion_cube>
it's not a GADT or first class functor :D
<flux>
rks_, what is the potential damage? they'll break ocaml?-)
<rks_>
flux: :D
<flux>
there are dark corners in ocaml but as long we stay on the sound level, it's all alright in my book
<rks_>
well flux, thing is
<rks_>
most of the time they don't need to look in these dark corners
<rks_>
but if we point them out, they surely will
<rks_>
(and they might not understand what they find :-')
<flux>
and if they do, they'll pick that there's another thing they haven't quite yet mastered. but in the future, when they find themselves stumped on a problem, they might think 'hmm, that thing I didn't quite know about, maybe it'll fit in here nicely', and go learn about it.
<zorun>
companion_cube: oh, right, I thought it would allow to quantify universally anywhere in the type
<flux>
example: monads :)
<flux>
besides, if they want to put Printf-functions inside a record, they must know about the universal quantifier
<rks_>
well flux
<rks_>
my opinion is : if they do get stumped on a problem, then they'll come back and we can show them
<ollehar1>
this: let op_list = ref ([] : 'a op list);;
<rks_>
but I thing that can it can only confuse them at the beginning
<flux>
if you want it to be safe, then no, I don't think it's possible
<flux>
what is possible is connecting attributes to a value and then dynamically querying if this value has attribute X, and so on
<flux>
while that might be a good approach in some situations (like hooks), I sort of doubt that is the best way to go here, for some random data
<flux>
you may find it beneficial that you can find what kind of data an object can contain, and then being able to find such places
<orbitz>
what's ollehar1 tryingto do?
<ollehar1>
orbitz: ref list with record containing immediate object
<orbitz>
what's immediate object?
<ollehar1>
let a = object method bla = foo end
<orbitz>
ah objects
<ollehar1>
object without class
<orbitz>
outside my sphere :)
<ollehar1>
flux: yes, a map or hash map could be a solution, but less safe
<ollehar1>
no, that wouldn't work, nevermind
ontologiae has quit [Ping timeout: 264 seconds]
mye has quit [Quit: mye]
Enjolras has quit [Ping timeout: 245 seconds]
Enjolras has joined #ocaml
ottbot has quit [Ping timeout: 245 seconds]
<flux>
ollehar1, so do all the objects that are in that ref list need to adhere to the same interface?
<ollehar1>
flux: the function in the records in the ref list must know the type of the object before the object is created. that's why it's not possible to use immediate object
<ollehar1>
thanks for your time, though, very kind :)
<flux>
well, if you know that the type of the object is something, you can do this: let xs : (< a : int > list ref) = ref []
<flux>
but apparently you don't know it at that point
<flux>
with that you can do xs := [object method a = 42 end];;
walter has quit [Quit: This computer has gone to sleep]
beginner42 has joined #ocaml
IbnFirnas has joined #ocaml
awm22 has joined #ocaml
<ollehar1>
flux: yes, I realized, but that would put me in the same spot as to update the type definition every time I add a field.
<beginner42>
adrien: hi, is it a good idea to use the webkit as a crawler inside a ocaml program? or are there other alternative programs?
<Yoric>
Using webkit as a crawler?
<Yoric>
That sounds like overkill, doesn't it?
<Yoric>
Plus you should use Gecko, but then, I'm biased :)
<beginner42>
Yoric: gecko is from firefox?
<Yoric>
Indeed.
<beginner42>
Yoric: But there is not ocaml api, to access content of a website or similar operations?
<adrien>
Yoric: gecko has become unusable
<adrien>
you can't use it anymore outside of XUL applications
walter has joined #ocaml
<adrien>
and I'm not sure you have many alternatives but it really depends on what you want to get from the crawling
<Yoric>
adrien: I assume you mean "mozembed", but yes, that's true.
<adrien>
if you don't want much, maybe try to avoid webkit
<adrien>
webkit gives you access to the DOM but that might be impractical
<beginner42>
i could pass the pages and contents to extract via zmq
ollehar1 has quit [Ping timeout: 260 seconds]
thomasga has joined #ocaml
<adrien>
well, if you can work with a javascript engine plus a few other things around it, it'd probably be a lot better
Anarchos has joined #ocaml
ttamttam has quit [Remote host closed the connection]
ollehar has joined #ocaml
menace has joined #ocaml
<beginner42>
adrien: i will give it a try.
<beginner42>
thanks all for the advice
ottbot has quit [Ping timeout: 256 seconds]
<Kakadu>
I have `let () = Callback.register ...` in module which is put into cmxa
<Kakadu>
than I make .o from cmxa and link it it C++ main file
<Kakadu>
and while executing it seems that `Callback.register` is not executed?
<Kakadu>
Some my question is: when module initialization is performed?
<adrien>
what I've gathered by myself
<adrien>
when you link all your .cmxa together with ocamlopt, it generates a corresponding camlstartup*.s file
<adrien>
this file will initialize the module
<adrien>
s
<adrien>
I mean
<adrien>
this file will be assembled and linked into the final executable; it will be executed first and will call the initializers in the modules
clog_ has joined #ocaml
r126l_ has joined #ocaml
<Kakadu>
.cmxs?
thomasga has quit [Ping timeout: 246 seconds]
travisbrady has quit [Ping timeout: 246 seconds]
Qrntz has quit [Ping timeout: 246 seconds]
osa1 has quit [Ping timeout: 246 seconds]
clog has quit [Ping timeout: 246 seconds]
r126l has quit [Ping timeout: 246 seconds]
travisbrady_ is now known as travisbrady
patronus_ has quit [Ping timeout: 246 seconds]
ollehar has quit [Ping timeout: 260 seconds]
beginner42 has quit [Quit: irc2go]
<orbitz>
woo doggy, I can do get's with m riak client
Qrntz has joined #ocaml
Razzllls has joined #ocaml
walter has joined #ocaml
Kakadu has quit []
Icarot has joined #ocaml
mye has joined #ocaml
walter has quit [Quit: This computer has gone to sleep]
reavengrey has joined #ocaml
<reavengrey>
Hi, hi, anyone here who understands co-routines?
<reavengrey>
I was just introduced to the idea, but I have some questions
<companion_cube>
ask them, it might be interesting :)
<reavengrey>
Kk, the person who introduced me to them
<reavengrey>
Says that they have applications in increasing concurrency or parallelism
<reavengrey>
In applications such as, web servers, etc
<reavengrey>
You abstract the various sub routines as coroutines
<reavengrey>
And you gain some form of increased paralellism
<reavengrey>
But, it seems to me that they are really a mask
<reavengrey>
Over asynchronous programming?
<reavengrey>
And in fact the mini-context switches that are imposed by coroutines
<reavengrey>
(the context save and restore of the userspace context)
<reavengrey>
Are completely avoided when you just use an asynchronous programming model?
<companion_cube>
yes, but I suppose it's more natural to write it as coroutines
<reavengrey>
I'm asking to confirm, because he said that people in this channel would understand and be able to explain
<reavengrey>
Ah, right
<companion_cube>
rather than by chaining callbacks by hand
<reavengrey>
So it's like syntax sugar?
<reavengrey>
Languages can give a syntactical overlay at the syntax level
<companion_cube>
it may be a bit deeper, because true coroutines are more powerful than the usual stack management
<reavengrey>
Mm, but if you are blocking on synchronous fread()
Icarot has quit [Remote host closed the connection]
<reavengrey>
coroutines don't implicitly make you stop blokcing, for example
<reavengrey>
The true solution is still select/poll()
<reavengrey>
asynch
<reavengrey>
Do I have it right?
<reavengrey>
Or something?
<Razzllls>
select pool only work on specific OS calls/IO types
<Razzllls>
coroutines are more general than that
<reavengrey>
Well, not specifically select/poll
<reavengrey>
but I used those as a general example of "asynchronicity"
<companion_cube>
reavengrey: with coroutines, instead of registering a callback to select(), you would yield control to select(), and get a value/event back in the same coroutine
<reavengrey>
Select will still block though :O
<Razzllls>
reavengrey: that's not the point, it's not about blocking
<reavengrey>
But that was a good argument for syntax enhancement
<Razzllls>
IT's about code control, be able to combine functions in a way that you wouldn't otherwise
<reavengrey>
Right
<reavengrey>
So, it's a more relaxed, or slightly easier model to understand
<reavengrey>
improving source level syntax
<reavengrey>
Thanks, I needed to be sure
<Razzllls>
also they can be used in non IO situations, not related to select, or any event
<reavengrey>
Yea, that is true
<Razzllls>
I think I might have an example
<reavengrey>
As long as parallelism isn't the core issue, they do provide an abstraction that makes the design cleaner
<Razzllls>
are you familiar with the goto debate in the early 70s? between Knuth and Djkstra?
<Razzllls>
Structural programming with goto and how goto is good from one guy
<reavengrey>
Well, not that specifically, but I don't like goto myself
<Razzllls>
and how goto is bad from another, and higher level abstraction must be introduced
<reavengrey>
Continue, I should be able to follow along
<companion_cube>
coroutines are also good for some algorithms, like checking whether two trees contain the same sequence of elements
<reavengrey>
Yea, but in the end, my core question is,
<reavengrey>
It seems to me, I need to be sure
<reavengrey>
That they are a mask for asynch, or rather, a sort of ..."bastardization" that avoids the need for new programmers
<reavengrey>
To properly understand asynchronous models
<reavengrey>
Like, asynch without actual asynch modeling
<Razzllls>
not necessarily, co-routines can be used in a non-async mode,, a subroutine (a normal function) can be called from a single point, a courroutine can be called from any point and can return to any
<reavengrey>
Right
<Razzllls>
it's not necessarily about async, but about having goto without having goto
<Razzllls>
jumping in a way that is safe vs goto
ottbot has joined #ocaml
<reavengrey>
Yea, a langauge level abstraction for cleaner source
<reavengrey>
I can see the merit
<Razzllls>
all high level abstractions are for a cleaner source
<reavengrey>
Yea
<Razzllls>
you should read the debate or rather the articles
<reavengrey>
P. much
<Razzllls>
pro goto and vs goto
<reavengrey>
Yea, I avoid goto like the plague
<reavengrey>
Thanks a lot for the discussion everyone
* companion_cube
doesn't despise all gotos
mye_ has joined #ocaml
mye has quit [Ping timeout: 252 seconds]
mye_ is now known as mye
Yoric has quit [Ping timeout: 264 seconds]
Razzllls has quit [Quit: ChatZilla 0.9.90 [Firefox 19.0.2/20130307023931]]
rwmjones has quit [Ping timeout: 256 seconds]
Snark has quit [Quit: Quitte]
<reavengrey>
Hi,
<reavengrey>
One last question, it seems I got something wrong
Razzllls has joined #ocaml
<reavengrey>
I'm told that coroutines are not really fibers / lightweight-threads?
<reavengrey>
Is this true?
<reavengrey>
I thought that coroutines are just really fibers
adotbrown has joined #ocaml
stephstephg has joined #ocaml
rwmjones has joined #ocaml
adotbrown has quit [Ping timeout: 246 seconds]
adotbrown has joined #ocaml
mcclurmc has joined #ocaml
stephstephg has quit [Quit: Konversation terminated!]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
anderse has quit [Quit: anderse]
smondet has quit [Ping timeout: 255 seconds]
adotbrown has quit [Ping timeout: 272 seconds]
clog has joined #ocaml
Razzllls has quit [Quit: ChatZilla 0.9.90 [Firefox 19.0.2/20130307023931]]
travisbrady has quit [Quit: travisbrady]
adotbrown has joined #ocaml
Yoric has joined #ocaml
osa1_ has quit [Quit: Konversation terminated!]
Yoric has quit [Ping timeout: 256 seconds]
walter|r has joined #ocaml
ollehar has joined #ocaml
reavengrey has quit [Ping timeout: 245 seconds]
reavengrey has joined #ocaml
reavengrey has quit [Read error: Connection reset by peer]
mcstar has joined #ocaml
<mcstar>
hey
reavengrey has joined #ocaml
<mcstar>
can you guys help me translate this code to ocaml?