adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
lusory_ has joined #ocaml
ahokaomaeha has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
chris447 has joined #ocaml
chris447 has left #ocaml []
madroach has quit [Ping timeout: 248 seconds]
madroach has joined #ocaml
mye has joined #ocaml
myx has quit [Ping timeout: 255 seconds]
emmanuelux has quit [Quit: emmanuelux]
ollehar has joined #ocaml
gnuvince has joined #ocaml
ollehar has quit [Quit: ollehar]
yacks has joined #ocaml
m4b has joined #ocaml
<m4b> hello; i was on here on friday asking about caml_initialize taing up 50% of the program time according to gprof, for a vm I am writing; on the suggestion of a kind user here, I switched out record types I was using to represent 32-bit instruction segments, and changed the memory model from hashtables of arrays, to patricia trees of arrays; unfortunately, the changes have resulted in no speedup whatsoever, and caml_initialize is still
<m4b> taking up the majority of the program time. I would be very grateful if someone could (1) explain what exactly that function call does, and (2) how I might optimize my program; the code is here: http://hpaste.org/82586
pkrnj has joined #ocaml
flx_ has joined #ocaml
flux has quit [Ping timeout: 245 seconds]
flx_ is now known as flux
ahokaomaeha has joined #ocaml
m4b has quit [Ping timeout: 264 seconds]
cyball1 has quit [Ping timeout: 248 seconds]
ahokaomaeha has quit [Read error: Connection reset by peer]
ahokaomaeha has joined #ocaml
ahokaomaeha has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
pkrnj has quit [Quit: Textual IRC Client: www.textualapp.com]
cdidd has quit [Read error: Operation timed out]
cyball1 has joined #ocaml
ahokaomaeha has joined #ocaml
yacks has quit [Quit: Leaving]
ttamttam has joined #ocaml
Yoric has joined #ocaml
ttamttam has quit [Client Quit]
oriba has joined #ocaml
ttamttam has joined #ocaml
oriba has quit [Remote host closed the connection]
ttamttam has quit [Remote host closed the connection]
ahokaomaeha has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
myx has joined #ocaml
Snark has joined #ocaml
ontologiae has joined #ocaml
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
ttamttam has joined #ocaml
oriba has joined #ocaml
Cyanure has joined #ocaml
djcoin has joined #ocaml
<oriba> strange Caml-list seems not to spread my mails... is the list doiwn, or what?
<oriba> or am I false positively "spam"?
<oriba> or i sthe list just too slow at the moment?
<oriba> anyone here who has multiple OCaml installs on the same system?
<oriba> Can I run them in parallel without creating a big mess?
<julm> of course you can
<julm> you merely have to play with PATH and OCAMLFIND_CONF to select one install or the other
ahokaomaeha has joined #ocaml
<oriba> OCAMLFIND_CONF? since when is it supported? my old ocamlfind-manpage does not mention it
<julm> man 5 findlib.conf
<oriba> exists.
<oriba> thanks
Kakadu has joined #ocaml
Cyanure has quit [Remote host closed the connection]
Yoric has quit [Ping timeout: 264 seconds]
mye has quit [Quit: mye]
<orbitz> oriba: I run everything on Nix which supports mulitple versions pretty easily too
<orbitz> oriba: looks like your email made it to the mailing list and it has 2 replies
mika1 has joined #ocaml
cago has joined #ocaml
mye has joined #ocaml
mye has quit [Client Quit]
tani has joined #ocaml
tane has quit [Ping timeout: 245 seconds]
ontologiae has quit [Ping timeout: 276 seconds]
<oriba> orbitz, "Nix"??
<oriba> I see no such emails
<oriba> strange
thomasga has joined #ocaml
<oriba> orbitz, yes, the mail is in the archive.... have asked my provider (it's not in my spamfolder).... hmhhh
hkBst has joined #ocaml
<oriba> Ah, both people say, I should use OPAM.
<julm> ahahah
<oriba> OPAM, which I found on github needs ocaml (>= 3.12.1) but I have 3.11.2 :-(
<oriba> julm, why are you laughing?
<julm> they're so oriented :°
<oriba> ?
<oriba> what do you mean?
<julm> that it's a trend
<oriba> they are biased? or what?
<oriba> aha
<adrien_oww> 3.11.2 is *old*
<julm> squeeze
<Kakadu> very old
<oriba> someone yesterday also recommended me OPAM
<adrien_oww> why are you on that version?
<oriba> yes it is old
<julm> which is still the debian stable afaik
<oriba> I was too lazy for updating ;-)
<adrien_oww> if you use opam (or godi or whatever), you won't be using your distribution's ocaml anyway
<oriba> and on a server where my webstuff lies (where I'm NOT root), there is also 3.11.2
<Kakadu> oriba: 3.12.1 has many interesting features
<oriba> so if I update and use new features, I may break the code compared to that server
<oriba> Kakadu, yes, and 4.00 even more :-)
<oriba> Thats why I want to switch now
<Kakadu> oriba: not really :)
<oriba> But when that server has 3.11.2 ... too bad
<oriba> Kakadu, not really?
<oriba> GADT?!
<Kakadu> yeah,
<oriba> is bytecode from 4.00 compatible to 3.11.2?!
<Kakadu> I think not
<oriba> or maybe I can compile to native
<Kakadu> almost sure that not
<oriba> maybe it runs there too
<oriba> OAPM is hype it seems
<oriba> on the list they said, it can switch between versions easily
<oriba> but it does not help if I need to have the old one
<oriba> or I first need to compile 4.00, installOPAM with it and then... maybe...
<oriba> "configure: error: Your version of OCaml: 3.11.2 is not supported" :-(
Kakadu has quit [Read error: Connection reset by peer]
Kakadu_ has joined #ocaml
<flux> oriba, ocamlbrew is great!
<oriba> hmhh
<flux> bootstraps you an ocaml 4.0/opam environment
<flux> with a single command
<flux> (to your home directory, for example ~/.ocamlbrew/ocaml-4.0.0)
<oriba> hmhh
<flux> and then you take it into use with "source ~/.ocamlbrew/ocaml-4.0.0/etc/*.bashrc"
<oriba> from which ocaml does do this?
<Kakadu_> oriba: no hmhh, just do it!
<oriba> hehe
<flux> oriba, you can get ocamlbrew here: https://github.com/hcarty/ocamlbrew or just curl -kL https://raw.github.com/hcarty/ocamlbrew/master/ocamlbrew-install | bash
<oriba> I will try it
<flux> it worked on my raspberry pi as well
<flux> (well, almost, I imagine the current version should work without issues)
<flux> after that you can get the stuff you want with opam list/opam install
<oriba> flux, on raspberri pi?! wow
<flux> it took some time, though...
<flux> oriba, it takes about 1.1 Gbytes, btw
<oriba> oh
yacks has joined #ocaml
<oriba> good that I have cleaned up my disk some weeks ago...
<oriba> it does build 4.00.1. I already did that...
<oriba> I just did not installed it
<oriba> flux, how long will it take? I hope less than an hour...
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
<oriba> hmhhh it's uilding OPAm now :-)
<oriba> flux, seems to be ready
<oriba> crazy
<oriba> :)
hkBst has quit [Remote host closed the connection]
<oriba> flux, how to use it?
myx has quit [Read error: Operation timed out]
<Kakadu_> read manuals)
<Kakadu_> or tutorial in web
<oriba> which manuals?
<Kakadu_> man opam?
<oriba> No manual entry for opam
hkBst has joined #ocaml
<Kakadu_> opam help install?
<oriba> no ~/.ocamlbrew
<oriba> opam not known
<Kakadu_> Oh, really?
<oriba> cooking did not worked, it seems
<oriba> but I have ~/ocamlbrew/ocaml-4.00.1/bin/opam
<oriba> PATH not set by brewery
Yoric has joined #ocaml
Yoric has quit [Client Quit]
Yoric has joined #ocaml
ottbot has joined #ocaml
yacks has quit [Read error: Connection reset by peer]
<Kakadu_> oriba: success?
<oriba> hmhh, need to explore that later....
ontologiae has joined #ocaml
<oriba> no
<Kakadu_> I forget to mention: which opam && eval `opam config env`
<oriba> maybe I need to brew myself :(
<oriba> opam config env' failed.
Tobu has quit [Read error: Connection reset by peer]
<oriba> rm is my friend ;-)
Tobu has joined #ocaml
<flux> oriba, source ~/ocamlbrew/ocaml-4.00.1/etc.*.bashrc
<oriba> "bash: /home/oliver/ocamlbrew/ocaml-4.00.1/etc.*.bashrc: No such file or directory"
<oriba> this works: source /home/oliver/ocamlbrew/ocaml-4.00.1/etc/ocamlbrew.bashrc
<oriba> wow
<oriba> which ocaml gives me the ocamlbrew-ocaml
<oriba> so I can use it I think
<Kakadu_> it will `system` ocaml in opam terminology
<oriba> other shell gives me the installed at /usr/bin/ :-)
<oriba> aha
<Kakadu_> see list in `opam switch`
<oriba> hmhhh
<oriba> switch means switching to other releases?
<Kakadu_> btw
<Kakadu_> yeah, this switching
<oriba> cool :-)
<Kakadu_> have you already executed `opam init`?
<oriba> no
Tobu has quit [Read error: Connection reset by peer]
<oriba> hmhh, it says, it was already done
<oriba> ah ok :-)
Tobu has joined #ocaml
<oriba> so it looks like I then can use 3.11.2 and 4.00.1 for development :-)
yacks has joined #ocaml
cyball2 has joined #ocaml
<oriba> but I need to install packages with opam then.... it seems... will try it :-)
<Kakadu_> don't forget to reinstall libraries for both versions
<oriba> hmhhh
<oriba> aha
<oriba> switch to one version, install libs, switch to other version, install libs?
<oriba> (I could use the original version in other shell without opam)
cyball1 has quit [Ping timeout: 276 seconds]
<oriba> how do I seem which ocal is swithced on?
<Kakadu_> ocamlc -v?
<oriba> hehe
<oriba> ah, there is Advanced_Usage in the docs...
<oriba> for switching
dwmw2_gone is now known as dwmw2
<oriba> crazy, it installs 3.11.2, when switching to it...
ocp has joined #ocaml
<oriba> hey, even 4.00.1 is installed by opam, when switching, it installs it again...
<oriba> hmhh... or the 4.00.1 is from ocamlbrew, and not the same as that of OPAM?
<oriba> Will explore that later
<oriba> Kakadu_, flux even I need to explore this more, this all was very helpful already. thanks :-)
oriba has quit [Quit: oriba]
yacks has quit [Read error: Operation timed out]
mcclurmc has quit [Ping timeout: 264 seconds]
tani has quit [Quit: Verlassend]
yacks has joined #ocaml
rixed has quit [Ping timeout: 245 seconds]
hkBst has quit [Ping timeout: 248 seconds]
Icarot has joined #ocaml
Icarot has quit [Client Quit]
hkBst has joined #ocaml
ahokaomaeha has quit [Ping timeout: 252 seconds]
_andre has joined #ocaml
anderse has joined #ocaml
mcclurmc has joined #ocaml
adotbrown has quit [Ping timeout: 248 seconds]
reynir has quit [Remote host closed the connection]
Yoric has quit [Ping timeout: 256 seconds]
Yoric has joined #ocaml
thomasga has quit [Quit: Leaving.]
tane has joined #ocaml
leoncamel has joined #ocaml
<anderse> I'm playing around with the idea of rewriting some of our ruby http-services in ocaml for fun and hopefully some performance gains, is there any ocaml http service that you know could be suitable for tiny services?
<zorun> anderse: ocsigen is pretty complete, but maybe a tad overkill for your needs
<zorun> otherwise, I've heard of CoW (Caml on the Web) for manipulating structured data commonly found on the web (XHTML, JSON, etc)
<adrien_oww> there's ocaml-http
<adrien_oww> and of course ocamlnet
<anderse> the first thing im looking at is more or less a distributed hash of json, so it extremly simple service
<anderse> i started looking at ocaml-cohttpserver but since im completely new to the ecosystem i thought i might ask here :)
Icarot has joined #ocaml
Rotek has joined #ocaml
Rotek has quit [Client Quit]
csmrfx has joined #ocaml
<anderse> an unrelated question, would you suggest jane street's core or batteries for someone starting out with ocaml but who has quite high stability requirements?
<adrien_oww> both are stable and well-tested
<csmrfx> sounds bit strange, those "high stability requirements"
<anderse> sorry, i mean, i dont want to be the only one using a certain feature in production and stumbling on a bug which no one has seen before - but perhaps there are no library level bugs in core or batteries!
<csmrfx> we all do!
<csmrfx> but... how do you know what exactly creates stability in your app, etc. etc.
<anderse> ive come to think that stuff which is widely adopted is generally safer if you have no clue, and more info is found on google etc
<anderse> i guess what i wanted to know is "is anyone actually using both of these?"
<csmrfx> sounds more like belief than fact
<anderse> yeah, i built most of my life around it, belief
<csmrfx> hehe, the little software engineer in me wants specs!
<djcoin> csmrfx: using something that has users seems to me like a good criteria
<csmrfx> But still we dont know what would "stability" imply in this context
<anderse> as someone who mostly does ruby, no segfaults would be a nice start ;)
<csmrfx> anderse: try jruby!
<csmrfx> no segfaults
<djcoin> csmrfx: ?
<anderse> i know, we do alot of xml data processing and our jruby-branch performed worse, otherwise we'd already be on it
<nicoo> csmrfx: No; instead, you have giganormous GC pauses ;)
<csmrfx> strange, jruby and jvm both have improved performance lately
<csmrfx> nicoo: ;)
<anderse> csmrfx: i think it boils down to the libxml backend to our library being faster than the java implementation
mcsquiggedy has joined #ocaml
<nicoo> anderse: And JNI isn't an option ?
<csmrfx> anderse: there is no think, only *know*
<anderse> csmrfx: you have not been inside of my head, that is one thing which is clear!
<anderse> nicoo: im sure, we've didnt have any pressing reason to migrate so we didnt spend any of time reworking the library
<anderse> this thing rewriting some stuff in ocaml is mostly because it think it seems fun, no facts, just thinking - dont tell the other guys at my startup ok? ;)
ahokaomaeha has joined #ocaml
<nicoo> :)
ahokaomaeha has quit [Read error: Connection reset by peer]
ahokaomaeha has joined #ocaml
Fullma has joined #ocaml
rixed has joined #ocaml
cdidd has joined #ocaml
SanderM has joined #ocaml
hkBst has quit [Read error: Connection reset by peer]
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
Icarot has quit [Remote host closed the connection]
yacks has quit [Read error: Connection reset by peer]
q66 has joined #ocaml
mattrepl has joined #ocaml
Yoric has quit [Ping timeout: 256 seconds]
leoncamel has quit [Ping timeout: 252 seconds]
hkBst has quit [Ping timeout: 256 seconds]
travisbrady has joined #ocaml
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
mcsquiggedy has quit [Read error: Operation timed out]
cago has left #ocaml []
SanderM has quit [Remote host closed the connection]
ttamttam has quit [Quit: ttamttam]
hkBst has quit [Ping timeout: 248 seconds]
hkBst has joined #ocaml
travisbrady has quit [Quit: travisbrady]
hkBst has quit [Ping timeout: 248 seconds]
travisbrady has joined #ocaml
Sergey has joined #ocaml
mcsquiggedy has joined #ocaml
hkBst has joined #ocaml
tane has quit [Quit: Verlassend]
thomasga has joined #ocaml
ocp has quit [Ping timeout: 245 seconds]
yacks has joined #ocaml
darkf has quit [Quit: Leaving]
yacks has quit [Ping timeout: 244 seconds]
Kakadu_ has quit [Ping timeout: 244 seconds]
Icarot has joined #ocaml
ttamttam has joined #ocaml
hkBst has quit [Quit: Konversation terminated!]
ttamttam has quit [Quit: ttamttam]
tac has joined #ocaml
ocp has joined #ocaml
Icarot has quit [Ping timeout: 244 seconds]
Yoric has joined #ocaml
paolooo has joined #ocaml
Cyanure has joined #ocaml
ocp has quit [Quit: Leaving.]
gnuvince has quit [Ping timeout: 255 seconds]
ttamttam has joined #ocaml
osa1 has joined #ocaml
ttamttam has quit [Quit: ttamttam]
ttamttam has joined #ocaml
paolooo has quit [Quit: Page closed]
q66 has quit [*.net *.split]
rixed has quit [*.net *.split]
mika1 has quit [*.net *.split]
dezzy has quit [*.net *.split]
fayden has quit [*.net *.split]
rwmjones has quit [*.net *.split]
_habnabit has quit [*.net *.split]
TDJACR has quit [*.net *.split]
TDJACR has joined #ocaml
tane has joined #ocaml
q66 has joined #ocaml
rixed has joined #ocaml
dezzy has joined #ocaml
fayden has joined #ocaml
rwmjones has joined #ocaml
_habnabit has joined #ocaml
anderse has quit [Quit: anderse]
<companion_cube> I used opam switch for ocaml4.00.1, which works fine, except that the 'Num' module does not seem to be compiled :s
<companion_cube> does anyone know why?
<thelema> companion_cube: ls `ocamlc -where`/num*
<thelema> I have it in my opam 4.00.1
<companion_cube> ls: cannot access /home/simon/.opam/4.00.1/lib/ocaml/num: No such file or directory
<companion_cube> hm sorry, forgot the *
<companion_cube> hmm, so I need to find why ocamlbuild cannot link to 'num.cmxa'
<thelema> num isn't part of stdlib, so you have to include num.cmxa on command line
<companion_cube> wow, the lib is "num", but the library is "nums"
<companion_cube> -_-
<thelema> the tag is "use_num", I think
<thelema> or maybe use_nums"
<thelema> the modules are Num and Ratio, in the library nums
<companion_cube> I added -lib nums and it works
<companion_cube> thank you
<adrien> companion_cube: use ocamlfind!
<adrien> :P
<companion_cube> I do
<companion_cube> -use-ocamlfind :p
<adrien> ocamlfind list | grep -i num
<adrien> :-)
mcclurmc has quit [Ping timeout: 245 seconds]
milosn has quit [Remote host closed the connection]
<companion_cube> I tried ocamlfind query num
<companion_cube> but this points to a different place...
nze has joined #ocaml
milosn has joined #ocaml
mye has joined #ocaml
<nze> How can I query ocaml toplevel for currently bound values?
<nze> also, how does the library path work? can I introspect it?
<nze> most importantly, where do I get this kind of info? the book by Chailloux et al didn't get me very far...
<thelema> I don't think there's any hook at the moment to query that, although it should be possible to add to the toplevel
<thelema> the library path works as any other library path; a list of places to search for module files
<nze> so just a variable then?
<thelema> that's the official documentation
<thelema> an internal variable of the toplevel; I don't think it's exposed other than the #directory directive to add to it.
<thelema> You may be able to use this module to get at various internals: https://github.com/ocaml/ocaml/blob/trunk/toplevel/toploop.mli
<nze> so no way to know where it goes looking then? I've been fiddling with -I but the only thing that seems to work is passing full path filenames :/
<thelema> Toploop.toplevel_env should get you the list of currently bound values somehow
<thelema> that's the code that adds to the load path, but I don't see a way to get at the Config module
<thelema> the default search path is just Config.standard_library, which you can print by "ocamlc -where"
<thelema> nze: what are you trying to include?
dwmw2 is now known as dwmw2_gone
<nze> thelema: i installed ocurl through opam and now i'm trying to use it
<thelema> if you've done the necessary opam magic for the toplevel (ocaml -I $OCAML_TOPLEVEL_PATH)
<thelema> you should be able to do #require "ocurl";;
<thelema> and then just use ocurl
<thelema> err, maybe also #use "topfind";; (before #require)
<thelema> and apparently ocurl's findlib package name is just curl, so #require "curl";;
<nze> yeah, that does the job neatly, thanks
<thelema> you're welcome
ottbot has quit [Ping timeout: 252 seconds]
<nze> looking at ocamlc -where, ocaml -I +../curl does the job
mye has quit [Quit: mye]
m4b has joined #ocaml
<m4b> mfp: hello, I took your advice (thank you!), and removed all the instruction types from the program and work with just arrays of integers; replaced the hashtables of arrays with patricia trees of arrays; and when I don't call Array.copy to return a fresh, non-aliased array, the program is really fast; unfortunately, it looks like I need Array.copy in order to not alias; I even changed the register model to a list of 8 elements, in case
<m4b> the aliasing was coming from there, but no effect; do you have any suggestions for a way to get around this problem?
osa1 has quit [Ping timeout: 245 seconds]
ontologiae has quit [Ping timeout: 252 seconds]
mye has joined #ocaml
nze has quit [Ping timeout: 248 seconds]
malc__ has joined #ocaml
ocp has joined #ocaml
ocp has quit [Client Quit]
ahokaomaeha has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
m4b has quit [Ping timeout: 256 seconds]
Navska has joined #ocaml
mye has quit [Quit: mye]
ottbot has joined #ocaml
mye has joined #ocaml
Snark has quit [Quit: Quitte]
<Navska> Bonjour ! Je viens de commencer le caml (prépa) et j'avoue que je rame un peu ! Si quelqu'un pouvais me filer un coup de main à propos d'un algo ce serait sympa merci !
<adrien> hi, this channel is english-speaking but #ocaml-fr exists too
<thelema> Navska: #ocaml-fr
<thelema> Navska: also, don't ask to ask, just ask.
m4b has joined #ocaml
ottbot has quit [Ping timeout: 255 seconds]
_andre has quit [Quit: leaving]
<m4b> mfp
<m4b> mfp if you've got some time, I'd like to get your opinion on how, if possible, to remove the array.copy function that is being called (and which is responsible for the huge amount of caml_initialize calls), and still get non-aliased objects
<orbitz> mfp responds randomly
<thelema> m4b: copy on write?
<m4b> eh, whoops; what is the whisper or talk command?
mcsquiggedy has quit [Ping timeout: 252 seconds]
<thelema> m4b: /m
<m4b> thelema: thank you; i'm not sure I understand your suggestion, copy on write. the problem is i have a vm; it runs fast now, when I replaced the memory model from hashtables of arrays to patricia trees of arrays, _when_ I remove a necessary Array.copy function to prevent aliasing; I need to not have aliased objects, but with that one line, the caml_initialize is called 3 billion times for 1 million executions of the main loop
<thelema> does each execution of the main loop modify 3000 memory locations?
<m4b> thelema: no that's the weird part; each execution is equivalent to one instruction execution. if I remove array.copy, the program runs incredibly fast.
<thelema> what causes the array copy to execute?
<orbitz> well, stop copying all dem ararys :)
<m4b> code here: http://hpaste.org/82632
<m4b> thelema: it is a "program" load operation; it loads the program, which is an array in the patricia tree, to be loaded into the 0x0 location in the patricia tree
<m4b> orbitz: i would, but I need to return non-aliased arrays
<thelema> memory is your entire memory image?
<m4b> thelema: the memory parameter (in the memory functions and the function execute1) is the patricia tree of arrays.
metasyntax has joined #ocaml
osa1 has joined #ocaml
<thelema> the array is what?
<m4b> thelema: the array is an array of integers (32-bit instructions); in other words a program in machine language
<thelema> so your memory is a patricia tree of these arrays, meaning that the memory is indexed by the id of the program?
<thelema> anyway, try getting rid of the arrays and having the patricia tree be a little bit bigger to hold all the instructions directly.
Navska has left #ocaml []
<m4b> thelema: it would have to be a patricia tree of patricia trees then...?
<thelema> no, just a patricia tree of integers
<thelema> I don't get how memory is indexed, can you explain this?
<m4b> thelema: that doesn't make any sense; the instructions update "arrays", i.e., arrays of program instructions; the entire thing holding all of these arrays is, in this case, a patricia tree of arrays
<thelema> really? ok then, yes - a patricia tree of patricia trees
<thelema> or maybe an array of patricia trees, depending on the indexes of the programs
<m4b> updating a single value would require returning the whole object, correct?
<thelema> yes, but only a small portion of the object would be modified; so the rest would be used unchanged
<thelema> only the path to the modified value
<m4b> hmmmm
<thelema> better than copying the whole array
<malc__> m4b: erm. do you realize that your array contains poitners to integers?
<malc__> y;t;n
<m4b> no, why does it contain pointers to integers?
<malc__> because int array is not specialized
<thelema> malc__: yes, because int32, don't worry about it.
<m4b> what does "int array is not specialized" mean?
<malc__> well, ocaml does special magic for double arrays
<malc__> so they are just a contigous region of memory containing doubles
<m4b> it's not an array of doubles; they're just arrays of ints
<malc__> anything else is boxed
<thelema> malc__: err, Int32 is boxed, int is unboxed.
djcoin has quit [Ping timeout: 248 seconds]
<malc__> thelema: ints in array are boxed too
<thelema> malc__: and looking again, there's no int32 here.
<thelema> malc__: not at all.
<malc__> orly
<m4b> ok, so (1) do I want boxed or unboxed versions, (2) what should the type of array be of to get the desired boxed or unboxed?
<m4b> thelema: correct, no int32
<malc__> m4b: you want bigarrays really
myx has joined #ocaml
<m4b> malc__: so if I change the arrays to big arrays, you are saying that the necessary array.copy will be ok, and caml_initialize won't be called a billion times?
<thelema> malc__: no need if ints suffice, and bigarray won't solve copying problem
<m4b> thelema: yes, that's what i thought
<thelema> m4b: if you use an immutable structure like patricia trees for your arrays, then you won't have to copy the whole array to avoid changing the original
<m4b> malc__: from documentation, big arrays are used for efficient sharing between c and fortran code; since my code is doing none of that, I didn't think necessary
<m4b> thelema: it's worth a shot; however, would something like a map be more ideal in this case?
<thelema> m4b: the patricia tree you're using is exactly a map
<malc__> m4b: Bigarrays have blitting
<m4b> thelema: I know, but balanced binary trees have log n lookup, insertion, and the patricia trees have linear in size of key, i believe?
<thelema> m4b: linear in size of key is log n for compact keys
<thelema> for keys 0..n-1
<m4b> thelema: this is an extremely interesting discussion, unfortunately I have to leave for about 1 hour; I will be back, hopefully you
<m4b> will be around
<osa1> I have a pretty-printer written using Format module using mostly printf function, how can I print that to a string ?
<thelema> osa1: val pp_set_formatter_output_functions : formatter -> (string -> int -> int -> unit) -> (unit -> unit) -> unit
<thelema> or val str_formatter : formatter
<thelema> A formatter to use with formatting functions below for output to the stdbuf string buffer. str_formatter is defined as formatter_of_buffer stdbuf.
<thelema> yes, str_formatter is better
<thelema> and then val flush_str_formatter : unit -> string
<osa1> thelema: str_formatter is a formatter, to which function should I pass it to set it as buffer ?
m4b has quit [Ping timeout: 260 seconds]
<osa1> ok
<osa1> thelema: sorry I don't understand, do you have an example of str_formatter ?
<thelema> Format.fprintf str_formatter "Foo%d" 5; flush_str_formatter () == "Foo5"
<thelema> something like that; I don't use Format much, so usage may be way off
<osa1> do I need to change my printf calls to fprintf formatter ?
<malc__> # Format.sprintf "moo";;
<malc__> - : string = "moo"
<thelema> osa1: yes
<osa1> thelema: that's 250 lines of code
<osa1> I was expecting a side-effectful function that automagically writes to a string buffer when called before printfs
<thelema> ok, then you want pp_set_formatter_output_functions
<thelema> use it to modify std_formatter to write to a buffer
<thelema> osa1: and in the future, use fprintf and have an extra argument to the function of what formatter to use
<osa1> and then how can I create string buffer (with type of out_channel) ?
<thelema> pp_set_formatter_output_functions doesn't involve an out_channel
<thelema> you give it two functions: one that takes a string, offset and length and the other that flushes
malc__ has quit [Quit: leaving]
<osa1> thelema: ok so I change all printf's to fprintf, but what about print_string, print_int etc ?
<thelema> you're mixing Format and non-format IO?
<thelema> oops, there is Format.print_string, etc
<thelema> not a format expert
<thelema> pp_print_string, pp_print_int should be the same as print_* but take the formatter as argument
emmanuelux has joined #ocaml
<osa1> thelema: are we completely sure that there's now way to redirect stdout to a string buffer ?
<osa1> with just one function
<thelema> osa1: there is, use pp_set_formatter_output_functions on std_formatter
Cyanure has quit [Remote host closed the connection]
<thelema> let buf = Buffer.create 100 in pp_set_formatter_output_functions std_formatter (Buffer.add_substring buf) (fun () -> ())
<thelema> then do your printing and get the result in buf
emmanuelux has quit [Read error: Connection reset by peer]
<osa1> great. this should work. thanks.
emmanuelux has joined #ocaml
Yoric has quit [Ping timeout: 264 seconds]
ttamttam has quit [Remote host closed the connection]
dsheets has quit [Quit: Leaving.]
<orbitz> is this a valid type:
<orbitz> (tag -> (int -> ('a, error) Result.t) -> 'a t)
<thizanne> why not ?
<orbitz> seems to have some issues with polymorphic variants
<orbitz> can't generalize
<orbitz> error is a polymorphic variant as well
gnuvince has joined #ocaml
adotbrown has joined #ocaml
mcclurmc has joined #ocaml
osa1 has quit [Ping timeout: 256 seconds]
ahokaomaeha has joined #ocaml
thomasga has quit [Quit: Leaving.]
Yoric has joined #ocaml
cdidd has quit [Ping timeout: 248 seconds]
Yoric has quit [Ping timeout: 256 seconds]
ahokaomaeha has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
ahokaomaeha has joined #ocaml
ottbot has joined #ocaml
travisbrady has quit [Quit: travisbrady]
cdidd has joined #ocaml
myx has quit [Quit: ушёл]
tac has quit [Quit: Page closed]
ottbot has quit [Quit: WeeChat 0.4.0]
sw2wolf has joined #ocaml
m4b has joined #ocaml
sw2wolf has left #ocaml []
q66 has quit [Remote host closed the connection]
darkf has joined #ocaml