gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
Xizor has quit []
iago has joined #ocaml
<ssbr_> Alright, situation got resolved with upstream source of code. Thanks for all your help! :)
letrec has quit [Ping timeout: 252 seconds]
TDJACR has quit [Read error: Operation timed out]
TDJACR has joined #ocaml
TDJACR has quit [Quit: leaving]
TDJACR has joined #ocaml
mrvn has quit [Read error: Operation timed out]
emmanuelux has quit [Remote host closed the connection]
mrvn has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
smerz has quit [Read error: Connection reset by peer]
cyphase has quit [Quit: http://www.cyphase.com/]
Tobu has joined #ocaml
iago has quit [Quit: Leaving]
cyphase has joined #ocaml
mrvn has quit [Ping timeout: 245 seconds]
mrvn has joined #ocaml
bjorkintosh has quit [Ping timeout: 255 seconds]
16WAAJLRQ has joined #ocaml
17WAADGJR has joined #ocaml
brendan has quit [Quit: leaving]
Tobu has quit [Ping timeout: 272 seconds]
17WAADGJR has quit [Remote host closed the connection]
16WAAJLRQ has quit [Remote host closed the connection]
Tobu has joined #ocaml
Tobu has quit [Changing host]
Tobu has joined #ocaml
ulfdoz has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
cdidd has quit [Remote host closed the connection]
solidus-river has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
Tobu has joined #ocaml
ski has quit [Ping timeout: 250 seconds]
ski has joined #ocaml
ocp has quit [Quit: Leaving.]
hiptobecubic has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
brendan has joined #ocaml
Tobu has joined #ocaml
brendan has quit [Quit: leaving]
brendan has joined #ocaml
diego_diego has joined #ocaml
diego_diego has quit [Quit: diego_diego]
diego_diego has joined #ocaml
jaxtr has quit []
jaxtr has joined #ocaml
ftrvxmtrx_ has quit [Quit: Leaving]
Tobu has quit [Ping timeout: 272 seconds]
ankit9 has joined #ocaml
Tobu has joined #ocaml
tufisi has joined #ocaml
Submarine has quit [Ping timeout: 240 seconds]
Cyanure has joined #ocaml
ftrvxmtrx has joined #ocaml
djcoin has joined #ocaml
thomasga has joined #ocaml
mononofu has joined #ocaml
Cyanure has quit [Remote host closed the connection]
mika1 has joined #ocaml
cago has joined #ocaml
hiptobecubic has quit [Ping timeout: 252 seconds]
Tobu has quit [Ping timeout: 272 seconds]
eni has joined #ocaml
larhat has joined #ocaml
Cyanure has joined #ocaml
Tobu has joined #ocaml
diego_diego has quit [Quit: diego_diego]
Fnar has quit [Changing host]
Fnar has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
BiDOrD has joined #ocaml
Submarine has quit [Client Quit]
BiDOrD_ has quit [Ping timeout: 245 seconds]
eni has quit [Ping timeout: 248 seconds]
avsm has quit [Ping timeout: 245 seconds]
roha has joined #ocaml
eni has joined #ocaml
mononofu has quit [Remote host closed the connection]
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
cdidd has joined #ocaml
emmanuel__ has joined #ocaml
<pippijn> what about something like perl XS for ocaml?
larhat has quit [Quit: Leaving.]
snearch has joined #ocaml
snearch has quit [Read error: Connection reset by peer]
_andre has joined #ocaml
<adrien> what does it do?
<flux> btw, I've used some perl modules with great success from OCaml with the perl4caml thingie
<flux> so if you have a perl module that does the task, it might just be possible to make use of that
<flux> hmm, except perhaps not XS, apparently it's some form of foreign interface system :)
<flux> obviously you can call C code from OCaml, not sure how or if XS is simpler
Tobu has quit [Ping timeout: 272 seconds]
eni has quit [Ping timeout: 244 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
Tobu has joined #ocaml
letrec has joined #ocaml
<adrien> gildor_: don't buy windows licenses: use evaluation versions since their EULA _explicitely_ state that they're meant for software testing
tchell_ has joined #ocaml
r126f_ has joined #ocaml
sivoais_ has joined #ocaml
tonyg_ has joined #ocaml
mehdid_ has joined #ocaml
mcclurmc has joined #ocaml
bacam_ has joined #ocaml
mononofu has joined #ocaml
31NAA87MH has quit [Quit: ZNC - http://znc.in]
sivoais has quit [Ping timeout: 252 seconds]
r126f has quit [Ping timeout: 252 seconds]
tchell has quit [Ping timeout: 252 seconds]
tonyg has quit [Ping timeout: 252 seconds]
mehdid has quit [Ping timeout: 252 seconds]
bacam has quit [Ping timeout: 252 seconds]
solidus-river has quit [Ping timeout: 252 seconds]
solidus-river has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
ocp has joined #ocaml
mehdid_ is now known as mehdid
Tobu has joined #ocaml
bacam_ is now known as bacam
Submarine has quit [Ping timeout: 240 seconds]
<Ptival> thomasga: do you know about fixing typerex indentation?
<thomasga> well it depends
<thomasga> the easiest way is to update tools/ocp-typerex-ide/emacs/typerex-tuareg.el
<thomasga> with the latest version of tuareg
<Ptival> ok I'll take a look if needed
<Ptival> I'm basically over-parens-ing my code to make the indentation behave properly :d
<thomasga> the cleanest way is that I find some time to integrate my indenter with typerex
eni has joined #ocaml
<thomasga> but I really don't know when I will be able to do that :-(
Tobu has quit [Ping timeout: 272 seconds]
ocp has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
gnuvince has quit [Quit: C-x C-c]
sivoais_ has quit [Quit: leaving]
sivoais has joined #ocaml
oriba has joined #ocaml
ocp has joined #ocaml
gnuvince has joined #ocaml
roha has quit [Read error: Operation timed out]
roha has joined #ocaml
mononofu has quit [Remote host closed the connection]
ankit9 has quit [Ping timeout: 260 seconds]
<mrvn> I had some problems with tuareg and named arguments. After I used some of them the indent stopped working after that line.
<mrvn> Anyone had that before?
oriba has quit [Quit: oriba]
<ssbr_> Hum. How do I get more information about an exception? When I run this program, I get `Fatal error: exception Sys_error("Is a directory")`, but no information about where this occurs (or what was a directory.)
<ocp> in this case, you cannot do nothing
<ssbr_> _habnabit: Gah!
<ssbr_> _habnabit: it was OCAMLRUNPARAM="b1" :(
<ocp> your program has already caught the exception
<ssbr_> not "b"
<ocp> or maybe not actually ;-)
<ssbr_> ocp: setting OCAMLRUNPARAM="b1: gave me the additional info `Raised at file "pervasives.ml", line 325, characters 12-32` :p
<ssbr_> I should've googled then asked rather than asked then googled. :(
<mrvn> compile with -g to get a backtrace
<ssbr_> I assumed this'd be hard to google
<ocp> beware that some program have a (try main () with e -> Printf.fprintf stderr "Fatal error: %s"......)
<mrvn> You want the file+line that calles pervasives.ml
<ocp> that prevents to know the location of the exception
<ssbr_> mrvn: Ah.
<mrvn> ocp: totaly useless and evil
<ocp> you probably tried to seek into a directory
<adrien> hmmm, iirc "try foo () with e -> ...; raise e" would give an "exception re-raised at"
<adrien> no?
<mrvn> adrien: but not the backtrace where it was originally raised
<mrvn> iirc
<mrvn> Would be nice if with -g exceptions would keep track of where they are raised, cought, reraised
<adrien> I'm under the impression it's kept
<ssbr_> I am trying to figure out where in the makefile to edit in a -g parameter :S
<adrien> ssbr_: which makefile?
<mrvn> adrien: maybe if you reraise the original instead of raising a new one.
<ssbr_> adrien: for the project I've been given
<mrvn> ssbr_: Makefile, OMakefile, OcamlMakefile, myocamlbuild, ...?
<ssbr_> Relevant lines are probably `../datalog: $(OBJS_CMX) datalog/ui.cmx\n $(OCAMLOPT) $(LINK_FLAGS) -o $@ $(LIBS) $^ `
<adrien> ssbr_: add it to any call to ocamlc or ocamlopt if there is not global parameter for that
<ssbr_> mrvn: the file is called Makefile and I'm invoking make, so
<adrien> hmm, you need it in LINK_FLAGS
<adrien> *and* at compilation of .cmx files
<ssbr_> OK, cmx files also take $(LINK_FLAGS)
<adrien> errr
<adrien> that's a makefile with weird variable names
<ssbr_> welp, that didn't work
<ocp> ssbr_: clearly, your program is doing an "input_line" on a directory
<ssbr_> I guess I wasn't supposed to do it as LINK_FLAGS="-g" make datalog
<ocp> is your program so big you can't know where it happens ?
<ssbr_> ocp: this is my first day looking at the source code, man
<ssbr_> also, my first day using ocaml.
<ocp> grep 'input_line' *.ml ?
<ssbr_> 11 occurrences. The ones in datalog.ml are probably most likely
<adrien> ssbr_: edit the makefile and add "-g" there
<adrien> and you can keep it there forever
<ssbr_> adrien: well, probably the person maintaining this doesn't want it to stay
smondet has joined #ocaml
<ssbr_> I do mean to push back changes
<ssbr_> but dank u
struktured has joined #ocaml
<ssbr_> Bah, I still only get the message about pervasives.ml . It must be somewhere else.
<ssbr_> maybe in one of the library dependencies? The libraries and the program get different makefiles, I only edited the program's makefile
struktured has quit [Remote host closed the connection]
struktured has joined #ocaml
<adrien> gah, ioctl() in C with unions everywhere
<adrien> this is really the worst non-API I've ever seen
<adrien> ssbr_: edit the makefile, add -g, make clean, make, run as 'OCAMLRUNPARAM=b ./your_app', see the (hopefully full) backtrace
<adrien> remove -g from the makefile
<ssbr_> adrien: yes, that was what I did.
<adrien> including "make clean"?
<ssbr_> most definitely.
<ssbr_> the thing is that there's the makefile, and then there's lots of other makefiles in subdirectories
<ssbr_> I only edited one such subdirectory's makefile...
<adrien> ah, well, take a few minutes and add it everywhere; getting the backtrace will save a lot of time
<ssbr_> Does ocamlc take a -g option?
<ssbr_> derp, yes
oriba has joined #ocaml
oriba has quit [Read error: Connection reset by peer]
roha has quit [Ping timeout: 245 seconds]
ocp has quit [Quit: Leaving.]
oriba has joined #ocaml
<ssbr_> ls
<ssbr_> gah. Sorry, not used to xmonad.
avsm has joined #ocaml
roha has joined #ocaml
oriba has quit [Quit: oriba]
joelr has joined #ocaml
<joelr> moin
<joelr> what does this mean? http://pastie.org/3884569
<joelr> hmm… use module XXX : sig … end instead?
<joelr> seems to work
<joelr> problem solved
roha has quit [Ping timeout: 244 seconds]
<hcarty> pippijn: ciml is somewhat like Perl's XS, or possibly PDL's PP language.
joelr has quit [Quit: joelr]
thomasga1 has joined #ocaml
thomasga has quit [Read error: Connection reset by peer]
olauzon has joined #ocaml
olauzon has quit [Remote host closed the connection]
Kakadu has joined #ocaml
<ssbr_> aha, figured it out. There was a makefile include I needed to edit.
<ssbr_> adrien: thanks for your patient support. Couldn't've done it without you. :)
<ssbr_> ... well. Anyway thanks!
Cyanure has quit [Remote host closed the connection]
ftrvxmtrx has quit [Quit: Leaving]
cago has quit [Quit: Leaving.]
mika1 has quit [Quit: Leaving.]
joelr has joined #ocaml
snearch has joined #ocaml
<joelr> damn, it's hot. summer is here.
<ssbr_> You think that, and then one day you leave the window open and wake up with hypothermia
<mrvn> ssbr_: Life sucks and then you die.
<hcarty> mrvn: ... from hypothermia after leaving a window open
<mrvn> or from the splinter you get closing it
<joelr> assuming i'm packing modules into Parent and provide Parent.mli, do I need to have Parent.ml that includes the other modules?
<thelema> joelr: no
<joelr> hmm
letrec has quit [Ping timeout: 255 seconds]
<joelr> let me check something...
<thelema> http://caml.inria.fr/pub/docs/manual-ocaml/manual025.html <- look at the -pack option docs
<joelr> any suggestions on this? http://pastie.org/3884887
<joelr> thelema: ^
<thelema> looking
<joelr> thelema: i'm packing those modules into a library together with callbacks. callbacks refers to them Trade.t, etc., not as RAPI.Trade.t. and RAPI.mli does the same in the signatures for the missing modules
<joelr> the library i'm packing is RAPI and i only provide RAPI.mli, no RAPI.ml
<thelema> I don't think you can have a Callbacks base for a pack with code in it, anyone?
<thelema> It looks like you're not building callbacks as a pack
<joelr> thelema: what do you mean by a callbacks base for a pack?
<thelema> packs have a base. Foo, Bar, Baz all become Base.Foo, Base.Bar, etc.
<thelema> the base you seem to want for your callbacks pack is Callbacks
<joelr> thelema: i'm packing callbacks indeed. see https://gist.github.com/7e4f9cd2ab9fed844f2b
<joelr> thelema: why do you think i want Callbacks? that module is part of RAPI, although it does not appear in the interface for the pack (RAPI.mli)
<thelema> you're packing callbacks into RAPI, yes?
<joelr> thelema: yes, i am. see the gist with my _oasis file
<thelema> but you also want Bid,Trade,etc to be packed into Callbacks?
<joelr> thelema: no, i'm just using them from Callbacks
<joelr> thelema: let me paste...
<thelema> you want those to be packed into RAPI
<thelema> your _oasis file helps make this clear, yesterday we were talking about packing packs
<thelema> multi-level packing
<joelr> thelema: this is Callbacks.ml https://gist.github.com/f17359473054edbb7a47
<thelema> what's the command used to create RAPI.cma?
<joelr> thelema: i want bid, ask, trade, callbacks to be packed all into RAPI. i don't want to have callbacks in the rapi interface, though
<joelr> thelema: one sec...
<thelema> (look in _build/_log)
eni has quit [Ping timeout: 250 seconds]
<joelr> ocamlfind ocamlc -a -dllib -lRAPI_stubs -cclib -lRAPI_stubs -cclib -lstdc++ -cclib -lssl -cclib -lcrypto -cclib -L/Users/joelr/Work/rithmic/5.2.0.0/darwin-10/lib -cclib -lRApi-optimize -cclib -lOmneChannel-optimize -cclib -lOmneEngine-optimize -cclib -lOmneStreamEngine-optimize -cclib -l_api-optimize -cclib -l_apipoll-stubs-optimize -cclib -l_kit-optimize src/RAPI.cmo src/OmneException.cmo src/AdmCallbacks.cmo src/Callbacks.cmo src/Engine.cmo src/Alert.cmo
<joelr> src/Ask.cmo src/Bid.cmo src/Trade.cmo -o src/RAPI.cma
<thelema> hmm, I don't think the order of modules in a .cma file matters...
<thelema> so the missing modules are being linked into your cma file
<thelema> same list of modules for .cmxa?
<joelr> thelema: hence my question
<joelr> checking
<joelr> ocamlfind ocamlopt -a -cclib -lRAPI_stubs -cclib -lstdc++ -cclib -lssl -cclib -lcrypto -cclib -L/Users/joelr/Work/rithmic/5.2.0.0/darwin-10/lib -cclib -lRApi-optimize -cclib -lOmneChannel-optimize -cclib -lOmneEngine-optimize -cclib -lOmneStreamEngine-optimize -cclib -l_api-optimize -cclib -l_apipoll-stubs-optimize -cclib -l_kit-optimize src/RAPI.cmx src/OmneException.cmx src/AdmCallbacks.cmx src/Callbacks.cmx src/Engine.cmx src/Alert.cmx src/Ask.cmx src/Bid.cmx
<joelr> src/Trade.cmx -o src/RAPI.cmxa
<joelr> looks the same
<thelema> I agree... hmm
<thelema> can you run ocamlobjinfo on your RAPI.cmxa file and grep for Bid?
<joelr> one sec
err404 has joined #ocaml
mononofu has joined #ocaml
<joelr> it's there, at least in globals
<thelema> 991d3406d4dcb7763ecae2cec7f11543 Bid
<thelema> in callbacks "interfaces imported"
mononofu has quit [Remote host closed the connection]
<thelema> Name: Bid
<thelema> CRC of implementation: d4f80fc6c0508bd177feeda32a20adb5
<thelema> and even Bid imports the same 991d3406d4dcb7763ecae2cec7f11543 Bid
<joelr> thelema: yes?
<thelema> On a hunch, try writing RAPI.Bid/Trade/Ask/Alert in Callbacks
<joelr> thelema: sec… i tried open RAPI there and then got interface mismatches. let met ry...
<joelr> thelema: i get this, which i don't understand https://gist.github.com/fcb1166d170e446c3ae8
<thelema> This is the kind of problem I had with packs; trying to access one packed module from another.
<thelema> reading...
<joelr> thelema: do i have to put external in the mli file as well?
<thelema> very
<thelema> yes
<joelr> or create status in Status.ml that uses the external
<joelr> ok so that's what the deal is
<thelema> better to put external in the mli file
<joelr> thelema: i don't want to export the externals, though.
<joelr> they should not be part of the api, right?
<joelr> i mean, i don't think they should be
<joelr> it doesn't look clean
<thelema> then define a normal function that is equal to the external function
<thelema> let ticket = ticker
<joelr> right
<thelema> This should give you a value instead of an external
<joelr> thelema: thanks. let me do this for all modules that use external
<thelema> there's some performance benefit from exposing the externals - is this irrelevant?
* joelr goes back to the drawing board
<joelr> thelema: well… hmm… yes, it's important i suppose
<thelema> i.e. when linking, it can create a direct call to the stub instead of a call to a caml function that calls a c stub
<thelema> but only if you expose the externals
snearch has quit [Quit: Verlassend]
<joelr> thelema: i suppose i can always go back to exposing externals if i find that it matters
<thelema> the usual practice is to expose them.
<joelr> fair enough
<thelema> but yes, it should be easy either way.
<joelr> thanks
<thelema> You may have to eta-expand your let foo = foo functions - let foo x = foo x
<ssbr_> Aie. So I'm getting this error: http://fpaste.org/RWWj/ I think for this file src/ui.ml: http://fpaste.org/tqRP/
<ssbr_> Scratch that and ignore me.
<thelema> ok
<ssbr_> of course it's datalog/ui.ml :S
<joelr> thelema: i get a circular build error now.
<joelr> Circular build detected (src/RAPI.cmx already seen in [ src/Callbacks.cmx; src/RAPI.cmx; src/RAPI.cmxs ])
<thelema> yes, ocamlbuild would give that... hmm...
ftrvxmtrx has joined #ocaml
<thelema> ok, I don't know how to solve your problem and keep using packs.
<thelema> from what I understand, to pack module Foo into Bar, you compile Foo with argument -for-pack Bar
<thelema> and it creates Bar.Foo inside foo.cmx
<joelr> right
<thelema> and then you can join a bunch of these files into a single Bar.cmx by using -pack
<joelr> the question is, should other modules in the pack be using Bar.Foo or just Foo?
<thelema> but ocamlbuild and oasis seem to be creating bar.cmxa and putting the foo.cmx (-for-pack Bar) inside it.
<joelr> gildor_: ^
<thelema> I'm not certain. My understanding is that because of the -for-pack, it should be Bar.Foo
<joelr> let me get a build log
<hcarty> It should still be Foo.x
<thelema> Obviously just Foo isn't working, although it only finds that out at link time because foo.cmi exists just fine and gives the interface information for Foo
<thelema> oh... hmmm
<hcarty> That works for me, but I'm using OCamlMakefile for that particular library
<thelema> then maybe the problem is that Bar.cmx isn't being created?
<thelema> and instead, bar.cmxa is being jumped to?
<joelr> this is how it compiles callbacks, for example: ocamlfind ocamlopt -c -g -I src -ccopt -Wall -ccopt -W -ccopt -Wextra -ccopt -g -ccopt -x -ccopt c++ -ccopt -I -ccopt '~/Work/rithmic/5.2.0.0/include' -ccopt -g -package unix -package threads -package cmdliner -thread -for-pack RAPI -I src -o src/Callbacks.cmx src/Callbacks.ml
<thelema> sure, and when does it create RAPI.cmx?
<hcarty> joelr: Is there a ocamlfind ocamlopt -pack -o rAPI.cmx ...
<joelr> checking
<joelr> ocamlfind ocamlopt -pack -g -I src src/OmneException.cmx src/AdmCallbacks.cmx src/Status.cmx src/Alert.cmx src/OrderBook.cmx src/Quote.cmx src/Ask.cmx src/Bid.cmx src/Trade.cmx src/Callbacks.cmx src/MarketData.cmx src/Engine.cmx -o src/RAPI.cmx
<joelr> this one?
<thelema> yup, that looks good.
<thelema> now you just have to use rapi.cmx instead of building a rapi.cmxa from the same files
<thelema> maybe an oasis bug
<joelr> let me see if it builds a cmxa
<joelr> oh, yes, it does build RAPI.cmxa
<joelr> ocamlfind ocamlopt -a -cclib -lRAPI_stubs -cclib -lstdc++ -cclib -lssl -cclib -lcrypto -cclib -L/Users/joelr/Work/rithmic/5.2.0.0/darwin-10/lib -cclib -lRApi-optimize -cclib -lOmneChannel-optimize -cclib -lOmneEngine-optimize -cclib -lOmneStreamEngine-optimize -cclib -l_api-optimize -cclib -l_apipoll-stubs-optimize -cclib -l_kit-optimize src/RAPI.cmx src/OmneException.cmx src/AdmCallbacks.cmx src/Callbacks.cmx src/Engine.cmx src/Alert.cmx src/Ask.cmx src/Bid.cmx
<joelr> src/Trade.cmx -o src/RAPI.cmxa
<joelr> but shouldn't it? i'm using ocamlopt
<hcarty> joelr: All the other cmx files are the problem I expect
<joelr> hcarty: you mean the build of cmxa should just use RAPI.cmx and that's it?
<hcarty> joelr: That line should only include RAPI.cmx, not all of the others.
<hcarty> joelr: I worded that poorly - the only cmx on that line should be RAPI.cmx
<joelr> gildor_: ^
<joelr> bug in oasis?
<joelr> i wonder why packedlib example in oasis work
* thelema tries to find it
<joelr> examples/packedlib
<joelr> in 0.3~rcxxx
<thelema> on web
<joelr> ocamlforge
<thelema> I don't have a checkout of oasis handy
<joelr> sec
<thelema> CompiledObject: best
<thelema> can you drop this line? L200
<joelr> thelema: in my oasis? i want native code, though
<thelema> joelr: thanks for trying, but the actual data is in an iframe
<thelema> I found it.
<thelema> joelr: just for debugging purposes
<thelema> yes, I found the file I wanted.
<thelema> https://forge.ocamlcore.org/plugins/scmdarcs/cgi-bin/darcsweb.cgi?r=oasis/oasis;a=headblob;f=/examples/packedlib/_oasis
<joelr> Error: Error while linking src/RAPI.cma(Callbacks):
<joelr> Reference to undefined global `Trade'
<joelr> weird
<thelema> just Trade now?
<thelema> not the others?
<joelr> yes
<thelema> Are you making clean between builds?
<joelr> thelema: that's cause i did not export trade. one sec...
<hcarty> joelr: Where is your _oasis posted? I lost the link...
NihilistDandy has quit [Ping timeout: 244 seconds]
<joelr> it's not including trade here somehow
<joelr> + ocamlfind ocamlc -g -I src -cclib -lz -linkpkg -package unix -package threads -package cmdliner -thread src/MarketData.cmo src/Connection.cmo src/OrderBook.cmo src/Quote.cmo src/Status.cmo src/RAPI.cma src/algokit.cmo -o src/algokit.byte
<joelr> but then shouldn't it be using the RAPI
<joelr> back in a few
<thelema> I expect trade to be in RAPI.cma (as part of RAPI.cmo)
<ssbr_> Hum. So I'm dealing with an ocaml app that takes the argument "-main_program" and runs it. (This is a datalog interpreter.) If -main_program isn't defined, it blows up, by assuming a default of "" (i.e. the current working directory -- not an executable file)
<joelr> i think i know what the deal is. back in a few.
<thelema> ssbr_: that sucks.
<ssbr_> what would be the "right" way to enforce that there _is_ no default? Check if the parsed -main_program is the empty string and then if so, print an error message / the usage / argspec ? Or is there some way to make Arg do this for me?
<thelema> afaik, Arg can't do this
<thelema> after running Arg.parse, just do: if !main_program = "" then failwith "Need a -main_program"
<ssbr_> So should I reproduce the behavior of raising Arg.Bad (except outside of Arg.parse) ?
<thelema> ssbr_: yes, that would better; IIRC, you can call Arg.usage directly and then `exit 1`
<ssbr_> thelema: OK, got it. Thanks for your help. :)
mononofu has joined #ocaml
thomasga1 has quit [Quit: Leaving.]
jave has quit [Read error: Operation timed out]
mononofu has quit [Remote host closed the connection]
mononofu has joined #ocaml
<ssbr_> Hey guys, I'm pretty new to ocaml (limited experience in Haskell and ATS), and I'm really struggling to figure out what the type signature for printf means. Can anyone tell me where to look? (signature is `('a, out_channel, unit) format -> 'a`)
<thelema> ssbr_: it's magical
<thelema> the compiler assigns a type to the format string
<thelema> this type includes the information on what further parameters are needed and their types
<thelema> so the -> 'a becomes something like -> int -> string -> unit
djcoin has quit [Quit: WeeChat 0.3.2]
<ssbr_> thelema: Well. Uh.
<hcarty> ssbr_: The magic happens at compile time. The format string is parsed and the appropriate types fall out of that.
<ssbr_> Right.
<hcarty> The 'raw' type indicates things like the return value of the call, where output goes, and maybe a few other items.
<hcarty> When read out loud, the type is generally pronounced "ooo, spooky"
avsm has quit [Quit: Leaving.]
<ssbr_> hcarty: hahaha
<thelema> # format_of_string "%d %s";;
<thelema> - : (int -> string -> '_a, '_b, '_c, '_d, '_d, '_a) format6 = <abstr>
<ssbr_> I think, for now, I'm gonna let this slide and declare it magic.
<Qrntz> that's what it is!
<ssbr_> but I'll keep this in mind and come back to it once I'm more comfortable
<ssbr_> Qrntz: sure, but all magic can be understood in principle!
<ssbr_> by declaring it magic I'm just saying "I don't wanna ;_;"
<thelema> if you look at the type of this, it has "int -> string -> '_a" in the type
<Qrntz> «any sufficiently advanced technology is indistinguishable from magic»
<thelema> the "int" matches the %d and the "string" matches the %s
ulfdoz has joined #ocaml
<ssbr_> Right.
<ssbr_> the other ML descendent I used -- ATS -- I think did something similar, but I never looked at the type signature
<ssbr_> (also it used tuples instead of varargs)
<Qrntz> ats actually gets translated to C — I think it has less magical transformations to do
<ssbr_> Qrntz: It still tries to be type-safe, though
<ssbr_> (to the extreme: it adds dependent typing)
<Qrntz> I know, I tried it too :-)
<ssbr_> so in particular, it suffers the same problem of "well, what if the format string doesn't match the types of the passed parameters?"
<ssbr_> and so it has to generate the type based on the format string magically
Tobu has quit [Ping timeout: 272 seconds]
<thelema> yes, the ocaml compiler looks at the string and generates the right type
mononofu has quit [Remote host closed the connection]
mononofu has joined #ocaml
mononofu has quit [Remote host closed the connection]
Tobu has joined #ocaml
diego_diego has joined #ocaml
<joelr> thelema, hcarty: the problem was with my use of the packed library outside of the library. i was using modules (callbacks) that were packed but not "exported"
<joelr> thanks for your help!
<thelema> joelr: you're welcome.
<hcarty> joelr: You're welcome, glad you got it working
jave has joined #ocaml
srcerer has joined #ocaml
larhat has joined #ocaml
bjorkintosh has joined #ocaml
jarray52 has joined #ocaml
larhat has quit [Quit: Leaving.]
<jarray52> Is there an easy fix for the following piece of code: let total=0;; for i=1 to 100 do let total=total+i done;;
<_habnabit> let total = 100
<thelema> let total = ref 0
<thelema> total := !total + i
<jarray52> I'm trying to increment total by i inside the for loop.
<bjorkintosh> hmm. should you be using a for loop at all?
<jarray52> on each iteration
<_habnabit> (1 -- 100) |> fold (+) 0
<jarray52> bjorkintosh: I realize this is not the functional paradigm, but I'm trying to learn the language and implementing simple functions in many different ways.
<thelema> let total = ref 0 in for i = 1 to 100 do total := !total + i; done
<bjorkintosh> ah alright jarray52.
<jarray52> thelema: Thanks.
<jarray52> I'm using the ocaml interpreter. Is there a way to get the previous line by typing the up arrow key or some other keystroke combination?
<jonafan> total = 50*99 iirc
<thelema> jonafan: rlwrap ocaml\
<thelema> (without \)
<jonafan> also to the other dude
<thelema> jarray52: you too
<thelema> :)
<jonafan> from my .bashrc: alias oc='rlwrap -r -c -D 2 ocaml'
<jonafan> actually it's 50*101
<thelema> jonafan: yes, n(n+1)/2
<hcarty> jarray52: It can take a bit more effort to get going, but utop is nice as well
<jarray52> jonafan: yes.
<hcarty> jarray52: utop is a customized toplevel with context-sensitive completion, editing support, and a few other goodies.
<jarray52> hcarty: Are there other ocaml interpreters?
<hcarty> jarray52: utop is still using the same underlying code as the official 'ocaml' binary
<hcarty> jarray52: But it has been extended/modified to support more features and a friendlier out-of-the-box environment.
<jarray52> hcarty: It doesn't seem to be in my distro's repository
<hcarty> jarray52: I'm not sure if it's available anywhere other than compiling from source.
Tobu has quit [Ping timeout: 272 seconds]
<hcarty> jarray52: You can use odb.ml to ease the build process, but that may be getting ahead of what you want to do at this point.
<jarray52> hcarty: Is utop the only other interpreter for ocaml?
<hcarty> jarray52: There is also http://try.ocamlpro.com/
<jarray52> hcarty: I'm just trying to learn the basics of the language.
<hcarty> jarray52: If you just want to get started with language basics then try.ocamlpro.com is a good start, or using rlwrap + the ocaml binary that comes from your distribution
<bjorkintosh> what's rlwrap?
<jarray52> hcarty: Thanks. Now, I understand what jonafan was trying to tell me.
<jonafan> rlwrap makes the arrow keys do what you want them to do in the ocaml repl, among other things
<jarray52> jonafan: Thanks for the .bashrc alias.
diego_diego has quit [Quit: diego_diego]
pango has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
pango has joined #ocaml
avsm has joined #ocaml
eni has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
<ssbr_> Would anyone recommend a source for learning camlp4?
<ssbr_> (in particular I have to modify a parser written in it.)
<thelema> ssbr_: camlp4 docs are crap, you may have to reverse engineer existing parsers
<ssbr_> (/ with it. Not sure of distinctions.)
<ssbr_> thelema: blaraagh.
<ssbr_> I'll just settle for the scraps people leave up on their blogs then.
<joelr> mrvn: ping
<thelema> ssbr_: there officially is a wiki for it, iirc
<thelema> contribute if you can
<ssbr_> thelema: Alright. Thanks. :)
diego_diego has joined #ocaml
diego_diego has quit [Client Quit]
thomasga has joined #ocaml
thomasga has quit [Client Quit]
<mrvn> joelr: pong
<ssbr_> Agh. Can someone explain to me what this line does? "let _ = (program : 'program Gram.Entry.t) in ..."
<joelr> mrvn: i'm returning Int_val from C to mean a parameter-less constructor and the values seem to be cached on the ocaml side. have you seen anything like that? i always get the same value even though the printout on the c side shows different values
<thelema> ssbr_: it asserts that program has type 'a Gram.Entry.t
<ssbr_> It assigns _ to something, so that must have side effects, but... that looks like a type declaration? I'm pretty fuzzy here. I haven't seen this.
<ssbr_> Oh.
<ssbr_> thelema: could that have been done when program was first assigned? (up at `let program = Gram.Entry.mk "program"`)
<mrvn> ssbr_: it casts program to the type and assigns it to _
<mrvn> ssbr_: which should be a total NOP
<ssbr_> Right.
<ssbr_> OK, thank you both.
<mrvn> joelr: don't you mean Val_int?
<thelema> mrvn: no cast; :> is cast
<mrvn> thelema: :> isn't exactly a cast
<mrvn> ssbr_: One thing that statement does it fix the type of program
<mrvn> ssbr_: maybe some artefact left over from fixing a type error where the author wanted to specify the type to get a better error
<mrvn> the caml/mlvalue.h should declare the value type as something that doesn't silently get promoted from ints or longs.
<joelr> mrvn: i'm an idiot
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
<joelr> mrvn: thanks
<mrvn> typedef struct { long tag : 1; long val : 31/63; } for example.
<ssbr_> ARGH. OK -- how do I tell if a .ml file is generated by a camlp4 thing?
<ssbr_> pretty sure I was reading the wrong file.
<mrvn> .oO(you get an error if you forget it)
<ssbr_> (make clean does not clean things up properly, sadly)
<thelema> ssbr_: ml files on disk are generally pre-camlp4 modification
<mrvn> ssbr_: camlp4 works in memory
<joelr> mrvn: i really _was_ returning Int_val :D
<ssbr_> and then a .p4 file with the same name: http://bpaste.net/show/3q7SxbC1zLYoVWJZ1omo/
<mrvn> joelr: that should give interesting results.
<joelr> mrvn: it looked as if i was always getting the same values back
<ssbr_> they sure look like the former was generated from the latter.
Tobu has quit [Ping timeout: 272 seconds]
<mrvn> joelr: you where getting x / 4 back
<thelema> ssbr_: I agree, I think the former is.
<ssbr_> Alright, I guess this is nonstandard then. I'll be sure to watch out for .p4 files with the same name (otherwise) as .ml files
eni has quit [Quit: .]
roha has joined #ocaml
avsm has quit [Quit: Leaving.]
iago has joined #ocaml
Submarine has quit [Remote host closed the connection]
_andre has quit [Quit: leaving]
ulfdoz has quit [Ping timeout: 245 seconds]
sivoais_ has joined #ocaml
sivoais has quit [*.net *.split]
solidus-river has quit [*.net *.split]
solidus-river has joined #ocaml
jonafan_ has joined #ocaml
j2d2j2d2_ has joined #ocaml
nimred_ has joined #ocaml
patronus_ has joined #ocaml
Tobu has joined #ocaml
jonafan has quit [Remote host closed the connection]
j2d2j2d2 has quit [Write error: Broken pipe]
patronus has quit [Write error: Broken pipe]
ccasin has quit [Write error: Broken pipe]
nimred has quit [Write error: Broken pipe]
ccasin has joined #ocaml
jlouis_ has joined #ocaml
pollux_ has joined #ocaml
jlouis has quit [Ping timeout: 260 seconds]
pollux has quit [Ping timeout: 260 seconds]
pollux_ is now known as pollux
joelr has quit [Quit: joelr]
solidus-river has left #ocaml []
bzzbzz_ has quit [Ping timeout: 260 seconds]
bzzbzz has joined #ocaml
bacam_ has joined #ocaml
bacam has quit [Ping timeout: 260 seconds]
roha has quit [Ping timeout: 250 seconds]
cyphase has quit [Ping timeout: 260 seconds]
mehdid_ has joined #ocaml
mehdid has quit [Ping timeout: 260 seconds]
untroubled has joined #ocaml
jonafan_ is now known as jonafan
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
lopex_ has joined #ocaml
cyphase has joined #ocaml
cyphase has quit [Excess Flood]
lopex has quit [Ping timeout: 260 seconds]
cyphase has joined #ocaml
lopex_ is now known as lopex
cyphase has quit [Changing host]
cyphase has joined #ocaml
gnuvince has quit [Ping timeout: 240 seconds]
alpounet has quit [Ping timeout: 260 seconds]
alpounet has joined #ocaml
roha has joined #ocaml
avsm has joined #ocaml
sivoais_ has quit [Quit: leaving]
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
fraggle_ has quit [Read error: Connection reset by peer]
gnuvince has joined #ocaml
smondet has quit [Quit: Leaving]
bacam_ is now known as bacam
roha has quit [Ping timeout: 252 seconds]
ggherdov has joined #ocaml
tufisi has quit [Ping timeout: 260 seconds]
<bjorkintosh> so i can display the results of simple arithmetic in the interactive session like so "2 + 3 + 10;;"
<bjorkintosh> and then get the result.
<bjorkintosh> why won't the compiler display the results if i type it in?
<bjorkintosh> ... and compile it?
<thelema> bjorkintosh: because the toplevel automatically prints results
<thelema> with the compiler, you have to do "print_int (2+3+10)"
<bjorkintosh> ah.
<thelema> you have to ask for results to be printed
<thelema> and you have to use the right printing function.
<bjorkintosh> and if i did something like let b = 2 + 3 + 10;; it would print it?
<thelema> compiled programs don't print anything unless you ask them to.
<thelema> let b = 2 + 3 + 10 in print_int b
untroubled has quit [Quit: leaving]
<bjorkintosh> oh lovely.
<bjorkintosh> i'm trying not to work in the repl; but with the compiler directly.
<thelema> it is common to do: let main () = ... code to execute;; let () = main ()
jarray52 has left #ocaml []
Tobu has quit [Ping timeout: 272 seconds]
err404 has quit [Remote host closed the connection]
cyphase has quit [Ping timeout: 260 seconds]
ggherdov has quit [Quit: bye folks]
cyphase has joined #ocaml
Tobu has joined #ocaml
<bjorkintosh> what's the let () = main () bit about?
dsheets has quit [Ping timeout: 244 seconds]
dsheets has joined #ocaml
larhat has joined #ocaml
Naereen has joined #ocaml
<Naereen> Hello.
Naereen has quit [Client Quit]
<thelema> bjorkintosh: it runs the main function previously defined
letrec has joined #ocaml
<bjorkintosh> hmm i see.
mjonsson has joined #ocaml
mehdid_ has quit [Ping timeout: 255 seconds]
mehdid has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
fraggle_ has joined #ocaml
fraggle__ has joined #ocaml
fraggle__ has quit [Read error: Connection reset by peer]