<lewis1711>
I forgot about the unfortunate memory usage of utop. I am assuming I am using it in some idiomatic way (Editing a file, saving it, then going #use "./my_file.ml" to play with it)
<lewis1711>
unidiomatic way rather
ygrek_ has joined #ocaml
madroach has quit [Ping timeout: 260 seconds]
madroach has joined #ocaml
ril has joined #ocaml
ygrek_ has quit [Ping timeout: 240 seconds]
sh0t has joined #ocaml
ontologiae has joined #ocaml
<echo-area>
Can I match arguments in the argument place like in Haksell? E.g. let f PATTERN = ... Or do I need to use `function`?
dtscode is now known as nchambers
sh0t has quit [Ping timeout: 255 seconds]
nicoo has quit [Remote host closed the connection]
<dmbaturin>
echo-area: Technically you can, but there is no way to make it exhaustive for types with more than one variant if you use sum types.
<dmbaturin>
Or if you use more than one pattern in general. So in this case you need 'match <pat> with' or the 'function' sugar.
_um has joined #ocaml
<dmbaturin>
Standalone "let f (x, y) = ..." or "let f _ = ..." will work, but "let f 0 = true let f _ = false" will be interpreted as shadowing rather than additional definition.
<echo-area>
dmbaturin: I see. That is due to only one such `let` definition can exist. Thank you.
<echo-area>
Oh
<echo-area>
I should not have said `can exist`
<echo-area>
Many can exist but the last will override the others
ryanartecona has joined #ocaml
nicoo has joined #ocaml
ncthom91 has joined #ocaml
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_um has quit [Read error: Connection reset by peer]
^elyse^ has joined #ocaml
ontologiae has quit [Ping timeout: 244 seconds]
_um has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
contempt has quit [Ping timeout: 255 seconds]
contempt has joined #ocaml
ncthom91 has joined #ocaml
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hugomg has joined #ocaml
pacmann has quit [Remote host closed the connection]
raphaelss has quit [Read error: Connection reset by peer]
tmtwd has quit [Ping timeout: 240 seconds]
^elyse^ has quit [Quit: Leaving...]
Algebr has joined #ocaml
rgrinberg2 has quit [Ping timeout: 250 seconds]
coody has joined #ocaml
rgrinberg2 has joined #ocaml
ncthom91 has joined #ocaml
gsingh93_ has quit [Quit: Connection closed for inactivity]
hugomg has quit [Quit: Leaving]
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ncthom91 has joined #ocaml
rgrinberg2 has quit [Ping timeout: 265 seconds]
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FreeBirdLjj has joined #ocaml
mac10688 has quit [Ping timeout: 240 seconds]
ncthom91 has joined #ocaml
ncthom91 has quit [Client Quit]
rgrinberg2 has joined #ocaml
_um has quit [Ping timeout: 264 seconds]
j0sh__ has quit [Ping timeout: 264 seconds]
vbmithr has quit [Ping timeout: 264 seconds]
meiji11 has quit [Ping timeout: 264 seconds]
j0sh has joined #ocaml
vbmithr has joined #ocaml
rgrinberg2 has quit [Ping timeout: 276 seconds]
<lewis1711>
given something like "type t = A | B | D ...", can I use pattern matching to express "all members of t except A" ?
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Enjolras>
lewis1711: you can do something like match value with A -> do something with A | _ -> do something with all members except A
ryanartecona has joined #ocaml
nullcatxxx_ has joined #ocaml
darkf has joined #ocaml
rgrinberg2 has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
wagle has quit [Remote host closed the connection]
Bahman has joined #ocaml
aantron has quit [Remote host closed the connection]
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
wagle has joined #ocaml
Bahman has quit [Read error: Connection reset by peer]
MercurialAlchemi has joined #ocaml
Bahman has joined #ocaml
govg has quit [Ping timeout: 264 seconds]
govg has joined #ocaml
Bahman_ has joined #ocaml
Bahman__ has joined #ocaml
Bahman has quit [Ping timeout: 240 seconds]
Bahman_ has quit [Ping timeout: 240 seconds]
Bahman_ has joined #ocaml
Bahman__ has quit [Ping timeout: 240 seconds]
Bahman has joined #ocaml
Bahman_ has quit [Ping timeout: 252 seconds]
govg has quit [Ping timeout: 264 seconds]
govg has joined #ocaml
Bahman_ has joined #ocaml
Bahman has quit [Ping timeout: 252 seconds]
solrize has left #ocaml ["Leaving"]
contempt has quit [Ping timeout: 240 seconds]
Bahman__ has joined #ocaml
contempt has joined #ocaml
groovy2shoes has quit [Read error: Connection reset by peer]
Bahman_ has quit [Ping timeout: 250 seconds]
mort___ has joined #ocaml
govg has quit [Ping timeout: 260 seconds]
rgrinberg2 has joined #ocaml
nullcatxxx_ has joined #ocaml
johnf has joined #ocaml
rgrinberg2 has quit [Ping timeout: 264 seconds]
johnf has quit [Remote host closed the connection]
mort___ has quit [Quit: Leaving.]
govg has joined #ocaml
nullcatxxx_ has quit [Read error: Connection reset by peer]
nullcatxxx_ has joined #ocaml
Algebr has quit [Ping timeout: 240 seconds]
meiji11` has quit [Remote host closed the connection]
tmtwd has quit [Ping timeout: 240 seconds]
eni has joined #ocaml
govg has quit [Ping timeout: 240 seconds]
govg has joined #ocaml
orbifx has joined #ocaml
bjorkintosh has quit [Quit: Leaving]
ontologiae has joined #ocaml
ril has joined #ocaml
ril has quit [Max SendQ exceeded]
Bahman__ has quit [Quit: Ave atque vale]
coody has quit [Quit: Connection closed for inactivity]
ousado_ has joined #ocaml
ousado has quit [Ping timeout: 276 seconds]
sh0t has joined #ocaml
demonimin has joined #ocaml
contempt has quit [Ping timeout: 252 seconds]
djellemah has quit [Ping timeout: 265 seconds]
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
contempt has joined #ocaml
pierpa` has quit [Ping timeout: 260 seconds]
Haudegen has quit [Ping timeout: 240 seconds]
ggole has joined #ocaml
Haudegen has joined #ocaml
kay has quit [Ping timeout: 246 seconds]
ggole has quit [Ping timeout: 260 seconds]
ggole has joined #ocaml
^elyse^ has joined #ocaml
larhat has joined #ocaml
Bahman has joined #ocaml
<^elyse^>
is there a library that offers the same functionality as pervasive "ref" except that (=) on such values uses identity equality instead of structural equality?
<python476>
^elyse^: interesting question
larhat has quit [Quit: Leaving.]
ousado_ has quit [Ping timeout: 240 seconds]
<^elyse^>
it's not hard to implement yourself though
<^elyse^>
you can implement it as a ('a ref, Int64.t) pair where the Int64.t is generated from an auto-incrementing atomic global
<ggole>
You could be a bit more efficient than that
<^elyse^>
how? :P
<ggole>
type 'a foo = { mutable contents : 'a; id : Int64.t }
<ggole>
One less indirection
<^elyse^>
yeah sure
<ggole>
You also don't get the same treatment for arrays, hash tables, queues, and other mutable structures
<ggole>
If you are after a nice consistent 'egal' like equality, (=) isn't it :/
mort___ has joined #ocaml
lobo has joined #ocaml
^elyse^ has quit [Quit: Leaving]
djellemah has joined #ocaml
rgrinberg2 has joined #ocaml
rgrinberg2 has quit [Ping timeout: 246 seconds]
ousado_ has joined #ocaml
lewis1711 has quit [Ping timeout: 244 seconds]
zpe has joined #ocaml
divyanshu has joined #ocaml
divyanshu has quit [Read error: No route to host]
divyanshu has joined #ocaml
jgjl has joined #ocaml
Nahra has quit [Read error: Connection reset by peer]
Nahra has joined #ocaml
troydm has quit [Quit: What is hope? That all of your wishes and all of your dreams come true? (C) Rau Le Creuset]
<zozozo>
^elyse^: why do you not use physical equality (==) ?
mort___ has quit [Quit: Leaving.]
BitPuffin|osx has joined #ocaml
divyanshu has quit [Read error: Connection reset by peer]
raphaelss has joined #ocaml
divyanshu has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
jgjl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rgrinberg2 has joined #ocaml
Haudegen has joined #ocaml
jgjl has joined #ocaml
rgrinberg2 has quit [Ping timeout: 252 seconds]
JuggleTux has joined #ocaml
kushal has joined #ocaml
jgjl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jgjl has joined #ocaml
ousado_ is now known as ousado
ousado has quit [Changing host]
ousado has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 240 seconds]
divyanshu has quit [Read error: No route to host]
divyanshu has joined #ocaml
divyanshu has quit [Client Quit]
<baum>
reconnect
groovy2shoes has joined #ocaml
JuggleTux has left #ocaml [#ocaml]
julienXX has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
BitPuffin|osx has joined #ocaml
rgrinberg2 has joined #ocaml
kushal has quit [Ping timeout: 276 seconds]
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ontologiae has joined #ocaml
ggole has joined #ocaml
ontologiae has quit [Ping timeout: 246 seconds]
mort___ has quit [Quit: Leaving.]
zpe has joined #ocaml
zpe has quit [Ping timeout: 246 seconds]
orbifx2 has joined #ocaml
orbifx has quit [Ping timeout: 246 seconds]
ollehar has quit [Quit: ollehar]
zpe has joined #ocaml
zpe has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 250 seconds]
orbifx2 has quit [Ping timeout: 252 seconds]
eni has quit [Remote host closed the connection]
groovy2shoes has quit [Quit: Leaving]
Haudegen has joined #ocaml
coody has joined #ocaml
tmtwd has quit [Ping timeout: 240 seconds]
eni has joined #ocaml
mort___ has joined #ocaml
Kakadu has joined #ocaml
jgjl has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
lewis1711 has joined #ocaml
jave has joined #ocaml
Bahman has quit [Quit: Ave atque vale]
lewis1711 has quit [Ping timeout: 276 seconds]
rgrinberg2 has quit [Ping timeout: 272 seconds]
orbifx has joined #ocaml
zpe has joined #ocaml
darkf has quit [Quit: Leaving]
perturbation has joined #ocaml
zpe has quit [Ping timeout: 260 seconds]
ollehar has joined #ocaml
ontologiae has joined #ocaml
ontologiae has quit [Ping timeout: 255 seconds]
mort___ has quit [Quit: Leaving.]
troydm has joined #ocaml
ggole has quit [Ping timeout: 255 seconds]
rgrinberg2 has joined #ocaml
ynniv has joined #ocaml
rgrinberg2 has quit [Ping timeout: 240 seconds]
<ynniv>
merlin is having trouble finding Cryptokit on my Mac because it finds the module in capitalized “Cryptokit.mli” and lowercased “cryptokit.mli”. Is this a common problem?
ygrek_ has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
slash^ has quit [Read error: Connection reset by peer]
<ynniv>
Hmm. Works if I add ’S /path/to/cryptokit/‘ instead of ‘PKG cryptokit’
ynniv has quit [Quit: ynniv]
^elyse^ has joined #ocaml
ontologiae has joined #ocaml
nullcatxxx_ has joined #ocaml
damason has quit [Ping timeout: 240 seconds]
python476 has quit [Ping timeout: 246 seconds]
nopf_ is now known as nopf
zpe has joined #ocaml
nullcatxxx_ has quit [Ping timeout: 240 seconds]
mort___ has joined #ocaml
zpe has quit [Ping timeout: 250 seconds]
MercurialAlchemi has quit [Ping timeout: 250 seconds]
nullcatxxx_ has joined #ocaml
dhil has joined #ocaml
rgrinberg2 has joined #ocaml
pierpa` has joined #ocaml
perturbation has quit [Quit: Leaving]
damason has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
types has joined #ocaml
<types>
i have a Core Time.t ref and want to dereference it with !, but i get this error
<types>
Error: This expression has type Core.Std.Time.t ref This is not a function; it cannot be applied.
<companion_cube>
you wrote !r where r is the referecne?
<^elyse^>
types: show more context
<^elyse^>
as in, the actual code
<types>
let update_heartbeat t = let time = ! t.next_heartbeat in if time Time.(<.) (Time.now ()) then begin ZMQ.Socket.send t.cluster "Alive"; t.next_heartbeat := Time.add (Time.now ()) (Time.Span.of_float 2) end else ()
<^elyse^>
you are applying time to two arguments here
<^elyse^>
I think you mean to apply Time.(<.), i.e. "if Time.(<.) time (Time.now ()) then"
<types>
i confused the infix operator..
<types>
^elyse^: still the same error
<types>
why is the dereferencing not working?
<j0sh>
is there a way to write a polymorphic variadic apply function? eg, "let apply f x = apply (f x)" that takes something like "apply foo "abc" 123" where val foo : (string -> int -> ...) or "apply bar 456 "abc"" where val bar : (int -> string -> ...) ?
<j0sh>
i'm mostly having a hard time trying to figure out how to determine the base case
<j0sh>
and getting it all to type check...
<mrvn>
There is only one case
<mrvn>
apply: ('a -> 'b) -> 'a -> 'b
<mrvn>
let apply f x f x
<mrvn>
let apply f x = f x
<j0sh>
is there a way to make that work with labels?
<j0sh>
(should have mentioned that earlier)
<mrvn>
let apply f = f
^elyse^ has quit [Quit: Leaving...]
<j0sh>
hmm
<j0sh>
my issue is without a 'recursive' apply there's no way for me to hold/process the result internally
<j0sh>
maybe continuations or something? i don't know
nullcatxxx_ has joined #ocaml
<j0sh>
i guess more what i'm trying to say is there a way of passing all the arguments of a given function as a single parameter to 'apply' and execute on that?
<mrvn>
there isn't unless you construct an N-tuple with GADTs
<j0sh>
hmm, alright
nullcatxxx_ has quit [Read error: Connection reset by peer]
igoroliveira has joined #ocaml
nullcatxxx_ has joined #ocaml
larhat has joined #ocaml
mort___ has quit [Quit: Leaving.]
lobo has quit [Quit: zleep]
<Leonidas>
has anyone tried core async on mirage? does that work?
<Leonidas>
j0sh: yes, I also wondered whether there is an analogin to apply from Lisp but turns out it is inherently type unsafe.
<Leonidas>
or "inherently untyped"
<Leonidas>
one of the issues is that lists may have n arguments, whereas the arity of functions in ocaml is always fixed
<j0sh>
Leonidas: ah, didn't realize there was a function in lisp that did exactly that (and actually called 'apply', no less)