<d_bot>
<RegularSpatula> dune will ignore folders starting with an underscore, if you just want to be lazy
<d_bot>
<RegularSpatula> or wait...you're using rust and ocaml together a lot right... you mention ignoring `target` dirs...you're trying to ignore compiled rust artifacts i bet?
<hackinghorn>
do sort operations waste space? like sort, rev, I need to create another list, make 2 lists. Should I use ref to save space?
<hackinghorn>
*list operations
<d_bot>
<leviroth> Are you familiar with garbage collection?
Tuplanolla has quit [Quit: Leaving.]
<d_bot>
<leviroth> Assuming you aren't still using the original unsorted list (and, if you were, using a ref wouldn't help), OCaml should clean up the unused list for you.
<hackinghorn>
ah thankss
<d_bot>
<leviroth> That isn't like a precise technical description
<d_bot>
<leviroth> But probably good enough unless you're actually noticing performance problems
<hackinghorn>
I have 2 sorted list a and b, I need to traverse the first one and for each element i, find the smallest but greater than a[i] in b. Normally in C, I need one traversal, how do I do it in OCaml with one traversal?
<hackinghorn>
I need something like a iterator or sth
<d_bot>
<Splingush> You'd pattern match on a 2-tuple consisting of both lists, so you have their respective heads and tails. If the head of b is not greater than the head of a, continue with the tail of b. You can use a when-condition in the matching.
<d_bot>
<darrenldl> hackinghorn: sounds like you should turn b into a search tree : D
<hackinghorn>
ahh thankss, I'll see
<d_bot>
<darrenldl> if you want to be really stingy on memory, then you'll have to use (big)array
<d_bot>
<darrenldl> (we encountered a memory problem somewhat, and so we had to use bigarray + binary search)
<hackinghorn>
ahh thxx
<hackinghorn>
that sounds great
<hackinghorn>
looks like I need a recursive function let rec solve a b =..
<d_bot>
<darrenldl> CCArray from containers has a binary search function i think
<d_bot>
<darrenldl> for search tree, you can just use Map from stdlib
<hackinghorn>
is there a way I can find the smallest number greater than X in a set S?
<d_bot>
<darrenldl> S.split then min_elt i guess?
<hackinghorn>
ahh ill try that
<hackinghorn>
eh that is not log(n) tho
[itchyjunk] has joined #ocaml
<d_bot>
<darrenldl> wait what's the time complexity then
jess is now known as catoshi_nyakamot
catoshi_nyakamot is now known as CatoshiNyakamoto
rgrinberg has quit [Ping timeout: 245 seconds]
<hackinghorn>
split is probably O(nlogn)
<hackinghorn>
I'm assuming Set is a balanced binary tree
rgrinberg has joined #ocaml
shawnw has joined #ocaml
shawnw has quit [Ping timeout: 245 seconds]
mbuf has joined #ocaml
motherfsck has quit [Ping timeout: 240 seconds]
motherfsck has joined #ocaml
waleee has quit [Ping timeout: 245 seconds]
CatoshiNyakamoto is now known as jess
motherfsck has quit [Ping timeout: 245 seconds]
motherfsck has joined #ocaml
zebrag has quit [Remote host closed the connection]
gravicappa has joined #ocaml
<d_bot>
<mimoo> yeah 😮
[itchyjunk] has quit [Remote host closed the connection]
Nahra`` has quit [Remote host closed the connection]
Nahra`` has joined #ocaml
Nahra`` has quit [Ping timeout: 265 seconds]
<d_bot>
<mimoo> I ended up removing the offending folder as part of the rule
vicfred has quit [Quit: Leaving]
motherfsck has quit [Ping timeout: 245 seconds]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Serpent7776 has joined #ocaml
xiongxin has joined #ocaml
wonko has joined #ocaml
motherfsck has joined #ocaml
mro has joined #ocaml
olle has joined #ocaml
hendursaga has quit [Remote host closed the connection]
hendursaga has joined #ocaml
hendursaga has quit [Ping timeout: 276 seconds]
<d_bot>
<darrenldl> hackinghorn: wait why split is nlogn, i presume one just yields the components of the search result?
hendursaga has joined #ocaml
<d_bot>
<darrenldl> oh wait...
<d_bot>
<darrenldl> ye im being very silly
Haudegen has joined #ocaml
glassofethanol has joined #ocaml
mro has quit [Remote host closed the connection]
hendursa1 has joined #ocaml
hendursaga has quit [Ping timeout: 276 seconds]
mro has joined #ocaml
mro has quit [Client Quit]
Nahra has joined #ocaml
brettgilio7 has joined #ocaml
brettgilio has quit [Ping timeout: 240 seconds]
brettgilio7 is now known as brettgilio
hendursa1 has quit [Ping timeout: 276 seconds]
hendursa1 has joined #ocaml
<olle>
Why did Freud use free association rather than hypnosis?
<olle>
Hm, wrong channel
average has joined #ocaml
kakadu has joined #ocaml
<hackinghorn>
lol olle
<olle>
Also it was explained on WP
RaeK5ook has joined #ocaml
<RaeK5ook>
gforge.inria.fr is down, perhaps forever. Did cudf.git alread find a new home?
<RaeK5ook>
Since it is a dependency of opam, I hope people take care of cudf.git?
bartholin has joined #ocaml
gravicappa has quit [Ping timeout: 245 seconds]
bartholin has quit [Ping timeout: 245 seconds]
bartholin has joined #ocaml
mpu has joined #ocaml
mpu has left #ocaml [#ocaml]
mpu has joined #ocaml
Haudegen has quit [Quit: Bin weg.]
xiongxin has quit [Ping timeout: 252 seconds]
Haudegen has joined #ocaml
xiongxin has joined #ocaml
waleee has joined #ocaml
[itchyjunk] has joined #ocaml
gravicappa has joined #ocaml
rgrinberg has joined #ocaml
<d_bot>
<Alistair> Is there a reason that OCaml decided to implicitly bind type variables existentially? Or is it just a historical peculiarity?
<d_bot>
<Alistair> And if so, are there any plans to change it?
<companion_cube>
you mean when you write `let f : 'a -> 'b = … `?
<d_bot>
<Alistair> Yeah, `'a` and `'b` are existential variables, not universal ones. Or "flexible" as opposed to "rigid"
<companion_cube>
they're not exactyl existential, I'd say
<companion_cube>
they're metas, to be unified with the actual type
<companion_cube>
this works if `f : int -> bool` for example
<companion_cube>
so it's not a quantifier at all
<Corbin>
This is akin to how an ordinary lambda is existential; `fun x -> ...` means that, for each x which happens to exist, there is an applicative expression for that x...
<d_bot>
<Alistair> this is equivalent to existential, you've basically said `exists a. a = type`
<Corbin>
...but the quantification actually ranges over *all* possible x, and similarly 'a and 'b might be existential type variables but they are universally quantifying over types.
<Corbin>
Maybe "existential" and "universal" aren't the best words for explaining how elements are selected from types?
<companion_cube>
@Alistair: it's a bit weird, cause the existential would be _outside_ the typing statement
<companion_cube>
`exists a b. f : a -> b`
<companion_cube>
that's quite unusual I'd say
<companion_cube>
a proper existential can be found in GADTs
<companion_cube>
type foo = Foo : 'a * ('a -> string) -> foo`
<companion_cube>
that does wrap an existential quantifier
<d_bot>
<Alistair> Not really, since the same occurs w/ explicit universal quantification e.g. `fun (type a) -> let id : a -> a = ...`
<companion_cube>
well, `let f : 'a -> 'b = …`
<companion_cube>
isn't the same as `let f : type a. a -> b = …`
<companion_cube>
(which isn't valid syntax but anyway)
<d_bot>
<Alistair> I know, I'm not saying they're the same. I'm saying that the binding of the variables would always occur outside the annotation. Since we use monotypes for annotations (which don't have binders).
<companion_cube>
the way I see it is that regular annotations don't have variables
<companion_cube>
but metavariables
<companion_cube>
there are places (type definitions) where you have actual binders
<companion_cube>
`type foo = { foo: type a b. … }` for the universal, and the GADT above for existentials, for example
<d_bot>
<Alistair> I'd disagree, monotypes are defined with a type variable. There is however no such thing as a free variable, so those variables must be bound at some point. An from the semantics I see when I do something like: `let foo (x : 'a) = let _ : 'a = true in x;;` its obviously an existential binding, since this has the type: `bool -> bool` and not a type error.
<companion_cube>
I disagree too, it's not a binding :p
<companion_cube>
you write a type schema that will unify with the actual type
<companion_cube>
you can't write an actual quantifier
<d_bot>
<Alistair> Yes, those a universal and existential bindings at the type level for variables, however, for variables to occur in annotations (in expressions), there must be a binder at the expression level (as seen in things like `fun (type a) -> ...`
<companion_cube>
(type a) is not a binder
<companion_cube>
it's just a way of naming a variable
<companion_cube>
(typically for 1st class modules, in my experience)
<d_bot>
<Alistair> It is, it binds the rigid type variable `a`
<companion_cube>
again the only true form of forall is in record/method types
<companion_cube>
hmmm
<companion_cube>
ok (type a) is a opaque variable, but it's weaker, in my memory? for polymorphic recursion it still doesn't cut it?
<companion_cube>
it's still a schema but with a rigid variable
<d_bot>
<octachron> there is also the explicit universal binding `'a. ... ` (e.g. `let rec f: 'a . .... `) for polymorphic recursion.
<companion_cube>
yes! right! the one needed for GADTs
<companion_cube>
that one is a quantifier alright
zebrag has joined #ocaml
<d_bot>
<Alistair> and would that be semantically equivalent `let rec f (type a) : ...`?
RaeK5ook has quit [Quit: Client closed]
<companion_cube>
I'm not sure, I think the `'a . …` forces the generalization
<d_bot>
<octachron> Not really.
<d_bot>
<octachron> `f: 'a. ... ` gives you more information about the type of `f` in `f` body.
<companion_cube>
ah, it generalizes before inferring f's body?
<companion_cube>
so that's why it works for polymorphic recursion ?
<d_bot>
<octachron> `f (type a)` gives you a rigid type, on which equation can be added with GADT.
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<d_bot>
<Alistair> In what sense? That `f` is universally quantified?
<companion_cube>
f's type in its own body, I think
<companion_cube>
and the body of the mutually recursive functions
<d_bot>
<octachron> Yes. And thus `let rec f: 'a. 'a -> unit -> 'a = fun x () -> ignore (f true); x` is polymorphic.
rgrinberg has joined #ocaml
<d_bot>
<Alistair> But why can we not do the same w/ `type a`? From my understanding, `a` is abstract (i.e. stands for some unknown type), then why can't it be quantified (just as we think `'a` in `'a list` stands for some unknown type)
<d_bot>
<octachron> In `let f = fun (type a) -> ... `, `f` and `a` are unrelated. Contrarily in `let f: typexpr = ...`, `typexpr` is an explicit type annotation on `f`.
glassofethanol has quit [Quit: leaving]
[itchyjunk] has quit [Remote host closed the connection]
xiongxin has quit [Ping timeout: 265 seconds]
xiongxin has joined #ocaml
<d_bot>
<Alistair> But supposing that `a` is used within `...`, then we may deduce that it's universally quantified and hence the inferred type of `f` is quantified?
xiongxin has quit [Read error: Connection reset by peer]
olle has quit [Ping timeout: 245 seconds]
<companion_cube>
I might be totally wrong on that, but OCaml types don't even have proper quantifiers
<companion_cube>
only schemas
bartholin has quit [Quit: Leaving]
<companion_cube>
the 'a. … above also forces 'a to remain generalized
<d_bot>
<Alistair> schemas have quantifiers: ```
<d_bot>
<Alistair> sigma ::= tau | forall a. sigma
<d_bot>
<Alistair> ```
<companion_cube>
no more than prolog terms have quantifiers :)
<d_bot>
<octachron> Explicit rigid variables does not help with higher-rank inference. Consider, `type 'a t = Bool: bool t let rec f (type a) (w:a t) (x:a) = match w with Bool -> f Bool; x` both `bool t -> bool -> bool` and `'a. 'a t -> 'a -> 'a` would be valid.
wonko has quit [Ping timeout: 252 seconds]
<d_bot>
<Alistair> but `'a. 'a t -> 'a -> 'a` is clearly the principal type, since `bool t -> bool -> bool` is simply an instance of it.
<companion_cube>
you can still have non bound variables in it, btw
CodeBitCookie[m] has quit [Ping timeout: 260 seconds]
berberman has joined #ocaml
Franciman has joined #ocaml
CodeBitCookie[m] has joined #ocaml
kakadu has quit [Quit: Konversation terminated!]
olle_ has joined #ocaml
wonko has joined #ocaml
mbuf has quit [Quit: Leaving]
mortemeur has joined #ocaml
ocabot_ has quit [Remote host closed the connection]
ocabot has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Skyfire has quit [Quit: WeeChat 3.3]
Skyfire has joined #ocaml
gravicappa has quit [Ping timeout: 245 seconds]
<cemerick>
Drup: I discovered that data- and aria- attributes need to be encoded in camelCase (https://github.com/ocsigen/tyxml/blob/6c9dd5b01e4850d6d9fba03ddea7150a1bfcb40b/jsx/tyxml_jsx.ml#L25 for anyone looking on), but other attributes (e.g. svg's stroke-* attrs) need to be snake_case. Is the latter an artifact of jsx, or have I just not found the bit in tyxml where that different encoding is set up?
hendursa1 has quit [Quit: hendursa1]
hendursaga has joined #ocaml
wonko has quit [Ping timeout: 265 seconds]
Tuplanolla has joined #ocaml
average has quit [Quit: Connection closed for inactivity]
<Drup>
it's an artifact of JSX, we tried to stay consistent with the react jsx
<Drup>
but I think we tried to accept both when possible
<Drup>
if not, it should probably be fixed
vicfred has joined #ocaml
rgrinberg has joined #ocaml
olle_ has quit [Quit: leaving]
<cemerick>
Drup: yeah, it's slightly borked; `ariaHidden="true"` works, but `aria_hidden="true"` yields `aria-_hidden="true"` in the rendered html
Serpent7776 has quit [Quit: leaving]
xand0 has quit [Ping timeout: 245 seconds]
caasih has quit [Ping timeout: 268 seconds]
kevinsjoberg has quit [Ping timeout: 260 seconds]
cbarrett has quit [Ping timeout: 260 seconds]
cemerick has quit [Ping timeout: 268 seconds]
conjunctive has quit [Ping timeout: 260 seconds]
Boarders has quit [Ping timeout: 268 seconds]
v0idpwn has quit [Ping timeout: 246 seconds]
jyc has quit [Ping timeout: 260 seconds]
JSharp has quit [Ping timeout: 264 seconds]
v0idpwn has joined #ocaml
caasih has joined #ocaml
conjunctive has joined #ocaml
cbarrett has joined #ocaml
Boarders has joined #ocaml
JSharp has joined #ocaml
kevinsjoberg has joined #ocaml
xand0 has joined #ocaml
jyc has joined #ocaml
dh` has quit [Quit: brb]
cemerick has joined #ocaml
dh` has joined #ocaml
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Tuplanolla has quit [Quit: Leaving.]
Haudegen has quit [Quit: Bin weg.]
rgrinberg has joined #ocaml
mortemeur has quit [Read error: Connection reset by peer]
rgrinberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]