<rks`>
also if `Both:(...) is valid ocaml, you can paint me yellow
<rks`>
(and call me dumbo)
<rks`>
what you want is
Haudegen has quit [Ping timeout: 246 seconds]
<rks`>
« fun k -> function `Both (x, y) -> ... | `Left x -> ... | `Right y -> ... »
<keep_learning>
rks`, Thank you
<companion_cube>
ah, interesting, they did change the signature
<keep_learning>
I was not able to under `Both
MercurialAlchemi has joined #ocaml
<keep_learning>
companion_cube, rks` Thank you
sepp2k has joined #ocaml
Mercuria1Alchemi has joined #ocaml
jwatzman|work has joined #ocaml
Algebr` has joined #ocaml
lobo has joined #ocaml
Haudegen has joined #ocaml
Kakadu has joined #ocaml
antkong has joined #ocaml
Mercuria1Alchemi has quit [Ping timeout: 246 seconds]
darkf has quit [Ping timeout: 276 seconds]
darkf has joined #ocaml
kushal has joined #ocaml
kushal has quit [Read error: Connection reset by peer]
kushal has joined #ocaml
mmin has joined #ocaml
Algebr` has quit [Ping timeout: 246 seconds]
<mmin>
I'm working on an implementation of finite maps using the format of the stdlib implementation as a reference. For some reason, ocaml thinks that there is a syntax error in the functor definition 'module Make (Ord : OrderedType) : RBT with type k = Ord.t', but I'm not sure what's wrong. The toplevel just complains about a 'syntax error' at the end of the line. Any thoughts?
darkf_ has joined #ocaml
<companion_cube>
if it's in the .ml file, you need to actually define the function, with = struct .... end
darkf has quit [Ping timeout: 276 seconds]
<companion_cube>
if it's in the .mli, I guess you must have some unfinished declaration earlier in the file
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
darkf_ has quit [Remote host closed the connection]
darkf_ has joined #ocaml
<mmin>
That must be true. I was just checking that something wasn't wrong with the syntax. Thanks.
rand__ has joined #ocaml
darkf_ is now known as darkf
darkf has quit [Ping timeout: 276 seconds]
<keep_learning>
When I am trying to evaluate the buffer I am getting Reference to undefined global `Core'
<octachron>
keep_learning, you need to enable threads with #thread;; before requiring core
<keep_learning>
larhat, octachron Thank you.
Algebr` has quit [Ping timeout: 276 seconds]
<Nazral>
with yojson, to check if a field is null or another json list is it fine to do let myfield = json |> member "myfield" in let is_null = function | null -> "nothing" | _ -> "something" ?
troydm has joined #ocaml
<Nazral>
nevermind I solved my problem
ggole has joined #ocaml
julien_t has quit [Ping timeout: 248 seconds]
Algebr` has joined #ocaml
snhmib has joined #ocaml
Kakadu has quit [Quit: Page closed]
dhil has quit [Ping timeout: 260 seconds]
artart78 has joined #ocaml
dhil has joined #ocaml
pierpa has quit [Read error: Connection reset by peer]
Sorella has joined #ocaml
pierpa has joined #ocaml
orbifx has joined #ocaml
<orbifx>
Is there a function for both min and max?
<ggole>
Of a sequence?
Algebr` has quit [Ping timeout: 268 seconds]
<orbifx>
Of an int
<orbifx>
Or float
<ggole>
Er, you want something like int -> int -> int * int?
Kakadu has joined #ocaml
pierpa has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
pierpa has joined #ocaml
Janni has joined #ocaml
freehck has quit [Remote host closed the connection]
malc_ has quit [Ping timeout: 248 seconds]
<Janni>
Hello! I have a weird question: is there an easy way to "serialise" an object into a tuple? (I don't even want to start to explain why I'd need tihs)
<Drup>
Please explain, it sounds very entertaining :D
<pierpa>
sounds lascivious
<Drup>
(you have something like {< foo : t ; bar : t >} and you want a (t * t) ? No easy wat
<Janni>
OK, not even that hard... I'm using a web framework (Ocsigen, Eliom, etc) that can serialise tuples, but not handle objects.
<Drup>
way*
<Drup>
You will have to write the function yourself :/
<ggole>
How do you know to reconstruct an object and not a tuple on the other end?
<Kakadu>
.о нщсещ
<Kakadu>
ooups
<Janni>
ggole: Didn't think that far ahead :-)
<Janni>
(I was just wondering whether an object and a tuple aren't essentially the same in OCaml)
<Janni>
(for some definition of "essentially")
<ggole>
They are very different, both in terms of typing and representation
<Drup>
objects are full of closures
<Drup>
that's why you can't serialize them
<ggole>
Tuples have no hidden parts
<Janni>
Alright. That answers my question. Thanks.
<ggole>
So yeah, write it by hand or change to a record or something.
<Janni>
I wanted to, but the framework can't handle records either.
<Drup>
Hum ? It can
<Janni>
Hmm. Well, yes. But the record would contain functions with RPC and stuff and the signatures are functional and... I didn't get it to work.
mmin has quit [Ping timeout: 276 seconds]
<Drup>
Ok
<Drup>
(tuples and record are mostly the same)
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 260 seconds]
FreeBird_ has quit [Ping timeout: 244 seconds]
darkf_ has joined #ocaml
<orbifx>
ggole: int -> int -> int
<orbifx>
Where the resulting unt is a value within the two ints
<orbifx>
I can write that but I like to resuse :-D
<lyxia>
max?
* ggole
tries to reconcile that with "both min and max" and fails
darkf has quit [Ping timeout: 276 seconds]
<Kakadu>
orbifx: I was asked yesterday how far are my QtQuick bindings? what do you think ?
<orbifx>
Kakadu: didn't get the message. Not timed them but a few hundred events a second?!
<orbifx>
ggole: i want to cap my integer between a range.
<ggole>
I see. That's usually called "clamp".
<companion_cube>
fun a b -> a + Random.int (b-a) ?
<companion_cube>
:D
<Kakadu>
orbifx: I think it was about how powerful is current approach
<orbifx>
Any thoughts on using an if-else versus min-max approach?
darkf_ is now known as darkf
<mrvn>
ggole: shouldn't 10 be last?
<ggole>
Eh, you could write it that way
<ggole>
I had in mind "clamp N to the range..."
<mrvn>
none of the parameters are optional?
<ggole>
No, why would they be?
<mrvn>
maybe you only want to clamp to the top?
<ggole>
That's just min
<mrvn>
true
<mrvn>
ggole: Maybe have a CLAMP functor that takes a module with low/high and outputs a module with all the arithmetic operators clamped?
<ggole>
Interesting idea
Algebr` has joined #ocaml
<mrvn>
orbifx: have you compared the asm output for both cases? Does it generate cmov for both or does it jump?
<mrvn>
ggole: some days ago someone asked for overflow save arithmetic and this would be a more general form of it.
<ggole>
Operations like clamp are usually in graphics code where you wouldn't need such general approaches
<mrvn>
but you would often clamp to 0-255.
<ggole>
If you are clamping to the unit interval, that's usually called saturate
<ggole>
So you would use that specific operation
<ggole>
(Which GPUs tend to support directly, iirc)
<orbifx>
mrvn: i was asking about overflow handling.
hxegon has joined #ocaml
<octachron>
clamped arithmetics sounds quite ill-defined: what is max_value - 1?
Haudegen has quit [Ping timeout: 250 seconds]
<mrvn>
one less
mehdib has joined #ocaml
<octachron>
so addition is not associative: i.e (max_value + k) - k = max_value - k ≠ max_value = max_value + ( k - k ) ?
malc_ has joined #ocaml
<mrvn>
octachron: with saturating + it wouldn't.
<ggole>
That's saturation for you.
malc_ has quit [Read error: Connection reset by peer]
malc_` has joined #ocaml
<octachron>
does'nt that imply that for any arithmetic expression x → f(x) , you have an x-dependant optimal ordering of operations leading to a least saturated output?
<mrvn>
that would be f(a,b,c,d,e,f,g,h) where every single value matters potentially.
lmaury has left #ocaml ["Leaving"]
<mrvn>
you can also not saturate temporaries.
<mrvn>
e.g. in c++ you would define ( + ) : sat_int -> sat_int -> tmp_int and ( = ) : tmp_int -> sat_int
hxegon is now known as hxegon_AFK
<octachron>
mrvn, using temporaries is more or less equivalent to doing all computation in linear space and then projecting to your non-linear space, isn'it?
<mrvn>
if you want to go all theoreticall on me
Algebr` has quit [Ping timeout: 240 seconds]
hxegon has joined #ocaml
Janni has quit [Quit: Leaving]
hxegon_AFK has quit [Ping timeout: 240 seconds]
<theblatte>
do people here have opinions on which unit test framework is The Best? eg ounit vs ppx_inline_test? (vs alcotest?)
Haudegen has joined #ocaml
<Drup>
ounit ⊂ alcotest
<Drup>
so, there is that
octachron has quit [Ping timeout: 250 seconds]
<theblatte>
Drup: so do you write your tests in the same style in both ounit and alcotest?
<malc_`>
i just did a résümȩ̊́́́̆ thing for real (cf. http://www.xkcd.com/1647/) but ⊂ is stretching it
<theblatte>
also, is ppx_inline_test tied to jenga, as it seems to be?
hxegon has quit [Quit: BRB]
<theblatte>
⊂++
<Drup>
There are other equivalent inline testing framework, and companion_cube will be happy to tell you everything about them
sh0t has joined #ocaml
<malc_`>
theblatte: sneaky
<Drup>
malc_`: ಠ_ಠ
<malc_`>
﷽
<theblatte>
ok now it's just squares :|
<malc_`>
theblatte: your IRC client and/or terminal emulator is not up to snuff that's all
<theblatte>
Drup: thx ^^
<Drup>
Do you even utf8 ؟
<malc_`>
or maybe your font selection is lacking
<theblatte>
malc_`: more likely to be my font
<theblatte>
I see some of these, but not all
<Drup>
For linux people, deja vu combines good lisibility and large utf8 support
<Drup>
(and open sourceness)
<theblatte>
XTerm*faceName: xft:DejaVu Sans Mono for Powerline-10:antialias=true:hinting=true
<theblatte>
yes but no it seems
<Drup>
The issue might be xterm itself
<malc_`>
Drup: there's no proper shaping in xterm
<malc_`>
so basically one gets a half arsed support for CJK and that's the end of unicode in xterm
octachron has joined #ocaml
antkong has quit [Quit: antkong]
tennix has joined #ocaml
hxegon has joined #ocaml
malc_` has quit [Quit: ERC (IRC client for Emacs 25.0.50.2)]
julien_t has joined #ocaml
kushal has quit [Quit: Leaving]
hxegon is now known as hxegon_AFK
scrabcakes has joined #ocaml
octachron has quit [Ping timeout: 264 seconds]
hxegon_AFK is now known as hxegon
<scrabcakes>
are there any more detailed compiling debuggers available other than the ocaml default?
copy` has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 248 seconds]
<companion_cube>
theblatte: about testing, I use qtest, for it allows to write {unit,random} tests near to the code
MercurialAlchemi has joined #ocaml
Algebr` has joined #ocaml
Algebr` has quit [Ping timeout: 264 seconds]
hcarty has joined #ocaml
sh0t has quit [Ping timeout: 268 seconds]
jeffmo has joined #ocaml
shinnya has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 276 seconds]
seangrove has joined #ocaml
lobo has quit [Quit: WeeChat 1.4]
tane has joined #ocaml
_whitelogger has quit [Ping timeout: 264 seconds]
igitoor has quit [Ping timeout: 264 seconds]
_whitelogger_ has joined #ocaml
mattg has joined #ocaml
yminsky_ is now known as yminsky
mal`` has joined #ocaml
Leonidas_ is now known as Leonidas
sfri has joined #ocaml
igitoor_ has quit [Changing host]
igitoor_ has joined #ocaml
orbifx has quit [Quit: AtomicIRC: The nuclear option.]
igitoor_ is now known as igitoor
emmanueloga has joined #ocaml
parataxis has joined #ocaml
badon has quit [Disconnected by services]
badon_ has joined #ocaml
badon_ is now known as badon
scrabcakes has quit [Quit: leaving]
rom1504_ is now known as rom1504
hcarty1 has joined #ocaml
kushal has joined #ocaml
MercurialAlchemi has joined #ocaml
hcarty has quit [Ping timeout: 276 seconds]
sh0t has joined #ocaml
Algebr` has joined #ocaml
pierpa has quit [Ping timeout: 276 seconds]
Kakadu has quit [Quit: Page closed]
Algebr` has quit [Ping timeout: 260 seconds]
<theblatte>
companion_cube: thanks!
_whitelogger_ has quit [Excess Flood]
_whitelogger has joined #ocaml
slash^ has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
yunxing has joined #ocaml
darkf has quit [Quit: Leaving]
malc_ has joined #ocaml
kdas_ has joined #ocaml
regnat_ has quit [Ping timeout: 276 seconds]
kushal has quit [Disconnected by services]
kdas_ is now known as kushal
kushal has quit [Changing host]
kushal has joined #ocaml
mmin has joined #ocaml
Algebr` has joined #ocaml
axiles has joined #ocaml
ggole has quit []
yunxing has quit [Ping timeout: 250 seconds]
octachron has joined #ocaml
julien_t has quit [Ping timeout: 260 seconds]
pflanze has quit [Remote host closed the connection]
yunxing has joined #ocaml
Algebr` has quit [Remote host closed the connection]
mmin has quit [Ping timeout: 264 seconds]
Sorella has quit [Ping timeout: 260 seconds]
_whitelogger has quit [Excess Flood]
_whitelogger has joined #ocaml
Sorella has joined #ocaml
douglascorrea has joined #ocaml
yunxing has quit [Remote host closed the connection]
kamog has joined #ocaml
thebinary has joined #ocaml
AlexRussia has quit [Ping timeout: 260 seconds]
Kakadu has joined #ocaml
AlexRussia has joined #ocaml
Haudegen has quit [Ping timeout: 248 seconds]
douglascorrea has quit [Remote host closed the connection]
douglascorrea has joined #ocaml
dhil has quit [Ping timeout: 264 seconds]
yunxing_ has joined #ocaml
kushal has quit [Quit: Leaving]
kansi has quit [Read error: Connection reset by peer]
hxegon has quit [Ping timeout: 244 seconds]
sepp2k has quit [Quit: Leaving.]
hxegon has joined #ocaml
ygrek has joined #ocaml
butts_butts has joined #ocaml
Haudegen has joined #ocaml
kushal has joined #ocaml
thebinary has quit [Read error: Connection reset by peer]
kamog has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
<keep_learning>
Hello everyone
<keep_learning>
I am trying to use utop in emacs
<keep_learning>
I am launching utop using M-x utop
<keep_learning>
but when I am trying to evaluate my buffer (C-c C-b) then it is asking me start
<chindy>
why doesn't that worklet maybe_rect = function Circle _ -> None | Rect r -> Some r
<flux>
because the value 'r' cannot be referred to
<flux>
or, perhaps more precisely, its type cannot be
<flux>
I think the technical reason is that Rect of { .. } is represented in the memory differently from Rect of record. in the former case, the record is inline in the sum type.
<flux>
and let's say you could return the "r" from the function, I mean why not, the compiler knows its type?
<flux>
then the problem becomes that happens when you have uniform representation for values and this value doesn't follow it. I think :).
<flux>
I understand it's sort of a special case how the code under Rect r -> xxx can access the fields of r that are actually in the sum type
struk|work has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
julien_t has joined #ocaml
<j0sh>
how does one invoke ppx_core? my (ocamlbuild) command is failing at link time, says 'no implementations provided for the following modules: Ppx_core ...'