shp changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | nohttp://www.ocaml-lang.org | Public logs at http://tunes.org/~nef/logs/ocaml/
bobzhang has quit [Ping timeout: 260 seconds]
hongboz has joined #ocaml
mye has joined #ocaml
lolcathost has joined #ocaml
myx has quit [Read error: Connection reset by peer]
ontologiae has quit [Ping timeout: 255 seconds]
Oejet has quit [Quit: Leaving.]
<Qrntz> I am getting «Invalid_argument("Random.int")» with the bound being both positive and fairly low (0-100) which should fully satisfy the range check the function does
<Qrntz> this only happens when the function calling Random.int is located in a shared object that's dynamically loaded
<Qrntz> am I overlooking something or is this a legitimate bug report?
madroach has quit [Ping timeout: 240 seconds]
madroach has joined #ocaml
<thelema> is it possible that a negative number is being passed in?
<Qrntz> 03:12:36 < Qrntz> I am getting «Invalid_argument("Random.int")» with the bound being both positive and fairly low (0-100) which should fully satisfy the range check the function does
<Qrntz> a positive constant only ever gets passed
<Qrntz> it was originally 100 but I tried it with values of the 0-100 range and it fails unconditionally
<Qrntz> a minimal example I just wrote doesn't seem to fail, but I suspect it's too minimal
mye_ has joined #ocaml
weie has joined #ocaml
mye has quit [Ping timeout: 240 seconds]
mye_ is now known as mye
<thelema> Can you call a non-dynamically loaded wrapper that prints the argument?
technomancy has left #ocaml []
jbrown has joined #ocaml
q66 has quit [Quit: Quit]
<Qrntz> thelema, the argument to Random.int?
darkf has joined #ocaml
<darkf> So what's the best way to have a main function? I have an a.ml and a b.ml where b.ml has a let () = printf "hi\n" and a.ml doesn't have a let (), but when I run `ocaml a.ml b.ml` it doesn't execute it.
<thelema> Qrntz: yes
<thelema> darkf: let main () = ...;; let () = main ();;
<darkf> thelema: Would love to if the let () would execute
<thelema> I'm not sure why let () = printf "hi\n" isn't working; it should.
<Qrntz> buffered output?
<darkf> No, it works on single file programs
<thelema> wait, 'ocaml a.ml b.ml'? do you mean ocamlc?
<darkf> No, just ocaml :\
<darkf> Huh, works with ocamlc
<Qrntz> thelema, I'm not sure I saw the point but it's late here and I followed your advice — everything goes fine with a non-dynlinked function
<Qrntz> if that matters, the piece of code that calls Random.int looks like «if Random.int 100 < !probability then … else ()» where !probability is a regular int ref; I really don't know where to look for clues because that's an odd failure
<Qrntz> sorry, I probably should be going to bed before it gets any more weird
<Qrntz> see you later!
<thelema> darkf: ocaml only takes one script file argument
gnuvince has joined #ocaml
gnuvince_ has quit [Ping timeout: 260 seconds]
tac has joined #ocaml
<darkf> agh generic "Syntax error" drives me nuts
<darkf> what's wrong with: assert Hashtbl.length genv.sym = 0;
Yoric has joined #ocaml
<darkf> ah, nevermind; better diagnostics would be nice
<thelema> assert()
<thelema> although I'd expect a type error, not a syntax error
<darkf> yeah, it binds weird, it wants assert((Hashtbl.length genv.sym) = 0)
<thelema> hmm, you shouldn't need the () before =
<thelema> bu assert is definitely unusually high priority.
hongboz has quit [Ping timeout: 276 seconds]
Yoric has quit [Ping timeout: 252 seconds]
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 248 seconds]
emmanuelux has joined #ocaml
mgodshall has joined #ocaml
nickmeharry has quit [Quit: Leaving.]
emmanuelux has quit [Quit: emmanuelux]
tac has quit [Ping timeout: 245 seconds]
lolcathost has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
lolcathost has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
ulfdoz_ is now known as ulfdoz
gnuvince has quit [Ping timeout: 272 seconds]
lolcathost has quit [Ping timeout: 255 seconds]
gnuvince has joined #ocaml
lolcathost has joined #ocaml
lolcathost has quit [Client Quit]
lolcathost has joined #ocaml
Yoric has joined #ocaml
lolcathost has quit [Ping timeout: 246 seconds]
lolcathost has joined #ocaml
gour has joined #ocaml
RagingDave has joined #ocaml
lolcathost has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
lolcathost has joined #ocaml
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
chambart has joined #ocaml
<adrien> morning :-)
<adrien> I've been tring to understand a commit by Jacques Garrigues from 2002 titled "acceleration des Makefiles" (Makefiles speedup) (rev 4758) which introduces shell scripts to run ocamlc and ocamlopt during ocaml's build (ocamlcomp.sh and ocamlcompopt.sh)
<adrien> I don't understand how going through an additional thing to execute is going to be faster than using variables in a shell script
<adrien> s/shell script/makefile/
chambart has quit [Ping timeout: 246 seconds]
milosn has joined #ocaml
lolcathost has quit [Ping timeout: 276 seconds]
mye has quit [Quit: mye]
tane has joined #ocaml
q66 has joined #ocaml
<fasta> adrien: you are right about that.
<fasta> adrien: it seems to be a rather poor commit in general, because the commit message doesn't reflect all of the changes.
<flux> maybe it can switch the contents of the .sh files during compilation for faster versions?
lolcathost has joined #ocaml
<fasta> The only advantage I see it is that it is easier to understand.
<fasta> It's not going to be faster.
<fasta> But overall it still seems fairly poor, since there are still multiple places in which the same information is defined.
<adrien> flux: I'll have to check that
<adrien> it's bothering me because with "Makefile.nt" it doesn't use that and also because I need to have two "ocamlrun" in the boot/ directory: ocamlrun-build and ocamlrun-target
<adrien> (host, not target)
<fasta> ocamlcomp.sh is also garbage code.
<fasta> Look at the lack of quotes.
<adrien> (but I don't think we'll see canadian cross with ocaml that soon :P )
<adrien> fasta: it's generated from a .in file
<fasta> Also look at the non-portable use of ``.
<fasta> adrien: ocamlcomp.sh?
<adrien> from what I've gathered, for some time, `` has been more portable that $() because of bugs in some shells
<adrien> fasta: there's ocamlcomp.sh.in somewhere
<fasta> adrien: even if that's the case, then ocamlcomp.sh.in is doing the wrong thing, unless it accounts for directories containing spaces.
<adrien> agreed; I meant that quoting in a file that is generated through search-replace from a shell script is very difficult
<fasta> adrien: $() is a POSIX standard. Is `` also?
<adrien> anyway, I think I'll try to get rid of this
<adrien> not sure; I think $() was problematic in bash years ago
<flux> I would be very surprised if `` wasn't POSIX
<adrien> I'll check as soon as I've managed to make my laptop lose 1°C and slow down its fan
xavierm02 has joined #ocaml
<fasta> adrien: very difficult is not ever an excuse for doing the wrong thing, IMHO.
<fasta> Bash wiki: `...` is the legacy syntax required by only the very oldest of non-POSIX-compatible bourne-shells. There are several reasons to always prefer the $(...) syntax:
<fasta> adrien: how can you fix this? Can you just commit to the OCaml tree?
<adrien> I cannot but I'm working on cross-compiler support
<adrien> so I send patches
nickmeharry has joined #ocaml
<adrien> my reference for shell scripting is SUSv2, from 1997
<adrien> so ten years ago you most probably still had to use `` =)
<fasta> adrien: ok, the best way is to introduce a macro to select the quoting style at build time :)
<adrien> in 2013, I'd say: kill with fire the shells that don't handle $()
mye_ has joined #ocaml
<fasta> adrien: there are a _lot_ of such quoting problems if you grep around.
<fasta> adrien: probably 1000+.
lolcathost has quit [Ping timeout: 240 seconds]
lolcathost has joined #ocaml
Submarine has quit [Quit: Leaving]
tane has quit [Remote host closed the connection]
ontologiae has joined #ocaml
sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
<xavierm02> arg
<xavierm02> let ll_product l0 r0 =
<xavierm02> let rec next =
<xavierm02> function
<xavierm02> | LazyList.Nil, LazyList.Nil -> raise LazyList.No_more_elements
<xavierm02> | LazyList.Nil, LazyList.Cons (rh, rt) -> next (l0, rt)
<xavierm02> | _ -> 1
<xavierm02> in
<xavierm02> 1
<xavierm02> ;;
<xavierm02> File "Sat.ml", line 9, characters 53-61:
<xavierm02> Error: This expression has type
<xavierm02> 'a Batteries_uni.LazyList.node_t * 'b Batteries_uni.LazyList.t
<xavierm02> but an expression was expected of type
<xavierm02> 'a Batteries_uni.LazyList.node_t * 'b Batteries_uni.LazyList.node_t
<xavierm02> Type
<xavierm02> 'b Batteries_uni.LazyList.t =
<xavierm02> 'b Batteries_uni.LazyList.node_t lazy_t
<xavierm02> is not compatible with type
<xavierm02> 'b Batteries_uni.LazyList.node_t = 'b BatLazyList.node_t
<xavierm02> line 9 is the second match
<xavierm02> I srsly don't get it
<xavierm02> I can match l0 against LazyList.Nil
<xavierm02> and get no error but I can't replace LazyList.Nil by l0?
<xavierm02> >_<
jewel has joined #ocaml
<xavierm02> wait
<xavierm02> it's the right part that dosn't work >_<
tane has joined #ocaml
ontologiae has quit [Ping timeout: 248 seconds]
<xavierm02> never mind
<xavierm02> I think I found it
<xavierm02> had to use LazyList.next on the right side
philed has quit [Remote host closed the connection]
chambart has joined #ocaml
Yoric1 has joined #ocaml
Yoric has quit [Ping timeout: 246 seconds]
chambart has quit [Ping timeout: 246 seconds]
jewel has quit [Quit: Leaving]
<adrien> considering how the Sys module seems to be done, I think ocaml bytecode is portable between word sizes and endianness
ontologiae has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
darkf has quit [Quit: Leaving]
Qrntz has quit [Changing host]
Qrntz has joined #ocaml
lolcathost has quit [Read error: Operation timed out]
chambart has joined #ocaml
lolcathost has joined #ocaml
flixr has left #ocaml []
jamii has joined #ocaml
<fasta> adrien: what do you mean by portable?
<fasta> adrien: in theory?
<fasta> adrien: because in practice, it is not.
<adrien> it's portable for a given ocaml version
<adrien> which is already pretty nice
Cyanure has joined #ocaml
ski has quit [Ping timeout: 246 seconds]
ski has joined #ocaml
emmanuelux has joined #ocaml
sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
avsm has left #ocaml []
avsm has joined #ocaml
<Qrntz> thelema, just letting you know I resolved that issue with Random.int; the function which called it with an invalid argument was very near in the call graph but not the one I was suspecting
<Qrntz> I shan't try debugging late in the night/morning ever again
<adrien> usually the issue is being stubborn ;-)
<adrien> (when debugging I mean)
<Qrntz> probably
sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
sgnb has quit [Ping timeout: 272 seconds]
ontologiae has quit [Ping timeout: 246 seconds]
sgnb has joined #ocaml
gnuvince_ has joined #ocaml
gnuvince has quit [Ping timeout: 272 seconds]
RagingDave has quit [Quit: Ex-Chat]
RagingDave has joined #ocaml
weie_ has joined #ocaml
weie has quit [Ping timeout: 276 seconds]
mattrepl has joined #ocaml
jamii has quit [Read error: Operation timed out]
mye_ has quit [Quit: mye_]
hongboz has joined #ocaml
RagingDave_ has joined #ocaml
RagingDave has quit [Ping timeout: 255 seconds]
hongboz has quit [Remote host closed the connection]
RagingDave_ is now known as RagingDave
<thelema> Qrntz: ah, that makes sense
iZsh has quit [Quit: Coyote finally caught me]
lolcathost has quit [Ping timeout: 246 seconds]
sagoi has joined #ocaml
lolcathost has joined #ocaml
jamii has joined #ocaml
sagoi is now known as babalu
wagle_ has joined #ocaml
wagle has quit [Ping timeout: 260 seconds]
lolcathost has quit [Ping timeout: 276 seconds]
lolcathost has joined #ocaml
gnuvince_ has quit [Read error: No route to host]
RagingDave has quit [Quit: Ex-Chat]
RagingDave has joined #ocaml
RagingDave has quit [Client Quit]
iZsh has joined #ocaml
mattrepl has quit [Quit: mattrepl]
babalu has quit [Quit: Page closed]
mattrepl has joined #ocaml
lolcathost is now known as Automorphism
gnuvince_ has joined #ocaml
sivoais has quit [Ping timeout: 256 seconds]
<flux> I wonder though what the api looks like, or is it simply "here's a list of updates, merge these"
<flux> which would be just one function more to map/set/etc
sivoais has joined #ocaml
Anarchos has joined #ocaml
pkrnj has joined #ocaml
lolcathost has joined #ocaml
Automorphism has quit [Ping timeout: 276 seconds]
watermind has quit [Ping timeout: 260 seconds]
troydm has quit [Read error: Operation timed out]
troydm has joined #ocaml
lolcathost has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
lolcathost has joined #ocaml
benmachine has joined #ocaml
<benmachine> I'm trying to ocaml odb.ml netclient and finding that it keeps failing because it tries to install a whole list of libraries but some of them are already installed
<benmachine> can it... not do that, instead?
<benmachine> (just install the ones I haven't got)
<Qrntz> this makes me wonder if odb is relevant anymore now that there's OPAM
<Qrntz> but I have no idea
lolcathost has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
lolcathost has joined #ocaml
<benmachine> sigh, and now it's trying to install stuff in /usr/bin, this is at least two different kinds of wrong
<Qrntz> benmachine, try OPAM, it aims to be a full-fledged package manager (as opposed to odb.ml's 80%)
<thelema> Qrntz: odb is having much less work put into it than opam
<Qrntz> thelema, is development on it going to be continued though?
<thelema> benmachine: in general, odb shouldn't install libraries that are already installed, unless you're doing --force
<thelema> Qrntz: The real work in in curating the package archive; making sure things are tested and pushing bug fixes upstream
watermind has joined #ocaml
<thelema> especially since odb doesn't have a provision for patching (intentionally; the right solution is to fix upstream)
<Qrntz> ah, I see
<benmachine> thelema: right, but what I'm doing is trying to install netclient, which tries to install several libraries, and fails
<benmachine> thelema: and if it fails installing halfway through, I seemingly have to nuke everything and start again
<thelema> benmachine: which library fails?
<benmachine> thelema: I can't remember now, I've worked around it
<benmachine> thelema: possibly more than one of them failed
<benmachine> one tried to install stuff in /usr/bin, but I'm installing unprivileged so that doesn't work
<thelema> netclient's 'make install' is problematic for odb because it can partially succeed, meaning that it can leave the system in a state where the whole thing isn't installed, but it will fail at an early step because some part of it is already installed
<benmachine> at that point I gave up and started hacking files -_-
<benmachine> thelema: yes, that's what I've observed
<thelema> yes, auto-installing netclient is troublesome.
* thelema looks at what opam does
<thelema> ok, no support for netclient in opam
<thelema> so it looks like godi is the only thing that can auto-install netclient
<benmachine> oh gosh what is godi
<thelema> under perfect conditions, odb can, but as you noticed, it breaks easily
<benmachine> how many of these things are there ._.
<thelema> part of the reason I wrote odb is that godi was just *too* complex.
<thelema> (and I couldn't get it to work)
<benmachine> :)
<benmachine> odb is yours?
<benmachine> presumably just odb and not the whole oasis thing?
<thelema> just odb, not all of oasis
<thelema> but yes, it's mine. If you have improvements, please suggest.
Reventlov has joined #ocaml
<benmachine> oh, then I can't complain to you about how the oasis syntax is /so close/ to Cabal syntax but not quite it
Reventlov is now known as Guest8861
<benmachine> is ODB the thing that Jane Street are also working on?
<thelema> I take that back, opam can install ocamlnet.
<thelema> ah, they pass -bindir
<thelema> odb only supports --prefix
Guest8861 has quit [Client Quit]
<Qrntz> OPAM passes -bindir to every package
<thelema> Qrntz: really?
<Qrntz> at least every one from the ones I installed
<thelema> benmachine: no, odb isn't worked on by jane street at all
<Qrntz> it passes OPAM-specific directories to the configure scripts
Reventloff has joined #ocaml
<thelema> Qrntz: yes, like --prefix
<Qrntz> I find that very similar to rvm's behavior except rvm is way easier to confuse
<thelema> odb runs on heuristics instead of having a config file with patterned command lines for every application.
<thelema> design decision; maybe the wrong one.
<benmachine> good grief, finally compiled ocaml.org successfully
lolcathost has quit [Ping timeout: 272 seconds]
weie_ has quit [Quit: Leaving...]
PM has quit [Ping timeout: 246 seconds]
<watermind> is it possible to simulate SML's type annotations? in the sense that annotations must instatiations of the respective inferred type for it to typecheck?
<thelema> watermind: can you give an example?
<thelema> It sounds like phantom types
<thelema> or do you mean just declaring that functions have a given type?
<watermind> thelema: no no
<watermind> thelema: I mean this, let f (x : 'a ) : 'a = x + 1
<watermind> it typechecks, and it wouldn't in either SML nor haskell
<watermind> since int is not an instance of a
<thelema> ah, yes. Type annotations in ocaml are restrictions on the type of the function, i.e. they can only narrow
<flux> watermind, let f : 'a. 'a -> _ = x + 1
<thelema> iirc, what you want has just been added; being able to instist a function be polymorphic
<thelema> and flux has the syntax before I.
<flux> watermind, or with older ocaml: module Foo : sig val f : 'a -> 'b = struct let f x = x + 1 end
<flux> (and maybe include Foo afterwards)
<thelema> basically you have to introduce a universal quantification: "'a."
<thelema> otherwise ocaml will just unify your type with the inferred type
<watermind> flux: yes I know I can do these sorts of annotations... maybe I'm not being clear, I'd like all of those to NOT typecheck
<watermind> in OCaml, it typechecks because 'a->'b and 'a->'a all unifiy with int -> int,
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
<watermind> another approach is to require the annotations to be instances of the inferred type
<watermind> and 'a -> 'a is not an instance of int -> int
tac has joined #ocaml
<thelema> watermind: the "'a." addition will make it not typecheck
<watermind> thelema: flux: ohhhh
<thelema> it insisits that the resulting type be polymorphic
<watermind> flux: sorry I misunderstood you, thank you that is fantastic
<thelema> # let f : 'a . 'a -> 'a = fun x -> x + 1;;
<thelema> Error: This definition has type int -> int which is less general than 'a. 'a -> 'a
<thelema> also doing the same thing with modules will make it not typecheck, as module signatures aren't just unified
<watermind> thelema: so does OCaml support rank N polymorphism?
<watermind> let me try
<thelema> no, ocaml's type inference is decidable.
<watermind> right
Cyanure has quit [Remote host closed the connection]
tac has quit [Quit: Page closed]
lolcathost has joined #ocaml
gour has quit [Quit: WeeChat 0.3.8]
emmanuelux has quit [Ping timeout: 272 seconds]
jamii has quit [Ping timeout: 255 seconds]
emmanuelux has joined #ocaml
Yoric1 has quit [Ping timeout: 260 seconds]
RagingDave has joined #ocaml
tani has joined #ocaml
tane has quit [Ping timeout: 272 seconds]
<xavierm02> I'm about to letting lazy lists go and just waste tons of memory
<xavierm02> unless someone can tell me why the compiler cries
<xavierm02> I just can't understand
<xavierm02> By the way
<xavierm02> the point of this code is to transform
<xavierm02> [a0, ..., an] [b0, ..., bm] into [a0 b0, a1 b0,...,anb0,...a0b1...anb1,...a0bm...anbm]
<xavierm02> in other words
<xavierm02> take two list
<xavierm02> and list all the possible combinaisons of two elements
<xavierm02> oh wait
<xavierm02> I think I'm stupid
PM has joined #ocaml
<xavierm02> (fun x y -> LazyList.of_list [x;y])
<xavierm02> I am stupid
<xavierm02> nevermind
<watermind> can binary infix operators be used as first order values without lambdas?
<watermind> or is that the proper way to do it?
<xavierm02> (fun x y -> x + y)
<xavierm02> is equivalent to
<xavierm02> (+)
<xavierm02> from what I understand
<xavierm02> so yes and no
<xavierm02> I think
<watermind> I see thanks, I was looking at some code and they always used the former version
<xavierm02> you mean (+)?
<watermind> no the fun x y -> x + y
lasagna has joined #ocaml
<lasagna> Hi, I have a newbie question.
<lasagna> I type # for i = 1 to 10 do
<lasagna> # xl := i :: !xl;
<lasagna> # done;
<lasagna> # !xl;;
<lasagna> and it says error, unbound value x1
<lasagna> wait that should be x1
<lasagna> not xl
<lasagna> oh lol
<lasagna> the font on this thingy does not differentiate between l and 1
<xavierm02> watermind: I don't knwo of any reason to use it
<xavierm02> are you sure they actually can do it?
<xavierm02> and are the expression really that simple?
<xavierm02> you need thelema or wmeyer to answer
<xavierm02> I'm kind of a newbie too
<Qrntz> lasagna, did you declare the reference beforehand?
<xavierm02> or Qrntz
<xavierm02> Qrntz: any reason to use (fun x y -> x + y) over (+)?
<Qrntz> no, they're identical
<xavierm02> k, ty :)
<Qrntz> not that I know of, at least
<Qrntz> and ( + ) is commutative, so it would not matter in «(fun x y -> y + x)» vs «( + )» either
<Qrntz> I suppose someone considers the explicit lambda expression to be more readable
<lasagna> Qrntz I got it, I had typed xl when transcribing from the example, but it clearly was supposed to be x1
<lasagna> but in the interpreter x1 and xl look identical
<Qrntz> get a better font :-p
<Qrntz> I recommend Ubuntu Mono
<lasagna> yeah I'm just messing around with this thing online
<Qrntz> ah, I see
<lasagna> haven't been bothered to download it yet
<lasagna> but I need it for my job this summer
<lasagna> so I'm just dipping my toe in
<xavierm02> it's awesome you'll see
<Qrntz> I can clearly distinguish «l» and «1» in that console, still, check your system fonts
tani has quit [Quit: Verlassend]
<watermind> lasagna: job with ocaml? mind if I ask what kind of job it is?
darkf has joined #ocaml
<lasagna> wall street
<lasagna> :P
<watermind> that was my guess
<watermind> lasagna: mind if I ask you a quick question in pvt ?
xavierm02 has quit [Remote host closed the connection]
xavierm02 has joined #ocaml
xavierm02 has quit [Client Quit]
pkrnj has quit [Quit: Computer has gone to sleep.]
darkf_ has joined #ocaml
RagingDave has quit [Quit: Ex-Chat]
darkf has quit [Ping timeout: 246 seconds]
<lasagna> Printf.printf "the minimum of %d and $d is %d" a b (if a > b then b else a)
<lasagna> why doesn't this work :(
darkf_ is now known as darkf
Demitar has joined #ocaml
<lasagna> (a and b are of crouse defined already)
<Qrntz> lasagna, one of your «%»s is a «$»?
<Qrntz> it works if I change it to the proper character
<Qrntz> also, there's a predefined «min» function
<Qrntz> you could just use «min a b»