<octachron>
_obad_: as far as I can see, adding a scalar to a vector is not supported by BLAS (probably because it is a quite unnatural operation in generic vector spaces)
<_obad_>
it's ok I'll just use axpy and a vector of ones. close enough
mal`` has quit [Ping timeout: 248 seconds]
<octachron>
it is probably the easiest way if you are not memory limited
tmtwd_ has joined #ocaml
octachron has quit [Quit: Leaving]
shinnya has quit [Ping timeout: 240 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
keen__________16 has joined #ocaml
keen__________15 has quit [Ping timeout: 276 seconds]
nullca___ has quit [Ping timeout: 248 seconds]
BitPuffin|osx has joined #ocaml
amnn has joined #ocaml
dpzmick has joined #ocaml
dpzmick has quit []
tmtwd_ has quit [Ping timeout: 264 seconds]
rgrinberg has quit [Ping timeout: 248 seconds]
rgrinberg has joined #ocaml
nico__ has joined #ocaml
Hannibal_Smith has quit [Ping timeout: 264 seconds]
sepp2k has quit [Quit: Leaving.]
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ygrek has quit [Ping timeout: 246 seconds]
psy_ has quit [Remote host closed the connection]
psy_ has joined #ocaml
amnn has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
tmtwd has joined #ocaml
darkf has joined #ocaml
nico__ has quit [Read error: Connection reset by peer]
Hannibal_Smith has joined #ocaml
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 248 seconds]
darkf_ is now known as darkf
mal`` has joined #ocaml
struktured has quit [Ping timeout: 246 seconds]
struktured has joined #ocaml
MercurialAlchemi has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 264 seconds]
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tmtwd has quit [Remote host closed the connection]
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 248 seconds]
MercurialAlchemi has quit [Ping timeout: 246 seconds]
darkf_ is now known as darkf
manud has quit [Quit: manud]
empyrean has quit [Ping timeout: 244 seconds]
samrat has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
samrat has joined #ocaml
ggole has joined #ocaml
kushal has joined #ocaml
accidus has quit [Ping timeout: 246 seconds]
accidus_benartiu has quit [Ping timeout: 256 seconds]
Bhavya has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 246 seconds]
accidus_benartiu has joined #ocaml
accidus has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 264 seconds]
kushal has quit [Quit: Leaving]
keep_learning has joined #ocaml
<keep_learning>
Hello everyone
<keep_learning>
I am relatively new to OCaml so pardon me if I sound stupid.
<keep_learning>
I am trying use Lwt library
<keep_learning>
and it's already installed on system as shown by opam list
<keep_learning>
but when I am writing open Lwt
<keep_learning>
write some code in emacs (C-c C-b) gives me unbound module
octachron has joined #ocaml
<octachron>
keep_learning, you need to load the lwt package: try #use "topfind";; #require "lwt";;
jonludlam has quit [Ping timeout: 240 seconds]
<keep_learning>
octachron: Thank you
ricochet1k has joined #ocaml
Simn has joined #ocaml
kushal has joined #ocaml
ollehar has joined #ocaml
ollehar has quit [Remote host closed the connection]
ollehar has joined #ocaml
<Maelan>
23:30 flux│ in fact that's probably a relatively common use: handling impossible match cases the compiler cannot see are impossible → I usually raise an exception Wont_happen for that purpose. :-)
<Maelan>
But I agree the assert false is sometimes convenient, especially with pattern matching.
<flux>
maelan, there's really no different between assert false, raise Wont_happen and failwith "nope :-(", but people like me still like assert false a lot :)
<flux>
s/rent/rence/
samrat has quit [Quit: Computer has gone to sleep.]
tane has joined #ocaml
samrat has joined #ocaml
<ggole>
assert false gives you the location
ricochet1k has left #ocaml ["PING 1436514324"]
octachron has quit [Quit: Leaving]
<flux>
yeah, even when backtraces aren't on
tane has quit [Ping timeout: 256 seconds]
samrat has quit [Quit: Computer has gone to sleep.]
sh0t has joined #ocaml
thomasga has joined #ocaml
<Maelan>
You are right.
tane has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
huza has joined #ocaml
<Maelan>
But as someone mentionned earlier, this could be achieved with an “assert_false” primitive as well. To me it would avoid the awkwardness of something that looks like a function call, but with special treatment when the argument is syntactically equal to some value.
<Maelan>
Anyway, things are like that for some reasons, it’s no more time to change them.
<Maelan>
I guess this kind of things can be achieved with a camlp4’s alternative syntax.
rgrinberg has joined #ocaml
<ggole>
assert isn't a function call for any kind of argument...
samrat has joined #ocaml
<Maelan>
I know, only it *looks like*…
Haudegen has joined #ocaml
rgrinberg has quit [Ping timeout: 265 seconds]
matason has joined #ocaml
sivoais has quit [Ping timeout: 252 seconds]
sh0t has quit [Ping timeout: 265 seconds]
sivoais has joined #ocaml
AltGr has left #ocaml [#ocaml]
yomimono has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
samrat has joined #ocaml
dsheets has quit [Ping timeout: 256 seconds]
samrat has quit [Client Quit]
samrat has joined #ocaml
matason has quit [Ping timeout: 256 seconds]
manud has joined #ocaml
manud has quit [Quit: manud]
jonludlam has joined #ocaml
Reventlov has quit [Quit: leaving]
Reventlov has joined #ocaml
ygu_ has quit [Quit: leaving]
yomimono has quit [Ping timeout: 256 seconds]
dsheets has joined #ocaml
huza has quit [Quit: WeeChat 0.3.8]
Kakadu has joined #ocaml
creichert has quit [Ping timeout: 248 seconds]
yomimono has joined #ocaml
kaustuv has joined #ocaml
<kaustuv>
Is it possible to use 'opam switch' to switch to a compiler toolchain that is not managed by opam?
nullcat_ has joined #ocaml
<kaustuv>
For example, say it's the ocamljava binary distribution
<theblatte>
there's "opam switch system", I don't know if it helps
<theblatte>
opam switch list --all
nullca___ has joined #ocaml
<kaustuv>
But system seems to be hard-coded to what's installed with dpkg
<theblatte>
ah, I thought it would just look at $PATH so you can install your own ocaml toolchain manually
nullcat_ has quit [Ping timeout: 246 seconds]
KDr2 has quit [Ping timeout: 276 seconds]
rgrinberg has joined #ocaml
kaustuv has left #ocaml ["ERC Version 5.3 (IRC client for Emacs)"]
rgrinberg has quit [Ping timeout: 252 seconds]
nullcat has joined #ocaml
nullca___ has quit [Ping timeout: 240 seconds]
xificurC_ has joined #ocaml
xificurC has quit [Ping timeout: 264 seconds]
KDr2 has joined #ocaml
antegallya has joined #ocaml
nullca___ has joined #ocaml
nullcat has quit [Ping timeout: 264 seconds]
xificurC_ has quit [Quit: WeeChat 1.2]
xificurC has joined #ocaml
tmtwd has joined #ocaml
pyon is now known as magical-imouto
kushal has quit [Ping timeout: 264 seconds]
tmtwd has quit [Ping timeout: 256 seconds]
mort___ has joined #ocaml
thomasga has quit [Quit: Leaving.]
kushal has joined #ocaml
|jbrown| has quit [Quit: Client exiting]
thomasga has joined #ocaml
ceryo has joined #ocaml
thomasga has quit [Quit: Leaving.]
tane has quit [Quit: Verlassend]
nullca___ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rand000 has joined #ocaml
Haudegen has quit [Ping timeout: 246 seconds]
Haudegen has joined #ocaml
tmtwd has joined #ocaml
antegallya has quit [Ping timeout: 252 seconds]
nullcat_ has joined #ocaml
nullca___ has joined #ocaml
mort___ has left #ocaml [#ocaml]
nullcat_ has quit [Ping timeout: 250 seconds]
rgrinberg has joined #ocaml
samrat has quit [Quit: Computer has gone to sleep.]
rgrinberg has quit [Ping timeout: 265 seconds]
kushal has quit [Quit: Leaving]
thomasga has joined #ocaml
nullca___ has quit [Quit: gone...]
nullcat has joined #ocaml
nullcat is now known as nullcat_
<nullcat_>
``type t = S of s and s = T of t;; let rec x = S y and y = T x;;`` gives back ``val x : t = S (T <cycle>) val y : s = T (S <cycle>) ``
<nullcat_>
val x : t = S (T <cycle>) val y : s = T (S <cycle>)
keep_learning has quit [Quit: Page closed]
<nullcat_>
my question is when I start to traverse starting from "x", how can I know I already visit x when i reach y.
<nullcat_>
don't know if it's a trivial problem but i am not very clear how to do this right now..
Submarine has joined #ocaml
Submarine has joined #ocaml
<ggole>
In theory there's no way: in practice you can use ==
<Maelan>
ggole, why don’t you regard == as part of the “theory”?
<ggole>
It isn't defined to do what it needs to do to solve that problem.
<ggole>
(But it will do so in practice, at least with the current compiler.)
<Drup>
Maelan: == is ill defined
<Maelan>
I don’t understand, what nullcat_ really wants is comparing pointer values, isn’t it the semantics of == ?
<Maelan>
(saved for ints and the like)
<Drup>
Maelan: precisely, did you knew constant constructors where ints ?
<Maelan>
Yep
struktured has quit [Ping timeout: 250 seconds]
<ggole>
"On mutable types such as references, arrays, byte sequences, records with mutable fields and objects with mutable instance variables, e1 == e2 is true if and only if physical modification of e1 also affects e2. On non-mutable types, the behavior of ( == ) is implementation-dependent; however, it is guaranteed that e1 == e2 implies compare e1 e2 = 0."
<ggole>
nullcat_'s example falls under the problematic second sentence.
<Maelan>
But here we want to explore a data structure and see if we already run that way, so probably the == test won’t be on integers or bools or constant constructors either.
<Drup>
probably :3
<Drup>
I mean, it's mostly playing with fire at this point, it may works, or not, depending on how the compiler/runtime works
<nullcat_>
ummm... i think i should state my problem with more details. hold on...
Hannibal_Smith has quit [Quit: Leaving]
<Drup>
sure, it works, and lot's of people use it, it doesn't make it well defined
<ggole>
I wonder how you'd support identity cleanly
<ggole>
A typeclass maybe
<Drup>
ggole: same as equality, I would say
Bhavya has quit [Quit: Quit the channel]
<ggole>
But equality proceeds by looking at the parts. How do you look at the identity?
<Drup>
issue may arises if your compile does a lot of constant folding/automatic sharing
<Drup>
(like .. ghc)
<Maelan>
Okay, I thought the execution internals (at least gross principles), thus ==, were defined with the language itself.
<Maelan>
But it does not make great practical differences, since there is only one implementation of OCaml, right?
<ggole>
The implementation evolves over time
Haudegen has quit [Remote host closed the connection]
<ggole>
Even in practice there have been some optimisations added that affect the behaviour of ==
<ggole>
Eg, constructors applied to all constant arguments become constants rather than allocated each time
rossberg has quit [Remote host closed the connection]
<ggole>
In theory bit-equal constructors that have different types could be numbered together, too
<ggole>
(That one is probably pretty marginal.)
<Maelan>
For constant data, I assume, otherwise it will lead to issues with garbage collection?
<Maelan>
Er, no.
<Maelan>
As long as there exists a reference to the data, it won’t be collected.
rossberg has joined #ocaml
<Maelan>
I answer myself. :-)
<ggole>
Yep.
<Maelan>
But, what happens with mutable data?
<ggole>
You have to preserve the semantics of mutation, so the objects more or less have to be disjoint
<ggole>
I suppose you could split the object into immutable and mutable parts and share the immutable part, but that doesn't seem like it would be an improvement.
<ggole>
Isn't that was what SML did, with refs?
<ggole>
s/was//
<Maelan>
In fact I do not find any example where you get bitwise-equal constructors with two unrelated mutable fields.
<Maelan>
I mean, if I write ``type s = S of int ref type t = T of int ref let s = S {contents=0} let t = T {contents=0}``
psy_ has quit [Ping timeout: 250 seconds]
<Maelan>
This creates two distinct refs, thus the values are not bitwise-equal.
<Maelan>
In order to get equality, I should use the same ref in both places, but then we actually want that mutation of s affects t.
<ggole>
Consider a case with more fields/elements. The immutable ones could be shared (which would involve the compiler introducing a pointer).
<ggole>
Oh, but that *isn't* what SML did. Forget that.
rgrinberg has joined #ocaml
Haudegen has joined #ocaml
psy_ has joined #ocaml
<nullcat_>
https://gist.github.com/marklrh/a31197476027a7eba31a ah.. here is what I am doing. I need to feed json_parser into a metaocaml function so that function gives me piece of optimized parsing code. The thing is that, I don't want to fall into infinite loop when generating code. So, I hope there is some mechanism that can help me. One may say "why not extend your type _ cgrammar with an int (an identifier) so you can know if you have visited
<nullcat_>
before", well, the reason is complicated....
Haudegen has quit [Read error: Connection reset by peer]
thomasga has quit [Quit: Leaving.]
Haudegen has joined #ocaml
<nullcat_>
ideally, i treat this json_parser value as a graph so i do some analysis and then I can generate code of something like "let rec ... = ... and ... = ... "
hay207 has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 246 seconds]
<nullcat_>
ppx might help here, but i don't want to use ppx in addition to metaocaml..
<Maelan>
I ran into trouble recently when trying to do something similar to what nullcat_ wants. I first used a hashtable to store visited nodes. I stored the result of ‘Obj.repr’ applied on the elements (yes, that was crappy), in order to prevent Hashtbl.find to use structural equality (what would possibly not terminate…).
<Maelan>
But of course, I got plenty of bugs and fails.
<Maelan>
*failures
<Maelan>
In fact, at first I stored kind of addresses as ints obtained with ‘Obj.magic’ (yes, thats was crappier).
<ggole>
Yeah, that won't work
<Maelan>
But then I figured out than addresses change because of the GC.
<ggole>
The "proper" way to do it in OCaml is to assign an int id and use that as the key
<Maelan>
Anyway I needed an ID for fancy printing unbound type variables (it was a type unification algorithm, and the nodes where type variables that could point to other types, thus allowing joins and cycles).
<nullcat_>
as i said, the reason why i cannot do this is complicated. here is the reason, if i add such key, i need to do "Left (nonce (), ..., ...)" or "Repsep (nonce (), ...)". User needs to write this "nonce ()" explicitly, which definitely creates hassle. Then, one might ask why don't you create a wrapper function that automatically handles this. Ok, the reason is that, if i do this, the compiler will think "let rec n1 = e1 and n2 = e2 ... " is
<ggole>
As for your let rec problem... I'm not sure how to fix that
<ggole>
In some cases you can proceed by passing the problematic value around as an argument
<nullcat_>
the problematic value ?
Haudegen has joined #ocaml
BitPuffin has joined #ocaml
<ggole>
The let rec problem usually turns up because you have a binding that is the result of an application
<ggole>
eg, the v in let rec f a = ... and v = f foo
<nullcat_>
ok
valli has left #ocaml ["."]
<Maelan>
One more weird question: is there any chance that ‘x == x’ reports false due to garbage collecting taking place between the evaluation of both operands? (x can be some complex expression)
thomasga has joined #ocaml
Reventlov has quit [Quit: leaving]
Reventlov has joined #ocaml
<zozozo>
I'd say no, since garbage collection is triggered by allocation and testing equality doesn't allocate anything
<Maelan>
But what if it’s ‘let x = ref 0 in (compute_heavily () ; x) == (compute_heavily_again () ; x)’ ?
<Maelan>
Hmm, I think my question is stupid.
<zozozo>
this is the same as : let x = ref 0 in let _ = copute_heaviliy () in let _ = compute_heavily () in x == x
<zozozo>
anyway, nothing GC related should alter the semantics of your program
<Maelan>
I assume that once the pointer to the first evaluated argument is stored temporarily somewhere, it is updated consistently by the GC.
Simn has quit [Ping timeout: 256 seconds]
<companion_cube>
well, GC can affect programs that use Weak
<companion_cube>
(it happened to me)
<Maelan>
Yeah, but since == is not well-defined and reflects the internals of OCaml, I thought there could be room for the GC affecting the program there. :-)
<zozozo>
what do you mean by not 'well-defined' ?
<rks`>
zozozo: are you sure your equivalence holds?
<Maelan>
zozozo, something like “not specified by the OCaml standard” or “implementation-dependent”?
<zozozo>
rks`: after thinking about it, not really, it would be something more like : let _ = compute () in let x' = x in let _ = compute () in let x'' = x in x' == x'', but event then I'm not so sure
<Maelan>
see discussion at 14:57
<zozozo>
modulo evaluation order of the two sides
<Maelan>
Oh, er, 14:57 in France…
badkins has joined #ocaml
hay207 has joined #ocaml
<zozozo>
no pb, I'm in france, but ok, == is not as well-defined as one could hope
billof has joined #ocaml
<ggole>
Maelan: if that happened, it would be a serious GC bug
nullcat has joined #ocaml
Simn has joined #ocaml
ceryo has quit [Remote host closed the connection]
ceryo has joined #ocaml
nullcat_ has quit [Ping timeout: 264 seconds]
nullcat__ has joined #ocaml
amnn has joined #ocaml
nullcat has quit [Ping timeout: 252 seconds]
badkins_ has joined #ocaml
nullcat__ has quit [Ping timeout: 250 seconds]
nullcat_ has joined #ocaml
badkins has quit [Ping timeout: 255 seconds]
samrat_ has joined #ocaml
rand000 has quit [Quit: leaving]
ollehar has quit [Quit: ollehar]
nullcat_ has quit [Ping timeout: 252 seconds]
nullcat_ has joined #ocaml
jonludlam has quit [Ping timeout: 255 seconds]
samrat_ has quit [Quit: Computer has gone to sleep.]
hay207 has quit [Ping timeout: 252 seconds]
MercurialAlchemi has joined #ocaml
badkins_ has quit []
Submarine has quit [Quit: Leaving]
Reventlov has quit [Quit: leaving]
slash^ has joined #ocaml
Reventlov has joined #ocaml
creichert has joined #ocaml
darkf has quit [Quit: gn]
contempt has quit [Ping timeout: 246 seconds]
zpe has quit [Ping timeout: 250 seconds]
zpe has joined #ocaml
contempt has joined #ocaml
_obad_ has quit [Ping timeout: 264 seconds]
sh0t has joined #ocaml
thomasga has quit [Quit: Leaving.]
thomasga has joined #ocaml
rgrinberg has quit [Ping timeout: 264 seconds]
rgrinberg has joined #ocaml
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<smondet>
rks`: the `##` operator was added to 4.02.2, does it mean that Merlin is going to recognize js_of_ocaml's objects? if yes is it already the case? or when?
<Drup>
it's already working
<Drup>
with the ppx extension for jsoo
thomasga has quit [Quit: Leaving.]
<Drup>
it basically works out of the box)
<smondet>
Drup: cool ! opam-switching now :)
<Drup>
still crappy with the camlp4 version of jsoo
<Drup>
oh, and there is a breaking change for ppx in 4.02.2, so I think you need merlin master, or something
<smondet>
Drup: is the joo.ppx released?
<Drup>
*mumble something about hhugo doing releases*
<Drup>
no it'sn ot
thomasga has joined #ocaml
<Drup>
so, jsoo dev ;)
thomasga has quit [Client Quit]
zpe has quit [Remote host closed the connection]
iZsh has quit [Excess Flood]
iZsh has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
ollehar has joined #ocaml
MrScout has joined #ocaml
antegallya has joined #ocaml
shinnya has joined #ocaml
<def`>
smondet: merlin has recognized jsoo for a loong time?!
<def`>
(4.00 peobably)
dsheets has quit [Ping timeout: 265 seconds]
<smondet>
def`: I (4.02.1) get a syntax error at the first `##`
<Drup>
def`: but it was by special casing (and it was a bit dodgy sometimes ..)
<Drup>
smondet: you need "EXT js" in the .merlin
<Drup>
(iirc)
<smondet>
`EXT js` does not seems to change anything (even after merlin-{refresh,restart-process})
<smondet>
s/seems/seems/
<smondet>
aaah s/seems/seem/
pgomes has joined #ocaml
walter|r has quit [Remote host closed the connection]
thomasga has joined #ocaml
BitPuffin has quit [Ping timeout: 252 seconds]
ygrek has joined #ocaml
antegallya has quit [Quit: Leaving.]
<ollehar>
to adapt hindler-milner to php, would you transform php's "function($a, $b, $c)" to several lambdas? or rahter adapt the algorithm it self?
antegallya has joined #ocaml
<ollehar>
if the question is clear.
<Drup>
hum, there is no lambda in php right ? It dosen't make sense to assume functions are first class functions when they are really not.
rgrinberg has quit [Ping timeout: 244 seconds]
<ollehar>
right
<ollehar>
but I was thinking for the unification algorithm
<ollehar>
maybe I'm far off here...
rgrinberg has joined #ocaml
<ollehar>
I found these example implementations, and wasn't sure how to adapt them to my needs.
<ollehar>
or I will need "deep understanding" - :O
<ollehar>
*implementations of algorithm W
badkins has quit []
amnn has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Haudegen has quit [Ping timeout: 264 seconds]
Hannibal_Smith has quit [Ping timeout: 255 seconds]
Haudegen has joined #ocaml
badkins has joined #ocaml
Kakadu has quit [Quit: Page closed]
MooseAndCaml has joined #ocaml
jwatzman|work has joined #ocaml
<MooseAndCaml>
Hi hi. I'm using opam 1.2.2 but I get an error with opam switch 4.02.2 : "4.02.2" is not a valid compiler.
mcclurmc has joined #ocaml
<smondet>
MooseAndCaml: did you `opam update` recently?
<MooseAndCaml>
yes, just the other day
<MooseAndCaml>
i just ran it again though and it seems to be doing work
mcclurmc has quit [Remote host closed the connection]
thomasga has quit [Ping timeout: 256 seconds]
Hannibal_Smith has joined #ocaml
myst|work has quit [Quit: leaving]
Kakadu has joined #ocaml
ollehar has quit [Ping timeout: 250 seconds]
keen__________16 has quit [Read error: Connection reset by peer]
keen__________16 has joined #ocaml
myst|work has joined #ocaml
myst|work has quit [Client Quit]
myst|work has joined #ocaml
billof has quit [Ping timeout: 264 seconds]
myst|work has quit [Client Quit]
pgomes has left #ocaml ["Leaving"]
Kakadu has quit []
mcclurmc has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
ggole has quit []
obadz has quit [Ping timeout: 248 seconds]
obadz has joined #ocaml
nullcat_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
struktured has joined #ocaml
MrScout has quit [Remote host closed the connection]
MrScout has joined #ocaml
Haudegen has quit [Ping timeout: 256 seconds]
manizzle has joined #ocaml
struktured has quit [Ping timeout: 265 seconds]
antegallya has quit [Ping timeout: 246 seconds]
badkins_ has joined #ocaml
antegallya has joined #ocaml
badkins has quit [Ping timeout: 248 seconds]
Haudegen has joined #ocaml
slash^ has quit [Quit: Leaving.]
thomasga has joined #ocaml
thomasga1 has joined #ocaml
thomasga has quit [Ping timeout: 250 seconds]
monod has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
dsheets has joined #ocaml
badkins_ is now known as badkins
billof has joined #ocaml
Hannibal_Smith has quit [Quit: Leaving]
Hannibal_Smith has joined #ocaml
nullcat has joined #ocaml
Algebr has joined #ocaml
Haudegen has quit [Ping timeout: 252 seconds]
<Algebr>
If you hide a value in a closure, say let thing = let g = "123" in fun a ->... does that g get created once or is it created each time thing is calld
<Algebr>
called
blAckEn3d has joined #ocaml
<flux>
g is created once
blAckEn3d has quit [Client Quit]
<flux>
I think it would be quite difficult to rationalize how it would get recreated for each call
lewis1711 has joined #ocaml
<lewis1711>
is there any way to jig up opam, so that when you make a change to some file, it reloads it?
blAckEn3d has joined #ocaml
blAckEn3d has quit [Client Quit]
_andre has quit [Quit: leaving]
<Algebr>
I do want it to be created just once
Haudegen has joined #ocaml
<Algebr>
lewis1711: you mean like if a file changes in some packages to have opam update; opam upgrade? I guess you can just write a shell script for that.
<lewis1711>
Algebr, my mistake, I was conflating "opam" with "utop". so I'll re-write
<lewis1711>
is there a way to jig up UTOP, so that when you're editing a file, utop reloads it in the repl when you make a change?
<Algebr>
Write some code that polls the file for changes, then #mod_use "file_name.ml";;
nullca___ has joined #ocaml
<Algebr>
Write it as lwt based and put it in your ocamlinit I guess as a function that takes the file name.
nullcat has quit [Ping timeout: 265 seconds]
badkins has quit []
struktured has joined #ocaml
Nahra has joined #ocaml
amnn has joined #ocaml
amnn has quit [Ping timeout: 248 seconds]
amnn has joined #ocaml
amnn has quit [Client Quit]
nullca___ has quit [Ping timeout: 255 seconds]
empyrean has quit [Remote host closed the connection]
MercurialAlchemi has quit [Ping timeout: 264 seconds]
monod has quit [Quit: Sto andando via]
m4b has joined #ocaml
<m4b>
this is a dumb question; but suppose i've got a `(string * int) list` i want sorted first by string, then by int, in that each bucket has the same string, then sorted in ascending order by its int; can't seem to get it working
<Maelan>
You want a list, or a list of lists m4b?
<m4b>
Maelan: just a flat list
<Maelan>
So you can just use ‘List.sort’ and give it your custom comparison function.
<m4b>
Maelan: yea i did; so i have something like `if (s1 = s2) then Pervasives.compare i1 i2 else Pervasives.compare s1 s2`
<m4b>
but the resulting list has the strings sorted correctly, but the ints amongst those strings aren't sorted
<m4b>
where s1,s2 are the strings for the respective tuples being sorted, and i1, i2 are the ints
<Maelan>
let cmp (s,a) (t,b) = let r = String.compare s t in if r <> 0 then r else Pervasives.compare a b ;;
<Maelan>
let my_sort_function = List.sort cmp ;;
<Maelan>
weird.
<m4b>
let me try your version,brb
<m4b>
i think i messed up by using = on the strings, instead of Pervasives.compare
<Maelan>
No, that should be fine.
<m4b>
ok, that's what i thought :(
<Maelan>
‘x = y’ is equivalent to ‘Pervasives.compare x y = 0’, it’s structural comparison in both cases.
<Maelan>
Actually, I think you can just use ‘let my_sort_functon = List.compare Pervasives.compare’ for your needs, as the semantics of structural equality matches your needs.
<m4b>
Maelan: well i simplified the example, the objects being compared are actually much more complicated, but i basically do a compare against strings first, then integers
<Maelan>
ok
<m4b>
heh; i don't know why this isn't working; i tried both my simple version and yours with basic example and sorts as expected
Simn has quit [Quit: Leaving]
<tobiasBo1>
Hello
<tobiasBo1>
I would like to do a pretty simple thing : send an email
<tobiasBo1>
I tried some library such as "smtp", however it doesn't support SSL connection, such as the one used by gmail
mcclurmc has quit [Remote host closed the connection]
<tobiasBo1>
So if anyone has some idea to do that I would be happy to hear about it. I'm currently trying to understand the ssl library, but I'm affraid to write disgusting code since I know very little things about ssl.
<tobiasBo1>
Algebr: The thing is that here the whole ssl part is in the program sendmail (last line), and I would like a portable code, without a need to configure a sendmail server.
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
rgrinberg has quit [Ping timeout: 265 seconds]
<Algebr>
I look forward to seeing your solution.
antegallya has quit [Ping timeout: 246 seconds]
ygrek has joined #ocaml
cdidd_ has quit [Ping timeout: 244 seconds]
Algebr has quit [Remote host closed the connection]
mlamari_ has quit [Read error: Connection reset by peer]
mlamari_ has joined #ocaml
nicoo__ has joined #ocaml
iZsh has quit [Ping timeout: 246 seconds]
nicoo has quit [Read error: Connection reset by peer]
Drup has quit [Ping timeout: 264 seconds]
Lasher` has quit [Ping timeout: 256 seconds]
nicoo__ is now known as nicoo
iZsh has joined #ocaml
Lasher` has joined #ocaml
Drup has joined #ocaml
cdidd_ has joined #ocaml
yomimono has quit [Quit: Leaving]
mcclurmc has quit [Remote host closed the connection]
lewis1711 has quit [Ping timeout: 265 seconds]
MrScout has quit [Ping timeout: 248 seconds]
MrScout has joined #ocaml
rgrinberg has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
mcclurmc has joined #ocaml
madroach has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
ninja-maid-robot is now known as pyon
<m4b>
Maelin: fwiw; i found my issue, it was an evil bug; basically i was sorting a flattened list by library name (string), then by offset (int) of the symbol in that library; the sorting function as expected worked fine, and the confusing part was it worked fine on linux/elf binaries; so i use a constructor `Lib (installname, soname) for storing the symbols library; but the installname/soname distinction is only really relevant on elf
<m4b>
binaries, and so on the mach binaries, for the lib i did `Lib (name, soname), but it should have been `Lib (soname, soname); but somehow at some point a variable "name" got shadowed by the _symbol name_, not the library name, so, when sorting i was using the fst of the `Lib tuple, which at this point was the symbol name; so what was happening was the list was being sorted by symbol name, not library, and then the offset size, so it was
<m4b>
just coming out all crazy; anyway it was silly and i think i need to drink a glass of wine now ;)