__DL__ changed the topic of #ocaml to: OCaml 3.09.0 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
CosmicRay has quit [Read error: 113 (No route to host)]
fab_ has joined #ocaml
fab__ has quit [Read error: 110 (Connection timed out)]
m3ga has joined #ocaml
Skal has quit ["Client exiting"]
smimou has quit ["bli"]
fab__ has joined #ocaml
whit is now known as whit|prom
fab_ has quit [Read error: 110 (Connection timed out)]
whit|prom has quit []
bzzbzz has joined #ocaml
Revision17 has joined #ocaml
pango_ has joined #ocaml
dylan has quit [Read error: 110 (Connection timed out)]
fab__ has quit []
m3ga has quit ["disappearing into the sunset"]
pango has quit [Read error: 110 (Connection timed out)]
CosmicRay has joined #ocaml
descender has quit [Remote closed the connection]
descender has joined #ocaml
CosmicRay has left #ocaml []
Raziel has quit ["Yo soy goma. Tú eres cola."]
shirogane has joined #ocaml
__DL__ has joined #ocaml
Schmurtz has quit ["Plouf !"]
joshcryer has joined #ocaml
Snark has joined #ocaml
shirogane has quit [Remote closed the connection]
_JusSx_ has joined #ocaml
<_JusSx_> HI OCAML ppl
revision17_ has joined #ocaml
Revision17 has quit [Read error: 110 (Connection timed out)]
ld has joined #ocaml
<ld> hi, if I were to make an ocaml application that would need an embedded database, what database would you recommend ?
<flux__> there's ocaml-sqlite
<flux__> so maybe sqlite could fit your needs
<flux__> I don't think there are many real alternatives ;) (note, I have not used sqlite, only read about it)
<ld> isn't ocaml-sqlite alpha ?
<flux__> I don't know. it might still be sufficient for your needs, atleast there are some bindings and you wouldn't need to start from scratch
<ld> oh well... giving it a try :)
<ld> thanks flux__
<flux__> good luck
<ld> thanks :)
ld has quit ["leaving"]
Skal has joined #ocaml
smimou has joined #ocaml
_fab has joined #ocaml
fab__ has joined #ocaml
_fab has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
fab__ has quit []
justinc has quit [Read error: 110 (Connection timed out)]
vodka-goo has joined #ocaml
bzzbzz has quit ["leaving"]
rq has quit ["Leaving"]
rq has joined #ocaml
_batdog is now known as batdog
vinz42 has joined #ocaml
vinz42 has quit [Remote closed the connection]
Mitar has joined #ocaml
<Mitar> is there anything wrong with this?
<Mitar> Pair (e1, e2) -> if is_list e2 then list_eval gamma env e1 e2 else error
<Mitar> i get Unbound value is_list
<Mitar> but i have later on let is_list = function _ -> false
<Mitar> (this is just an example which fails)
<ski> you should define things before using them (or define things mutually recursive)
<Snark> "later on"
<Snark> this is were you fail
<Mitar> hmm, it should be before this? is not dual pass compilation/
<Mitar> ?
<ski> let only scopes over the things after it
<ski> let rec f x = ....
<Mitar> hm, so how can i declare two functions which call each other?
<ski> for recursive
<Mitar> and?
<ski> let rec f x = ..g..
<ski> and g x = ..f..
<ski> for mutually recursive
<Mitar> and rec is_list = function << syntax error at rec
<ski> no second 'rec'
<Mitar> hmm, yes, of course
<Mitar> thanks
<Mitar> it is really a "strange" language
<ski> not so much different, compares to other functional programming languages
<ski> it's a different paradigm than imperative, of course
<Mitar> yes, to functional ... but from common languages it is
<ski> (Mitar : have you seen any other FPL ?)
<ski> s/common/imperative/ :)
<Mitar> FPL?
<ski> Functional Programming Language
<Mitar> i am learning them, i took course Theory of programming languages
<ski> nice
<ski> any Logic Programming, too ?
<Mitar> not yet
<Mitar> that is next semester
<Mitar> so we made MinML, MinHaskell, MinScheme
<ski> (Functional and Logic are often grouped under Declarative .. they are more similar to each other than to imperative)
<ski> heh, ok
<ski> Erlang is also an interesting language
<Mitar> i have to write MinScheme for homework in OCaml
<Mitar> :-)
<ski> 10000s of threads ? no problem :)
<Mitar> we have decleration programming in second semester
<Mitar> 10000s of threads, why?
<ski> it's designed for concurrency
<Mitar> yes, erlang ...
<Mitar> we just mentioned it
<Mitar> there is no time for everyhing
<ski> a functional core, and then threads comminicating with message-passing
<ski> ok
<Mitar> Andrej Bauer is my profesor, if you know him
<ski> no
<ski> which uni ?
<Mitar> University of Ljubljana, Slovenia
<Mitar> (EU)
<ski> ok
<ski> (yes)
<Mitar> (some people search in Russia)
<ski> (ignorant fools ;)
<Mitar> ok, back to work, chat is not good for work
<Mitar> thanks ...
<ski> hehe, yeah
<Mitar> what is a short cut to making a list: a :: b :: c :: []
<vodka-goo> [ a; b;c ]
<Mitar> thanks
<Mitar> what is difference between @ and ::
<lispy> @ will combine two lists, :: will comebine an element and a list
<Mitar> is there any faq for such questions?
<lispy> well, the type of each function could answer it :)
<lispy> i don't know of an faq but that doesn't mean it doesn't exist :)
<Mitar> yes, type, i have forgotten about that
<Mitar> build_args vars e =
<Mitar> try
<Mitar> List.combine vars e
<Mitar> with Invalid_argument -> error
<Mitar> The constructor Invalid_argument expects 1 argument(s), but is here applied to 0 argument(s)
<Mitar> why/
<Mitar> ?
<pango_> exception Invalid_argument of string
<pango_> if you want to match any Invalid_argument exception, you must either use a free variable (Invalid_argument s), or the universal pattern _
<pango_> (Invalid_argument _)
<Mitar> yes, _
<pango_> or match specifically Invalid_argument "List.combine"
<Mitar> i am still searching for documentation ...
<Mitar> yes, what would List.combine as a parameter in Invalid_argument?
<Mitar> "List.combine"?
<pango_> # List.combine [1] [1;2] ;;
<pango_> Exception: Invalid_argument "List.combine".
<Mitar> this is sooo useful
<Mitar> :-)
<Mitar> thanks
<Mitar> i am getting a grip with ocaml slowly
<pango_> there's not so many error conditions that can happen one typing is correct ;)
<pango_> s/one/once/
<Mitar> i know
<Mitar> but i am a Perl guy ...
<Mitar> this is guite a difference for me
<Mitar> :-)
<pango_> I mainly learned ocaml using "developing applications with objective caml"
__DL__ has quit [Remote closed the connection]
<pango_> those days, there's more choice, http://www.ocaml-tutorial.org/ and others
<pango_> but I still consider it a great book
<pango_> btw, List.combine is written in ocaml, so there's always the solution to look at the source (list.ml in library directory)
<pango_> straightforward non tail-recursive implementation btw
<Mitar> is this good or bad?
<Mitar> (i think that non tail-recursive is bad)
<pango_> well, it doesn't scale to very large lists... stack overflow problems
<Mitar> yes, why they do not use for loop? :-)
<pango_> that function could have been written tail-recursive without resorting to imperative flow control structures...
<Mitar> yes, and why it is not?
revision17_ has quit [Remote closed the connection]
<pango_> non tail-recursive is ok for small lists, and code is a bit more readable
Revision17 has joined #ocaml
<Mitar> how can i sum all ints in a list?
<Mitar> fold_left + list?
<pango_> List.fold_left (+) 0 myintlist
<Snark> let rec sum_int_list l = match l with [] -> 0 | car :: cdr -> car + (sum_int_list cdr)
<Mitar> i like fold solution better
<Mitar> hm, why (+)
<Mitar> i see that it does not for without
<Mitar> but why?
<Mitar> and why 0?
<Snark> (+) to mean the function
<Snark> and 0 to give the seed
<pango_> # List.fold_left ;;
<pango_> - : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a = <fun>
<Mitar> ehm, this is too unreadable for me
<pango_> you'll have to learn to read it then ;)
<Mitar> it means: we have a function which maps a' to b' and back to a'?
<Mitar> and than this function we use on a'?
<Mitar> and on
<Mitar> b'?
<Mitar> hmm
<pango_> yes, 'a and 'b are type variables
<Mitar> aaa
<Mitar> i have to think about types and not values here
<pango_> signature does only give information about expected types, but it's often enough to understand what a function does
<Mitar> ok
<pango_> (as you did)
<Mitar> 'a-s does not mean the same value but the same type
<pango_> right
<Mitar> i have to keep this in mind
<Mitar> if i have a type Int of int
<Mitar> how can i get int out of this?
<Mitar> so that i can + on it?
<pango_> I suppose you have a sum type, like type int_or_string = Int of int | String of string
<pango_> then you can write
<pango_> let int_value ios =
<pango_> match ios with
<pango_> | Int i -> i
<pango_> | _ -> invalid_arg "int_value"
<Mitar> yes ...
<Mitar> you correctly assume
<Mitar> is there difference between Int i -> Int i and Int i -> i
<Mitar> ?
<pango_> Int i is of type int_or_string, in that example
<pango_> while i in just an int
<pango_> s/in/is/
<pango_> val int_value : int_or_string -> int = <fun>
<Mitar> aha
<Mitar> thanks
Rickdangerous has joined #ocaml
<Mitar> hm: This expression has type Minscheme.expr but is here used with type int
<Mitar> but expr is union of Int which is int
<Mitar> and i get this in and to_int = function
<Mitar> Int e -> Int e
<Mitar> | _ -> error
<Mitar> aaa
<Mitar> Int e -> e
<Mitar> and it works
<Mitar> strange
<pango_> you're getting fooled by your own notation, Int e is not an integer
<Snark> not strange
<pango_> since it's build by the Int constructor, it's type is the sum type
<pango_> had you chosen expr = Foo of int | Bar of string, maybe things would have been more obvious
<pango_> Foo e is an expr, not an integer
<Mitar> yes, but why can than ocaml converts to int ?
<Mitar> i would understand if i had to write Int e -> int e
<Snark> e is of type int
<pango_> it does not "convert", it does deconstruction thru pattern matching
<Snark> there's no need to make it explicit
<Mitar> hm, Int is just a alias for int
<Mitar> ?
<Mitar> aggh: List.fold_left (*) 0 << it takes it as a comment
<pango_> Int is an expr constructor with an int parameter, so e has to be a int
<Mitar> (and yes, there should be 1 and not 0)
<pango_> you must write ( * ) with spaces
<Mitar> nice
<Mitar> thanks
<pango_> because (* indeed denotes the start of a comment
<Mitar> i will go to my friends now, to help them with this assigment
<Mitar> i know, but the solution for this is simple
<Mitar> thanks again for all your help
<pango_> np
Rickdangerous has left #ocaml []
Snark has quit ["Leaving"]
<pango_> Mitar: you could have written e:int, but it's not necessary, ocaml type inference already determined that
Raziel has joined #ocaml
Raziel has quit [Client Quit]
Raziel has joined #ocaml
zigong has joined #ocaml
_JusSx_ has quit [Client Quit]
Skal has quit ["Client exiting"]
bzzbzz has joined #ocaml
zigong has quit [Remote closed the connection]
whit has joined #ocaml