companion_cube changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.11 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.11/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
mxns has quit [Ping timeout: 264 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 256 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 256 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 246 seconds]
rock64_ has quit [Ping timeout: 256 seconds]
rock64 has joined #ocaml
sm2n has quit [Ping timeout: 245 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 265 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 265 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 245 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
mbuf has joined #ocaml
mxns has quit [Ping timeout: 264 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 264 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 265 seconds]
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
andreas31 has quit [Ping timeout: 268 seconds]
andreas31 has joined #ocaml
mfp has quit [Ping timeout: 260 seconds]
zebrag has quit [Quit: Konversation terminated!]
osa1_ has joined #ocaml
osa1 has quit [Ping timeout: 244 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 264 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
xandkar has quit [Ping timeout: 260 seconds]
narimiran has joined #ocaml
waleee-cl has quit [Quit: Connection closed for inactivity]
hosewiejacke has joined #ocaml
Serpent7776 has joined #ocaml
tizoc has quit [Quit: Coyote finally caught me]
tizoc has joined #ocaml
mischief has left #ocaml ["WeeChat 3.0"]
mxns has joined #ocaml
mxns has quit [Ping timeout: 244 seconds]
Haudegen has joined #ocaml
Tuplanolla has joined #ocaml
mxns has joined #ocaml
sm2n has joined #ocaml
sm2n has quit [Ping timeout: 265 seconds]
mxns has quit [Ping timeout: 244 seconds]
Jesin has quit [Ping timeout: 276 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 244 seconds]
madroach has joined #ocaml
madroach_ has quit [Ping timeout: 276 seconds]
vicfred has quit [Quit: Leaving]
mxns has joined #ocaml
nullcone has quit [Quit: Connection closed for inactivity]
mxns has quit [Ping timeout: 244 seconds]
mxns has joined #ocaml
sm2n has joined #ocaml
mxns has quit [Ping timeout: 244 seconds]
sm2n has left #ocaml ["Leaving"]
bartholin has joined #ocaml
Jesin has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 265 seconds]
<d_bot_> <tsnobip> hey, is it possible to use ocamlformat as a lib to format a string?
mfp has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
hosewiejacke has quit [Ping timeout: 276 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 256 seconds]
nepascourir has joined #ocaml
mxns has joined #ocaml
mxns has quit [Ping timeout: 265 seconds]
mxns has joined #ocaml
hosewiejacke has joined #ocaml
Haudegen has joined #ocaml
TheLemonMan has joined #ocaml
mxns has quit [Ping timeout: 260 seconds]
mxns has joined #ocaml
zebrag has joined #ocaml
mxns has quit [Ping timeout: 264 seconds]
neiluj has joined #ocaml
neiluj has joined #ocaml
neiluj has quit [Changing host]
malc_ has joined #ocaml
malc_ has quit [Quit: ERC (IRC client for Emacs 28.0.50)]
osa1_ has quit [Ping timeout: 265 seconds]
mxns has joined #ocaml
osa1 has joined #ocaml
<d_bot_> <myl> whats the best way to get ocaml syntax highlighting on vscode?
<d_bot_> <myl> im currently using the OCaml and Reason IDE plugin, but it doesn't appear to have any syntax highlighting for Ocaml
andreas31 has quit [Ping timeout: 268 seconds]
andreas31 has joined #ocaml
glass has joined #ocaml
theglass has quit [Ping timeout: 272 seconds]
<steenuil> @myl: I think the recommended plugin now is called OCaml Platform
<d_bot_> <rgrinberg> There’s an upcoming rpc feature to use it as a long running process. Not sure that will work for you though
neiluj has quit [Ping timeout: 260 seconds]
tane has joined #ocaml
mxns has quit [Ping timeout: 265 seconds]
mxns has joined #ocaml
mxns has quit [Ping timeout: 244 seconds]
nullcone has joined #ocaml
<d_bot_> <Butanium> Hey I don't understand why this flatten function is less optimized than the official one
<d_bot_> <Butanium> ```ocaml
<d_bot_> <Butanium> let rec flatten ll =
<d_bot_> <Butanium> match ll with
<d_bot_> <Butanium> | [] -> []
<d_bot_> <Butanium> | x :: xs ->
<d_bot_> <Butanium> let rec aux l = match l with
<d_bot_> <Butanium> | [] -> flatten xs
<d_bot_> <Butanium> | y :: ys -> y :: aux ys in aux x;;```
<d_bot_> <Butanium> The official one use the @ operator and I thought this would make the function O(n²)
<d_bot_> <Butanium> ```ocaml
<d_bot_> <Butanium> let rec flatten = function
<d_bot_> <Butanium> [] -> []
<d_bot_> <Butanium> | l::r -> l @ flatten r```
CissWit is now known as Johann
<nepascourir> I don't think this official one is 0(n²). it looks more like O(n) with n the number of elements in all the lists
<d_bot_> <darrenldl> it reads like they have the same lists traversal pattern and same time complexity, namely `aux` seems to be the same as `@`? (i might be being very silly as well)
<d_bot_> <craigfe> ```ocaml
<d_bot_> <craigfe> Does anyone know why the following can't be made covariant?
<d_bot_> <craigfe> # type +'a t = Leaf of 'a | Both : 'a t * 'b t -> ('a * 'b) t ;;
<d_bot_> <craigfe> Line 1, characters 0-59:
<d_bot_> <craigfe> Error: In this GADT definition, the variance of some parameter
<d_bot_> <craigfe> cannot be checked
<d_bot_> <craigfe> ```
<d_bot_> <craigfe> Probably a simpler instance of the same problem:
<d_bot_> <craigfe> ```ocaml
<d_bot_> <craigfe> type +'a t = Pair : 'a * 'b -> ('a * 'b) t ;;
<d_bot_> <craigfe> ```
mxns has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
<d_bot_> <craigfe> looks like this is a well-known (by people other than me) limitation: http://gallium.inria.fr/~scherer/research/variance_gadts/short_talk.pdf
mxns has quit [Ping timeout: 244 seconds]
<d_bot_> <craigfe> will use the force instead (https://github.com/let-def/lwd/blob/master/lib/lwd/lwd.ml#L58-L63)
<d_bot_> <Butanium> What does @ really do?
<d_bot_> <Butanium> Because for me on every l1@l2 use you do len(l1 + l2 operations)
<Fardale1> @ does l1 operations
<Fardale1> It does not need to unfold l2
<Fardale1> @ is similar to your aux function
<d_bot_> <craigfe> impl. is fairly easy to check, too: https://github.com/ocaml/ocaml/blob/trunk/stdlib/stdlib.ml#L294-L297
waleee-cl has joined #ocaml
<d_bot_> <Butanium> Oh ok thanks
vicfred has joined #ocaml
<d_bot_> <darrenldl> small extension: in practice with this type of flattening, space complexity could be a problem, in which case you'd want use sth from Seq
<d_bot_> <tsnobip> yeah unfortunately that wouldn't be a good fit for my use case but I'll take a look at how I can help with making the API public @rgrinberg. gpetiot gave me some nice hints already. 🙂
<d_bot_> <Butanium> The problem is that there are too many :: in a row while @ threat them list per list
<d_bot_> <darrenldl> both yours and stdlib flatten builds a (long) chain of `::` before the final reduction takes place
<d_bot_> <Butanium> So where does the space complexity come from 👀
<d_bot_> <darrenldl> (my statement about memory wasnt correct: transformation from list to seq to list would help move things to heap and not use up the stack space, but both approaches share the same space complexity)
<d_bot_> <darrenldl> well also depends on your data consumption pattern: if you only need a linear traversal of the list of lists, then seq is fine as end result, and avoids intermediate allocation
<d_bot_> <darrenldl> intermediate construction of a flat list*
nepascourir has quit [Quit: Leaving]
mxns has joined #ocaml
hosewiejacke has quit [Ping timeout: 276 seconds]
mbuf has quit [Quit: Leaving]
mxns has quit [Ping timeout: 240 seconds]
mxns has joined #ocaml
bartholin has quit [Quit: Leaving]
Haudegen has joined #ocaml
<d_bot_> <froyo> yo what happened to ocamloscope? what's the tea on that
<d_bot_> <froyo> seems dead
<d_bot_> <froyo> looked promising
<d_bot_> <froyo> hoogle is a godsend of course
zebrag has quit [Ping timeout: 256 seconds]
hosewiejacke has joined #ocaml
neiluj has joined #ocaml
neiluj has joined #ocaml
hosewiejacke has quit [Quit: Leaving]
guanche has joined #ocaml
sz0 has joined #ocaml
zebrag has joined #ocaml
narimiran has quit [Ping timeout: 260 seconds]
<d_bot_> <froyo> (so I thought an ocaml equiv would be carried to high glory by the community)
Neco has joined #ocaml
Neco is now known as Guest98915
Guest98915 has quit [Client Quit]
Carlos has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
Carlos is now known as Guest43923
zebrag has joined #ocaml
Guest43923 has quit [Client Quit]
Solrac has joined #ocaml
Solrac is now known as Tekato
Tekato has quit [Ping timeout: 240 seconds]
aquijoule__ has joined #ocaml
aquijoule_ has quit [Remote host closed the connection]
<d_bot_> <cemerick> Won't such a thing always be more awkward because of no type classes / modularity?
Jesin has quit [Quit: Leaving]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
beajeanm has quit [Quit: Ping timeout (120 seconds)]
beajeanm has joined #ocaml
Serpent7776 has quit [Quit: leaving]
engil has quit [Ping timeout: 246 seconds]
engil has joined #ocaml
wagle has quit [Ping timeout: 264 seconds]
wagle has joined #ocaml
so has quit [Ping timeout: 246 seconds]
so has joined #ocaml
<d_bot_> <Jo.Blade> Hello is anyone here use vim for ocaml dev ?
<companion_cube> sure
<guanche> why is it opam gives me this error when trying to compile it? File "src/dune_rules\\cram_exec.ml", line 293, characters 50-61:
<guanche> The field output_file does not belong to type sh_script
<d_bot_> <Jo.Blade> So, is someone know any vim addon to send sélection to an interactive interpreter ?
<companion_cube> I tried some and none were really nice :/
<d_bot_> <Jo.Blade> Uh
<d_bot_> <Jo.Blade> In fact I only need to have the log informations
<d_bot_> <Jo.Blade> Because there is no all type prints by default
<d_bot_> <Jo.Blade> And I prefer not write a lot of new functions just for logging array, lists, bool....
<d_bot_> <Jo.Blade> .
<d_bot_> <Jo.Blade> Maybe can I use an autocmd with a term buffer running ocaml...
guanche has quit [Read error: Connection reset by peer]
<companion_cube> ah well
<companion_cube> I write tons of printers 🤷
<companion_cube> you can look at ppx_deriving too
<d_bot_> <Jo.Blade> What is ppx_deriving ?
<d_bot_> <Jo.Blade> Yes but I can't understand what it does exactly
Tuplanolla has quit [Quit: Leaving.]
<d_bot_> <froyo> ocamloscope does some module-grouping -- my guess is it's too generic though.
<d_bot_> <froyo>
<d_bot_> <froyo> I would prefer if there were a bunch of community-submitted "standard" module-types that only matched on type sigs and not val names, thus allowing you to add more constraints to your queries if you wanted.. as long as the module in question implemented "a group of functions whose types match this constraint" so to speak.
<d_bot_> <froyo> autogenerates common boilerplate code for type declarations.
<d_bot_> <froyo> e.g. deriving sexp would give you sexp serializing functions for your type
<d_bot_> <froyo> similar to haskell's typeclass deriving if you have any experience with that
<d_bot_> <Jo.Blade> Thanks
<d_bot_> <Jo.Blade> No, ocaml is my first fonctional language
<d_bot_> <Jo.Blade> Before I use C and its derivatives
<d_bot_> <froyo> hm ok here's a more common example i suppose:
<d_bot_> <froyo> say you have a type like
<d_bot_> <froyo> `type something = { this: int; that: string }`
<d_bot_> <froyo> that looks like json and in fact there's a ppx_deriving extension that generates functions that would convert between this type and a json representation of it. and instead of writing those functions by hand, you just say something like
<d_bot_> <froyo> `type something = { ...same as before } [@@deriving json]`
<d_bot_> <froyo> or maybe look at
<d_bot_> <froyo> `type e = A | B | C`
<d_bot_> <froyo> this sum type looks a lot like an enum so it would be nice if we had the ability to convert between `A B C` and `0 1 2` without having to write the code for it, so here comes a similar use-case for ppx.
<d_bot_> <froyo> but ppx can do a lot more.. what if I wanted to embed an SQL query and have it generate modules, functions, or types? Some ppx somewhere probably offers
<d_bot_> <froyo> `[%sql {| SELECT .... FROM ... |} ]` though we're steering a little far from derivations here.
<d_bot_> <froyo>
<d_bot_> <froyo> ppx is more or less a program that runs on your source file after it's parsed then generates extra stuff for the compiler to work with. ocaml allows for arbitrary annotations inside `[@.....]`, `[%.....]`, as well as some other constructs.
tane has quit [Quit: Leaving]
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml
zebrag has quit [Quit: Konversation terminated!]
zebrag has joined #ocaml