adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.09 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.09/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
nicoo has quit [Remote host closed the connection]
nicoo has joined #ocaml
Serpent7776 has quit [Quit: leaving]
Serpent7776 has joined #ocaml
ArthurStrong has quit [Ping timeout: 260 seconds]
_whitelogger has joined #ocaml
amiloradovsky has quit [Ping timeout: 244 seconds]
cantstanya has quit [Remote host closed the connection]
cantstanya has joined #ocaml
mbuf has joined #ocaml
mfp has quit [Ping timeout: 265 seconds]
dborisog has joined #ocaml
narimiran has joined #ocaml
narimiran_ has joined #ocaml
narimiran has quit [Read error: Connection reset by peer]
_whitelogger has joined #ocaml
ArthurStrong has joined #ocaml
<ArthurStrong> Hi all. Is there a standard function to slice a list by n-item parts? like [1;2;3;4;5;6] by 2-item sublists -> [1;2];[3;4];[5;6]
<ArthurStrong> also, it is possible in utop to print (in debug mode) all function arguments during execution?
<ArthurStrong> I want to debug a recursive function...
nullcone has quit [Quit: Connection closed for inactivity]
Haudegen has joined #ocaml
<haesbaert> ArthurStrong: I think List.partition with an external ref counter is your smallest solution
raver has joined #ocaml
<haesbaert> oh I misread, disregard me.
<ArthurStrong> haesbaert: thanks for the idea
narimiran_ is now known as narimiran
mfp has joined #ocaml
<ArthurStrong> I have an issue with List.iter
<ArthurStrong> I just want to run a function for each element in list
<ArthurStrong> but...
<ArthurStrong> Error: This expression has type string list -> unit but an expression was expected of type 'a list
<ArthurStrong> my function has signature string list -> unit, OK
<ArthurStrong> but what List.iter wants?
<abc_> This is List.iter's signature: 'a list -> f:('a -> unit) -> unit = <fun>
<ArthurStrong> what should I do?
<abc_> I don't know either, still learning it, and saw your question by accident.
<ArthurStrong> oh I just supplied arguments in wrong order. neverming. thanks!
* ArthurStrong noob
<schube[m]> lubegasimon: assuming you're asking how OCaml infers that x has type (int, string) pair without you writing the type explicitly? The answer to that is that OCaml knows that "the key `first` belongs to type `('a, 'b) pair`", therefore when you use a literal which has this key it will infer that it is `('a, 'b) pair. If you define another record type with a key named `first` in the same module you may run into trouble because
<schube[m]> OCaml will then infer that new record type so you should try to keep these keys unique within a module.
<abc_> ArthurStrong: Congratulate!
<ArthurStrong> (utop) anyway, is it possible to log all function arguments for debugging?
mbuf has quit [Quit: Leaving]
narimiran has quit [Ping timeout: 244 seconds]
ggole has joined #ocaml
dborisog has quit [Remote host closed the connection]
tane has joined #ocaml
andreas303 has quit [Remote host closed the connection]
andreas303 has joined #ocaml
dborisog has joined #ocaml
amiloradovsky has joined #ocaml
<ArthurStrong> I'm trying to read a text fil
<ArthurStrong> file
<ArthurStrong> but getting: Error: The module In_channel is an alias for module Core_kernel__.Import.In_channel, which is missing
<ArthurStrong> however, I do "open Core"
<ArthurStrong> what is this?
<ArthurStrong> "open Core_kernel" - no luck as well
<ArthurStrong> let f = In_channel.read_lines "tmp";;
<ArthurStrong> excuse me, but Ocaml's system of modules is just crappy. is there a standard set of them?
<ArthurStrong> what should I use and what shouldn't?
dborisog has quit [Remote host closed the connection]
<ArthurStrong> oh, I should "open Stdio"
ygrek has joined #ocaml
vesper11 has quit [Read error: Connection reset by peer]
vesper11 has joined #ocaml
<ArthurStrong> Anyway. is there a guide on ocaml libraries? Standard, non-standard, batteries, etc?
<ArthurStrong> I just confused totaly
<ArthurStrong> and lost
<Fardale> ArthurStrong: you can look here https://ocamlverse.github.io/content/standard_libraries.html
<ArthurStrong> Fardale: thanks!
vicfred has quit [Quit: Leaving]
narimiran has joined #ocaml
TheLemonMan has joined #ocaml
vesper11 has quit [Read error: Connection reset by peer]
vesper11 has joined #ocaml
nullcone has joined #ocaml
gareppa has joined #ocaml
gareppa has quit [Remote host closed the connection]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
Hrundi_V_Bakshi has joined #ocaml
dborisog has joined #ocaml
narimiran has quit [Quit: leaving]
dborisog has quit [Ping timeout: 265 seconds]
MirandaKerr has joined #ocaml
MirandaKerr has quit [Client Quit]
ollehar2 has joined #ocaml
<ollehar2> String.trim not working on bytes?
<def> trimming does not remove \000
<ollehar2> @def It also doesn't remove \n
<ollehar2> In my test, at least :|
<def> it does here
<def> but it only removes the whitespaces at the beginning and at the end
<def> in your example there are \000 after, so it won't remove \n
<ollehar2> aha!
<ollehar2> @def So how do I remove \000?
<ollehar2> Manually with regexp?
<ollehar2> Hm, gonna run some tests.
<def> it depends what you want to achieve
<def> remove characters anywhere in the string, or just at the end?
<def> or maybe you want to take the substring that ends before the first \000?
<ollehar2> I wanna keep the entered string without \n, in this case "asd".
<ollehar2> String.length returns 100
<def> but how come you get the \000 ?
<ollehar2> From Bytes.create?
<def> (input_line stdin might directly achieve what you want)
<def> oh, then maybe (Bytes.sub_string buffer 0 bytes_read)
<ollehar2> From which module?
<def> pervasives.
<ollehar2> ok cool
<def> it uses the channel abstraction (similar to the C FILE* type)
<ollehar2> Yes, both works good, thank you!
<def> np
ollehar2 has quit [Quit: Connection closed]
ggole has quit [Quit: Leaving]
vicfred has joined #ocaml
tane has quit [Quit: Leaving]
nicoo has quit [Ping timeout: 240 seconds]
nicoo has joined #ocaml
ArthurStrong has quit [Quit: leaving]
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
amiloradovsky has quit [Ping timeout: 240 seconds]
Kaedenn has joined #ocaml
<Kaedenn> Can I get more output from ocamlc than just "Syntax error on line X column Y"?
amiloradovsky has joined #ocaml
amiloradovsky has quit [Remote host closed the connection]
amiloradovsky has joined #ocaml
Kaedenn has quit [Ping timeout: 260 seconds]
Kaedenn has joined #ocaml