zorun has quit [Read error: Connection reset by peer]
zorun has joined #ocaml
dnolen has quit [Quit: dnolen]
emmanuelux has quit [Remote host closed the connection]
Boscop has quit [Ping timeout: 245 seconds]
Transformer has joined #ocaml
Transformer has quit [Excess Flood]
Transformer has joined #ocaml
Transformer has quit [Excess Flood]
joewilliams is now known as joewilliams_away
<thelema>
everyonemines: true, static analysis can find bounds misuses. but in general, run-time checks are needed in some places, and the ocaml compiler isn't architected to make this easy
<thelema>
I guess some external program could do the static analysis of ocaml code to find these bugs
<everyonemines>
That's more what I was thinking of.
dnolen has joined #ocaml
everyonemines has quit [Quit: Leaving.]
Transformer has joined #ocaml
Transformer has quit [Excess Flood]
joewilliams_away is now known as joewilliams
flapjackery has joined #ocaml
flapjackery has quit [Client Quit]
jimmyrcom has quit [Ping timeout: 245 seconds]
dnolen has quit [Quit: dnolen]
wagle has quit [Ping timeout: 260 seconds]
ulfdoz has quit [Ping timeout: 258 seconds]
wagle has joined #ocaml
hto has joined #ocaml
ygrek has joined #ocaml
hcarty has quit [Ping timeout: 244 seconds]
hcarty has joined #ocaml
ygrek has quit [Ping timeout: 248 seconds]
fraggle_ has quit [Ping timeout: 255 seconds]
orbitz has quit [Ping timeout: 276 seconds]
ttamttam has joined #ocaml
ikaros has joined #ocaml
everyonemines has joined #ocaml
orbitz has joined #ocaml
junsuijin has quit [Remote host closed the connection]
arubin has quit [Quit: arubin]
edwin has joined #ocaml
Boscop has joined #ocaml
Boscop has quit [Ping timeout: 248 seconds]
ikaros has quit [Quit: Ex-Chat]
ttamttam has quit [Ping timeout: 260 seconds]
ttamttam has joined #ocaml
Kakadu has joined #ocaml
ikaros has joined #ocaml
<everyonemines>
What's different about the word choices of americans?
xarch has left #ocaml []
<everyonemines>
oops wrong tab sorry
everyonemines has quit [Quit: Leaving.]
Cyanure has joined #ocaml
lopex has joined #ocaml
larhat has joined #ocaml
ttamttam has quit [Read error: Operation timed out]
avsm has joined #ocaml
asmanur has quit [Ping timeout: 260 seconds]
asmanur has joined #ocaml
ttamttam has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
Kakadu has quit [Ping timeout: 265 seconds]
Associat0r has quit [Quit: Associat0r]
avsm has quit [Ping timeout: 245 seconds]
avsm has joined #ocaml
thomasga has joined #ocaml
_andre has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
struktured has quit [Ping timeout: 245 seconds]
dnolen has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
avsm has quit [Client Quit]
milosn has quit [Read error: Operation timed out]
ikaros has joined #ocaml
jimmyrcom has joined #ocaml
avsm has joined #ocaml
milosn has joined #ocaml
ttamttam has quit [Ping timeout: 252 seconds]
dnolen has quit [Quit: dnolen]
ttamttam has joined #ocaml
emmanuelux has joined #ocaml
metasyntax|work has joined #ocaml
lopex_ has joined #ocaml
lopex has quit [Ping timeout: 265 seconds]
lopex_ is now known as lopex
larhat has quit [Read error: Connection reset by peer]
larhat has joined #ocaml
lopex has quit []
bobry has quit [Ping timeout: 276 seconds]
bobry has joined #ocaml
emmanuelux has quit [Ping timeout: 240 seconds]
joewilliams is now known as joewilliams_away
sepp2k has joined #ocaml
joewilliams_away is now known as joewilliams
lopex has joined #ocaml
junsuijin has joined #ocaml
ulfdoz has joined #ocaml
avsm has quit [Quit: Leaving.]
randori has joined #ocaml
randori has quit [Quit: leaving]
randori has joined #ocaml
Boscop has joined #ocaml
iris1 has quit [Read error: Connection reset by peer]
thomasga has quit [Quit: Leaving.]
junsuijin has quit [Ping timeout: 240 seconds]
larhat has quit [Quit: Leaving.]
The_third_man has quit [Ping timeout: 255 seconds]
thomasga has joined #ocaml
junsuijin has joined #ocaml
joewilliams is now known as joewilliams_away
thomasga has quit [Quit: Leaving.]
joewilliams_away is now known as joewilliams
mjonsson has joined #ocaml
thomasga has joined #ocaml
thomasga has quit [Client Quit]
arubin has joined #ocaml
yezariaely has joined #ocaml
ygrek has joined #ocaml
jimmyrcom has quit [Ping timeout: 240 seconds]
jimmyrcom has joined #ocaml
everyonemines has joined #ocaml
<_sol>
Say I have a type with several constructors and I have a list of values of that types. Now I'd like to construct a list of all values that were produced with one specific constructor. How would I do that in ocaml?
<thelema>
_sol: List.filter?
<_sol>
thelema: Is that the shortest way? In haskell I could use a list comprehension, like: [x | SomeCons x <- values]
<thelema>
There's a syntax extension in batteries for comprehensions (list and otherwise), but just using stdlib - yes
<thelema>
given one list you want to find those elements produced by a constructor, or given a list, you want to apply a specific constructor to all the values in that list?
emmanuelux has joined #ocaml
<_sol>
thelema: the first
randori has quit [Quit: leaving]
<_sol>
thelema: So with my limited knowled of ocaml I'd now define a predicated that tests whether the value was produced with a certain constructor (with match .. of) and the use List.filter.
<thelema>
then the easiest way to do this using only stdlib is probably fold_left: `List.fold_left (fun acc -> function SomeCons x -> x :: acc | _ -> acc) [] values`
<thelema>
that will give you a list of [SomeCons 1; SomeCons 2] instead of [1;2]
<thelema>
it doesn't remove the encapsulation
<thelema>
Under batteries, `List.filter_map (function SomeCons x -> Some x | _ -> None) values` is cleaner
<_sol>
thelema: I'd prefer to stay with the stdlib for now, so I guess I'll folow your suggestion and use fold_left
<_habnabit>
_sol, batteries has greatly reduced my general frustration with ocaml; highly recommended
<_sol>
_habnabit: so you are still frustrated, but less?
<_habnabit>
oh, sure.
<_habnabit>
all languages are terrible
<_sol>
yes, you are probably right
ztfw has joined #ocaml
randori has joined #ocaml
The_third_man has joined #ocaml
abdallah has joined #ocaml
<thelema>
has anyone built a proper units of measure system in ocaml? I'm looking to make sure I don't mix up bytes/simulation_tick with bits/second
_andre has quit [Quit: leaving]
<abdallah>
If I have a function f : ('a -> 'b) -> 'a -> 'b, and a function g : 'a -> 'b and a value a : 'a, then I can get a value b : 'b with f g a. Is it possible to obtain something such a f (f (f (f ...))) a?
<abdallah>
without using g at all.
<thelema>
abdallah: like the fixed point operator?
<thelema>
This is the closest that you get in ocaml, as there's no bottom value.
<thelema>
ocaml needs a bootstrap value
hto has quit [Quit: Lost terminal]
hto has joined #ocaml
<abdallah>
thelema: thanks!
g0dmoney- has joined #ocaml
ttamttam has quit [Quit: Leaving.]
<abdallah>
thelema: I would use Fun.bounded_fix f g 100 to get f (f (f (f ... g) ...))) ? with 100 nested f being a value
<thelema>
abdallah: sounds right
<abdallah>
I suppose, I would actually need bound_fix_cmp because I don't want to compare g and f g with (=)...
<abdallah>
But this is only details...
<abdallah>
Woups, bounded_fix does not work as I expected : it just sets a limit on the nesting and fails instead of returning the final value. But I suppose I can write my own operator.
fraggle_ has joined #ocaml
junsuijin has quit [Quit: Leaving.]
<abdallah>
Do you have a mnemonic for the interpretation of the return value in compare : 'a -> 'a -> int?
<thelema>
abdallah: it helps to remember that it can be almost correctly defined for integers as `let compare a b = a-b`
<thelema>
(or is it the other way around... hmm)
<thelema>
nope, it's that way...
<thelema>
subtraction only works for small ints - overflow causes incorrect comparisons
sepp2k has quit [Ping timeout: 240 seconds]
<abdallah>
Ok, thank you. We can remember that this is almost true : compare = (-)
taupin has joined #ocaml
<abdallah>
preserving the order of a and b.
yezariaely has quit [Quit: Leaving.]
sepp2k has joined #ocaml
oriba has joined #ocaml
RafeKettler has joined #ocaml
arubin has quit [Quit: arubin]
arubin has joined #ocaml
joewilliams is now known as joewilliams_away
ztfw has quit [Remote host closed the connection]
ninegrid has quit [Ping timeout: 260 seconds]
joewilliams_away is now known as joewilliams
emmanuelux has quit [Ping timeout: 240 seconds]
emmanuelux has joined #ocaml
edwin has quit [Remote host closed the connection]
randori has quit []
hto has quit [Quit: Lost terminal]
ygrek has quit [Ping timeout: 248 seconds]
Associat0r has joined #ocaml
Associat0r has quit [Changing host]
Associat0r has joined #ocaml
arubin has quit [Quit: arubin]
RafeKettler has quit [Quit: RafeKettler]
avsm has joined #ocaml
RafeKettler has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
ikaros has joined #ocaml
<smango>
'a list array means an array of lists containing 'a types?
<_habnabit>
yes
<_habnabit>
let f: 'a -> 'a list array = fun x -> [|[x]|]
<smango>
gotcha, thanks
Transformer has joined #ocaml
Amorphous has quit [Ping timeout: 240 seconds]
Transformer has quit [Excess Flood]
Smerdyakov has joined #ocaml
Amorphous has joined #ocaml
dnolen has joined #ocaml
sepp2k has quit [Remote host closed the connection]
avsm has quit [Quit: Leaving.]
Smerdyakov has quit [Quit: Leaving]
struktured has joined #ocaml
RafeKettler has quit [Quit: RafeKettler]
Cyanure has quit [Read error: Operation timed out]