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
emmanuelux has joined #ocaml
TechCel has joined #ocaml
Progster has quit [Ping timeout: 260 seconds]
gnuvince has joined #ocaml
iago has quit [Quit: Leaving]
gnuvince has quit [Read error: Operation timed out]
gnuvince has joined #ocaml
ivan\ has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
ivan\ has joined #ocaml
xenocons has quit [Quit: leaving]
munga has joined #ocaml
bobzhang1988 has joined #ocaml
madroach has quit [Ping timeout: 265 seconds]
Guest85212 is now known as henux
henux has quit [Changing host]
henux has joined #ocaml
TechCel has quit [Ping timeout: 240 seconds]
Progster has joined #ocaml
xenocons has joined #ocaml
munga has quit [Read error: Operation timed out]
contempt has quit [Ping timeout: 250 seconds]
contempt has joined #ocaml
emmanuelux has quit [Quit: emmanuelux]
bobzhang1988 has quit [Ping timeout: 252 seconds]
Progster has quit [Ping timeout: 246 seconds]
bobzhang1988 has joined #ocaml
Progster has joined #ocaml
Progster has quit [Ping timeout: 252 seconds]
ankit9_ has joined #ocaml
bobzhang1988 has quit [Ping timeout: 250 seconds]
ulfdoz has joined #ocaml
sepp2k has joined #ocaml
ankit9_ has quit [Quit: Leaving]
ulfdoz has quit [Ping timeout: 252 seconds]
ontologiae has joined #ocaml
pango is now known as pangoafk
djcoin has joined #ocaml
Cyanure has joined #ocaml
rejabber has quit [Quit: leaving]
ftrvxmtrx has quit [Quit: Leaving]
BiDOrD_ has joined #ocaml
ontologiae has quit [Ping timeout: 244 seconds]
BiDOrD has quit [Ping timeout: 245 seconds]
cdidd has quit [Read error: Operation timed out]
Cyanure has quit [Remote host closed the connection]
ankit9_ has joined #ocaml
wagle has quit [Read error: Operation timed out]
eni has joined #ocaml
ftrvxmtrx has joined #ocaml
wagle has joined #ocaml
Cyanure has joined #ocaml
Submarine has joined #ocaml
Cyanure has quit [Ping timeout: 245 seconds]
munga has joined #ocaml
silver has joined #ocaml
mika1 has joined #ocaml
Cyanure has joined #ocaml
ontologiae has joined #ocaml
Submarine has quit [Ping timeout: 244 seconds]
eni has quit [Ping timeout: 246 seconds]
eni has joined #ocaml
eni has quit [Ping timeout: 246 seconds]
Submarine has joined #ocaml
thomasga has joined #ocaml
Submarine has quit [Ping timeout: 244 seconds]
ocp has joined #ocaml
mnabil has joined #ocaml
mcclurmc_away is now known as mcclurmc
avsm has joined #ocaml
mcclurmc is now known as mcclurmc_away
Guest57254 has joined #ocaml
Guest57254 is now known as akanaka
<akanaka> Hi! Could somebody help me with ocamlnet and point out to any doc or sample online of how to setup (the simplest way) a Basic auth in http client?
rgrinberg has quit [Ping timeout: 240 seconds]
beckerb has joined #ocaml
<ontologiae> akanaka: let setLoginPass ~l:l ~p:p = Http_client.Convenience.http_user := l ; Http_client.Convenience.http_password := p; ()
ocp has quit [Quit: Leaving.]
<akanaka> ontologiae: Merci, will use this. Does the same globals works with pipeline interface (in my samples it doesn't work, but may be I missed something (just started to study this subject)) or it needs separate initialization?
wagle has quit [Read error: Operation timed out]
wagle has joined #ocaml
<ontologiae> akanaka: never used it in pipeline. But you can look at his code, his module conveniance use pipeline if I remember
<akanaka> merci again, will dive now into the code for investigation...
Progster has joined #ocaml
eni has joined #ocaml
Progster has quit [Ping timeout: 244 seconds]
eni has quit [Ping timeout: 256 seconds]
mcclurmc_away is now known as mcclurmc
<pippijn> ontologiae: ~l:l can be abbreviated to ~l
avsm has quit [Read error: Operation timed out]
madroach has joined #ocaml
_andre has joined #ocaml
ankit9_ has quit [Quit: Leaving]
ocp has joined #ocaml
<ontologiae> pippijn: thx for the tip, I didn't know !
wagle has quit [Ping timeout: 244 seconds]
xcombelle has joined #ocaml
hongboz has joined #ocaml
Progster has joined #ocaml
xcombelle has quit [Quit: I am a manual virus, please copy me to your quit message.]
hongboz has quit [Remote host closed the connection]
wagle has joined #ocaml
munga has quit [Read error: Operation timed out]
gnuvince has quit [Ping timeout: 250 seconds]
gnuvince has joined #ocaml
ocp has quit [Quit: Leaving.]
Kakadu has joined #ocaml
avsm has joined #ocaml
avsm has quit [Client Quit]
avsm has joined #ocaml
<ontologiae> I'm thinking about a big problem in my 10KLOC Ocaml app i'm writing. It's a document management system, and so I have a LOT of string
<thelema> ontologiae: do you need faster string concat/slicing for long strings?
sepp2k has quit [Ping timeout: 246 seconds]
<ontologiae> thelema: no it's not a problem of performance
<ontologiae> I'm looking for a way to _type_ my string
<ontologiae> if one string represents a car and one another a dog, i would like to be sure that the compiler doesn't compile
<thelema> you need to differentiate between different strings?
<thelema> use phantom types
<ontologiae> phantom types ?
<ontologiae> thx thelema
<thelema> Another way to do this is with lots of private types: module CarString : sig type t val to_string : t -> string val of_string : string -> t end = struct type t = string let to_string x = x let of_string x = x end
<pippijn> jane street uses phantom types to encode default values
<pippijn> or something..
thelema_ has joined #ocaml
<thelema_> then define module DogString the same way. The resulting CarString.t can't be confused with DogString.t
ftrvxmtrx has quit [Quit: Leaving]
<ontologiae> ok, I see, i create it with CarString.of_string "foo" ?
wmeyer` has quit [Read error: Connection reset by peer]
wmeyer`` has joined #ocaml
caligula has quit [Read error: Connection reset by peer]
<ontologiae> a = b;;
<ontologiae> Error: This expression has type DogString.t
<ontologiae> but an expression was expected of type CarString.t
caligula has joined #ocaml
<ontologiae> Great !
thelema has quit [Ping timeout: 265 seconds]
sepp2k has joined #ocaml
<ontologiae> The Martin's explanation is very clear for my purpose
ski has quit [Ping timeout: 252 seconds]
malc_ has joined #ocaml
cdidd has joined #ocaml
zorun has joined #ocaml
ski has joined #ocaml
smondet has joined #ocaml
<Drakken> The findlib installer doesn't seem to have a -prefix option like ocaml does.
<Drakken> I like -prefix for installing locally.
<adrien> Drakken: it has at least bindir, mandir, sitelib
<Drakken> yep. Actually, it didn't work too badly with no options.
braibant has joined #ocaml
Cyanure has quit [Quit: Quitte]
<Drakken> What's the search path for #use "topfind" in the toplevel?
<thomasga> CAMLLIB
Progster has quit [Ping timeout: 272 seconds]
<Drakken> All I have is topfind.mli and .cmi
mika1 has quit [Quit: Leaving.]
<thomasga> there is a script called topfind (with no suffices) in the sdlib path
<thomasga> (if you've installed ocamlfind completly)
ocp has joined #ocaml
<Drakken> thomasga okay, thanks. topfind is in $CAMLLIB, but ocaml can't ocaml find it.
<Drakken> Is CAMLLIB locked in at compile time?
<adrien> no
<adrien> there's a default search path
<adrien> but OCAMLLIB is an env var
<adrien> see "man ocamlrun"
<thomasga> (how people are using topfind when they don't have admin rights on their machine ?)
<thomasga> (I mean, how do they install it)
<Drakken> I put everything in ~/ocaml/
<ssbr-> Is it weird to want to have a camlp4 rule that calls itself recursively to build some intermediate structure, but is wrapped in some finalization procedure if the rule is invoked from outside?
<ssbr-> e.g. to have a logical expression syntax, but anybody that allows you to insert a logical expression only sees that expression in CNF when they get a value
<ssbr-> (even though it might be in any form)
<ssbr-> not sure if I'm making myself clear. Basically I wish I didn't have to do "x = some_rule -> wrap x" every tile I invoke some_rule
<Drakken> ssbr- why can't you call wrap in some_rule?
<Drakken> because it's recursive?
<ssbr-> Drakken: oh, heh, right
<Drakken> just define wrap_some_rule and call that
<ssbr-> I could have it do [[ x = real_some_rule -> wrap x]]
<ssbr-> Drakken: thanks for clearing that up :)
Kakadu has quit [Quit: Page closed]
<Drakken> adrien well, here's the output: http://pastebin.com/gRj72tks
<adrien> Drakken: hmm, in ocaml, ok, there's a #command to add a dir
<adrien> or use -I when calling ocaml
<samposm> which gives best error messages, ocaml or ocamlc? (I think ocamlopt gives very short error messages only)
<Drakken> adrien that's not necessary, is it? Shouldn't it work as is if I fix something?
<adrien> prefer -I to $CAMLLIB or $OCAMLLIB
<adrien> much clearer
<adrien> samposm: ocamlopt!
<adrien> samposm: they give the same error messages
<orbitz> adrien: I thought short error messages was one of the optimizations in ocamlopt :)
<adrien> orbitz: nah, they had nothing to optimize more :P
<orbitz> Haha
<samposm> another question: what to put in .ocamlinit to load library from a subdir of the current working dir?
mcstar has joined #ocaml
<samposm> (or just putting an absolute location is ok, too)
<samposm> ah, #directory is the directive I need. thanks
K_F has quit [Ping timeout: 240 seconds]
K_F has joined #ocaml
<Drakken> Hmm. I set OCAMLLIB to std-lib, but now ocaml can't find pervasives.cmi.
<Drakken> Does that mean topfind was installed in the wrong directory?
<f[x]> why do you mess with ocamllib?
<adrien> Drakken: how did you configure ocaml? what does "ocamlc -where" say?
mnabil has quit [Remote host closed the connection]
<samposm> err, when I use toplevel interactively, I have libraries, but when I run a scrip (ocaml script.ml), it does not find my libraries. what's going on?
<adrien> what's that file?
<Drakken> f[x] because #use "topfind" isn't working the way I expect it to: http://pastebin.com/gRj72tks
<f[x]> how did you configure findlib?
<thelema_> Drakken: why is topfind in std-lib/
<f[x]> by default ocamlfind will install itself so that everything works
<samposm> it won't look at .ocamlinit when I run a script?
<f[x]> samposm, no
<thelema_> topfind should be directly in ocamlc -where
<thelema_> thelema@thelema-laptop:~/.y$ ll `ocamlc -where`/topfind
<thelema_> -rw-r--r-- 1 root root 1357 Jun 7 15:54 /usr/local/lib/ocaml/topfind
<Drakken> adrien ocamlc -where points to $OCAMLLIB, which I changed to std-lib in my ocaml lib directory.
<samposm> f[x]: can I make it to?
<f[x]> Drakken, your CAMLLIB doesn't point to std-lib
K_F has quit [Ping timeout: 240 seconds]
<f[x]> Drakken, if you configure things manually, then you probably know what you are doing?
<Drakken> f[x] but it didn't. I had a godi directory in my ocaml direcory, so findlib/configure's heuristic thingy tried to put stuff in there.
<f[x]> samposm, try passing it with explicit -init option
<Drakken> I deleted /godi/ from the directories, but I didn't delete /std-lib.
<samposm> f[x]: I tried, does not work
<f[x]> samposm, no, that won't work
<f[x]> then specify all the libs in the script - that's robust
<thelema_> #use "~/.ocamlinit" in the script?
<f[x]> except the tilde thingy
<thelema_> sure
<Drakken> thelema_ I guess I should have specified the lib directory explicitly when I installed findlib. I tried it without args and then edited Makefile.config.
<Drakken> I guess that didn't work :(
<f[x]> > edited Makefile.config
<f[x]> why?
<f[x]> how?
<Drakken> because it had a bunch of /godi/ directories.
<Drakken> with emacs
<adrien> how could it have that?
<f[x]> and why did you think it was wrong?
<f[x]> obv. because ocaml was installed via godi?
xcombelle has joined #ocaml
<Drakken> the findlib installer heuristic probably saw the godi directory and assumed I was using godi.
<adrien> it has no heuristic afaik
<f[x]> the findlib installer doesn't have any such heuristics
<f[x]> show `ocamlc -where`
<adrien> but if you have godi in your path while installing another installation, you're doing something bad
<Drakken> only because the findlib installer assumed I was using it.
<samposm> thelema_: yes, that works. but is there any way to get the same sourcefile to work both for ocaml and ocamlopt?
<adrien> no
<adrien> Drakken: where is godi installed?
<f[x]> samposm, not without extra handwork
<Drakken> adrien in <ocaml-prefix>/godi
Progster has joined #ocaml
<Drakken> along with bin, man, etc, lib, and odb
<adrien> what is the value of $PATH when you configure ocamlfind?
<Drakken> adrien well, I changed it in .bashrc, but there's still a bunch of godi directories in PATH of the shell I installed findlib from.
<adrien> you _have_ to fix that
<thelema_> samposm: no.
<thelema_> samposm: this, to me, is a significant weakness of the ocaml programming environment, with at least two solutions
<thelema_> 1) someone comes up with a bit of magic that wraps ocamlopt (and ocamlc) that looks for #require directives and translates them into -package foo for ocamlfind
<adrien> the "ocaml" binary accepts input from stdin
<adrien> and you sed over it :P
<thelema_> 2) both the toplevel and compilers gain support for a magic comment (or other new syntax) that indicates compilation and linking dependencies
malc_ has quit [Quit: leaving]
<thelema_> adrien: sed over the input to 'ocaml' to ... do what?
<adrien> add comments like
<adrien> (*#include "foo";;*)
<adrien> strip the comment markers (or even the first one only)
<thelema_> to uncomment the directives... yes, that may work.
<thelema_> except you'd still need that information to be entered in the command line to compile such a program
<adrien> you could extract it through a wrapper but I don't consider that a big issue since one can use the shell's history
<samposm> thelema_: ok, thanks for explaining
<thelema_> I wonder if ocamlbuild/ocamldep could be extended reasonably to auto-detect (*#require "foo"*) and turn it into an ocamlfind dep
<thelema_> the other reasonable thing would be to have ocamlc and ocamlopt ignore #-directives
<thelema_> this would remove the need of pre-processing the comments.
<samposm> I quite much miss end-of-line comments
<thelema_> samposm: me too, I wonder if there's a mantis bug we can vote up...
<ousado> adrien: hi again, re yesterdays question, what would be a/the alternative to relying on module evaluation to register plugins?
<samposm> I am kind of thinking about sume dirty perl solution to just preprocess the source file
<thelema_> hmm, no mantis bug that I can find
<avsm> thelema_: OCamlMakefile did the preprocess-first-line trick with (* pp, but its a little fragile
<avsm> since editors also want that
<thelema_> avsm: well, first n lines for n ~~ 20 generally solves the conflict
<avsm> yeah. would be nice to not have to impose that on the source file if possible though
hcarty has quit [Ping timeout: 245 seconds]
<avsm> between ocamlbuild, ocamlfind, _tags, there's got to be *somewhere* to stash it ;-)
<thelema_> yes, but having it anywhere outside the source file means it's grouped wrong. like having parallel arrays vs. array of tuples
hcarty has joined #ocaml
<Drakken> So info in findlib.conf gets hard-coded in when you install findlib.
<thelema_> Drakken: yes, findlib executable has defaults hard-coded in when it's compiled, these can be overridden by findlib.conf and/or environment variables
<thelema_> and/or command-line parameters
<Drakken> thelema I changed findlib.conf, but I still had to recompile.
<Drakken> thelema_
<thelema_> Drakken: iird, some constants get set based on configure in the topfind script; these cannot be changed except by editing topfind or reconfiguring
<thelema_> (and re-installing)
<thelema_> *iirc
<thomasga> http://caml.inria.fr/mantis/view.php?id=5699 <- could solve the topfind issue
<thomasga> :-)
<Drakken> thelema_ apparently that includes destdir and/or path
<thelema_> :( opam still uses findlib? I thought that with all the tracking of packages it does, it wouldn't need findlib.
<avsm> for now. findlib is essential to wrap existing packages
<avsm> opam doesnt touch the build system of individual packages yet
* thelema_ imagines opam providing a fake ocamlfind binary, but there's just so many options to findlib that it'd be a ton of work
silver has quit [Remote host closed the connection]
<avsm> findlib is definitely the least evil of all the ocaml build tools. it is, at least, predictable :)
<thelema_> all unpredictabilities in any computer program are the result of insufficient understanding of "what's going on"
<thelema_> so saying that findlib isn't terrible because it's predictable...
<thelema_> doesn't say much.
<flux> so what's terrible about findlib?
<thelema_> the maze of code that makes it work is my biggest problem
<thelema_> it is amazingly featureful, but it's grown a ton of cruft
<flux> maybe building ocaml programs is just a more complex task than it should be :)
<thelema_> totally agreed. A simple "require" declaration for outside packages that can be put in source files and the ability for required packages to have deps... this would go a long way
<mcstar> is there something like 'with-open-file' in stdlib?
<flux> thelema_, how about byte compilation/native compilation/debug packages, camlp4, camlp5, ..
<thelema_> ?
<flux> mcstar, no
<flux> batteries iirc has one, though
<mcstar> thx
<mcstar> ill check it out
<thelema_> mcstar: ah, I see; yes, use batteries, as flux said
<thelema_> flux: all packages should be compiled in debug mode, so that's not an issue
<thelema_> pre-processing should also be declared as part of this requires pattern, and not externally to the file being compiled by default
ankit9_ has joined #ocaml
<thelema_> byte vs. native shouldn't be a problem; the simplest implementation of this "require" would be to have "require foo" add "-I +foo" to compile and "foo.cma/cmxa" to link depending on compiler
<thelema_> if you try to native compile against a library that doesn't provide .cmxa, the link error could be spruced up to be more useful to beginners
<thomasga> thelema_: seems that you are trying to rebuild ocamlfind again :-)
thomasga has quit [Quit: Leaving.]
<thelema_> thomasga: the backend is looking like ocamlfind, yes.
<thelema_> but without the extreme configurability
<thelema_> without the longest match labels resolution
<thelema_> s/labels/predicates/
<flux> thelema_, how about profiling?-)
<flux> and multithreading/non-multithreading
eni has joined #ocaml
<thelema_> flux: a simple convention works here too - foo.prof.cmxa
<flux> and then the biggest: how about the tons of packages providing findlib data?
<thelema_> if a library needs threads, it can depend on a "threads" package that turns on compilation with threads
djcoin has quit [Quit: WeeChat 0.3.2]
<thelema_> as for backwards compatibility, I wish we were in a land where every package had a nice META file
<thelema_> there's a shift right now, and many packages are being rewritten with _oasis
<thelema_> I don't see a problem for _oasis to parse these same #requires to figure out most of the package's structure without as much of an _oasis file being written
mcclurmc is now known as mcclurmc_away
<thelema_> Packages using findlib can still use findlib. ocamlfind will still work on top of this system (well, maybe it won't know that some package sets multithreaded compilation)
<thelema_> But I'm just making stuff up off the top of my head, this all needs to be thought out a bit better.
<avsm> thelema_: i like the ocamlbuild %.p.cmx %.d.cmx convention, but it hasnt been plumbed all the way through to %.p.cmx, so doesnt actually work. would be great to see somethign that does that properly
gnuvince has quit [Ping timeout: 255 seconds]
gnuvince has joined #ocaml
avsm has quit [Quit: Leaving.]
pangoafk is now known as pango
Submarine has joined #ocaml
<mcstar> is there a way, for ocaml packages to put their documentation at one place?
<mcstar> and why isnt it installed in the first place?
<thelema_> mcstar: installed documentation is handled... inconsistently
<mcstar> shame
<thelema_> I'm mostly satisfied with online documentation
<mcstar> ok
ontologiae has quit [Ping timeout: 246 seconds]
eni has quit [Quit: Leaving]
<mcstar> im trying to use gsl from the toplevel
<mcstar> without success
<mcstar> i can link against gsl, by providing the -package gsl to findlib
<mcstar> but i cant load the .cma file, to use the binding interactively
<adrien> no!
<adrien> #use "topfind";;
<mcstar> :(
<adrien> #require "gsl";;
<mcstar> i have topfind
<mcstar> ah require
<mcstar> ill try
<adrien> it's written on the screen right after you "#use "topfind";;
<adrien> "
<mcstar> ill be damned, its working
<mcstar> ok ok
<mcstar> dont be mad
<mcstar> im once again in your debt
<mcstar> actually, there is nothing written after "#use "topfind";;
<mcstar> im using utop
TechCel has joined #ocaml
<adrien> - : unit = ()
<adrien> Findlib has been successfully loaded. Additional directives: #require "package";; to load a package
<adrien> arf, irssi ate one line feed
<mcstar> adrien: i know thats what it says
<mcstar> but not in utop
Progster has quit [Ping timeout: 260 seconds]
<mcstar> anyway, i just wanted to add that, to compensate my bad behavior
<adrien> bit weird that it doesn't display that
gnuvince has quit [Ping timeout: 246 seconds]
<adrien> it doesn't show the #use "topfind";;
<adrien> but I trust you
<mcstar> adrien: topfind is loaded, since i could use 'require'
<adrien> I think that's something I quite disliked in utop: it can change the output quite a lot
<mcstar> adrien: i just tried, that message doesnt show up in plain 'ocaml' either
<mcstar> it has to do with the .ocamlinit file i guess
<mcstar> i put the initialization stuff in there that batteries recommended
<mcstar> that loads topfind, and after that batteries
<adrien> no idea what it does
<adrien> maybe that if #use "topfind";;
<adrien> I'm way too used to pressing <return> right after ";;"
<adrien> my fingers do it on their own
gnuvince has joined #ocaml
<adrien> anyway, maybe that if it is in .ocamlinit, then the output is hidden
<mcstar> no
<mcstar> the script switches to non-interactive mode
<mcstar> laod topfind
<mcstar> and switches back to interactive
<mcstar> thats why that message is suppressed
<thelema_> yes, batteries' ocamlinit hides the topfind messages
osa1 has joined #ocaml
<Drakken> What are some small packages with very few dependencies?
<thelema_> Drakken: but not 0 dependencies?
<thelema_> Drakken: you can use odb foo --info to print the metadata for a package
<thelema_> Drakken: fileutils has dep on oUnit
Xizor has joined #ocaml
<thelema_> yojson has just a few deps
<Drakken> thelema_ is there a way to do that for "locally configured" packages?
<thelema_> ?? --info works for all packages
bzzbzz has joined #ocaml
<Drakken> Hmm. I guess my first few tries just didn't have any.
<Drakken> I kept getting info with no deps.
<Drakken> nvm
<thelema_> n/p
<samposm> is there a ready solution for 3d arrays of non-basic datatypes? or do I need to construch my own from 1d arrays?
<thelema_> construct your own from either nesting 1d arrays or by writing your own index computation to use one large array
<samposm> ok, thx
<samposm> ...if I nest 1d arrays, I can still use kind of array syntax to acces the elements?
<thelema_> yes, arr.(x).(y).(z)
<samposm> good :-)
<mcstar> embarassing
<mcstar> i dont think i had ever trouble writing to files in other languages
<mcstar> first of all, you have to provide a permission
<mcstar> ok, i can live with that
<adrien> it's the POSIX API
<adrien> actually, no
<adrien> C API
<mcstar> but then, to write to a file with fprintf, i need to change a file descriptor to a channel descrriptor right?
<mcstar> at least it typechecks...
<mcstar> but my file is empty, after i wrote some stuff to it
<mcstar> i closed the file
<thelema_> mcstar: are you using batteries?
<adrien> show the code too btw
<mcstar> im not sure what to do with the channel something
<mcstar> thelema_: batteries is loaded, yes
<mcstar> adrien: in c you dont have to provide a permission for a new file
<mcstar> and yes, you can change it with posix calls, though i never had to
<thelema_> let oc = open_out "outfile" in Printf.fprintf oc "Test\n%!"; close_out oc
<mcstar> ok, ill do it with open_out
<mcstar> i used this function: out_channel_of_descr
<thelema_> don't use that unless you need unix file descriptors
<thelema_> pervasives.open_out is fine for most uses
<mcstar> i opened a file with Unix.open
<mcstar> but afaik it should work
<thelema_> mcstar: best is with_file_out "outfile" (fun oc -> Printf.fprintf oc "Test\n%!")
<mcstar> i understand
<mcstar> but that doesnt explain why it does not work
<thelema_> show the code.
<mcstar> not much to look at
sgnb has quit [Read error: Connection reset by peer]
gnuvince has quit [Ping timeout: 246 seconds]
<thelema_> ah, you're closing the fd, but not the channel.
<thelema_> so the buffer with data to be written doesn't get flushed.
<thelema_> which is a good reason not to open files this way.
sgnb has joined #ocaml
<mcstar> i asked this
<mcstar> "im not sure what to do with the channel something"
<mcstar> that meant: do i need to close it or not
<adrien> mcstar: int open(const char *pathname, int flags, mode_t mode);
xcombelle has quit [Quit: I am a manual virus, please copy me to your quit message.]
<adrien> depends on which API you use
<adrien> but you have to know that ocaml's lib is modeled closely to unix
<thelema_> mcstar: I recommend using the File.with_file_out API and not worrying about closing.
<mcstar> adrien: FILE * fopen ( const char * filename, const char * mode );
<mcstar> thats the C version
<mcstar> what you showed is the posix
<mcstar> thelema_: yeah, will do in the future
<mcstar> i have to get to know the system
gnuvince has joined #ocaml
<mcstar> anyway, i have my pretty data in a file now
<adrien> mcstar: true; I really thought it was in C too; anyway, thelema has shown you the equivalent
sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
Submarine has quit [Read error: Operation timed out]
sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
ontologiae has joined #ocaml
<mcstar> here it comes, another nub question of mine
<mcstar> lets say, i made some functions, and i want to compile them with ocamlopt
<mcstar> because ocamlc is not fast enough
<mcstar> but, i still want to load them up in the toplevel
<mcstar> so, how do i do that?
<adrien> compile both version
<adrien> another possibility is the native toplevel but it's fairly experimental
<mcstar> no
<mcstar> im sure it can be done easily
<mcstar> hm, actually im not that sure
<mcstar> can toplevel only use byte compiled libs?
avsm has joined #ocaml
<adrien> yes
<mcstar> adrien: so what i want cant be done then?
<adrien> not with the regular toplevel
<mcstar> notwithstanding that experimental stuff
<mcstar> :(
<adrien> only ocamlnat can and it's experimental
<mcstar> then ill have to write a main and compile the whole thing
K_F has joined #ocaml
akanaka has quit [Ping timeout: 246 seconds]
<mcstar> adrien: what is the reason behind this?
<mcstar> because obviously, the toplevel can load object files
<mcstar> and it can interface with them
<mcstar> like gsl for example
<mcstar> it is in C, and the there is a byte-compiled something for it, gsl.cma i guess
<mcstar> for example, ghci can load compiled binaries
<mcstar> i mean libs
<mcstar> the toplevel definitions, or sources that you load, will be only byte compiled, but you can load other haskell libs that are object fikles
<mcstar> </rant>
<adrien> mcstar: ocamlnat requires more work
<adrien> it's slower to react
<adrien> it needs a toolchain, including a linker iirc
caligula has quit [Read error: Connection reset by peer]
caligula_ has joined #ocaml
ftrvxmtrx has joined #ocaml
akanaka has joined #ocaml
_andre has quit [Quit: leaving]
<mcstar> [? List : x | x <- (0.0,0.1) --. 10.0 ?];;
<mcstar> thats what ive been missing
<thelema_> mcstar: the magic of comprehensions?
<thelema_> and --.
<mcstar> i knew about --
<mcstar> and wanted one for floats
<mcstar> and there it is already
<thelema_> I think you could write (0.0, 0.1) --. 10.0 |> List.of_enum
<mcstar> (in haskell, there are standard enumerations, and i was missing that)
<thelema_> or just use the enum.
<mcstar> ah, List.of_enum, was looking for that too
<mcstar> yeah, great
<mcstar> how old is this batteries project?
* thelema_ thinks back
<mcstar> i think im lucky i joined to the ocaml crowd this late
<thelema_> early in 2008, I think
<mcstar> honestly, im somewhat sorry, that i never met functional languages while at university
<mcstar> my life could have been different...
<mcstar> (probably better)
<mcstar> erm
<mcstar> problem
<mcstar> File "interp.ml", line 64, characters 31-82:
<mcstar> Error: Unbound value List.of_enum
<mcstar> but i dont have List.of_enum in the code
<thelema_> do you have a [? List: ?] comprehension?
<mcstar> i supposed the camlp4 preprocessor translated the [? ?] list comprehension
<mcstar> yeah
<thelema_> yup, that's exactly what it does.
<thelema_> you'll need to add "open Batteries_uni"
<thelema_> or use [? BatList: ?]
<mcstar> hm
<mcstar> i dont understand this
<mcstar> there is a List module
<mcstar> how can batteries ovveride that?
<mcstar> override*
<mcstar> obviously, the List module doesnt provide .of_enum
<mcstar> so, can another module extend and re-export another module?
<mcstar> i guess it can...
ftrvxmtrx has quit [Ping timeout: 252 seconds]
<thelema_> batteries provides BatList
<thelema_> It also provides a module Batteries (and Batteries_uni) that have a submodule List.
<thelema_> so if you `open Batteries[_uni]`, then when you refer to List, you get the batteries list.
<mcstar> so if i once opened batteries, i cannot have access to the original List?
<mcstar> ok
TechCel has quit [Ping timeout: 244 seconds]
<thelema_> Batteries also provides the original modules under... Legacy, IIRC. so Batteries.Legacy.List == List
<mcstar> ok, it worked with 'open Batteries_uni', but didnt with 'open Batteries'
<mcstar> thelema_: i was asking in general
<thelema_> need to compile with threads to use 'open Batteries'
<mcstar> ah, so thats another command line option
<thelema_> in general, it's pretty easy to do `module List = struct include List let of_enum = ... end
<mcstar> oh, i noticed i left 2 toplevel definitions in the file by the same name/signature
<mcstar> but the compiler didnt warm me
<mcstar> this is my first useful ocaml program
<mcstar> thelema_: im wodering if the last function cold be rewritten in a better wya
<mcstar> that pattern matching stand out too much
<mcstar> stands*
<thelema_> it's one reasonable way to deal with command-line arguments.
<thelema_> I might not use invalid_arg to print your usage string, but it works.
<mcstar> what would you do?
<thelema_> do you really need all 6 parameters each time, or are there common defaults?
<mcstar> i need them
<thelema_> bitbckt: that actually doesn't get you very far for this kind of argument set
<bitbckt> just a bunch of anon args?
<mcstar> bitbckt: thanks, but i dont want to set that up for this
<mcstar> yes, anon is great for this
<mcstar> actually, im only going to use this program a couple of times
<thelema_> for this, I might just `if Array.length Sys.argv != 7 then usage else let lower = float_of_string Sys.argv.(1), ...
<mcstar> the real stuff is in c++
<thelema_> if you're only going to use this program a few times, then what you have is perfect
<mcstar> k
<bitbckt> agreed, one-offs aren't worth the effort.
ftrvxmtrx has joined #ocaml
sepp2k has quit [Read error: Connection reset by peer]
gnuvince has quit [Ping timeout: 250 seconds]
milosn has quit [Ping timeout: 245 seconds]
Progster has joined #ocaml
Anarchos has joined #ocaml
Xizor has quit []
mcstar has quit [Quit: mcstar]
smondet has quit [Quit: gotta go]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
Progster has quit [Ping timeout: 244 seconds]
henux has quit [Ping timeout: 250 seconds]
henux has joined #ocaml
henux is now known as Guest99251
hongboz has joined #ocaml
<hongboz> did anyone have a try to build the ocamldoc's documentation for ocaml's compiler?
Guest99251 is now known as henux
henux has quit [Changing host]
henux has joined #ocaml
hongboz has quit [Ping timeout: 255 seconds]
emmanuelux has joined #ocaml
ocp has left #ocaml []
osa1 has quit [Read error: Operation timed out]
osa1 has joined #ocaml
ontologiae has quit [Ping timeout: 246 seconds]