companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.2.0 released: https://ocaml.org/releases/5.2.0 | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
sailorCat has joined #ocaml
anpad has quit [Quit: ZNC 1.8.2 - https://znc.in]
rgrinberg has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
anpad has joined #ocaml
rgrinberg has quit [Quit: My Unrecognized Mac has gone to sleep. ZZZzzz…]
ygrek has joined #ocaml
<discocaml> <antomfdez> why this results always to none even if i change the list in match
<discocaml> <antomfdez> ```ocaml
<discocaml> <antomfdez> let rec aux k ac = function
<discocaml> <antomfdez> | [] -> if k = 0 then Some (List.rev ac) else None
<discocaml> <antomfdez> | h :: t -> aux (k - 1) (h :: ac) t;;
<discocaml> <antomfdez>
<discocaml> <antomfdez> match (aux 3 [] [1; 2; 3; 4; 5]) with
<discocaml> <antomfdez> | Some v -> Printf.printf "%s\n" (String.concat "; " (List.map string_of_int v))
<discocaml> <antomfdez> | None -> Printf.printf "None\n"
<discocaml> <antomfdez> ;;
<discocaml> <antomfdez> ```
<discocaml> <antomfdez>
<discocaml> <antomfdez> this is the solution VVV
<discocaml> <antomfdez> ```ocaml
<discocaml> <antomfdez> let split list n =
<discocaml> <antomfdez> let rec aux i acc = function
<discocaml> <antomfdez> | [] -> List.rev acc, []
<discocaml> <antomfdez> | h :: t as l -> if i = 0 then List.rev acc, l
<discocaml> <antomfdez> else aux (i - 1) (h :: acc) t
<discocaml> <antomfdez> in
<discocaml> <antomfdez> aux n [] list;;
<discocaml> <antomfdez> ```
<discocaml> <antomfdez> but i still dont understand the solution and dont know why i cannot use the way i was building
<dh`> here's a hint: what happems if you call aux 0 [1; 2]?
<dh`> also I think you're supposed to post stuff like that in the beginners channel :-)
Haudegen has joined #ocaml
terrorjack45 has quit [Quit: The Lounge - https://thelounge.chat]
<discocaml> <antomfdez> There is an API lib for discord actively maintained?
terrorjack45 has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
jotik has joined #ocaml
jotik has left #ocaml [#ocaml]
Inline has joined #ocaml
agentcasey has quit [Quit: ZNC 1.10.x-git-27-bfd731cf - https://znc.in]
agentcasey has joined #ocaml
YuGiOhJCJ has joined #ocaml
Inline has quit [Client Quit]
ygrek has quit [Remote host closed the connection]
Inline has joined #ocaml
alexherbo2 has joined #ocaml
bartholin has joined #ocaml
rgrinberg has joined #ocaml
Serpent7776 has joined #ocaml
alexherbo2 has quit [Remote host closed the connection]
rgrinberg has quit [Quit: My Unrecognized Mac has gone to sleep. ZZZzzz…]
euphores has quit [Ping timeout: 246 seconds]
luc4 has joined #ocaml
<luc4> Hello! I noticed that, as soon as I try to link to the threads module, I get this segfault: https://pastebin.com/kT59x9B4. No code changes, just linking to it. Any idea what the cause may be?
euphores has joined #ocaml
sailorCat has quit [Remote host closed the connection]
sailorCat has joined #ocaml
rgrinberg has joined #ocaml
Haudegen has joined #ocaml
sailorCat has quit [Quit: ZNC 1.8.2 - https://znc.in]
sailorCat has joined #ocaml
Tuplanolla has joined #ocaml
<octachron> The threads library install hooks in the runtime to handle the interaction between threads and the runtime/domain lock.
rgrinberg has quit [Quit: My Unrecognized Mac has gone to sleep. ZZZzzz…]
<luc4> octachron: I see, this may explain why it makes the difference. Do you have any idea why this may happen? Do you think this is an ocaml bug?
Inline has quit [Ping timeout: 265 seconds]
Inline has joined #ocaml
Inline has quit [Remote host closed the connection]
Inline has joined #ocaml
<octachron> This most likely due to the C bindings that you are using making assumptions that are no longer valid once the threads library is linked.
<octachron> This is very unlikely to be an OCaml bug.
YuGiOhJCJ has quit [Quit: YuGiOhJCJ]
ygrek has joined #ocaml
<luc4> octachron: I see, I'll have to find another way then. Thanks!
Serpent7776 has quit [Ping timeout: 276 seconds]
rgrinberg has joined #ocaml
luc4 has quit [Quit: Konversation terminated!]
Serpent7776 has joined #ocaml
Serpent7776 has quit [Ping timeout: 248 seconds]
mbuf has joined #ocaml
luc4 has joined #ocaml
rgrinberg has quit [Quit: My Unrecognized Mac has gone to sleep. ZZZzzz…]
anpad has quit [Quit: ZNC 1.8.2 - https://znc.in]
luc4 has quit [Quit: Konversation terminated!]
rgrinberg has joined #ocaml
anpad has joined #ocaml
rgrinberg has quit [Quit: My Unrecognized Mac has gone to sleep. ZZZzzz…]
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
Anarchos has joined #ocaml
<octachron> r0i7
mbuf has quit [Quit: Leaving]
Haudegen has quit [Read error: Connection reset by peer]
Haudegen has joined #ocaml
ygrek has quit [Remote host closed the connection]
Haudegen has quit [Read error: Connection reset by peer]
Haudegen has joined #ocaml
Serpent7776 has joined #ocaml
Inline has quit [Ping timeout: 272 seconds]