companion_cube changed the topic of #ocaml to: Discussion about the OCaml programming language | http://www.ocaml.org | OCaml 5.0 released(!!1!): https://ocaml.org/releases/5.0.0.html | Try OCaml in your browser: https://try.ocamlpro.com | Public channel logs at https://libera.irclog.whitequark.org/ocaml/
oriba has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
Soni has quit [Ping timeout: 256 seconds]
spip has quit [Quit: Konversation terminated!]
azimut_ has quit [Ping timeout: 255 seconds]
chrisz has quit [Ping timeout: 248 seconds]
chrisz has joined #ocaml
chrisz has quit [Ping timeout: 268 seconds]
chrisz has joined #ocaml
Soni has joined #ocaml
mbuf has joined #ocaml
Haudegen has joined #ocaml
bgs has joined #ocaml
trev has joined #ocaml
slothby has quit [*.net *.split]
noddy has quit [*.net *.split]
Serpent7776 has joined #ocaml
bgs has quit [Remote host closed the connection]
bartholin has joined #ocaml
wingsorc__ has quit [Ping timeout: 240 seconds]
John_Ivan has quit [Remote host closed the connection]
bartholin has quit [Quit: Leaving]
<discocaml> <Scarlet> hey, i have a problem that im stuck on for a while.
<discocaml> <Scarlet> i have file that is keep write into while the code is running, and everything is works. but whenever I re-run the program , i want to overwrite the file and not append to it . anyone know how to do it?
<discocaml> <Scarlet> i have file that i keep write into while the code is running, and everything is works. but whenever I re-run the program , i want to overwrite the file and not append to it . anyone know how to do it?
<discocaml> <Scarlet> i have file that is being consistently appended while the code is running, and everything is works. but whenever I re-run the program , i want to overwrite the file and not append to it . anyone know how to do it?
<discocaml> <Scarlet> ```let handle_buy (w1 : string) (w2 : int) (w3 : float) =
<discocaml> <Scarlet> let oc = open_out_gen [Open_append; Open_creat] 0o666 (base_directory^".asm") in
<discocaml> <Scarlet> let mult_val = (float_of_int w2) *. w3 in
<discocaml> <Scarlet> let str = "### BUY " ^ w1 ^ " ###\n" ^ (string_of_float mult_val)^ "\n" in
<discocaml> <Scarlet> total_buy := !total_buy +. mult_val;
<discocaml> <Scarlet> output_string oc str;
<discocaml> <Scarlet> close_out oc;;```
<discocaml> <Scarlet> ```ocaml
<discocaml> <Scarlet> let handle_buy (w1 : string) (w2 : int) (w3 : float) =
<discocaml> <Scarlet> let oc = open_out_gen [Open_append; Open_creat] 0o666 (base_directory^".asm") in
<discocaml> <Scarlet> let mult_val = (float_of_int w2) *. w3 in
<discocaml> <Scarlet> let str = "### BUY " ^ w1 ^ " ###\n" ^ (string_of_float mult_val)^ "\n" in
<discocaml> <Scarlet> total_buy := !total_buy +. mult_val;
<discocaml> <Scarlet> output_string oc str;
<discocaml> <Scarlet> close_out oc;;```
<discocaml> <Scarlet> ```ocaml
<discocaml> <Scarlet> let handle_buy (w1 : string) (w2 : int) (w3 : float) =
<discocaml> <Scarlet> let oc = open_out_gen [Open_append; Open_creat] 0o666 (base_directory^".asm") in
<discocaml> <Scarlet> let mult_val = (float_of_int w2) *. w3 in
<discocaml> <Scarlet> let str = "### BUY " ^ w1 ^ " ###\n" ^ (string_of_float mult_val)^ "\n" in
<discocaml> <Scarlet> output_string oc str;
<discocaml> <Scarlet> close_out oc;;```
<discocaml> <octachron> You can open the file in truncate mode at the start of your program.
<discocaml> <Scarlet> thanks!
olle has joined #ocaml
spip has joined #ocaml
kakadu has joined #ocaml
Tuplanolla has joined #ocaml
hrberg has quit [Quit: No Ping reply in 180 seconds.]
hrberg has joined #ocaml
azimut has joined #ocaml
olle has quit [Quit: Lost terminal]
<reynir> What ppx provides let%bind?
<discocaml> <leviroth> ppx_let
<reynir> thanks
<discocaml> <cameliacamelia888> I need your precious help. I need to return a copy of a list in which odd-length lists have been doubled. For exemple my list : oddList [[]; [1];[1;2];[1;2;3];[];[5;4;3;2;1]] must return oddList [[]; [1; 1]; [1; 2]; [1; 2; 3; 1; 2; 3]; []; [5; 4; 3; 2; 1; 5; 4; 3; 2; 1]]
<discocaml> <cameliacamelia888>
<discocaml> <cameliacamelia888> I tried this without success:
<discocaml> <cameliacamelia888>
<discocaml> <cameliacamelia888> let rec listes_paires l = match l with
<discocaml> <cameliacamelia888> | [] -> []
<discocaml> <cameliacamelia888> | x :: r -> if length x mod 2 = 0 then (x :: (listes_paires r))
<discocaml> <cameliacamelia888> else ((x@x):: (listes_paires r));;
<discocaml> <cameliacamelia888> I need your precious help. I need to return a copy of a list in which odd-length lists have been doubled. For exemple my list : oddList [[]; [1];[1;2];[1;2;3];[];[5;4;3;2;1]] must return oddList [[]; [1; 1]; [1; 2]; [1; 2; 3; 1; 2; 3]; []; [5; 4; 3; 2; 1; 5; 4; 3; 2; 1]]
<discocaml> <cameliacamelia888>
<discocaml> <cameliacamelia888> I tried this without success:
<discocaml> <cameliacamelia888> `
<discocaml> <cameliacamelia888> let rec listes_paires l = match l with
<discocaml> <cameliacamelia888> | [] -> []
<discocaml> <cameliacamelia888> | x :: r -> if length x mod 2 = 0 then (x :: (listes_paires r))
<discocaml> <cameliacamelia888> else ((x@x):: (listes_paires r));;`
<discocaml> <cameliacamelia888> I need your precious help. I need to return a copy of a list in which odd-length lists have been doubled. For exemple my list :
<discocaml> <cameliacamelia888> oddList [[]; [1];[1;2];[1;2;3];[];[5;4;3;2;1]]
<discocaml> <cameliacamelia888> must return
<discocaml> <cameliacamelia888> oddList [[]; [1; 1]; [1; 2]; [1; 2; 3; 1; 2; 3]; []; [5; 4; 3; 2; 1; 5; 4; 3; 2; 1]]
<discocaml> <cameliacamelia888>
<discocaml> <cameliacamelia888> I tried this without success:
<discocaml> <cameliacamelia888> `
<discocaml> <cameliacamelia888> let rec listes_paires l = match l with
<discocaml> <cameliacamelia888> | [] -> []
<discocaml> <cameliacamelia888> | x :: r -> if length x mod 2 = 0 then (x :: (listes_paires r))
<discocaml> <cameliacamelia888> else ((x@x):: (listes_paires r));;`
<discocaml> <octachron> What do you mean by "without success"?
<discocaml> <cameliacamelia888> Hello octachron, my code does not return anything
<discocaml> <cameliacamelia888> Hello octachron, my code doesn't return anything
<discocaml> <octachron> That's not the case?
<discocaml> <cameliacamelia888> I do,'t understand what's wrong
<discocaml> <octachron> How are you estimating that something is going wrong?
<discocaml> <cameliacamelia888> When I tried with https://console.basthon.fr/?kernel=ocaml return : "Error: Unbound value listes_paires"
<discocaml> <octachron> Well, you must define the function in the environment before calling.
<zozozo> mdx doesn't seem to work very well on windows (cf https://github.com/realworldocaml/mdx/issues/295 ), is there any way in dune to disable mdx when building on windows ?
<zozozo> I guess I can get what I want with enabled_if
<discocaml> <emillon> add `enabled_if` on the corresponding `(mdx)` stanza
bgs has joined #ocaml
<zozozo> yeah, that's what I found
slothby has joined #ocaml
motherfsck has joined #ocaml
neiluj has joined #ocaml
mbuf has quit [Quit: Leaving]
<discocaml> <RegularSpatula> Here is a quote from a matklad blog post: "we don’t have a reliability-oriented high-level programming language with a good quality of implementation (modern ML, if you will)." (https://matklad.github.io/2023/03/26/zig-and-rust.html) ...I'm wondering what others here think...why wouldn't ocaml fit as a reliability-oriented high level modern ML with a good implementation? (the context if you don't care to read the post, is that rust g
<discocaml> <RegularSpatula> setting aside ecosystem size (like availability of whatever libs you need) it seems that a lot of users looking for "modern ML" with a good implementation would be well served by ocaml rather than rust...anyway, just an interesting thought brought up from that paragraph in that post
<discocaml> <RegularSpatula> maybe "reliability-oriented" has a specific meaning that i don't understand and that explains why ocaml wouldn't fit the description (idk)
<discocaml> <masterbuilder> Personally I would not consider Rust to be a language belonging to the ML family, it just borrows some ideas
<discocaml> <RegularSpatula> the author of the post does use quotes when calling rust a "modern ML" so i think they probably mean it in the sense that you say...ML-ish or ML-inspired
olle has joined #ocaml
Serpent7776 has quit [Quit: leaving]
Stumpfenstiel has joined #ocaml
bartholin has joined #ocaml
<companion_cube> I suspect matklad refers to tooling, possibly to some stdlib things too (which are more painful in ocaml than they'd be in a more recent language). That's how I interpret it.
gdd has quit [Ping timeout: 252 seconds]
gdd has joined #ocaml
oriba has joined #ocaml
bgs has quit [Remote host closed the connection]
trev has quit [Remote host closed the connection]
olle has quit [Ping timeout: 260 seconds]
bartholin has quit [Quit: Leaving]
Stumpfenstiel has quit [Ping timeout: 276 seconds]
neiluj has quit [Quit: WeeChat 3.7.1]
Haudegen has quit [Ping timeout: 240 seconds]
xd1le has joined #ocaml
wingsorc has joined #ocaml