Leonidas changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 4.13.0 released: https://ocaml.org/releases/4.13.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
Soni has quit [Ping timeout: 240 seconds]
rgrinberg has joined #ocaml
Soni has joined #ocaml
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
<d_bot> <VPhantom> According to `man 7 signal` yes, the numbers we know (i.e. 11 for SIGSEGV) are part of POSIX.1-1990.
<d_bot> <VPhantom> `SIGBUS` was added later in SUSv2 and POSIX.1-2001.
<qwr> numbers or names?
<d_bot> <VPhantom> SIGBUS is 7 and 10 depending on architecture.
<d_bot> <VPhantom> Both.
<d_bot> <VPhantom> let me try to find you that man page online…
<d_bot> <VPhantom> Ah, there's a neat one here: <https://man7.org/linux/man-pages/man7/signal.7.html>
jlrnick has quit [Ping timeout: 240 seconds]
<d_bot> <VPhantom> It doesn't detail which comes from which standard but it better details which architecture uses which numbers.
<d_bot> <VPhantom> Since OCaml can target multiple architectures, it created its own proxy.
<d_bot> <VPhantom> …and indeed `static int posix_signals[]` translates the 10th position to `SIGSEGV`.
<d_bot> <Valentin> Yes it look likes ocaml uses its own representation for a better cohabitation between operating systems.
waleee has joined #ocaml
romildo has joined #ocaml
<d_bot> <Valentin> Thank you for your help )
reynir has joined #ocaml
romildo has quit [Quit: Leaving]
lagash_ has quit [Quit: ZNC - https://znc.in]
lagash has joined #ocaml
gravicappa has joined #ocaml
motherfsck has quit [Ping timeout: 240 seconds]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
olle has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
motherfsck has joined #ocaml
motherfsck has quit [Ping timeout: 256 seconds]
mro has joined #ocaml
motherfsck has joined #ocaml
motherfsck has quit [Ping timeout: 256 seconds]
LeSeulArtichaut has joined #ocaml
bartholin has joined #ocaml
LeSeulArtichaut has quit [Quit: Leaving]
motherfsck has joined #ocaml
romildo has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
jlrnick has joined #ocaml
motherfsck has quit [Ping timeout: 240 seconds]
mro has joined #ocaml
romildo has quit [Ping timeout: 256 seconds]
rgrinberg has joined #ocaml
motherfsck has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
mro has quit [Remote host closed the connection]
motherfsck has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
reynir has quit [Ping timeout: 256 seconds]
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
motherfsck has joined #ocaml
Tuplanolla has joined #ocaml
rak_ is now known as rak
adibsaad[m] has quit [Quit: Client limit exceeded: 20000]
gravicappa has quit [Ping timeout: 256 seconds]
reynir has joined #ocaml
jlrnick has quit [Ping timeout: 268 seconds]
mro has joined #ocaml
rgrinberg has joined #ocaml
slbtty has joined #ocaml
rgrinberg has quit [Read error: Connection reset by peer]
rgrinberg has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zebrag has joined #ocaml
zebrag has quit [Client Quit]
rond_ has joined #ocaml
kaph has quit [Read error: Connection reset by peer]
<slbtty> quick q: does LWT means "Low Level Threads"?
adibsaad[m] has joined #ocaml
<d_bot> <glennsl> "lightweight threads" I believe. Though it's not really that either
<slbtty> Sound legit, thanks for confirmation :)
bartholin has quit [Quit: Leaving]
rond_ has quit [Quit: Client closed]
kaph has joined #ocaml
mro has quit [Quit: Leaving...]
mro has joined #ocaml
mro has quit [Client Quit]