flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.01.0 http://bit.ly/1851A3R | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
CamelFodder has joined #ocaml
avsm has quit [Quit: Leaving.]
csakatoku has joined #ocaml
avsm has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
avsm has quit [Ping timeout: 264 seconds]
cyanure__ has joined #ocaml
Arsenik has quit [Ping timeout: 272 seconds]
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
angerman has quit [Quit: Gone]
cyanure__ has quit [Remote host closed the connection]
introom has joined #ocaml
ygrek has quit [Ping timeout: 272 seconds]
introom2 has joined #ocaml
introom has quit [Ping timeout: 272 seconds]
wolfnn has quit [Ping timeout: 240 seconds]
kyrylo has quit [Ping timeout: 260 seconds]
introom2 has quit [Ping timeout: 240 seconds]
introom2 has joined #ocaml
CamelFodder has quit [Remote host closed the connection]
ygrek has joined #ocaml
sheijk has quit [Ping timeout: 272 seconds]
introom2 has quit [Ping timeout: 264 seconds]
talzeus_ has joined #ocaml
introom2 has joined #ocaml
lopex has quit [Quit: Connection closed for inactivity]
introom2 has quit [Ping timeout: 246 seconds]
introom2 has joined #ocaml
nisstyre has joined #ocaml
mcclurmc has joined #ocaml
lopex has joined #ocaml
introom3 has joined #ocaml
csakatoku has quit [Remote host closed the connection]
introom2 has quit [Ping timeout: 272 seconds]
x2bool has joined #ocaml
x2bool has quit [Client Quit]
bitbckt has quit [Ping timeout: 240 seconds]
bitbckt has joined #ocaml
csakatoku has joined #ocaml
introom3 has quit [Ping timeout: 272 seconds]
introom3 has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
introom3 has quit [Ping timeout: 267 seconds]
introom3 has joined #ocaml
lopex has quit []
ygrek has quit [Ping timeout: 260 seconds]
nisstyre has quit [Quit: Leaving]
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
Kakadu has joined #ocaml
introom3 has quit [Ping timeout: 272 seconds]
csakatok_ has joined #ocaml
csakatok_ has quit [Read error: Connection reset by peer]
csakatok_ has joined #ocaml
boogie has joined #ocaml
csakatoku has quit [Ping timeout: 248 seconds]
csakatok_ has quit [Remote host closed the connection]
introom3 has joined #ocaml
csakatoku has joined #ocaml
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
csakatoku has quit [Read error: No buffer space available]
csakatoku has joined #ocaml
ygrek has joined #ocaml
dant3 has joined #ocaml
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
mort___ has joined #ocaml
csakatoku has quit [Remote host closed the connection]
dant3 has quit [Remote host closed the connection]
boogie has quit [Remote host closed the connection]
dant3 has joined #ocaml
Eyyub has quit [Ping timeout: 260 seconds]
csakatoku has joined #ocaml
Eyyub has joined #ocaml
willy_ has joined #ocaml
introom3 has quit [Quit: WeeChat 0.4.2]
introom has joined #ocaml
wwilly has quit [Ping timeout: 272 seconds]
Xenasis has joined #ocaml
csakatoku has quit [Remote host closed the connection]
introom has quit [Ping timeout: 264 seconds]
csakatoku has joined #ocaml
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
kyrylo has joined #ocaml
introom has joined #ocaml
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
mort___ has quit [Quit: Leaving.]
Arsenik has joined #ocaml
dant3 has quit [Ping timeout: 248 seconds]
introom has quit [Ping timeout: 264 seconds]
dant3 has joined #ocaml
Kakadu has quit [Ping timeout: 272 seconds]
ulfdoz has joined #ocaml
dant3 has quit [Read error: Connection reset by peer]
dant3 has joined #ocaml
qingant has joined #ocaml
ulfdoz has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
qingant has quit [Read error: Connection reset by peer]
angerman has joined #ocaml
talzeus_ has quit [Read error: Connection reset by peer]
Kakadu has joined #ocaml
ollehar has joined #ocaml
Xenasis has quit [Remote host closed the connection]
qingant has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
talzeus_ has joined #ocaml
introom has joined #ocaml
avsm has joined #ocaml
qingant has quit [Read error: Connection reset by peer]
avsm has quit [Quit: Leaving.]
bjorkintosh has quit [Ping timeout: 248 seconds]
csakatoku has quit [Remote host closed the connection]
csakatoku has joined #ocaml
csakatoku has quit [Ping timeout: 272 seconds]
introom2 has joined #ocaml
qingant has joined #ocaml
introom has quit [Ping timeout: 272 seconds]
qingant has quit [Client Quit]
ygrek has joined #ocaml
avsm has joined #ocaml
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
Eyyub has quit [Ping timeout: 272 seconds]
skchrko has joined #ocaml
ygrek has quit [Ping timeout: 246 seconds]
pminten has joined #ocaml
introom3 has joined #ocaml
chris2 has quit [Ping timeout: 246 seconds]
Moataz-E has joined #ocaml
introom2 has quit [Ping timeout: 272 seconds]
ollehar has quit [Ping timeout: 272 seconds]
<Moataz-E> hello everyone
chris2 has joined #ocaml
<Moataz-E> I am trying to solve the first Euler problem in ocaml
<Moataz-E> just decided to learn the language today
<Moataz-E> Sadly, i am facing a problem as the program is giving unexpected results. I wrote a quick python script that does the exact same thing but gives the correct solution
Eyyub has joined #ocaml
<Moataz-E> can anybody help me spot the error? Also, if possible, any ocaml tips regarding better ways to code something are highly appreciated
<Kakadu> Can you paste link to original problem text?
<pminten> Moataz-E: are you mainly trying to learn solving the Euler problems or to learn OCaml?
<Moataz-E> OCaml
<pminten> if it's about learning OCaml and getting feedback on your code exercism.io might be worth looking at as it's more focussed on feedback
<pminten> (truth be told there aren't many experienced OCamlers doing the nitpicking there, there's currently just two people new to the language as well)
<Moataz-E> pminten: I see, I've heard of that website but never tried. I would love to use it as practise but i also like to test new languages on euler's problems as they get quite challenging later on.
<pminten> yeah, exercism doesn't really have very challenging exercises, though there is at least one in the OCaml track that's semi-challenging if you haven't used zippers before
<pminten> as for your code I'd probably write the arg parsing like this: `[| multiple1; multiple2; limit |] = Array.map int_of_string Sys.argv`
<Moataz-E> pminten: zippers as in the zip function? I know it from Haskell
<pminten> Moataz-E: not quite, zippers as in tree zippers
<pminten> let you do stuff like `zipper_of_tree t |> first_child |> next_sibling |> value`
<Moataz-E> pminten: ohhh, didnt read that chapter when i was learning haskell :(
<Moataz-E> pminten: thanks for the code suggestion. Much neater way of parsing arguments
<pminten> correction: `[| _; multiple1; multiple2; limit |] = Array.map int_of_string Sys.argv`
<pminten> need to take into account the program name
<Moataz-E> pminten: ohhh yeh, its always the first argument. Good to know OCaml supports 'dont care'
<pminten> hmm, is it normal to get a warning about an inexhaustive match in `let [| a; b |] = [| 1; 2 |];;`?
<pminten> or are my warnings somehow set to pedantic?
<pminten> `print_string "The answer is: "; print_int result; print_newline ();` could be written as `Printf.printf "The answer is: %d\n" result;`
<Kakadu> Oh man
<Kakadu> It seems I found an error
talzeus_ has quit [Remote host closed the connection]
<Kakadu> limit * ((limit + 1) / 2)
<Kakadu> when limit is 6 it will answer 18
<Kakadu> when 21 is expected
<pminten> Moataz-E: one of the differences between OCaml and Python is that Python will cheerfully mix floating point numbers and integers
<pminten> I suspect that's what's causing the difference
<Kakadu> Moataz-E: ^^
<pminten> (depends on the Python version, Python 3.0 will have 3/2 == 1.5 while Python 2.7 will have 3/2 == 1)
<Moataz-E> Ohhh i see, i rewrote the whole program so that it uses floats and still got the error :S
talzeus_ has joined #ocaml
<Moataz-E> pminten: thanks for the print suggestion!
<Moataz-E> Kakadu: thanks for spotting the error, i will try to fix it now!
talzeus_ has quit [Remote host closed the connection]
introom3 has quit [Ping timeout: 240 seconds]
talzeus_ has joined #ocaml
talzeus_ has quit [Remote host closed the connection]
michael_lee has joined #ocaml
dant3 has quit [Remote host closed the connection]
kyrylo has quit [Read error: Operation timed out]
Xenasis has joined #ocaml
wolfnn has joined #ocaml
<Moataz-E> guys
<Moataz-E> i dont get how OCaml automatically chooses type of variable
<Moataz-E> ohhh nevermind, looks like it deducts that from the operations being done within the function
wolfnn has quit [Ping timeout: 252 seconds]
mfp_ has joined #ocaml
mfp has quit [Ping timeout: 252 seconds]
Nahra_ has quit [Quit: leaving]
Nahra has joined #ocaml
Eyyub has quit [Ping timeout: 260 seconds]
dant3 has joined #ocaml
robink has quit [Quit: No Ping reply in 180 seconds.]
robink has joined #ocaml
avsm has quit [Quit: Leaving.]
wolfnn has joined #ocaml
dant3 has quit [Remote host closed the connection]
_5kg has quit [Ping timeout: 246 seconds]
dant3 has joined #ocaml
_5kg has joined #ocaml
talzeus_ has joined #ocaml
talzeus__ has joined #ocaml
talzeus_ has quit [Ping timeout: 272 seconds]
darkf has quit [Quit: Leaving]
mcclurmc has joined #ocaml
dant3 has quit [Remote host closed the connection]
pminten has quit [Quit: Leaving]
ollehar has joined #ocaml
tane has joined #ocaml
dant3 has joined #ocaml
introom3 has joined #ocaml
dant3 has quit [Ping timeout: 252 seconds]
dant3 has joined #ocaml
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
ygrek has joined #ocaml
dant3_ has joined #ocaml
dant3 has quit [Read error: Connection reset by peer]
introom4 has joined #ocaml
introom3 has quit [Ping timeout: 264 seconds]
oriba has joined #ocaml
ggole has joined #ocaml
willy_ has quit [Ping timeout: 264 seconds]
<oriba> Hi, I',m confused by ocaml's type inference for some simple code.... please look here:
<oriba> Why is cmd_args a "doc_t aggregation_t list" and not a "operation_t * doc_t aggregation_t list" ??
<oriba> And why does it accept two different kind of types in the list?
<dsheets> oriba, ; is end statement
<dsheets> oriba, , is tuple product
<dsheets> line 45 has a value, Get, that constitutes a statement (you got a warning about it probably should be unit)
<dsheets> make it a comma
<dsheets> then you will get a type error on the next line
<oriba> dsheets, OMG.... thats so stupid.... oh oh too much beer yesterday ;-)
<oriba> dsheets, thanks!
<dsheets> oriba, -w @F@S
<oriba> ?
<dsheets> ocamlc -i -w @f@s evalreihenfolge.ml
<dsheets> should now shoot you in the face
mcclurmc has quit [Remote host closed the connection]
<oriba> messages do not look much different
<dsheets> oriba, man ocamlc shows all the warnings
<dsheets> it does not say that there was a fatal error due to warnings?
<dsheets> i also like p, u, and 40
introom5 has joined #ocaml
<oriba> I used the old 3.11.2 compiler. With 4.00.1 it does shout louder ;-)
mcclurmc has joined #ocaml
<oriba> dsheets, I used the old 3.11.2 compiler. With 4.00.1 it does shout louder ;-)
<dsheets> oh hm odd, i thought those were stable
<dsheets> i only use 4.x
introom4 has quit [Ping timeout: 264 seconds]
ulfdoz has quit [Ping timeout: 246 seconds]
<oriba> I have the old 3.11.2 on my system, and the new 4.x via opam
<oriba> I'm exploring some features and want to see which compiler accepzts what. So thats why I sometimes use boith compilers
<dsheets> afaik most users have moved to 4.00.1+ except maybe some banks
<oriba> banks?
<ggole> There are probably quite a few users who install whatever is provided by their package manager
<oriba> BTW: the code I pasted... I want to explore how this can be made this way with the normal sum datatypes, and how I can make it easier with GADT then
introom5 has quit [Ping timeout: 240 seconds]
introom5 has joined #ocaml
<oriba> A direct comparison of "how to od it with Sum types vs. how to do it with GADT" is, what I want to see.
mcclurmc has quit [Remote host closed the connection]
<oriba> A direct comparison of "how to do it with Sum types vs. how to do it with GADT" is, what I want to see.
<oriba> Possibly the code will look much better with GADTs
<ggole> My experience is that GADTs mostly involve pain and suffering.
<oriba> oh.
mcclurmc has joined #ocaml
dant3_ has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
<ggole> Don't get me wrong, by all means investigate the feature. I wouldn't hang your hopes on GADTs making your code clearer, though.
<oriba> hmhh
<oriba> I'm looking for a better/good representation of comands and results of a language. I tried around with sum types. It's posisble, but sometimes needs many matches. GADTs I did not used so far, I thought they can help. Possibly polymorphic variants would also be a dood idea (don't used them much so far)
<oriba> s/dood/good/
dant3 has joined #ocaml
sillyotter has joined #ocaml
silly_otter has joined #ocaml
silly_otter has quit [Client Quit]
<ggole> Arranging sum types for the clearest code can be a bit hit and miss, yeah.
<oriba> better ideas?
sillyotter has quit [Ping timeout: 240 seconds]
<ggole> I usually look at the code which is using the types, and try to imagine whether some change would make the code clearer or contain less duplication.
<ggole> Sometimes that involves changing the type, sometimes writing a helper, etc.
lasts_ has quit [Read error: Connection reset by peer]
lasts_ has joined #ocaml
<oriba> and you take GADTs not into account in the first place?
<ggole> I wouldn't use GADTs unless there was a good reason.
introom has joined #ocaml
<oriba> and what would be a good reason?
wwilly has joined #ocaml
<ggole> They can give greater type safety in some circumstances. I've actually found it remarkably hard to apply them to any real situation.
<dsheets> oriba, modeling a type system?
introom5 has quit [Ping timeout: 240 seconds]
<oriba> hmhm
<oriba> But thats, what I was doing with the sum types in the pasted code...
<ggole> Even that can lead to clumsiness.
<oriba> Maybe the clumsiness is always there
<oriba> It just looks different with sum types and GADTs?
bjorkintosh has joined #ocaml
<ggole> Ie, you have type _ term = Int : int -> int term | Bool : bool -> bool term | Pair : 'a * 'b -> ('a * 'b) term and everything looks fine
<ggole> Then you try to represent arbitrary tuples
<ggole> | Tuple : 'a array -> 'a array term doesn't work: you need a silly wrapper type, which induces more matching and indirection.
<oriba> thats the same problem with sum types
<ggole> With regular sums you just have Tuple of term array
<ggole> Which is what you want.
<oriba> but this also needs matching... if you look for a certain variable, you also have to distinguish if it is single value or aggregated (list/array,...)
<ggole> The problem is that there isn't any (straightforward) way to represent an arbitrary tuple in OCaml's type system: whenever the structure you are trying to represent no longer matches the structure that already exists in the type system, GADTs lose a lot of their appeal.
<oriba> hmhh :(
avsm has joined #ocaml
<ggole> There are workarounds, but the code tends to become more complicated rather than simpler in my experience.
ygrek has quit [Ping timeout: 264 seconds]
sheijk has joined #ocaml
introom has quit [Read error: Connection reset by peer]
<oriba> Why does this not work? http://pastie.org/8575457
<oriba> When I only have the first match in untabgle_apply, I get the following types:
<oriba> type 'a aggregation_t = Single of 'a | List of 'a list | Array of 'a array
<oriba> val untangle_apply : ('a -> 'b) -> 'a aggregation_t -> 'b
<oriba> But when adding the List and/or Array in the match, then I get the type error
<oriba> "val untangle_apply : ('a -> 'b) -> 'a aggregation_t -> 'b" looks nice to me. Should also work with the other aggregations?!
<ggole> oriba: the type of each clause is not the same
<ggole> func x produces type 'b, List.map func l produces type 'b list: those are not the same type.
<oriba> ah, ok now I see the problem... I need to wrap it again into the aggregation type
<ggole> Yep.
dant3 has quit [Remote host closed the connection]
michael_lee has quit [Quit: Ex-Chat]
<oriba> This is what I normaly had in mind (and also used). But it always leads to possibly getting things like List(Array(Single)) stuff - and leads to more matching issues. (Thats what I tried to kick out somehow). Maybe I need s a seperate function that parses the result and rediuces the datatype if needed.
<oriba> e.g. List(List) could in some cases be redused to List by concattenating; but not always.... depends on the function...
<oriba> Hmhhh. then each function of my DSL would need to get converter-functions on their side...
tant2n has joined #ocaml
tobiasBora has joined #ocaml
tant2n has quit [Quit: Leaving]
Xenasis has quit [Remote host closed the connection]
Kakadu has quit [Ping timeout: 272 seconds]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
avsm has quit [Quit: Leaving.]
swistak35 has quit [Ping timeout: 264 seconds]
ollehar has quit [Ping timeout: 272 seconds]
dant3 has joined #ocaml
dant3 has quit [Read error: Connection reset by peer]
dant3 has joined #ocaml
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
Kakadu has joined #ocaml
wwilly has quit [Quit: This computer has gone to sleep]
ollehar has joined #ocaml
oriba has quit [Quit: oriba]
swistak35 has joined #ocaml
q66_ has joined #ocaml
q66 has quit [Ping timeout: 246 seconds]
avsm has joined #ocaml
tobiasBora has quit [Ping timeout: 272 seconds]
zpe has joined #ocaml
snyp has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
q66_ is now known as q66
zpe has quit [Ping timeout: 264 seconds]
ggole has quit []
tobiasBora has joined #ocaml
angerman has quit [Quit: Gone]
skchrko has quit [Quit: Leaving]
snyp has quit [Quit: K Bye]
Xenasis has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
tane has quit [Quit: Verlassend]
<Kakadu> ctypes has type Unsigned.uint8 = UInt8.t and I'm wondering how can I create values of UInt8.t.
<Kakadu> In what package should I look for UInt8 module?
<adrien> isn't it inside ctypes?
<adrien> what does ctypes depend on?
<Kakadu> unix and bigarray only
<adrien> bigarray has such a type
<adrien> but I have no idea how ctypes' is defined
<Kakadu> Found! thanks
tobiasBora has quit [Ping timeout: 252 seconds]
lopex has joined #ocaml
lopex has quit []
lopex_ has joined #ocaml
lopex_ is now known as lopex
mcclurmc has quit [Remote host closed the connection]
Xenasis has quit [Remote host closed the connection]
Simn has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
tobiasBora has joined #ocaml
boogie has joined #ocaml
Xenasis has joined #ocaml
kyrylo has joined #ocaml
angerman has joined #ocaml
Kakadu has quit []
angerman has quit [Ping timeout: 240 seconds]
swistak35 has quit [Ping timeout: 240 seconds]
angerman has joined #ocaml
Xenasis has quit [Remote host closed the connection]
boogie has quit [Remote host closed the connection]
smerz_ has joined #ocaml
smerz has joined #ocaml
mcclurmc has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
Xenasis has joined #ocaml
ulfdoz has quit [Ping timeout: 260 seconds]
mcclurmc has joined #ocaml
Arsenik has quit [Remote host closed the connection]
Arsenik has joined #ocaml
angerman has quit [Quit: Gone]
rainbyte has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
sheijk has quit [Ping timeout: 252 seconds]
Xenasis has quit [Remote host closed the connection]
Simn has quit [Ping timeout: 246 seconds]
darkf has joined #ocaml
Arsenik has quit [Remote host closed the connection]
dant3 has quit [Remote host closed the connection]
dant3 has joined #ocaml
oriba has joined #ocaml
sheijk has joined #ocaml
tobiasBora has quit [Quit: Konversation terminated!]
nisstyre has joined #ocaml
avsm has quit [Quit: Leaving.]
dant3 has quit [Remote host closed the connection]
rwmjones has quit [Read error: Operation timed out]
rwmjones has joined #ocaml
<dsheets> is there something preventing primitive literals at the type level?
<dsheets> not any operators -- just literals like int and string
ygrek has joined #ocaml
dant3 has joined #ocaml
<dsheets> specifically, there are sometimes strings that are essentially namespace identifiers and it would be nice to be able to put those into types
madroach has quit [Ping timeout: 252 seconds]
smerz has quit [Ping timeout: 260 seconds]
dant3 has quit [Ping timeout: 264 seconds]
smerz_ has quit [Ping timeout: 272 seconds]
madroach has joined #ocaml
oriba has quit [Read error: Connection reset by peer]
oriba_ has joined #ocaml
NoNNaN has quit [Remote host closed the connection]
Xenasis has joined #ocaml
rwmjones has quit [Read error: Operation timed out]
oriba_ has quit [Quit: oriba_]