sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
pierpa has quit [Ping timeout: 260 seconds]
Algebr` has quit [Ping timeout: 250 seconds]
bruce_r has quit [Ping timeout: 250 seconds]
govg has joined #ocaml
ggole has joined #ocaml
zpe has joined #ocaml
sdothum has joined #ocaml
ygrek has joined #ocaml
ygrek_ has quit [Ping timeout: 258 seconds]
zpe has quit [Ping timeout: 250 seconds]
govg has quit [Ping timeout: 244 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
govg has joined #ocaml
johnf__ has quit [Read error: Connection reset by peer]
govg has quit [Ping timeout: 250 seconds]
govg has joined #ocaml
johnf has joined #ocaml
lol-icon has quit [Remote host closed the connection]
Algebr` has joined #ocaml
Algebr` has quit [Ping timeout: 265 seconds]
slash^ has joined #ocaml
gasche has quit [Ping timeout: 244 seconds]
zpe has joined #ocaml
MercurialAlchemi has joined #ocaml
zpe has quit [Ping timeout: 250 seconds]
stormogulen has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
Algebr` has joined #ocaml
stormogulen has quit [Ping timeout: 250 seconds]
Algebr` has quit [Ping timeout: 276 seconds]
ollehar has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 250 seconds]
shinnya has quit [Ping timeout: 250 seconds]
octachron has joined #ocaml
elfring has joined #ocaml
<elfring>
How consistent is the description for parameters which should get a function passed with a specific type in various application programming interfaces?
<elfring>
example : val sort : ('a -> 'a -> int) -> 'a list -> 'a list
<flux>
usually it's documented with something like (** [sort compare list] sorts input list in respect to the comparison function *)
<flux>
the signature of compare is typically assumed to be clear to the person reading documnetation
<flux>
though I could be wrong, look at how List.sort is documented ;)
<flux>
I wonder if it would be better or worse if it was like val sort : 'a compare_function -> 'a list -> 'a list, and the compare_function would have its own documentation..
<flux>
well, it seems List.sort documents the compare function quite well
<flux>
perhaps if you need to mention how it works, you can just refer to List.sort's docmentation ;)
<flux>
I'll just quote it here: " Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, compare is a suitable comparison function. The resulting list is sorted in increasing order. List.sort is guaranteed to run in constant heap ...
<flux>
... space (in addition to the size of the result list) and logarithmic stack space. "
<flux>
oh, there is sort_uniq nowadays, and I hadn't noticed List.merge exists..
<elfring>
flux: I copied the example from the documentation for the list module. I find the connection between the parameter "compare" and the data type display "('a -> 'a -> int)" unclear there. Some developers might see this relationship a bit eaier.
<elfring>
How do you think about a data type display like "'a compare_function" for more parameters in application programming interfaces?
Algebr` has joined #ocaml
<flux>
well, it's a two-edged sword: you need to look up the signature (and documentation) for compare_function elsewhere, but on the other hand you can reuse it and perhaps it'll allow you to reference it without documenting it and still be clear
Algebr` has quit [Ping timeout: 244 seconds]
<octachron>
another option would be to precise the return type of the compare function, for instance ('a -> 'a -> [>`Equal|Less|Greater])
<flux>
I think I highly prefer that functions like List.map have the signature for the map function inline
<ggole>
int isn't really the most principled comparison result
Algebr` has joined #ocaml
Algebr` has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
<flux>
I think most would agree, but it is what it is and it is difficult to change :)
zpe has quit [Ping timeout: 258 seconds]
AlexRussia has joined #ocaml
<elfring>
Can the type system of OCaml treat specifications like "('a -> 'a -> int)" and "'a compare_function" as equivalent?
<flux>
yes, type 'a compare_fnction = ('a -> 'a -> int) is a type alias
<elfring>
I would be interested to use such type aliases at more places.
<flux>
such as?
<ggole>
Using aliases to make datatype declarations more readable is pretty common.
<ggole>
Dunno that you win much in the comparison function case though.
<flux>
drup, so would it be possible to use that with some existing tls-bindings from ocaml? and possibly gain parallellism for ocaml code?-)
mcc has quit [Quit: Connection closed for inactivity]
<flux>
btw, if someone is interested in computer graphics art (demos), look up assembly on twitch, compos are going on now
<Drup>
flux: isn't it the same has having multiple process in the end ? You need multiple runtime if you want parallelism regardless, and I doubt you could walk around the limit of one runtime/process with that :)
<flux>
drup, you could use threads instead of processes?
<flux>
you would need multiple runtimes yes
<flux>
but is it now that ocaml cannot se that particular c library?-)
kakadu has quit [Read error: Connection reset by peer]
tane has joined #ocaml
kakadu has joined #ocaml
<flux>
(4k compos just passed but the main event is still ahead in 50 minutes)
ygrek has joined #ocaml
Nahra has quit [Ping timeout: 260 seconds]
fantasticsid has joined #ocaml
west has joined #ocaml
west has quit [Client Quit]
ggole has quit []
zpe has joined #ocaml
Nahra has joined #ocaml
munra has joined #ocaml
zpe has quit [Ping timeout: 276 seconds]
munra has quit [Client Quit]
orbifx1 has joined #ocaml
BananaMagician has joined #ocaml
malc_ has quit [Remote host closed the connection]
tmtwd has quit [Ping timeout: 252 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
MercurialAlchemi has quit [Ping timeout: 244 seconds]
wizeman has quit [Quit: Connection closed for inactivity]
hay207_ has quit [Ping timeout: 258 seconds]
zpe has joined #ocaml
hay207_ has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
wtetzner has quit [Read error: Connection reset by peer]
AlexRussia has quit [Ping timeout: 240 seconds]
BananaMagician has quit [Ping timeout: 240 seconds]
orbifx1 has quit [Ping timeout: 276 seconds]
BananaMagician has joined #ocaml
bruce_r has quit [Ping timeout: 264 seconds]
octachron has quit [Quit: Leaving]
kakadu has quit [Remote host closed the connection]