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
_habnabit has joined #ocaml
mjonsson has joined #ocaml
letrec has quit [Ping timeout: 245 seconds]
Tobu has quit [Ping timeout: 272 seconds]
oriba_ has joined #ocaml
oriba has quit [Ping timeout: 248 seconds]
oriba_ has quit [Quit: oriba_]
Tobu has joined #ocaml
iago has quit [Quit: Leaving]
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
emmanuelux has quit [Ping timeout: 264 seconds]
<Drakken> ssbr_ one hack would be to put the :b in an OPT after the a
Tobu has quit [Ping timeout: 272 seconds]
sivoais has quit [Quit: leaving]
sivoais has joined #ocaml
Tobu has joined #ocaml
Tobu has quit [Changing host]
Tobu has joined #ocaml
bjorkintosh has joined #ocaml
BiDOrD_ has joined #ocaml
BiDOrD has quit [Read error: Operation timed out]
mjonsson has quit [Remote host closed the connection]
bjorkintosh has quit [Read error: No route to host]
BiDOrD_ has quit [Remote host closed the connection]
BiDOrD has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
ulfdoz has quit [Quit: deprecated]
cyphase has quit [Ping timeout: 272 seconds]
ztfw` has joined #ocaml
pollux has quit [Ping timeout: 252 seconds]
yroeht has quit [Ping timeout: 252 seconds]
Tobu has quit [Ping timeout: 272 seconds]
ztfw has quit [Ping timeout: 252 seconds]
pollux has joined #ocaml
deavidsedice has quit [Quit: No Ping reply in 180 seconds.]
deavid has joined #ocaml
ssbr_ has quit [Ping timeout: 252 seconds]
snarkyboojum has quit [Quit: ...]
snarkyboojum has joined #ocaml
cyphase has joined #ocaml
yroeht has joined #ocaml
ssbr_ has joined #ocaml
ssbr_ is now known as Guest32568
struktured has quit [Ping timeout: 265 seconds]
wagle_ has joined #ocaml
wagle has quit [Quit: No Ping reply in 180 seconds.]
Tobu has joined #ocaml
snearch has joined #ocaml
testcocoon has quit [Ping timeout: 260 seconds]
testcocoon has joined #ocaml
ggherdov has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
testcocoon has joined #ocaml
gdsfh has joined #ocaml
<gdsfh> Hello. I'm trying to write an ocamlbuild plugin to compile OCaml + Coq projects. Here is an attempt: https://bitbucket.org/gds/ocamlbuild-coq-attempt , but the plugin doesn't work as expected: it fails to use rule "ocaml: mli -> cmi" to produce String0.cmi from the existing String0.mli file. If you run script "./run.sh" from repository, you'll see the problem. Any ideas?
mika1 has joined #ocaml
cago has joined #ocaml
ankit9 has joined #ocaml
tufisi has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
Submarine has quit [Ping timeout: 265 seconds]
djcoin has joined #ocaml
Cyanure has joined #ocaml
Cyanure has quit [Read error: Connection reset by peer]
ggherdov has quit [Quit: bye folks]
Cyanure has joined #ocaml
ftrvxmtrx has joined #ocaml
testcocoon has quit [Quit: Coyote finally caught me]
jlouis_ is now known as jlouis
snearch has quit [Quit: Verlassend]
thomasga has joined #ocaml
ankit9_ has joined #ocaml
ankit9 has quit [Read error: Connection reset by peer]
err404 has joined #ocaml
<Drakken> Is there a way to create module abbreviations in a .mli file without making them part of the signature?
Kakadu has joined #ocaml
<flux> well, you can open another module that does those abbreviations
mononofu has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
GPHemsley has quit [Ping timeout: 252 seconds]
ocp has joined #ocaml
jamii has joined #ocaml
GPHemsley has joined #ocaml
GPHemsley has quit [Changing host]
GPHemsley has joined #ocaml
hto has quit [Quit: Lost terminal]
hto has joined #ocaml
<Drakken> very good :)
emmanuelux has joined #ocaml
<Drakken> 2nd question: Is there a way to include a sig file in a .mlpack file?
avsm has joined #ocaml
Tobu has joined #ocaml
Tobu has quit [Changing host]
Tobu has joined #ocaml
rwmjones is now known as rwmjones_afk
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
rwmjones_afk is now known as rwmjones
ankit9_ has quit [Ping timeout: 260 seconds]
testcocoon has joined #ocaml
jamii has quit [Ping timeout: 248 seconds]
munga has joined #ocaml
<jaxtr> ahh it's a wonderful day
larhat has joined #ocaml
ankit9 has joined #ocaml
snearch has joined #ocaml
snearch has quit [Client Quit]
_andre has joined #ocaml
jamii has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
avsm has quit [Ping timeout: 260 seconds]
<hcarty> mrvn: There are a few logging modules that have camlp4 support. I think Lwt's logging module supports this (and requires that you use Lwt). Bolt does as well - http://forge.ocamlcore.org/projects/bolt/
ankit9 has quit [Ping timeout: 260 seconds]
<hcarty> mrvn: And in Batteries 2.x the main logging module has a functor which may give you the customization you want.
ocp has quit [Ping timeout: 260 seconds]
snearch has joined #ocaml
<hcarty> thelema: What do you think of a minimal or possibly comments-only packages file for odb installed by default with ocamlbrew, showing users how to add their own custom/non-oasis-db'd packages?
err404 has quit [Quit: Ex-Chat]
gnuvince has quit [Ping timeout: 250 seconds]
<hcarty> If a function never returns (for example, looping forever) it is better to leave its return type as 'a or force unit in the interface?
<thelema> hcarty: 'a, as exit
<Ptival> I'd say 'a too
<thelema> hcarty: I'm fine with a minimal packages file
<adrien> but even glib's mainloop returns :-)
<thelema> I agree about the requires-root packages
<hcarty> thelema, Ptival: Thanks
<hcarty> adrien: In this case the only way it's returning is if something raises an exception :-)
<hcarty> adrien: while true do ... or let rec loop f x = f x; loop f x
<hcarty> thelema: Ok. I'll see what they come back with on the bug report and go from there. I'll find time to come up with a first pass at a minimal file.
<adrien> hcarty: well, replacing "while true" with like "while !cond" could be nice too
<adrien> but it really depends on what you're doing
<hcarty> adrien: Fair point
munga has quit [Ping timeout: 245 seconds]
roconnor has joined #ocaml
<roconnor> Hi, when compiling coq-trunk from svn I get the following build error:
<roconnor> OCAMLOPT -o bin/coqide.byte
<roconnor> File "ide/coqide_main.ml4", line 1, characters 0-1:
<roconnor> Error: Error on dynamically loaded library: dlllablgtk2.so: dlllablgtk2.so: cannot open shared object file: No such file or directory
<roconnor> Can anyone tell me how to debug this error; i.e. how do I figure out where ocaml is looking for these dlls?
<roconnor> so I can point it to the right place
<thelema> roconnor: do you have a dlllablgtk2.so file and is its location in your ocaml/ld.conf file?
<roconnor> I have the file, but the compilation is sandboxed so it doesn't have access to any ocaml/ld.conf file.
<roconnor> I presumably need to set some compilation flags or some environment variables
<adrien> ocaml*opt* and .so?
<roconnor> adrien: I don't understand the question.
<adrien> iirc, opt-compiled executables don't use these dllfoo.so files
<adrien> and OCAMLOPT outputting a .byte file seems pretty weird
roha has joined #ocaml
<adrien> so, to me, it looks like there's something else going wrong
<thelema> OCAML_LD_LIBRARY_PATH=<path to dlllablgtk2.so>
<thelema> or maybe just CAML_LD_...
<adrien> the whole thing makes no sense; coq's build system looks fucked up
hto has quit [Quit: Lost terminal]
<roconnor> thelema: I'll give that a try
<adrien> complain to the coq devs
<roconnor> ok
<adrien> even if the env var stuff works, there's something else that's broken
<adrien> because no matter if it's naming something "OCAML*OPT*" for bytecode stuff, or calling native-code executables "*.byte", there's something wrong
gnuvince has joined #ocaml
<thelema> roconnor: adrien is right, something is fishy
<roconnor> hmm, the prebuilt-version from another machine was *not* building coqide ... maybe coqide is broken.
<roconnor> thelema: indeed, in coq8.3 it doesn't call OCAMLOPT, but rather COQMKTOP
<roconnor> okay, so defitely something to take up with the coq-devs
<adrien> "OCAMLOPT" could be anything, including a call to ocamlc of course, but it looks too big for the coq devs to never have seen it (or not seeing it now)
<roconnor> for now I can probably also disable building coqide
<roconnor> adrien: a quick glace makes it appear that OCAMLOPT is shorthand for either ocamlopt or ocamlopt.exe
avsm has joined #ocaml
avsm has quit [Client Quit]
err404 has joined #ocaml
<mrvn> .oO(and one would want ocamlopt.opt there too)
<roconnor> er could be I forget exactly what I read in the makefile
Kakadu has quit [Quit: Page closed]
snearch has quit [Quit: Verlassend]
munga has joined #ocaml
munga has quit [Remote host closed the connection]
roha has quit [Ping timeout: 272 seconds]
ftrvxmtrx has quit [Quit: Leaving]
tchell_ has quit [Ping timeout: 265 seconds]
roha has joined #ocaml
tchell has joined #ocaml
roha has quit [Read error: Operation timed out]
<thelema> module A provides type t, module B uses type t, module C includes A and tries to use functions from B that work on A.t, but these don't work because A.t <> C.t (the included copy of A.t)
<mrvn> thelema: rebind the type?
<thelema> mrvn: where?
<mrvn> when you include A
<mrvn> Although why isn't type C.t = A.t? Why is it abstract?
<thelema> I'm not sure. It may have to do with me using `module type of` to get the type of A so I can extend A.D
<mrvn> module A = struct type t let f : t -> t = function x -> x end
<mrvn> module B = struct let g : (A.t -> A.t) -> (A.t -> A.t) = function x -> x end
<mrvn> module C = struct include A let h () = B.g f end;;
<mrvn> Works fine here.
letrec has joined #ocaml
<thelema> must have to do with my `include (A:module type of A with ...)`
tonyg_ has quit [Quit: leaving]
<mrvn> thelema: I think that creates a new type.
larhat has quit [Quit: Leaving.]
<thelema> mrvn: well rebinding the new type to the old type seems to be working so far
<thelema> `and with type t := A.t`
<thelema> ... or not...
smerz has joined #ocaml
gdsfh has quit [Quit: Leaving.]
<thelema> ok, that was a bit ugly - fixed by re-declaring t in the signature (type t := A.t) *and* important that type as another type (so I could access its record fields)
cago has quit [Quit: Leaving.]
mika1 has quit [Quit: Leaving.]
mononofu has quit [Remote host closed the connection]
tonyg has joined #ocaml
ftrvxmtrx has joined #ocaml
<mfp> thelema: did you also try include (A:module type of A with type t = B.t and type ...) ?
<thelema> B doesn't include A, so it doesn't have a .t
mnabil has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
djcoin has quit [Quit: WeeChat 0.3.2]
dsheets has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
roconnor has quit [Remote host closed the connection]
letrec has quit [Ping timeout: 245 seconds]
ulfdoz has joined #ocaml
err404 has quit [Ping timeout: 264 seconds]
err404 has joined #ocaml
mfp has quit [Quit: Leaving]
Submarine_ has joined #ocaml
ocp has joined #ocaml
Submarine_ has quit [Read error: Connection reset by peer]
ulfdoz has quit [Quit: deprecated]
jamii has quit [Ping timeout: 265 seconds]
bjorkintosh has joined #ocaml
ulfdoz has joined #ocaml
mnabil has quit [Remote host closed the connection]
fraggle_ has quit [Read error: Connection reset by peer]
mfp has joined #ocaml
Kakadu has joined #ocaml
Guest32568 is now known as ssbr_
ssbr_ has quit [Changing host]
ssbr_ has joined #ocaml
wmeyer has joined #ocaml
<wmeyer> hi
<thelema> hi
<mrvn> wo?
eni has joined #ocaml
wmeyer` has joined #ocaml
wmeyer` has quit [Client Quit]
wmeyer` has joined #ocaml
wmeyer` has quit [Client Quit]
wmeyer has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
eni has quit [Ping timeout: 265 seconds]
roconnor has joined #ocaml
<roconnor> apparently that OCAMLOPT foo.byte stuff was simply a typo in the makefile ECHO statement while the real command was hidden :/
<thelema> heh
<roconnor> I'm working on using VERBOSE=1 to see what is actually being run
wmeyer has joined #ocaml
milosn has quit [Read error: No route to host]
milosn has joined #ocaml
ocp has left #ocaml []
fraggle_ has joined #ocaml
roconnor_ has joined #ocaml
roconnor has quit [Ping timeout: 252 seconds]
jarray52 has joined #ocaml
gnuvince has quit [Ping timeout: 260 seconds]
<jarray52> Does Ocaml support multithreading with shared memory between the threads?
Tobu has quit [Ping timeout: 272 seconds]
<mrvn> yes, just not 2 ocaml threads in parallel
fraggle_ has quit [Quit: -ENOBRAIN]
<jarray52> mrvn: unfortunate since that's a significant use case.
<mrvn> yes.
<mrvn> You can do multiple processes with shared memory if you work at it
<jarray52> mrvn: What's the overhead of multiple processes sharing memory. Let's assume that one process is attached to each core so that no overhead is incurred from process switches.
<mrvn> jarray52: 0
<jarray52> mrvn: hmm... that's pretty good. Are you saying that two processes can access memory as fast as threads can access memory?
<mrvn> jarray52: threads are just processes too. They just share more.
err404 has quit [Ping timeout: 264 seconds]
<mrvn> jarray52: on the hardware there is no difference between threads running on different cores or processes.
<jarray52> mrvn: processes have more information attached to them. And, doesn't the OS(Linux) typically associate memory to 1 and ony 1 process.
<jarray52> ?
<jarray52> mrvn: Otherwise, it would be a serious security issue, right?
<mrvn> not with shared memory
<jarray52> mrvn: Unless there is hardware support, the OS has to check if a process is authorized to write to that shared memory, right?
<mrvn> That is always checked by the hardware
<jarray52> hardware supports a multiple process check feature?
Xizor has joined #ocaml
<mrvn> nothing to do with multiple. The hardware simply has a memory management unit that translates from virtual addresses to physical addresses and does those checks.
<jarray52> mrvn: Is there an analogue of mutexes?
<mrvn> jarray52: IPC
<jarray52> mrvn: In order to lock the memory to one process until the lock is released?
<jarray52> IPC=Inter Process Communication?
<mrvn> yes
<thelema> jarray52: have a look at this: http://blog.camlcity.org/blog/multicore1.html
<mrvn> jarray52: Instead of shared memory you can also do message passing through a pipe or socket. That is often simpler if you only need to share little information at a time.
<mrvn> Plus that can run on different systems and not just cores of one system.
snearch has joined #ocaml
ftrvxmtrx_ has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 248 seconds]
<bjorkintosh> what's the replay debugger?
<bjorkintosh> as mentioned in this blogpost -> https://sites.google.com/site/steveyegge2/more-ocaml
<thelema> bjorkintosh: ocaml's debugger can go back in time
<jonafan> i'm guessing he's talking about ocaml's debugger, which allows you to rewind proram execution
<bjorkintosh> interesting.
<bjorkintosh> it's the standard ocamldebug?
<jonafan> yes
<jonafan> i have never used it
<bjorkintosh> why not? too gimicky?
<thelema> it's hard to use for single-stepping backwards
<jonafan> sadly the amount of actual ocaml code i get to write is pretty low
<jonafan> plus, ocaml is easy to get right
<bjorkintosh> has ocaml been used for any systems level apps?
<jonafan> the type system alone is a better debugger than any debugger i've used
<bjorkintosh> say, OSes and such? or is that frowned upon?
<thelema> bjorkintosh: no, noone has been silly enough to try that.
<Qrntz> mirage is the only one I'm aware of — an exokernel for the xen supervisor
<thelema> bjorkintosh: although ... yes, mirage is sort of close
<bjorkintosh> mirage relies on something else written in c doesn't it?
<thelema> bjorkintosh: yes, it's mostly a rewrite of the runtime to run directly on top of xen
<bjorkintosh> i wonder how efficient it is.
<Qrntz> I remember seeing a guide years ago on how to compile ocaml to linux kernel module code, but that's still largely pointless
<mrvn> Qrntz: Mirage is a ocaml runtime implemented as xen kernel. It's not exactly a kernel written in ocaml.
_andre has quit [Quit: leaving]
<flux> bjorkintosh, there should be some whitepapers on that topic
<Qrntz> mrvn, an «exokernel» is what they call it — I'm fine with that term
<mrvn> bjorkintosh: way more efficient than anything else. That is the point
<flux> apparently their software switch faired pretty well
larhat has joined #ocaml
<bjorkintosh> that's great.
<mrvn> I should check if could do an SDL compatible gfx API for mirage.
<mrvn> +I
<mrvn> xen has virtual framebuffers
Tobu has joined #ocaml
roha has joined #ocaml
eni has joined #ocaml
eni has quit [Quit: Leaving]
fraggle_ has joined #ocaml
thomasga has quit [Quit: Leaving.]
<thelema> Some people, when confronted with a problem, think, "I know, I'll use threads," and then two they hav erpoblesms.
<mrvn> thelema: key presses turning up in random order?
<mrvn> +like
<thelema> mrvn: printing being interleaved
<thelema> but you're right, that's not actually an interleaved output
<thelema> maybe memory corruption...
Kakadu has quit [Quit: Konversation terminated!]
err404 has joined #ocaml
<ssbr_> thelema: it could be interleaved :(
Cyanure has quit [Remote host closed the connection]
Cyanure has joined #ocaml
Cyanure has quit [Remote host closed the connection]
Cyanure has joined #ocaml
<Drakken> ssbr_ are you still working on that camlp4 prob?
<ssbr_> Drakken: ah, no, but my solution is butt ugly
<ssbr_> and I don't understand why I had to expand LIST1 x into x LIST0 x
<ssbr_> Drakken: http://bpaste.net/show/OeSrfppj50TghnzkN60U/ if you want to take a look
Cyanure has quit [Read error: Connection reset by peer]
Cyanure has joined #ocaml
<Drakken> ssbr_ why are you ignoring a in a:b?
<ssbr_> Drakken: Well, that's the name of a column in a relation, but apparently we never look at the names of columns in relations
<ssbr_> The grammar was like that when I found it. My job was to let you mix rules and relation definitions freely, without some arbitrary marker separating the two. (Even though they look very similar, up until you hit that colon)
<ssbr_> (the b part is the domain of the column)
<Drakken> Anyway, I was going to say you could define a parser that looks for an a and an optional :b, then look for a list of them, and then write your own code to sort things out.
snearch has quit [Quit: Verlassend]
<ssbr_> Could, but there's also the trailing "." and some issues with how to present the errors. I'm not sure that's better.
<ssbr_> I'd really like some way to define rules that aren't quite rules, so that camlp4 can still do its magic LL(1) factorization stuff across them
<ssbr_> but also so that my grammar is, er, readable
<Drakken> Can rules and relations appear arbitrarily in the same kinds of places?
<ssbr_> Drakken: IIRC the normal thing is that all the relations are defined first, and all the rules come afterward
<ssbr_> allowing mixing is optional
Cyanure has quit [Remote host closed the connection]
<Drakken> Alright. I was only talking about the stuff inside the parens, so the rulebody & periods are a separate issue.
<Drakken> It would factor the arguments of the two lines together, but it would be more permissive than your grammar, so you would have to write some code that checks to see if you have :b's in rules or if they're missing in relations.
<Drakken> ... and gets rid of the options either way.
<Drakken> The code you pasted is probably more compact overall.
cruxeternus has joined #ocaml
<ssbr_> Blargh.
<ssbr_> Drakken: for grammars like this, do you think I should use a different parsing tool next time?
<Drakken> you mean like yacc?
<ssbr_> Possibly. I don't know what people ordinarily use in the ocaml world :(
<Drakken> ocamllex/ocamlyacc is popular. I use Camlp4.PreCast because it already has ocaml syntax built in.
<pippijn> ssbr_: I use menhir a lot
<jarray52> What is the equivalent of open Batteries_uni;; for compiled code?
<pippijn> jarray52: does open Batteries_uni not work in compiled code?
roha has quit [Ping timeout: 250 seconds]
<ssbr_> OK, dank u. You guys have been a great help :)
<pippijn> ssbr_: nice error messages
<pippijn> (in menhir)
<jarray52> pippijn: Error: Unbound module Batteries_uni
<pippijn> jarray52: what are you using to build your software?
<pippijn> ocamlbuild?
<jarray52> pippijn: My .ocamlinit file has the line #require "batteries";;
<pippijn> oh
<pippijn> I don't know ocamllint
<jarray52> ocamlc
wagle_ is now known as wagle
<jarray52> .ocamlinit is read in line by line by the ocaml interpreter immediately after opening.
<pippijn> oh
<pippijn> init
<pippijn> okay
<pippijn> I always build with ocamlbuild
<wmeyer> I had similar problems with Camlp4, it's a very powerful tool for code generation and it's easy to extend Caml grammar. However, if you want more ambigous grammars and custom lexer not extending the language I would really advice on Menhir, Dypgen, parsing combinator library like Planck or one of the packrat implementations. Still however you can generate code through Camlp4, it's just you will not be able to extend existing O
<wmeyer> grammar.
thelema_ has joined #ocaml
<ssbr_> wmeyer: Message received. Thanks
<wmeyer> @ARM I had generated 200KLOC of ML using Menhir and Camlp4 and it was quite pleasant. From the other drawbacks I see is that the Camlp4 are not recursive, expand the rules until fixpoint is reached - this is how the Lisp macros work, and in this regard it's weaker paradigm.
<wmeyer> ssbr_: you are welcome.
<wmeyer> From other things I would like to see in Camlp4 is sort of type reflection. I want to know the environment during expansion.
<wmeyer> but that's just blue sky dreams :)
thelema has quit [Ping timeout: 265 seconds]
<wmeyer> You can also look at MetaOCaml - it's for completely different purpose, but I quite liked the idea when I was reading the paper.
<Drakken> Does menhir have an ocaml parser?
<wmeyer> I didn't see that, even if it has, Menhir is not extensible.
<wmeyer> Menhir however can produce functorised grammars, so this limitation is lifted.
Xizor has quit []
<wmeyer> It also allows to define macros, so also it's easier to reuse parts.
<wmeyer> Packrat parser are nice alternatives, they are fast, with unlimited lookahead, and lexerless.
<wmeyer> The last two, allows to mix several languages that the grammar is different without any quotations or separators.
<ssbr_> ehhhh... they're left-biased (or whatever the appropriate term is). I'm not convinced you don't accidentally run into problems
<ssbr_> (when composing PEGs)
<wmeyer> Not really, in fact in packrat parsing there exist an algoithm to parse grammars specified with left recursive rules.
<wmeyer> Other part of story is that you *can* always rewrite left recursive grammar.
<wmeyer> There is a paper and post saying that the algorithm does not work in every case however. It proves this, but I wasn't strong enough to follow this.
<jarray52> pippijn: Ocamlbuild worked. Thanks.
<wmeyer> @Drakken apart from that, Menhir can use ocamlyacc grammars so I suppose porting would be not a problem.
<wmeyer> But you can't beat lexless parsing in terms of extensibility.
<wmeyer> It's just much more fine grained.
<mrvn> wmeyer: we aren't playing quake here
roha has joined #ocaml
<wmeyer> mrvn: OK. I don't want to flood the channel.
jarray52 has left #ocaml []
<ssbr_> wmeyer: no, I mean packrat parsers don't backtrack on an ordered choice
<ssbr_> they pick the leftmost one that makes sense and run with it, even if a later choice might've made sense
<ssbr_> or maybe I don't
<ssbr_> anyway I've heard other people be critical of their ability to compose sanely
<wmeyer> Exactly, they are deterministic.
<mrvn> wmeyer: @nick doesn't mean the text goes only to nick.
<wmeyer> and that's a good thing.
Submarine has quit [Quit: Leaving]
<ssbr_> wmeyer: I always liked nondeterministic choice operators. As long as it's unambiguous, it's fine
<wmeyer> mrnv: Yes, I started using IRC and I had forggotten already how to do this -- in ERC does not seem to complete in either ways.
<wmeyer> ssbr_: It's a matter of taste, the difference feels like between static typing and dynamic typing with macros.
<wmeyer> However not having a lexer is adventorous :)
<wmeyer> You can always have the lexer in PEG if you want to
<wmeyer> It's just not mandatory
<wmeyer> (and perhaps a hurdle when you extend the grammar)
emmanuelux has quit [Remote host closed the connection]
<wmeyer> ssbr_: What kind of application you are working on?
err404 has quit [Remote host closed the connection]
<wmeyer> Right -- I am kind of tired, no staying overnight today, it's been kind of tiring week. night
<bjorkintosh> does ocaml have anything like sml's "it"?
<mrvn> which is what?
<bjorkintosh> in the repl, it represents the last value obtained.
<bjorkintosh> so if you did 2 + 2 ; you could then say it * 10 ;
<mrvn> not that i know.
<bjorkintosh> alright thanks.
<mrvn> just use let it = 2 * 2;;
emmanuelux has joined #ocaml
<mrvn> or write your own toplevel that implicitly binds the result to it
<bjorkintosh> aha.
<wmeyer> The problem would be a nested let.
<bjorkintosh> that sounds right now like a herculean task; i'm learning ocaml from some sml books i got my hands on.
<wmeyer> let it = let a = 1 in ?
<bjorkintosh> so i've barely scratched chapter 2.
<ssbr_> wmeyer: I'm extending a datalog interpreter
<wmeyer> ssbr_: Ouch I like prolog :)
<mrvn> wmeyer: you would check if the input starts with a let and if not you add one.
<wmeyer> ssbr_: Not that I understand how to program in Prolog, but it's veru useful
<ssbr_> wmeyer: datalog is a subset of prolog that can be evaluated ridiculously quickly
<wmeyer> ssbr_: Yes, I've heard about it. Did you try to implement WAM machine?
<ssbr_> Nope
<ssbr_> wmeyer: the executions style of datalog is different from prolog too
<ssbr_> in datalog you evaluate everything bottom-up rather than top-down
<wmeyer> ssbr_: So it has limited backtracking
<companion_cube> ssbr_: in which way are you extending it?
<ssbr_> wmeyer: well, "backtracking" doesn't make sense here. Everything is computed ahead of time
<ssbr_> every single query foo(X, Y). has its truth value known before you ask
<ssbr_> generally in the form of a logical circuit (BDD - binary decision diagram) that can quickly tell you the result
<ssbr_> companion_cube: right now I'm doing the easiest thing first -- adding universal quantification
<ssbr_> then I'm going to be adding syntactic sugar for sets of values
<companion_cube> wait, datalog is already universally quantified?
<ssbr_> wmeyer: oh, relatedly, there are no side effects in datalog
<ssbr_> companion_cube: universal quantification isn't very hard to add to datalog, no
<ssbr_> all the domains are finite, so it's pretty easy to check universal quantification.
<bjorkintosh> isn't datalog a 'pure' subset of prolog?
<wmeyer> ssbr_: Interesting
<ssbr_> bjorkintosh: sure, but it has more limitations than that. Pure, finite domains, stratified recursion/negation
<ssbr_> no functional terms
<wmeyer> ssbr_: Is not turing complete of course .. ?
<ssbr_> wmeyer: the usual interpretation of datalog is pure, where foo(A, B) is a query on a 2-ary relation foo, to check if it has the tuple (A, B)
<ssbr_> definitely not
<ssbr_> every datalog query terminates in finite time
<mrvn> so you can't even write while true do () done
<wmeyer> ssbr_: In general I like to degradate languages to be not turing complete :)
<bjorkintosh> interesting indeed.
<ssbr_> wmeyer: that would be silly
<ssbr_> lack of turing completeness is a phenomenally useful property
<wmeyer> yes
<wmeyer> ssbr_: That's what I just said.
<wmeyer> ssbr_: Degradate - means reduce to be not turing complete
<wmeyer> ssbr_: Maybe it was not clear
<ssbr_> ah. I thought you meant "degrade" <_<
<wmeyer> ssbr_: I think exactlu the same
<wmeyer> ssbr_: This is one of the main criteria of good DSLs
<pippijn> lack of turing completeness is really cool, but it's best wrapped in a sublanguage (maybe with effect typing)
<ssbr_> pippijn: well, datalog is used as a DSL in a similar fashion as, say, regular expressions
<ssbr_> or SQL
<pippijn> that, or it should be very easy to embed in other languages
<pippijn> like regex and sql
<wmeyer> ssbr_: Can Datalog is powerful enough to implement Hindley Milner style inference?
<wmeyer> Sorry s/Can/Is/
<ssbr_> wmeyer: I don't know, but I would really _hope_ so
<pippijn> s/bad grammar/good grammar
<wmeyer> :)
<ssbr_> wmeyer: seeing as program analysis is the main use case that I've encountered (and the reason this implementation exists)
<wmeyer> ssbr_: If it's just enough to type simple bare ML expressions then it it's already damn useful!
<ssbr_> wmeyer: the only use I've actually seen datalog applied to was pointer analysis
<ssbr_> which I'm told is hard
<ssbr_> but I have very little exposure to static analysis problems
<ssbr_> (I do that after I extend datalog)
<ssbr_> (woo the life of an undergrad)
<wmeyer> ssbr_: You mean propagating properties of programs through Datalog terms?
<ssbr_> wmeyer: I think that's right
<ssbr_> you can look at some papers about it probably
<ssbr_> and yes, "bddbddb" is the actual name of that datalog implementation.
<wmeyer> ssbr_: thanks, I might look at it
<wmeyer> ssbr_: Good luck with it, ML is the right choice here. Are you sharing this somewhere?
<ssbr_> wmeyer: unfortunately, I don't believe this implementation is open source :(
<ssbr_> in fact I don't think it even has a name
<wmeyer> ssbr_: I can see what you mean :)
<ssbr_> wmeyer: but bddbddb is similar in nature, I think
<ssbr_> as much as ML might be the right choice, previous programmers here have not been very nice: http://bpaste.net/show/RsYA2lAM2SrU16bN4FD2/
<ssbr_> like, it's not just me, right? that's totally what.
<wmeyer> ssbr_: Not pleasant to see - but not terrible either.
<pippijn> it's not totally what
<pippijn> but this is not how I would write it
<ssbr_> well, I'm not very good at ocaml, and I reached there after going like 5 steps in to see what is going on
<ssbr_> I've forgotten what the original thing I was trying to understand was
<ssbr_> I wish the author at least left comments
<pippijn> you could rewrite it a little
<pippijn> to make it clearer
gnuvince has joined #ocaml
* ssbr_ is presently reading the definition of construct_equalities_disjoint_set
<wmeyer> pippijn: I share the same opinion, but if you wrap into nice objects then .... :) Neh, I agree, could be better.
<pippijn> objects?
<wmeyer> ssbr_: Yes, OCaml stands for Objective Caml.
<pippijn> is_int, int_of_string, ...
<wmeyer> pippijn: That was kind ironic remark about how much worse you can write it in OCaml.
<pippijn> ah, ok
<pippijn> yes, you can always make things worse
<wmeyer> ssbr_: Happy lecture
<ssbr_> yay one-liners
<ssbr_> "(fun (x,y) -> ignore(DS.union (try DS.find ds (x) with Not_found -> failwith "renaming.ml 57a") (try DS.find ds (y) with Not_found -> failwith "renaming.ml 57"))) eqs;"
<pippijn> that's one line?
<ssbr_> Yes.
<pippijn> that's not nice
<_habnabit> looks like two lines here
<ssbr_> Well. Not anymore.
<pippijn> 57a 57, heh
<ssbr_> oh yeah, did I mention it isn't on line 57
<pippijn> maybe ocaml is missing a __LINE__
<wmeyer> ssbr_: Add some beer and it will be even worse (or better).
<ssbr_> it's on line 69
<wmeyer> ssbr_: ;)
<ssbr_> now it's on line 7x and 7y
<ssbr_> What should I replace those error messages with?
<wmeyer> ssbr_: I will not paste any of the C++ library code.
<pippijn> ssbr_: try UUIDs
<pippijn> scott mcpeak does that
<ssbr_> Well I was thinking the name of the function + some indication of the actual problem
<mrvn> ssbr_: just remove them
<ssbr_> but what's a usual approach?
<wmeyer> ssbr_: It's more useful than failwith ("renaming.ml" ^ string_of_int (Rand.int ()))
<ssbr_> -____-
<mrvn> if you want file/line infos then just assert false
<mrvn> doesn't seem sane there though
<pippijn> I don't understand why it's raising Failure, anyway
roha has quit [Ping timeout: 240 seconds]
<pippijn> it could just let the Not_found propagate up
<ssbr_> pippijn: I guess to give a line number?
<pippijn> Printexc
<pippijn> gives you line numbers in a stack trace
<pippijn> line and column numbers and file names
<wmeyer> ssbr_: You can have many solutions here, as it's been noted. Probably the best is to factor out and separate this exceptional behaviors into some function. And yes you can use exception, but you can use monads too if you feel so (I would stay here with exceptions)
<wmeyer> Here I an see a pattern you look up in enviroment, x and y so you can declare an exception that indiciates on which side it happened (left of right)
<wmeyer> or you can separate a pass
<pippijn> monads for exception handling..
<pippijn> I've thought about that, but it seems to clutter the code
<wmeyer> that deals with undefined variables
<pippijn> and it's probably a lot slower
<wmeyer> not always, but yes - in this case it clutters
<wmeyer> and not needed
<wmeyer> you can have separate pass before, to check if you have any undefined symbols, and later trust your find routines.
<wmeyer> Using failwith is not a very good idea, if you want to catch the exception later. However, as the first cut you should be not worried - because you can refactor later - having a strong typing is another reason to not be worried
<pippijn> with dependent types, you could first prove that there are no undefined symbols :)
<ssbr_> wmeyer: I'm pretty sure that the failure would only happen in the case of an error in the algorithm
<ssbr_> and that those are basically assertions
<pippijn> I'd just not catch the Not_found, I think
<ssbr_> pippijn: are there any dependently typed ML dialects other than ATS and its predecessor (Dependent ML) ?
<wmeyer> ssbr_: hm, then just use find alone
<pippijn> ssbr_: I don't think so, and I don't think ATS is expressive enough to contain that kind of proofs
<wmeyer> ssbr_: Coq's Gallina is pretty much close to ML
<pippijn> ssbr_: there is Ur