bastienleonard has quit [Ping timeout: 255 seconds]
raskol has quit [Ping timeout: 240 seconds]
Sankalp has quit [Ping timeout: 256 seconds]
Sankalp has joined #ocaml
kor1 has joined #ocaml
raskol has joined #ocaml
jpds1 has quit [Remote host closed the connection]
jpds1 has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
amk has quit [Ping timeout: 264 seconds]
amk has joined #ocaml
mbuf has joined #ocaml
jonasbits has quit [Ping timeout: 276 seconds]
jonasbits has joined #ocaml
sagax has quit [Remote host closed the connection]
mro has joined #ocaml
raskol has quit [Ping timeout: 276 seconds]
Tuplanolla has joined #ocaml
<d_bot>
<froyo> \> Hmm ok so its some advanced thing ig
<d_bot>
<froyo> nah it's just that OCaml's REPL takes freeform and unformatted input (including newlines), so the only way to let it know you're done writing stuff is to terminate with a `;;`
<d_bot>
<froyo> but non-interactively, you usually don't use `;;` at all. OCaml files are a series of toplevel declarations, no expressions. So if you want to write a standalone expression, you need to at least make it look like a declaration, by binding it to a throwaway name like `_`, or matching it to its output, like `()`
mro has quit [Quit: Leaving...]
azimut_ has quit [Ping timeout: 268 seconds]
<d_bot>
<froyo> I think the reason you can't mix declarations with expressions without a clear separator like `;;` is because doing so would introduce ambiguity: what's `let x = f <newline> 5`? is it `f` applied to `5` then bound to `x` or is it just `f` bound to `x` and `5` is a standalone expression? etc..
jonasbits has quit [Ping timeout: 276 seconds]
Serpent7776 has quit [Quit: leaving]
jonasbits has joined #ocaml
Haudegen has joined #ocaml
Anarchos has joined #ocaml
<Anarchos>
hello
sobafuchs has joined #ocaml
sobafuchs has quit [Quit: ERC 5.4.1 (IRC client for GNU Emacs 28.1)]
sobafuchs has joined #ocaml
sobafuchs has quit [Remote host closed the connection]
bartholin has joined #ocaml
Duns_Scrotus has joined #ocaml
jpds1 has joined #ocaml
_whitelogger has joined #ocaml
bartholin has quit [Ping timeout: 240 seconds]
spip has quit [Read error: Connection reset by peer]
spip has joined #ocaml
dextaa has quit [Read error: Connection reset by peer]
dextaa has joined #ocaml
bartholin has joined #ocaml
gentauro has quit [Read error: Connection reset by peer]
gentauro has joined #ocaml
dextaa has quit [Read error: Connection reset by peer]
dextaa has joined #ocaml
<Duns_Scrotus>
Is there a way to stop vscode from underlining an entire half-written function because you have an inexhaustive match (because the function is half-written)?
bastienleonard has joined #ocaml
rgrinberg has joined #ocaml
<d_bot>
<leviroth> Kind of a dumb hack, but you could add a `_ -> .` case. Then the error should just be on that bit.
<Duns_Scrotus>
ty leviroth
waleee has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<d_bot>
<cheeze> hello, are these two equivalent?
<d_bot>
<cheeze> ```ocaml
<d_bot>
<cheeze> let is_lucky n =
<d_bot>
<cheeze> match n with
<d_bot>
<cheeze> 7 | 8 -> true
<d_bot>
<cheeze> | _ -> false
<d_bot>
<cheeze>
<d_bot>
<cheeze> let is_lucky n =
<d_bot>
<cheeze> match n with
<d_bot>
<cheeze> | 7 | 8 -> true
<d_bot>
<cheeze> | _ -> false
<d_bot>
<cheeze> ```
<d_bot>
<NULL> That `|` is completely optional yes
<d_bot>
<cheeze> thank you
<d_bot>
<NULL> (or should be)
waleee has quit [Remote host closed the connection]
waleee has joined #ocaml
bartholin has quit [Ping timeout: 240 seconds]
waleee has quit [Ping timeout: 276 seconds]
mro has joined #ocaml
chrisz has quit [Ping timeout: 276 seconds]
mro has quit [Client Quit]
chrisz has joined #ocaml
waleee has joined #ocaml
kor1 has quit [Quit: Leaving.]
bartholin has joined #ocaml
szkl has quit [Quit: Connection closed for inactivity]
azimut has joined #ocaml
<d_bot>
<Pluton> Can i like do more stuff in like a else or do i need to always do let () = e do e2
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
troydm has joined #ocaml
<d_bot>
<NULL> I don't understand the question
<d_bot>
<NULL> OCaml has `if then else` and you can have any expression in the three arguments of the construction
<d_bot>
<NULL> (Before considering typing)
<d_bot>
<Pluton> Like can i put print_int 1 and print_int 2 in the else part
<d_bot>
<NULL> Yes, but `;` has lower priority than `if then else` so you need to wrap it in either parentheses or `begin end`
<d_bot>
<NULL> (Or use `let () = ... in ...` which has a higher priority)
<d_bot>
<Pluton> Whats most recommended / considered the best code
<d_bot>
<NULL> All can be fine in some situations, but I personally prefer `begin end`
<d_bot>
<NULL> Especially if you return unit in the end
<d_bot>
<Pluton> I mean nesting let () = ... in ... seems like bad code to me
<d_bot>
<Pluton> Is it considered bad code tho,m
<d_bot>
<NULL> If by bad you mean ugly, I tend to agree
<d_bot>
<Pluton> Yes ugly
<d_bot>
<NULL> When you use monadic operators, you sometimes have to use `let* () = ... in ...` so it's still sometimes a reasonable alternative
<d_bot>
<NULL> (Advanced stuff)
<d_bot>
<Pluton> let () = e in e2
<d_bot>
<Pluton> Is equal to
<d_bot>
<Pluton> ```
<d_bot>
<Pluton> let f e = e2
<d_bot>
<Pluton> f (let () = e)
<d_bot>
<Pluton> ```
<d_bot>
<Pluton> Right?
<d_bot>
<NULL> If by equal you mean behaviourally equivalent, I think so
<d_bot>
<Pluton> I see keywords kinda confusing
<d_bot>
<Pluton> like
<d_bot>
<Pluton> `string_of_int`
<d_bot>
<Pluton> `in`
<d_bot>
<NULL> `string_of_int` isn't a keyword, it's a simple function name
<d_bot>
<Pluton> Oh yea well basically a built-in function
<d_bot>
<Pluton> I think int_to_string would be more understandable
<d_bot>
<NULL> More like defined in the standard library, and in the part which is always accessible
<d_bot>
<NULL> If you see a function as something which takes its input on the right and gives out an input on the left (for the next function), it makes sense to use the `of` order
waleee has quit [Ping timeout: 240 seconds]
<d_bot>
<NULL> But that is moreso a choice that was made a long time ago which it is far too old to be changed
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
yilin has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
waleee has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<yilin>
Hello, I'm trying to use dune to include some generated C files but I'm having quite a few issues with user actions. I want to assign the stdout of a `run` to some variable and then reuse that in a later `run`.
<yilin>
I think I can redirect the stdout to a file and then substitute using %{read:file}, but it feels really odd to do it like this.
raskol has joined #ocaml
yilin has quit [Ping timeout: 240 seconds]
raskol has quit [Ping timeout: 256 seconds]
waleee has quit [Ping timeout: 268 seconds]
waleee has joined #ocaml
<d_bot>
<geoff> If you are using in a later run, you can put the generated file in your `deps` for the second rule
yilin has joined #ocaml
Haudegen has quit [Ping timeout: 244 seconds]
waleee has quit [Ping timeout: 276 seconds]
sagax has joined #ocaml
yilin has quit [Quit: WeeChat 3.5]
wingsorc has quit [Ping timeout: 240 seconds]
TakinOver has quit [Ping timeout: 272 seconds]
bastienleonard has quit [Ping timeout: 260 seconds]