companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.05.0 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.05/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
SomeDamnBody has joined #ocaml
keep_learning has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<SomeDamnBody> I have a graph that I expect to be a tree, but that may not be. I want to detect links between nodes at any point.
<SomeDamnBody> How might I build an algorithm that does this?
infinity0 has quit [Ping timeout: 240 seconds]
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
infinity0 has joined #ocaml
<Drup> SomeDamnBody: You want to know if there is a path between two nodes ?
sh0t has quit [Ping timeout: 248 seconds]
<SomeDamnBody> Well, a cross edge I think is the right term.
<SomeDamnBody> I want to detect the cross edge.
<Drup> ah, you want to detect if a graph is a DAG or a tree
<Drup> (or cyclic)
<SomeDamnBody> I'm not concerned if there is cycles from childs to parent. But it must be a tree.
<SomeDamnBody> I'm using ocamlgraph. It would be fantastic if I could use some library function to get this for free. lol
<Drup> yeah, the algorithm is in ocamlgraph
<SomeDamnBody> So, if A -> B, B -> C, and A -> C, and I start from A, how can I get the edge B -> C returned?
<SomeDamnBody> what's the algorithm named?
dhil has quit [Ping timeout: 260 seconds]
<Drup> I don't remember, give me a sec
<Drup> well, I mean, you could just look for cycles in the undirected version of the graph, that's equivalent
<Drup> I'm not sure it has a name, really, just doing a BFS will give you what you need.
<SomeDamnBody> Well, I need to detect them. So, and bfs may allow me to skip cross edges, but I have to be able to remove them.
<SomeDamnBody> There are other cycles though, as in from parent to leaf. So, if I look for cycles, then I might end up with more than I meant, because if I remove the cycles that are from parent to child, then this could cause a problem, since there are those that should change.
<Drup> You are not very clear about what you want precisely enough, but I believe this should give you what you want
<SomeDamnBody> Well a minimum spanning tree may end up giving me something like a cross edge remaining, but some other edge dropped...
cranmax has quit [Quit: Connection closed for inactivity]
<SomeDamnBody> Like, for example: I have A -> B, A -> C and that's the acyclic good part.
<SomeDamnBody> It may be that B -> A
<SomeDamnBody> That's fine. In fact, I want to preserve that. But it is not ok if B -> C
<Drup> No, a minimum spanning tree gives a tree. By definition, a tree does not have cross edges
<SomeDamnBody> Oh ok.
<Drup> I believe you are confusing trees and DAGs
<SomeDamnBody> Oh! You're right!
<SomeDamnBody> That's great.
<Drup> If you want to extract a DAG out of a graph, you can run a DFS and kill all back edges
<SomeDamnBody> Kruskal's output may give me a minimum spanning tree, but not tell me which edge was dropped. As in, I still need an edge list at the end, where I can get B -> C, the violator
<Drup> Well, I mean, that's not difficult, you have two sets of edges, you take the diff ...
<SomeDamnBody> I was thinking about that, but the back edge would get reported.
<Drup> (or, as I said, run a DFS)
<SomeDamnBody> From B -> A
<SomeDamnBody> I'm trying to build that now with a DFS. I'm just working on it a bit, because the graph is a bit fuzzy in it's structure. I have to be really careful to protect true positives and only remove false positives when I am really sure
SomeDamnBody has quit [Remote host closed the connection]
vgrocha has quit [Ping timeout: 240 seconds]
<Drup> (Since I got curious, the problem of finding a minimum/maximal spanning DAG is called https://en.wikipedia.org/wiki/Feedback_arc_set )
<Drup> (One thing that is particularly not enjoyable about graph theory is their completely inconsistent naming of problems)
zpe has joined #ocaml
silver has quit [Read error: Connection reset by peer]
zpe has quit [Ping timeout: 240 seconds]
copy_ has quit [Quit: Connection closed for inactivity]
LACampbell has quit [Quit: WeeChat 1.5]
_whitelogger has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 268 seconds]
mfp__ has quit [Ping timeout: 240 seconds]
Soni has quit [Ping timeout: 260 seconds]
ansiwen has quit [Read error: Connection reset by peer]
Soni has joined #ocaml
ansiwen has joined #ocaml
ygrek has joined #ocaml
jlam__ has joined #ocaml
jlam has quit [Ping timeout: 240 seconds]
govg has joined #ocaml
zpe has joined #ocaml
mengu has quit [Remote host closed the connection]
zpe has quit [Ping timeout: 240 seconds]
ziyourenxiang has joined #ocaml
jmiven has quit [Quit: co'o]
jmiven has joined #ocaml
gasche has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
MercurialAlchemi has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 240 seconds]
_whitelogger has joined #ocaml
bombastus has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
samrat_ has joined #ocaml
samrat_ has quit [Ping timeout: 240 seconds]
maxton has joined #ocaml
maxton_ has quit [Ping timeout: 246 seconds]
bombastus has quit [Ping timeout: 246 seconds]
zwild has joined #ocaml
bombastus has joined #ocaml
bombastus has quit [Remote host closed the connection]
malc_ has quit [Quit: ERC (IRC client for Emacs 25.0.50.2)]
zwild has quit [Read error: Connection reset by peer]
olibjerd has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
maxton has quit [Read error: Connection reset by peer]
maxton has joined #ocaml
zwild has joined #ocaml
ivanacostarubio has quit [Ping timeout: 240 seconds]
FreeBirdLjj has joined #ocaml
samrat_ has joined #ocaml
samrat_ has quit [Ping timeout: 260 seconds]
slash^ has joined #ocaml
<rgrinberg> Drup: what's the situation like with archlinux + opam? does the solver work by default?
SomeDamnBody has joined #ocaml
samrat_ has joined #ocaml
Soni has quit [Ping timeout: 240 seconds]
Soni has joined #ocaml
Merv_ has quit []
<adrien> rgrinberg: afaiu, it does now
<adrien> but it's only been a week (like since friday 8 days ago)
<rgrinberg> adrien: ok great. finally...
<adrien> well, try by yourself and report: I'm not an arch user myself, I only have some around me
argent_smith has joined #ocaml
Soni has quit [Ping timeout: 248 seconds]
Soni has joined #ocaml
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
jnavila has joined #ocaml
zpe_ has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
slash^ has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
<orbifx[m]> rgrinberg: I've not noticed anything on my arch
zwild has quit [Remote host closed the connection]
samrat_ has quit [Ping timeout: 260 seconds]
zpe_ has quit [Remote host closed the connection]
zpe has joined #ocaml
SomeDamnBody has quit [Remote host closed the connection]
zpe has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 240 seconds]
mengu has joined #ocaml
jnavila has quit [Ping timeout: 240 seconds]
mfp__ has joined #ocaml
dakk has joined #ocaml
mengu has quit [Remote host closed the connection]
average has quit [Ping timeout: 258 seconds]
average has joined #ocaml
kolko has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 248 seconds]
silver has joined #ocaml
sz0 has quit [Quit: Connection closed for inactivity]
jnavila has joined #ocaml
jnavila has quit [Remote host closed the connection]
olibjerd has quit [Quit: olibjerd]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
Soni has quit [Ping timeout: 240 seconds]
silver has quit [Read error: Connection reset by peer]
argent_smith has quit [Quit: Leaving.]
Soni has joined #ocaml
jlam has joined #ocaml
keep_learning has joined #ocaml
jlam__ has quit [Ping timeout: 248 seconds]
jlam__ has joined #ocaml
jlam has quit [Ping timeout: 276 seconds]
Soni has quit [Ping timeout: 255 seconds]
argent_smith has joined #ocaml
jlam has joined #ocaml
jlam__ has quit [Ping timeout: 248 seconds]
maxton_ has joined #ocaml
maxton has quit [Ping timeout: 255 seconds]
olibjerd has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
sh0t has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
samrat_ has joined #ocaml
samrat_ has quit [Ping timeout: 260 seconds]
cranmax has joined #ocaml
dhil has joined #ocaml
Soni has joined #ocaml
mrvn has quit [Ping timeout: 240 seconds]
dejanr has quit [Read error: No route to host]
dejanr has joined #ocaml
mrvn has joined #ocaml
FreeBirdLjj has joined #ocaml
vgrocha has joined #ocaml
zpe has joined #ocaml
sh0t has quit [Remote host closed the connection]
zpe has quit [Ping timeout: 260 seconds]
samrat_ has joined #ocaml
nbrr has joined #ocaml
<spacebat_> I'm trying to get started with batteries, I've used opam to switch to ocaml 4.04.2, opam install batteries seemed to work fine
<spacebat_> ocamlfind batteries/ocaml gives me a repl with Batteries
<spacebat_> but open Batteries doesn't work in a simple .ml file - ocamlopt says Error: Unbound module Batteries
<spacebat_> Same thing with Batteries_uni
<spacebat_> I've tried putting #require "batteries" at the top of the file but that doesn't work either
<spacebat_> what am I missing - how do I make an installed library available for use?
sam___ has joined #ocaml
<octachron> spacebat_, for compiling a file, a first step would be: "ocamlfind ocamlopt -package batteries a.ml"
<octachron> a second step would be to use a build system, "ocamlbuild" works for small project (completed by oasis for bigger ones); similarly, "jbuilder" is becoming quite popular
<octachron> (and there are other options available)
sam___ has quit [Ping timeout: 240 seconds]
<spacebat_> ok, I now get Error: No implementations provided for the following modules: Batteries referenced from wat.cmx
<def`> t
<spacebat_> I see that a builder would make sense, but I'm trying to understand the most basic steps right now
<spacebat_> one I can actually compile something by making the library available to the compiler, the next challenge is to make merlin see it also
govg has quit [Quit: leaving]
<spacebat_> because neither can see anything that I install
<octachron> spacebat_, for merlin, you need to add "PKG library1_name,library2_name"
<spacebat_> wat.ml is in $HOME and the content of ~/.merlin is one line PKG batteries
<spacebat_> I've restarted merlin but it can't resolve Batteries
<spacebat_> so it feels like I have something deeply or fundamentally wrong because none of the advice I've found seems to work
<octachron> spacebat_, for the compilation step, you need "-linkpkg"
<def`> spacebat_: what is your editor, os, and what tells you it can't resolve Batteries?
<spacebat_> I'm trying this with opam installed via homebrew on OSX and installed from the opam website for debian
<def`> (focusing on merlin part :P)
<spacebat_> oh, now merlin is working, not sure what I changed, but that's a relief
<spacebat_> it was highlighting anything do to with Batteries in red
<def`> ah good :)
<spacebat_> I just tried adding -linkpkg to the command line and it was successful but I don't know what it did
<spacebat_> what would be the output of a successful invokation of ocamlfind ocamlopt -package batteries -linkpkg wat.ml
<spacebat_> I'm looking for an executable that I can run
zpe has joined #ocaml
ryanartecona has joined #ocaml
<octachron> probably "a.out" aka the default executable name
<octachron> you may want to precise the output name with "-o executable_name"
<spacebat_> ah true, didn't expect that c-like behaviour
<spacebat_> thanks so much, I've got it working from the command line and have merlin support working in emacs
zpe has quit [Ping timeout: 240 seconds]
<octachron> spacebat_, note also if your aim is to understand OCaml compilation process, it would be simpler to try first to compile a set of files with no external dependencies
<octachron> like this you would only have to understand ocamlopt behavior not ocamlopt + ocamlfind (ocamlfind is mostly useful here to locate the right files for external dependencies)
<spacebat_> one more thing - a few months back I tried accessing environment variables in an ocaml repl and distinctly remember the function returning an option type
<spacebat_> but batteries and core seem to throw an exception if the variable is not found in the environment
<spacebat_> I guess I'm asking which is more idiomatic and which you'd prefer
<spacebat_> exceptions strike me as going against the grain of the type support in ocaml but of course there's a lot I don't know
<octachron> spacebat_, this sounds strange for core, generally only "exn" suffixed functions throw an exception
<octachron> otherwise, I would say that for accessing environment, an option sounds better, because the existence of the variable is uncertain
<spacebat_> ah, my mistake again - Core.Sys.getenv is string -> string option
<spacebat_> and you're right, there's an _exn alternative
<octachron> i.e exception for exceptional behaviors (or careful control flow sometimes), and option in uncertain times
<spacebat_> thanks again, this is clearer now
zpe has joined #ocaml
dhil has quit [Ping timeout: 246 seconds]
lostman has joined #ocaml
<lostman> is it possible to use jbuilder to build a library that binds to some c++ code? need to build the c++ code (including a c-style wrapper using extern c) and then bindings in ocaml
slack has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
copy_ has joined #ocaml
<rgrinberg> lostman: it should be possible. but i'm not sure how well it's documented. If you want an example, check out jst's re2 bindings i suppose
<lostman> rgrinberg: thanks. can I make it work with ctypes? I've been trying to figure it out today but didn't get too far
<rgrinberg> The answer is similar. It should be possible but not pretty or well documented
<rgrinberg> Study async_ssl to see how it's done
ryanartecona has joined #ocaml
spew has joined #ocaml
ziyourenxiang has quit [Ping timeout: 276 seconds]
sam__ has joined #ocaml
pyx has joined #ocaml
pyx has quit [Quit: WeeChat 1.9]
cranmax has quit [Quit: Connection closed for inactivity]
spew has quit [Ping timeout: 246 seconds]
ryanartecona has quit [Quit: ryanartecona]
cranmax has joined #ocaml
dhil has joined #ocaml
MercurialAlchemi has joined #ocaml
nbrr has quit [Ping timeout: 260 seconds]
maxton_ has quit [Read error: Connection reset by peer]
maxton_ has joined #ocaml
spew has joined #ocaml
jlam__ has joined #ocaml
jlam has quit [Ping timeout: 246 seconds]
sam__ has quit [Ping timeout: 240 seconds]
sam__ has joined #ocaml
sam__ has quit [Ping timeout: 260 seconds]
mrvn has quit [Ping timeout: 260 seconds]
mrvn has joined #ocaml
NJBS has joined #ocaml
NJBS has quit [Changing host]
NJBS has joined #ocaml
nahra`` has joined #ocaml
samrat_ has quit [Ping timeout: 260 seconds]
nahra` has quit [Ping timeout: 240 seconds]
reanguiano has joined #ocaml
ryanartecona has joined #ocaml
SpiceGuid has joined #ocaml
cranmax has quit [Quit: Connection closed for inactivity]
ryanartecona has quit [Quit: ryanartecona]
spew has quit [Ping timeout: 240 seconds]
NJBS has quit [Quit: Catastrophic failure.]
MercurialAlchemi has quit [Ping timeout: 248 seconds]
the_minerva has quit [Remote host closed the connection]
slash^ has quit [Read error: Connection reset by peer]
spew has joined #ocaml
pierpa has joined #ocaml
vgrocha has quit [Ping timeout: 240 seconds]
spew has quit [Ping timeout: 240 seconds]
jlam has joined #ocaml
jlam__ has quit [Ping timeout: 268 seconds]
MercurialAlchemi has joined #ocaml
sh0t has joined #ocaml
dhil has quit [Ping timeout: 240 seconds]
Enamex_ has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 260 seconds]
silver has joined #ocaml
Enamex_ is now known as change
Enamex has quit [Disconnected by services]
change is now known as Enamex
kakadu has joined #ocaml
zpe has joined #ocaml
SpiceGuid has quit [Quit: ChatZilla 0.9.92 [SeaMonkey 2.46/20161213183751]]
zpe has quit [Ping timeout: 258 seconds]
Enamex has quit [Quit: bye o/]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
ygrek has joined #ocaml
jlam__ has joined #ocaml
jlam has quit [Ping timeout: 260 seconds]
jlam has joined #ocaml
jlam__ has quit [Ping timeout: 248 seconds]
sh0t has quit [Remote host closed the connection]
argent_smith has quit [Quit: Leaving.]
olibjerd has quit [Quit: olibjerd]
mengu has joined #ocaml
infinity0_ has joined #ocaml
infinity0 is now known as Guest74600
infinity0_ has joined #ocaml
infinity0_ has quit [Changing host]
Guest74600 has quit [Killed (leguin.freenode.net (Nickname regained by services))]
infinity0_ is now known as infinity0
jlam has quit [Read error: Connection reset by peer]
jlam has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
mengu_ has joined #ocaml
mengu has quit [Ping timeout: 240 seconds]
mengu has joined #ocaml
ryanartecona has joined #ocaml
mengu_ has quit [Ping timeout: 240 seconds]
dakk has quit [Ping timeout: 268 seconds]
sh0t has joined #ocaml
sz0 has joined #ocaml
LACampbell has joined #ocaml
<LACampbell> hello. For the second time now, I've been able to `opam search` a package, but when I opam install a package it tells me "your request can't be satisfied: - No package matches $name". is there anything I should check?
<LACampbell> I've done opam update and opam remote. I just switched to 4.05 recently
sam__ has joined #ocaml
<dxtr> How would I write my match case to get a variable for both the items in a tuple and the tuple itself?
<dxtr> Said tuple is in a list too
kakadu_ has joined #ocaml
<LACampbell> dxtr: why not just nest matches?
<octachron> dxtr, "match l with (x,y as tuple) :: q -> …"
sam__ has quit [Ping timeout: 240 seconds]
<octachron> LACampbell, you could check "opam info $name"
<LACampbell> octachron: and install the deps manually? worth a shot
kakadu has quit [Ping timeout: 260 seconds]
<LACampbell> oh look at that, I can't install ppx_deriving - but it gives me a reason
<octachron> LACampbell, ah yes, ppx_deriving is not yet available with 4.05
<LACampbell> well that solves that mystery.
<LACampbell> thanks octachron
spew has joined #ocaml
bsima has joined #ocaml
mengu has quit [Quit: Leaving...]
kakadu_ has quit [Remote host closed the connection]
ryanartecona has quit [Quit: ryanartecona]
ziyourenxiang has joined #ocaml