Alpounet changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.1 out now! Get yours from http://caml.inria.fr/ocaml/release.html
thrasibule has joined #ocaml
Alpounet has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
Alpounet has quit [Remote closed the connection]
MrEvil has joined #ocaml
DrSunglasses is now known as nnyby
__marius1_ has joined #ocaml
caligula_ has joined #ocaml
thrasibule has quit [Read error: 110 (Connection timed out)]
__marius__ has quit [Read error: 110 (Connection timed out)]
thelema_ has quit [Read error: 60 (Operation timed out)]
thelema has joined #ocaml
caligula__ has quit [Read error: 110 (Connection timed out)]
kaustuv_ has quit [Read error: 60 (Operation timed out)]
kaustuv_ has joined #ocaml
thelema has quit [pratchett.freenode.net irc.freenode.net]
caligula_ has quit [pratchett.freenode.net irc.freenode.net]
__marius1_ has quit [pratchett.freenode.net irc.freenode.net]
haelix has quit [pratchett.freenode.net irc.freenode.net]
gim has quit [pratchett.freenode.net irc.freenode.net]
erickt has quit [pratchett.freenode.net irc.freenode.net]
lanaer has quit [pratchett.freenode.net irc.freenode.net]
r0bby has quit [pratchett.freenode.net irc.freenode.net]
jlouis has quit [pratchett.freenode.net irc.freenode.net]
haelix_ has joined #ocaml
jlouis_ has joined #ocaml
lanaer_ has joined #ocaml
__marius__ has joined #ocaml
thelema has joined #ocaml
r0bby has joined #ocaml
caligula_ has joined #ocaml
erickt has joined #ocaml
lanaer_ is now known as lanaer
gim has joined #ocaml
MrEvil has left #ocaml []
caligula_ has quit [Read error: 104 (Connection reset by peer)]
palomer has quit [pratchett.freenode.net irc.freenode.net]
caligula_ has joined #ocaml
palomer has joined #ocaml
ched_ has joined #ocaml
verte has joined #ocaml
f[x] has joined #ocaml
Snark has joined #ocaml
ulfdoz has joined #ocaml
<BigJ> does anyone see the benefit of learning ocaml first before C, for imperative programming?
<Camarade_Tux> I'd learn C first, if you started with ocaml you'd be tempted not to use to much imperative style ;-)
Associat0r has joined #ocaml
verte has quit ["~~~ Crash in JIT!"]
albacker has joined #ocaml
<BigJ> Camarade_Tux, you think you would be more inclined to use functional, or object oriented?
<BigJ> instead of imperative?
<Camarade_Tux> BigJ: if you only want imperative, there is probably no difference between ocaml and C, you could even flip a coin ;)
<Camarade_Tux> BigJ: as far as I'm concerned, I use the three ;)
<BigJ> I was just wondering to which style you were implying would be used instead of impterative
<BigJ> or "favoured"
<Camarade_Tux> oh, you always tend to use some functionnal evn when you want to do imperative, it's too practical
<BigJ> i don't know how much I like functional I definitely prefer object oriented or imperative
<BigJ> I am just learning functional for the first time though
<Camarade_Tux> where does your object-oriented background come from?
<BigJ> which language?
<BigJ> or where did I learn it?
Associat0r has quit []
<Camarade_Tux> which language
<BigJ> java
<Camarade_Tux> I think I'd go for C first, you almost know it, the only thing really different is memory management
<BigJ> ya I don't really have a choice, I have to learn ocaml first
<BigJ> trust me I would much prefer to just learn C
<Camarade_Tux> you'll quickly change your mind ;)
<BigJ> ya it seems that people who use ocaml really like it
<Camarade_Tux> one of the advantage over C is memore management, which means no segfault, no buffer overflow, no memory leak
<Camarade_Tux> and something easier for the programmer
<BigJ> and it's just as fast as C code?
<Camarade_Tux> no, but not far but unless you're on something that is completely cpu-bound, you won't get a difference
<Camarade_Tux> (that sentence is a bit weird)
<Camarade_Tux> second try: it's slower but for many/most tasks, you don't need the fastest thing
<Camarade_Tux> last time I wrote something that was cpu-intensive, I ended up not having enough memory for the program to take more than 30 seconds of cpu-power
<BigJ> what do you mostly use ocaml for?
<Camarade_Tux> anything ;-)
<Camarade_Tux> web server, web browsers, vizualisation, p2p, file synchronization, compilers, AI...
<gildor> BigJ: you can achieve near C performance with OCaml -- esp. if you are dealing with complex problem
<gildor> BigJ: you can even beat C program on certain task, because you can go further with OCaml when you get stuck by fear of segfault in C
<gildor> (speaking from real life experience)
authentic has joined #ocaml
<BigJ> k thanks for the info. it's 6 am I should go to bed
redchrom has joined #ocaml
mishok13 has quit [Read error: 110 (Connection timed out)]
onigiri has joined #ocaml
onigiri_ has joined #ocaml
onigiri has quit [Read error: 113 (No route to host)]
onigiri_ is now known as onigiri
redchrom has quit ["leaving"]
flux has quit [Remote closed the connection]
flux has joined #ocaml
flux has quit [Client Quit]
flux has joined #ocaml
mal`` has quit ["Coyote finally caught me"]
mal`` has joined #ocaml
myst has quit []
Alpounet has joined #ocaml
myst has joined #ocaml
ikaros has joined #ocaml
komar___ has joined #ocaml
komar__ has quit [Read error: 110 (Connection timed out)]
julm has quit [Read error: 113 (No route to host)]
malc_ has joined #ocaml
mishok13 has joined #ocaml
Snark has quit [Read error: 60 (Operation timed out)]
jimmyb2187 has quit [Read error: 113 (No route to host)]
marteo has joined #ocaml
schmx is now known as schme
ikaros has quit ["Leave the magic to Houdini"]
ikaros has joined #ocaml
ikaros has quit [Read error: 104 (Connection reset by peer)]
ikaros has joined #ocaml
malc_ has quit ["leaving"]
ikaros_ has joined #ocaml
ikaros_ has quit [Read error: 104 (Connection reset by peer)]
iZZy_ has joined #ocaml
ikaros has quit [Read error: 60 (Operation timed out)]
clog has quit [^C]
clog has joined #ocaml
_zack has joined #ocaml
kaustuv_` has joined #ocaml
kaustuv_ has quit [Read error: 60 (Operation timed out)]
sgnb has quit [Remote closed the connection]
sgnb has joined #ocaml
_zack has quit ["Leaving."]
palomer has quit ["Leaving"]
<albacker> where can i see examples of usage of scanf ?
<Alpounet> albacker, google ? the caml mailinst list ? ocaml libs and apps here and there ?
<Alpounet> a wiki would be a good idea actually, around OCaml
<Alpounet> likie caml.inria.fr/wiki/
<Alpounet> like*
<albacker> i saw the library standard one
<albacker> mailing list.. no.. and i googled :)
<albacker> thanks for the wii
<albacker> wiki*
<Camarade_Tux> popl, hmm, pearl?
<Camarade_Tux> nope
<Camarade_Tux> pleac!
<Alpounet> albacker, there isn't any wiki. But I'm saying it'd be good
<Camarade_Tux> there is only one entry for scanf but it's usually a good ressource (provided you can remember the name ;) )
<albacker> i saw it :D
smimou has joined #ocaml
MrEvil has joined #ocaml
komar___ is now known as komar_
MrEvil has quit [Client Quit]
onigiri_ has joined #ocaml
onigiri has quit [Read error: 60 (Operation timed out)]
onigiri_ is now known as onigiri
tmaeda is now known as tmaedaZ
marteo has quit ["Debian GNU/Hurd is Good."]
mal`` has quit ["Coyote finally caught me"]
mal`` has joined #ocaml
mal`` has quit ["Coyote finally caught me"]
<flux> regarding the recent D-self-post on reddit: I wonder if people in future could dislike choosing O'Caml because it has "two standard libraries" :) (I'm assuming of course that batteries is a huge success)
mal`` has joined #ocaml
<infoe> what do you ocaml'ers think of F#
<Alpounet> batteries isn't at this state IMO.
ztfw has joined #ocaml
<flux> infoe, I think it's interesting and I'd definitely consider taking a more serious look at it if I needed to do .NET development
<flux> infoe, however from what I've gathered so far, it does make some pretty big tradeoffs
<infoe> tell me more about those tradeoffs
<flux> for example, no camlp4; it has something to reduce the pain though (can't remember it's name, but a similar camlp4-module exists for ocaml also)
<kaustuv_`> I personally think F# is the wrong direction for ML, but maybe I like module systems too much
<flux> another example is the lack of ml module system
<infoe> im new to the ml family
<flux> but I haven't really used it, so I can't tell what kind of replacement it has for those
<flux> I suspect objects
<flux> oh, right, and it doesn't have ocaml-like objects and I really doubt they can be as neat as ocaml's are :)
<flux> and to top it off, I don't think it has polymorphic variants which are cool at times also
<infoe> afaik F# does have modules, i don't know how they compare to *ml though
<flux> (beware though, ocaml objects and polymorphic variants are an advanced subject)
<flux> infoe, well, some concept of separate compilation units must exist, but I don't think it has module signatures or functors
<infoe> i tried looking up something regarding polymorphic variants, and found that F# contains active patterns (which aren't available in vanilla ocaml?), i've used active patterns in f#, i wonder how similar that actually is to a polymorphic variant
onigiri_ has joined #ocaml
<infoe> when you say module signatures, do you mean a seperate file containing information about public signatures?
<infoe> i don't mean to give you the 3rd degree I'm just trying to figure out how relevant learning more ocaml will be to me using F#, with the projects I work on I am kind of locked in to .NET currently
<Camarade_Tux> kaustuv_`: as far as I see it, F# is an improvement for .net/C# coders, not ocaml ones ;)
<infoe> that sounds like valid reasoning to me
<infoe> although I had heard of ocaml before I never bothered to look into it until I decided to persue F#
<infoe> and I fell in love with the whole functional paradigm, coming from declarative/imperative langauges like T-SQL as well as from perl and C#
<orbitz> first class functions really change how you write code
<orbitz> even my Python code is becoming more functionalized
<infoe> i've been looking for a list of the differences between ocaml and F#, i keep stumbling across lists that are wrong or were correct before the beta1 of F#
<Camarade_Tux> infoe: the one at microsoft.com?
<flux> infoe, I don't think active patterns (like views for pattern matching?) and polymorphic variants have anything in common
<kaustuv_`> Camarade_Tux: sure, if you must use .Net and need bidirectional interaction with other .Net programs, F# is really your only choice.
<flux> infoe, I think it may be possible to simulate active pattern matching with the somewhat recent support for pattern matching lazy values..
<flux> infoe, but maybe active patterns are more powerful. likely they are faster than the results of such simulation would be.
<infoe> active pattern is like let (|Even|Odd|) n = if n % 2 = 0 then Even else Odd
<infoe> trying to grok the polymorphic variant right now...
<Camarade_Tux> kaustuv_`: or anybody with MS training, or with a boss that likes MS
<flux> polymorphic variants are simply type consturctors you don't need to declare beforehand
<infoe> Camarade_Tux: I found a link to the one at microsoft.com from SO but it was 404
<Camarade_Tux> flux: and with pattern-matching that is always exhaustive :)
iZZy_ has quit [Read error: 110 (Connection timed out)]
onigiri has quit [Read error: 110 (Connection timed out)]
onigiri_ is now known as onigiri
<flux> infoe, so how do you use the pattern?
<flux> match n with Even -> .. ?
<infoe> yes
tvn2009 has joined #ocaml
<Camarade_Tux> infoe: hmmm, if you still have the url that gave 404, you can try archive.org
<flux> infoe, I suppose advanced usage gives something more than that, I mean, it's not a big problem to just write match even_or_odd n with Even .. ?
<infoe> flux: the example was very naive
<infoe> and my drawing a comparison between active pattern vs. polymorphic variant was as well
Narrenschiff has joined #ocaml
<infoe> inspired by something Dr. Harrop wrote on a thread i was reading when searching for F# polymorphic variant, something to the effect that his visualization library in ocaml made use of the latter for reasons of extensibility but the trade off was poor debugging/error message support
<flux> actually it seems to me it'd be feasible to implemnt active patterns purely via camlp4..
<flux> except separate compilation would be interesting
<flux> as in if match xxx with Foo, where Foo(x) is an active pattern, map that into match mapping_function foo with Foo(lazy x) etc
<flux> (oh right, I don't think f# has lazy values builtin either?)
<flux> actually it might not be that simple after all, if you have multiple active patterns in a pattern.. I suppose
<flux> (also handling mixed active/non-active patterns would be tricky)
<infoe> F# has lazy
<flux> something atleast :)
<infoe> well what would be the difference from built-in-lazy vs say, memoization
<Camarade_Tux> reminds me I need to actually try ocaml plotting libraries, and I'll be happy only when I can plot the car accident rate in Paris in one line no matter the data source
<flux> infoe, syntax, possibly efficiency
<infoe> camarad_tux: use J
<flux> camarade_tux, did you look at hcarty's plplot bindings?
<flux> camarade_tux, I think its examples have a oneliner-example
<flux> but indeed, J will likely be more compact, but I'm not sure if it's worth the trouble to learn that if the purpose is to produce plots in ocaml :)
<Camarade_Tux> flux: I know of plplot but I've never tried it, I have a few things to do first :P
<Camarade_Tux> the goal is to get that in ocaml, not to use another language :P
<infoe> indeed
<Alpounet> plplot rocks!
<flux> alpounet, so you've given it a spin?-)
<Alpounet> yeah
<Alpounet> built from scratch :)
<Alpounet> hcarty needed testers, I volunteered.
<flux> brave, brave man
<Alpounet> haha
thrasibule has joined #ocaml
PupUser97a787 has joined #ocaml
<PupUser97a787> Saludos desde España
PupUser97a787 has quit ["Leaving."]
<Alpounet> interesting.
<Camarade_Tux> honestly, he's holding a record, waiting for two minutes is already a lot
_Jedai_ has quit [Read error: 110 (Connection timed out)]
Jedai has joined #ocaml
ttamttam has joined #ocaml
redchrom has joined #ocaml
komar_ has quit ["WeeChat 0.2.6.3-ohshi"]
redchrom has quit [Client Quit]
<myst> in many sources I see: let _ = ... What's the point of this? IIUC it's allowable to write main body as it is.
<Alpounet> it's to ignore compiler warnings
<Camarade_Tux> it ignores what is on the right-side of =
<Alpounet> hmm
<Alpounet> to work around compiler warnings*
<Camarade_Tux> '-w s' iirc :P
<Alpounet> it evaluates what's at the right of =, not more
<Camarade_Tux> oh, my sentence was terribly bad, it ignores the result of what is on the right-side of '='
<flux> I think myst means as a top-level statement, not as an expression
<flux> myst, it's a way to write .ml-files without ever writing ;;
<myst> flux, o_O KOOL!
<myst> now I understood
<flux> myst, a unit of code (separated by ;;) can be either: a list of statements OR an expression
<flux> (or XOR if you prefer..)
<myst> okay, thanks
<myst> another stupid question, what's meaning of "labl" in OCaml libraries? Like "LablGL".
Tomsik has joined #ocaml
<Tomsik> Hi, I'm trying to learn ocaml, can somebody tell me why does this not work:
<Tomsik> let solve a = function
<Tomsik> | 42 -> 0;
<Tomsik> | _ -> (print_int a;
<Tomsik> solve read_int;)
<Tomsik> solve read_int;;
<Camarade_Tux> myst, I guess it refers to labels/named arguments which are used a lot in lablgtk
<Camarade_Tux> (and friends)
<Camarade_Tux> Tomsik: what does the compiler say?
<Camarade_Tux> (rec?)
<Tomsik> Error: Unbound value solve
<myst> Tomsik, let *rec* solve
<myst> w/o *'s
<Tomsik> Oh
<Tomsik> Thanks
<myst> np
<Tomsik> Actually, how do I use read_int ?
NYNix has joined #ocaml
<Tomsik> Because I can't get it to work, it says it expected int, not unit->int
<Tomsik> read_int b; doesn't seem to work either
<Alpounet> read_int ()
<Camarade_Tux> solve (read_int ())
<Alpounet> "read_int ()" is of type int
<Alpounet> "read_int" is of type unit -> int
<Alpounet> just look at the types
<Alpounet> it's often enough to solve your problem :-p
<Tomsik> Heh
<Tomsik> let rec solve a = function
<Tomsik> | 42 -> 0;
<Tomsik> | _ -> (print_int a; 0;)
<Tomsik> solve (read_int());;
<Tomsik> File "main.ml", line 3, characters 8-25:
<Tomsik> Error: This expression is not a function; it cannot be applied
<Tomsik> is it about print_int returning value?
<Tomsik> And if yes, what should I do? let x = print_int a; doesn't seem to work
<Alpounet> remove the ";" after 0
<Alpounet> after both 0s, by the way
<Tomsik> still the same
<Alpounet> the last thing must be an expression, whereas we use ";" when separing instructions
_JusSx_ has joined #ocaml
<Alpounet> let rec solve a = function | 42 -> 0 | _ -> print_int a ; 0
f[x] has quit [Read error: 110 (Connection timed out)]
<Alpounet> something like this should be okay
<Alpounet> btw, you don't need the *rec* anymore
<Tomsik> Well, I want to use it later, just trying to get it to compile at all :p
<Tomsik> removed the parenthesis, still doesn't work
julm has joined #ocaml
<Tomsik> let rec solve a = function
<Tomsik> | 42 -> 0
<Tomsik> | _ -> print_int a; 0
<Tomsik> it's like that now
<Tomsik> there has to be some trivial mistake here, heh
ikaros has joined #ocaml
<Alpounet> btw, solve will be a function taking 2 arguments
<Tomsik> Huh, why?
<Alpounet> it takes one argument a. Applying solve <some value for a> is then what you define after the "=", that is : a function
<Alpounet> you rather want :
<Alpounet> # let rec solve = function | 42 -> 0 | x -> print_int x ; 0 ;;
<Alpounet> val solve : int -> int = <fun>
<Alpounet> I guess this is what you want
<Alpounet> (the "val solve : int -> int = <fun>" comes from my ocaml toplevel)
<Alpounet> # solve 42;;
<Alpounet> - : int = 0
<Alpounet> # solve 3;;
<Alpounet> 3- : int = 0
<Tomsik> well, still the same error
<Alpounet> http://ocaml.pastebin.com/ => both the code and the error
<Alpounet> with indications about line numbers in your file
<Alpounet> remove the "a" after solve
<Tomsik> same
<Alpounet> it's impossible
<Alpounet> let rec solve = function | 42 -> 0 | x -> print_int x ; 0 ;;
<Alpounet> works
jimmyb2187 has joined #ocaml
<Tomsik> yeah...
<Tomsik> it works, but what I've got doesn't
<Tomsik> d'oh
<Tomsik> ;; after 0
<Tomsik> That's the facepalm moment
Tomsik has quit ["Mangara fo a necetens outba mangratas."]
ttamttam has quit ["Leaving."]
_JusSx_ has quit ["leaving"]
<Camarade_Tux> http://www.reddit.com/r/programming/comments/9qiji/coders_at_work_simon_peyton_jones/ <- haskell on reddit really feels like spam
<orbitz> hah
<orbitz> you'r ejust jealous /r/ocaml/ doesn't exist!
<Camarade_Tux> otoh if you removed dons from reddit, it'd be almost haskell-free...
<orbitz> yeah he is quick
<Camarade_Tux> http://www.reddit.com/search?q=ghc <- more than 50% is from him ;)
<orbitz> yeah he should relaly start making osme fake accounts
<Camarade_Tux> he :P
<Camarade_Tux> (just to make it clear, I have nothing against it but it gets a bit tiring to see haskell mentionned everywhere, I see more haskell links than I get spam [after gmail's filtering [[which is leaking more and more]]])
<myst> :)
<myst> it's true, Haskell is f*cking good with computations, but when it comes to something real-world, all you can is to write another GHC
slash_ has quit [Client Quit]
albacker has quit ["Leaving"]
Demitar has quit ["Ex-Chat"]
Jedai has quit [K-lined]
<Camarade_Tux> flux: is ganame available as a library? I realized it was doing something I wanted for my browser (url rewriting)
thrasibule has quit [Read error: 110 (Connection timed out)]
Narrenschiff has quit []