mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.0 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
Smerdyakov has joined #ocaml
seafoodX has joined #ocaml
Submarine has quit [Remote closed the connection]
pantsd has joined #ocaml
yminsky has joined #ocaml
piggybox__ has joined #ocaml
visage has joined #ocaml
piggybox has joined #ocaml
piggybox_ has quit [Read error: 104 (Connection reset by peer)]
zarul has quit [Read error: 110 (Connection timed out)]
piggybox__ has quit [Read error: 104 (Connection reset by peer)]
visage has left #ocaml []
yminsky has quit []
buluca is now known as AkiraYuki
AkiraYuki is now known as buluca
zarul has joined #ocaml
piggybox has quit [Read error: 110 (Connection timed out)]
zarulshahrin has joined #ocaml
rhz has joined #ocaml
zarul has quit [Nick collision from services.]
<rhz> can you define multiple cases for functions like in Haskell? Or do you always have to use the match construct in OCaml?
zarulshahrin is now known as zarul
<mbishop> what do you mean?
<abez> rhz: as far as I know generics are about as far you can go with it or using a guard
<abez> rhz: let f x = match x with Dragons(_) -> ... | Trolls(_) -> ... | Olives(_) -> ... <-- guards or let f g x = g x <-- generic
<abez> rhz: You could always use classes and virtual dispatch
<abez> rhz: but as far as I know if you make a function let f (x:int) = x * x ;; let f (x:float) = x *. x ;; the old f will no longer be accessible.
<abez> rhz: Or you can use a functor
<abez> rhz: http://caml.inria.fr/pub/docs/manual-ocaml/index.html <-- for more detailed info
piggybox has joined #ocaml
buluca has quit [Read error: 113 (No route to host)]
thesoko has quit [Remote closed the connection]
thesoko has joined #ocaml
thesoko has quit [Remote closed the connection]
pantsd has quit [Read error: 110 (Connection timed out)]
jeberle has joined #ocaml
thermoplyae has joined #ocaml
thermoplyae has left #ocaml []
jeberle has left #ocaml []
piggybox_ has joined #ocaml
piggybox has quit [Read error: 110 (Connection timed out)]
zak_ has joined #ocaml
fluctus has left #ocaml []
rhz has quit ["Leaving"]
Cygal has joined #ocaml
zarul has quit [No route to host]
m3ga has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
Cygal` has joined #ocaml
Cygal has quit [Read error: 110 (Connection timed out)]
love-pingoo has joined #ocaml
xavierbot has joined #ocaml
<rwmjones> module type Req = sig type a type b end ;;
<xavierbot> module type Req = sig type a type b end
<rwmjones> module Example (Base:Req) = struct type a_or_b = A of Base.a | B of Base.b let foo (x : a_or_b list) = () end ;;
<xavierbot> module Example :
<xavierbot> functor (Base : Req) ->
<xavierbot> sig
<xavierbot> type a_or_b = A of Base.a | B of Base.b
<xavierbot> val foo : a_or_b list -> unit
<xavierbot> end
<rwmjones> type void;;
<xavierbot> type void
<rwmjones> module Myreq = struct type a = int type b = void end ;;
<xavierbot> module Myreq : sig type a = int type b = void end
<rwmjones> module Myexample = Example (Myreq) ;;
<xavierbot> module Myexample :
<xavierbot> sig
<xavierbot> type a_or_b = Example(Myreq).a_or_b = A of Myreq.a | B of Myreq.b
<xavierbot> val foo : a_or_b list -> unit
<xavierbot> end
<rwmjones> Myexample.foo [1; 2; 3];;
<xavierbot> Characters 16-17:
<xavierbot> Myexample.foo [1; 2; 3];;
<xavierbot> ^
<xavierbot> This expression has type int but is here used with type
<xavierbot> Myexample.a_or_b = Example(Myreq).a_or_b
<rwmjones> Myexample.foo [A 1; A 2; A 3];;
<xavierbot> Characters 18-19:
<xavierbot> Myexample.foo [A 1; A 2; A 3];;
<xavierbot> ^
<xavierbot> Unbound constructor A
<rwmjones> Myexample.foo [Myreq.A 1; Myreq.A 2; Myreq.A 3];;
<xavierbot> Characters 24-25:
<xavierbot> Myexample.foo [Myreq.A 1; Myreq.A 2; Myreq.A 3];;
<xavierbot> ^
<xavierbot> Unbound constructor Myreq.A
<rwmjones> Myexample.foo [Example.A 1];;
<xavierbot> Characters 26-27:
<xavierbot> Myexample.foo [Example.A 1];;
<xavierbot> ^
<xavierbot> Unbound constructor Example.A
<rwmjones> grrr
<rwmjones> Myexample.foo [Example(Myreq).A 1];;
<xavierbot> Myexample.foo [Example(Myreq).A 1];;
<xavierbot> ^^^^^^^^^
<xavierbot> Characters 23-32:
<xavierbot> Parse error: currified constructor
<rwmjones> Myexample.foo [Myexample.A 1];;
<xavierbot> - : unit = ()
<rwmjones> Myexample.foo [Myexample.B 1];;
<xavierbot> Characters 28-29:
<xavierbot> Myexample.foo [Myexample.B 1];;
<xavierbot> ^
<xavierbot> This expression has type int but is here used with type Myreq.b = void
<flux-_> difficult :)
seafoodX has quit []
buluca has joined #ocaml
xavierbot has quit [Read error: 110 (Connection timed out)]
_blackdog has joined #ocaml
buluca is now known as TH3_L4m4H
TH3_L4m4H is now known as buluca
_blackdog has quit ["Ex-Chat"]
_blackdog has joined #ocaml
noteventime has joined #ocaml
buluca has quit ["Leaving."]
_blackdog has left #ocaml []
magius_pendragon has joined #ocaml
slipstream-- has joined #ocaml
zarul has joined #ocaml
leo037 has joined #ocaml
zarul has quit [Remote closed the connection]
slipstream has quit [Read error: 110 (Connection timed out)]
leo037-2 has joined #ocaml
leo037-2 has quit ["Ex-Chat"]
leo037-2 has joined #ocaml
leo037-2 has quit ["Ex-Chat"]
leo037-2 has joined #ocaml
leo037-2 has quit [Client Quit]
mwc_ has joined #ocaml
<mwc_> I've poured through the module tutorial and the reference for module types. I'm trying to expose a variant type from a compilation unit
<mwc_> but as soon as I add "type foo" to the .mli, the compile errors on "inconsistent assumptions"
<mwc_> I'm trying to expose the type and all its variants.
<mwc_> (and yes, type foo is defined in the .ml)
<Smerdyakov> You add "type foo" with the list of variants, just like you were defining it anew?
<mwc_> yep
<mwc_> aha, oh man, this was silly
<mwc_> I'd let my .depends get out of date
<mwc_> :S
<mwc_> Well, that only took 30 minutes to sort out
<flux-_> yes, when getting that error, make clean
<flux-_> ..plus fix your dependencies ;)
<tsuyoshi> hmm.. ocamlnet is explicitly missing the one encoding I need, iso-2022-jp
<tsuyoshi> wonder if there's some really good reason for not supporting it, or if I can just add it myself
Smerdyakov has quit ["Leaving"]
martin_ has joined #ocaml
martin__ has joined #ocaml
mbishop has quit [Read error: 113 (No route to host)]
zak_ has quit [Read error: 110 (Connection timed out)]
love-pingoo has quit ["Connection reset by pear"]
mwc_ has quit ["leaving"]
leo037 has quit ["Leaving"]
xavierbot has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
seafoodX has joined #ocaml
seafoodX has quit []
leo037 has joined #ocaml
postalchris has joined #ocaml
Submarine has joined #ocaml
leo037 has quit ["Leaving"]
leo037 has joined #ocaml
mav- has joined #ocaml
Submarine has quit [Remote closed the connection]
ygrek has joined #ocaml
pantsd has joined #ocaml
leo037 has quit ["Leaving"]
leo037 has joined #ocaml
martin__ is now known as mbishop
Archville has joined #ocaml
<Archville> Hi.
<Archville> Where can i find infomation about the Ocaml programming language and it's differentes to C ?
<Archville> *differences
<flux-_> I doubt there is a list
<flux-_> OCaml is basically totally different
<flux-_> but, then I again, I suppose one can write C in any language..
<flux-_> s/I //
<Archville> I'm building my own simple programming language, looking for nice features on other languages already at use
<Archville> and a lot of people tells me Ocaml has nice things. specially for functional programming
<Archville> so i would like to read a bit on them
<flux-_> well, then looking how ML does things can be very useful
<flux-_> http://www.ffconsultancy.com/languages/ray_tracer/comparison.html compares a c++-raytracer against an ocaml-one
<Archville> Thanks, i'll take a look
<mbishop> creating a language takes a LOT of research heh
<mbishop> have you looked at SISAIL, Acute, Alice ML, Pict, Occam-Pi, SR, etc?
<Archville> Yeah, but i think it's worth it
<Archville> So far i looked at TCL, Lisp, some Scheme interpreters/compilers, Python, Ruby...
<Archville> Over all of them, i loved Scheme and Lisp
<Archville> So my little language looks a bit like them
<Archville> Never heard of the names you say, but i'll look at everything interesting i find
<Archville> :)
<flux-_> Haskell is also one big name in the functional world
<Archville> By the way, on the raytracer code... seems pretty elegant
<Archville> however i find strange things like: "Printf.printf"
<mbishop> there are a lot of neat ones, most of those I mentioned are based on process calculi
<Archville> Haskell annoys me
<flux-_> archville, it's the printf-function from the module Printf; if one wrote open Printf at the top of the file one would be able to omit the Printf-prefix
<Archville> I find it too hard to read
<Archville> and too hard to write
<Archville> Oh, so there are modules and you call functions from them
<Archville> like module.function parameters...
<Archville> Looks good, no need for #include things
<flux-_> yes, except module names always begin with a capital letter
<mbishop> I highly recommend "Programming Language Pragmatics 2nd edition", fantastic book covering a whole bunch of languages and how they do things
<Archville> I'm currently reading SICP
<mbishop> That's a fantastic book too :)
<Archville> Yes, it's really worth a look.
<Archville> Also found On Lisp by Paul Graham awesome.
fmardini has joined #ocaml
noteventime has quit [Remote closed the connection]
jlouis has quit [Remote closed the connection]
ygrek has quit ["Leaving"]
jlouis has joined #ocaml
fmardini has quit []
Mr_Awesome has joined #ocaml
david_koontz has quit ["Leaving"]
david_koontz has joined #ocaml
martin_ has left #ocaml []
Submarine has joined #ocaml
pantsd has quit [Read error: 110 (Connection timed out)]
screwt8 has quit [Read error: 104 (Connection reset by peer)]
pantsd has joined #ocaml
xavierbot has quit [Read error: 110 (Connection timed out)]
pantsd has quit [Read error: 110 (Connection timed out)]
leo037 has quit ["Leaving"]
magius_pendragon has quit ["leaving"]
Cygal` has quit [Remote closed the connection]
postalchris has quit ["Leaving."]
Cygal` has joined #ocaml
screwt8 has joined #ocaml