rgrinberg has quit [Read error: Connection reset by peer]
rgrinberg has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
brettgilio has quit [Ping timeout: 260 seconds]
kaph_ has joined #ocaml
kaph_ has quit [Remote host closed the connection]
kaph has quit [Ping timeout: 256 seconds]
Tuplanolla has quit [Quit: Leaving.]
rgrinberg has quit [Read error: Connection reset by peer]
rgrinberg has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
perrierjouet has joined #ocaml
bobo_ has joined #ocaml
spip has quit [Ping timeout: 256 seconds]
perrierjouet has quit [Ping timeout: 256 seconds]
perrierjouet has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
waleee has quit [Ping timeout: 252 seconds]
rgrinberg has joined #ocaml
perrierjouet has quit [Remote host closed the connection]
perrierjouet has joined #ocaml
perrierjouet has quit [Ping timeout: 256 seconds]
xiongxin has joined #ocaml
ns12 has quit [Ping timeout: 256 seconds]
Everything has quit [Quit: leaving]
gravicappa has joined #ocaml
perrierjouet has joined #ocaml
kaph has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
rgrinberg has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
rgrinberg has joined #ocaml
xiongxin1 has joined #ocaml
xiongxin has quit [Ping timeout: 240 seconds]
xiongxin1 is now known as xiongxin
bartholin has joined #ocaml
gopcode has joined #ocaml
vsiles has joined #ocaml
jlrnick has joined #ocaml
bartholin has quit [Quit: Leaving]
jlrnick has quit [Remote host closed the connection]
jlrnick has joined #ocaml
reynir1 has joined #ocaml
szkl has joined #ocaml
reynir1 is now known as reynir
jlrnick has quit [Read error: Connection reset by peer]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ns12 has joined #ocaml
mro has joined #ocaml
Techcable has quit [Remote host closed the connection]
Techcable has joined #ocaml
Techcable has quit [Remote host closed the connection]
Techcable has joined #ocaml
Techcable has quit [Remote host closed the connection]
Techcable has joined #ocaml
Techcable has quit [Remote host closed the connection]
Techcable has joined #ocaml
Techcable has quit [Remote host closed the connection]
Techcable has joined #ocaml
perrierjouet has quit [Remote host closed the connection]
perrierjouet has joined #ocaml
mro has quit [Quit: Leaving...]
Everything has joined #ocaml
perrierjouet has quit [Quit: WeeChat 3.4]
<d_bot>
<RIO> Shortest path with DFS in ocaml
<d_bot>
<RIO> I have this function which returns a path between two nodes of a graph. I want to modify this function to have the shortest path between these two nodes
<d_bot>
<RIO> (* functions *)
<d_bot>
<RIO> let rec path_aux rev_path v dst path_list g =
<d_bot>
<RIO> if v = dst then Some(List.rev (dst::rev_path))
<d_bot>
<RIO> else
<d_bot>
<RIO> let v_succs = G.succs v g in
<d_bot>
<RIO> let sol =
<d_bot>
<RIO> G.NodeSet.fold
<d_bot>
<RIO> (fun v' acc ->
<d_bot>
<RIO> if List.mem v' (v::rev_path)
<d_bot>
<RIO> then acc
<d_bot>
<RIO> else
<d_bot>
<RIO> match acc with
<d_bot>
<RIO> |Some _ -> acc
<d_bot>
<RIO> |None -> path_aux (v::rev_path) v' dst g
<d_bot>
<RIO> )
<d_bot>
<RIO> v_succs
<d_bot>
<RIO> None
<d_bot>
<RIO> in
<d_bot>
<RIO> sol
<d_bot>
<RIO>
<d_bot>
<RIO> let dfs_algo src dst g =
<d_bot>
<RIO> match path_aux [] src dst g with
<d_bot>
<RIO> |Some path -> path
<d_bot>
<RIO> |None -> raise NotFound
<d_bot>
<leviroth> Please don’t paste blocks of code in this channel. Messages are forwarded to IRC, where code blocks are hard to read.
<olle>
:(
<olle>
Actually, indentation is correct in my IRC client
<vsiles>
good here too but I find it hard to follow a code discussion like this once the code is past my screen height (irc/discord both)
<d_bot>
<glennsl> Also, please don't immediately cross-post questions (in this case also on Stack Overflow). Have some respect for the free time donated by people who might try to help you, so they don't spend a lot of time trying to explain something that you've already had explained elsewhere.
<olle>
Or just link to the SO thread in case you get no answer
<d_bot>
<glennsl> It might be good to give it more than 10 mins though...
<olle>
:)
<olle>
Also, sounds like a school assignment...?
<d_bot>
<glennsl> and with very little effort to solve it themselves
<d_bot>
<glennsl> it would be good to be more specific, point to a specific algorithm, show some attempt at implementing it. any errors that causes etc.
<olle>
Or just copy-paste from code rosetta page
<olle>
Dijkstra algorithm for shortest path in graph?
perrierjouet has joined #ocaml
reynir has quit [Quit: WeeChat 2.3]
sagax has joined #ocaml
Everything has quit [Quit: leaving]
infinity0 has joined #ocaml
hornhack has joined #ocaml
hackinghorn has quit [Ping timeout: 256 seconds]
xiongxin has quit [Remote host closed the connection]
gravicappa has quit [Ping timeout: 256 seconds]
<d_bot>
<Et7f3> someone needed the same thing so it seem.
<d_bot>
<Et7f3> (does the bridge handle reply ?)
<d_bot>
<Valentin> I'm not sure to understand the `SIGSEV` signal in module `Sys`. From multiple links I've read code `11` refers to `SIGSEV` (in Linux) but in the OCaml code I read:
<d_bot>
<Valentin> ```ocaml
<d_bot>
<Valentin> let sigsegv = -10
<d_bot>
<Valentin> ```
<d_bot>
<Valentin> Why are these two different? Should I trust the OCaml code?
spip has joined #ocaml
bobo_ has quit [Ping timeout: 256 seconds]
jlrnick has joined #ocaml
<d_bot>
<VPhantom> Hm, based on `man 7 signal` SIGSEGV is indeed 11. 🤔
<d_bot>
<VPhantom> 10 is one of the 3 values for `SIGUSR1`
<d_bot>
<VPhantom> Not sure why that value's negative, but it could be related to the offset?
<qwr>
as far i can say, the Sys module signal numbers bear no connection to the linux signal numbers, probably completely arbitrary and translated somewhere for system specific values?
<d_bot>
<VPhantom> Interesting. Odd that it's specific integers and not, say, a variant then.
<d_bot>
<VPhantom> The doc says "for the standard POSIX signals" so it would've been reasonable to expect a match.
<d_bot>
<VPhantom> Checking the source… Yeah they're negative for a reason I'm sure. They're only used in `Stdlib.Sys.signal` anyway I think?
<qwr>
does posix specify the numbers at all? according to man signal, the numbers are different even between linux architectures, like SIGBUS being 7 on x86/arm and 10 on MIPS