<discocaml>
<darrenldl> is there a format syntax/option where it keeps track of the width of the box instead of only just the indentation?
<discocaml>
<darrenldl> (`Format` or `Fmt`)
waleee has quit [Ping timeout: 260 seconds]
<companion_cube>
what would that look like?
<discocaml>
<val patate: unit Lazy.t> can one define a type's array-like initialisation (`[| x1; ...; xn |]`) ?
mbuf has joined #ocaml
<discocaml>
<val patate: unit Lazy.t> I think I saw somewhere that you could include a module, and `[| x1; ... xn |]`, but can't remember... maybe it's just me hallucinating
<discocaml>
<val patate: unit Lazy.t> I think I saw somewhere that you could include a module, and `[| x1; ... xn |]` would then work on it, but can't remember... maybe it's just me hallucinating
<discocaml>
<val patate: unit Lazy.t> One can do `module Array = struct let get = List.nth end` to shadow `.()` then use it on lists: `[1; 2; 3].(1)`... But is there something similar with initialisation?
<discocaml>
<darrenldl> companion_cube: i probably phrased that poorly, but basically say within a box, i print a list of strings, followed by say a closing bracket:
<discocaml>
<octachron> @BigOof Format doesn't record the width of boxes, so that doesn't seem possible in general.
<discocaml>
<darrenldl> gotcha, thanks! i was guessing that'd be the case for complexity and performance reasons, but just wanted to make sure im not missing some obvious api
<discocaml>
<bnguyenv> Oh no I think you could only have the ending parenthesis on a newline by itself actually
<discocaml>
<bnguyenv> Trying to play with it a bit, I can't manage to get even that, so maybe not sorry...
<discocaml>
<darrenldl> ooo, thanks for the update!
<discocaml>
<darrenldl>
<discocaml>
<darrenldl> tbh this need is very niche, and wouldnt make sense to be in a api that targets general use
olle has quit [Ping timeout: 248 seconds]
mro has joined #ocaml
spip has joined #ocaml
olle has joined #ocaml
hackinghorn has joined #ocaml
anpad has quit [Read error: Connection reset by peer]
anpad has joined #ocaml
<discocaml>
<Oégua> hey guys, I'm having a little bit of a problem to make my VSCode recongnize the Zarith library (i'm using the OCaml Platform extension)
<companion_cube>
@darrenldl oh, tough
rf has quit [Remote host closed the connection]
rf has joined #ocaml
masterbuilder has quit [Ping timeout: 248 seconds]
masterbuilder has joined #ocaml
rf has quit [Remote host closed the connection]
rf has joined #ocaml
<discocaml>
<darrenldl> companion_cube: yeah, this is only just for a small note finding tool i use for myself though, and i don't care enough to pad it properly anyway : D
masterbuilder has quit [Ping timeout: 248 seconds]
masterbuilder has joined #ocaml
mro_ has joined #ocaml
mro has quit [Ping timeout: 248 seconds]
mro_ has quit [Remote host closed the connection]
mro has joined #ocaml
mro has quit [Remote host closed the connection]
Haudegen has quit [Quit: Bin weg.]
gahr_ is now known as gahr
chrisz has quit [Ping timeout: 260 seconds]
chrisz has joined #ocaml
<discocaml>
<∆V> I want to manually create a call to an external function in OCaml's lambda IR and use OCaml's backend to compile that, but the arguments are not being passed correctly.
<discocaml>
<∆V> (data int 3063 "camlTest__1": addr "camlTest__fun_81" int 1)
<discocaml>
<∆V> (function camlTest__entry ()
<discocaml>
<∆V> (app (load_mut val "camlTest__1") 511 "camlTest__1" unit) 1a)
<discocaml>
<∆V>
<discocaml>
<∆V> (data)```
<discocaml>
<∆V> But the following c function:```c
<discocaml>
<∆V> CAMLprim value nat_foo(value arg) {
<discocaml>
<∆V> printf("foo called with %d!\n", Int_val(arg));
<discocaml>
<∆V> return Val_unit;
<discocaml>
<∆V> }```prints `foo called with 1500117184!`.
<discocaml>
<∆V> I use `ocamlopt` to generate a single object file (without the runtime) and I have no issues linking it. So what's going wrong here?
<discocaml>
<∆V> I want to manually create a call to an external function in OCaml's lambda IR and use OCaml's backend to compile that, but the arguments are not being passed correctly.
<discocaml>
<∆V> I discovered the same, hence I assume I'm just doing something fundamentally wrong. How do you suggest I do it?
<discocaml>
<∆V> Btw, I'm pretty sure `val` is just short for any literal value. It appears in all my tested cmm multiple times where you'd expect literals.
<discocaml>
<octachron> Don't generate an anonymous function when you intended to call an existing function?
<discocaml>
<∆V> But the called function is defined externally?
<discocaml>
<∆V> Should i just generate a call to an undefined function "nat_foo"?
Haudegen has joined #ocaml
<discocaml>
<octachron> As far as I understand, by the time that you call the function, it needs to have been resolved to some symbol, independently on where the function was defined.
<discocaml>
<∆V> You mean that which is added to the environment by the `external nat_foo` declaration?
<discocaml>
<∆V> The `Types.value_description`?
<discocaml>
<octachron> Types don't exist at runtime, if you are generating lambda you should ignore them.
<discocaml>
<∆V> So you're saying that I should just `Lapply nat_foo` basically?
mro has joined #ocaml
mro has quit [Remote host closed the connection]
<discocaml>
<octachron> Yes
<discocaml>
<∆V> I'll give it a try!
kurfen has quit [Ping timeout: 268 seconds]
<discocaml>
<∆V> @octachron as expected: `Fatal error: Selection.emit_expr: unbound var nat_foo`
<discocaml>
<∆V> But this is the lambda and cmm, if i follow ur instructions: ```
<discocaml>
<∆V> lambda:
<discocaml>
<∆V> (seq (apply nat_foo! 255) 0a)
<discocaml>
<∆V>
<discocaml>
<∆V> cmm:
<discocaml>
<∆V> (data int 768 global "camlTest" "camlTest":)
<discocaml>
<∆V> (data
<discocaml>
<∆V> global "camlTest__gc_roots"
<discocaml>
<∆V> "camlTest__gc_roots":
<discocaml>
<∆V> addr "camlTest"
<discocaml>
<∆V> int 0)
<discocaml>
<∆V> (function camlTest__entry ()
<discocaml>
<∆V> (app (load_mut val nat_foo!) 511 nat_foo! unit) 1a)```
<discocaml>
<∆V> Is the fact that it's applying a problem?
<discocaml>
<∆V> Is the fact that it's `apply`ing a problem?
kurfen has joined #ocaml
<discocaml>
<∆V> Oh
<discocaml>
<∆V> wait
<discocaml>
<∆V> I solved it!
<discocaml>
<∆V> I just add the function as a global primitive to the environment and the rest just works out of the box!
<discocaml>
<∆V> Thanks for the help! :))
<discocaml>
<octachron> Not sure if I add helped much (but yes within `nat_foo!` the `!` means that `nat_foo` is a global (and unique) identifier).
<discocaml>
<octachron> Not sure if I have helped much (but yes within `nat_foo!` the `!` means that `nat_foo` is a global (and unique) identifier).
<discocaml>
<∆V> Turns out that it indeed needed to be a global yea
hackinghorn has quit [Ping timeout: 248 seconds]
mischief has joined #ocaml
<mischief>
is it possible to pass configure flags to packages installed by opam?
<mischief>
to answer my own question, the answer appears to be no.. opam configure flags appear to be fixed inside the build script with no escape hatch.
bartholin has joined #ocaml
mbuf has quit [Quit: Leaving]
gentauro has quit [Read error: Connection reset by peer]
gentauro has joined #ocaml
terrorjack has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
<discocaml>
<cemerick> companion_cube: in the category of, "I didn't even know I wanted it"
Serpent7776 has quit [Quit: WeeChat 1.9.1]
dhil has joined #ocaml
waleee has joined #ocaml
Tuplanolla has joined #ocaml
Haudegen has joined #ocaml
mro has joined #ocaml
mro has quit [Remote host closed the connection]
mro has joined #ocaml
wingsorc has joined #ocaml
masterbuilder has quit [Quit: leaving]
mro has quit [Read error: Connection reset by peer]
mro_ has joined #ocaml
masterbuilder has joined #ocaml
Stumpfenstiel has joined #ocaml
mro_ has quit [Remote host closed the connection]
mro has joined #ocaml
olle has quit [Ping timeout: 248 seconds]
<discocaml>
<lukstafi> Hi! Has anyone experienced weird file IO behavior from within `%expect_test` code? For me, the output just does not appear in the file, and I made sure to flush often, verified that things get output if the channel is `stdout` (in the `Trailing output` section), and that the file is populated if the same code is run from a `dune exec` binary. (The code raises an exception, that is uncaught if run as `dune exec`.)
trev has quit [Remote host closed the connection]
dhil has quit [Ping timeout: 248 seconds]
bartholin has quit [Quit: Leaving]
bgs has quit [Remote host closed the connection]
mro has quit [Remote host closed the connection]
mro has joined #ocaml
sparogy has quit [Remote host closed the connection]