gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.0 http://bit.ly/aNZBUp
<_habnabit> I don't suppose there's any easier way of expressing the base case [] -> [].
<kaustuv> For Batteries 2.0, would it be a heinous crime to drop the non-labelled versions of functions entirely, since OCaml already allows injecting unlabelled arguments into labelled arguments if the order matches up?
zirhc has quit [Remote host closed the connection]
<thelema_> kaustuv: As long as we can keep comatibility, I'm in favor of labeled arguments
cyanure has quit [Remote host closed the connection]
oriba_ has joined #ocaml
oriba has quit [Ping timeout: 240 seconds]
mnabil has quit [Ping timeout: 272 seconds]
mnabil has joined #ocaml
oriba_ has quit [Quit: Verlassend]
arubin has joined #ocaml
Amorphous has quit [Ping timeout: 272 seconds]
boscop has quit [Ping timeout: 240 seconds]
cthuluh has quit [Remote host closed the connection]
spicey has joined #ocaml
Amorphous has joined #ocaml
<spicey> is this a historical thing that "find" has reversed arguments for the maps built with Map.Make vs Hashtbl? I.e for map it is key -> 'a t -> 'a, but hashtbl has ('a, 'b) t -> key -> 'a?
<spicey> That slightly reminds me of php functions and their chaotic argument orders (am I the first one to compare ocaml with php yet? /ducks)
arubin has quit [Quit: arubin]
<thelema_> spicey: hashtbl generally takes the hashtable first as it's mutable. map last, as it's immutable
<thelema_> with immutable data structures, it makes sense to partially apply with the structure first
<thelema_> *mutable
<thelema_> with immutable, it makes sense to build the structure by chaining it from one add to another
<spicey> Aha, not having used ocamls maps yet, I missed that they were immutable
thelema_ has quit [Read error: Connection reset by peer]
thelema has joined #ocaml
kaustuv has left #ocaml []
eye-scuzzy has quit [Ping timeout: 240 seconds]
ftrvxmtrx has joined #ocaml
eye-scuzzy has joined #ocaml
sepp2k has quit [Quit: Leaving.]
eye-scuzzy has quit [Ping timeout: 260 seconds]
eye-scuzzy has joined #ocaml
sun28 has joined #ocaml
eye-scuzzy has quit [Ping timeout: 245 seconds]
hcarty has quit [Ping timeout: 255 seconds]
hcarty has joined #ocaml
hto has quit [Quit: Lost terminal]
hto has joined #ocaml
hto has quit [Client Quit]
ftrvxmtrx has quit [Ping timeout: 260 seconds]
ftrvxmtrx has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 240 seconds]
ygrek has joined #ocaml
ftrvxmtrx has joined #ocaml
amirreza has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 246 seconds]
ftrvxmtrx has joined #ocaml
edwin has joined #ocaml
amirreza1 has joined #ocaml
ulfdoz has joined #ocaml
amirreza has quit [Ping timeout: 260 seconds]
cthuluh has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 240 seconds]
ftrvxmtrx has joined #ocaml
amirreza1 has quit [Read error: Connection reset by peer]
boscop has joined #ocaml
alpounet has quit [Ping timeout: 255 seconds]
Snark has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
ikaros has joined #ocaml
sun28 has quit [Quit: leaving]
eye-scuzzy has joined #ocaml
drunK has joined #ocaml
ftrvxmtrx has quit [Read error: Connection reset by peer]
cthuluh has quit [Ping timeout: 260 seconds]
mfp has left #ocaml []
cthuluh has joined #ocaml
mfp has joined #ocaml
ftrvxmtrx has joined #ocaml
amirreza has joined #ocaml
ftrvxmtrx has quit [Read error: Connection reset by peer]
amirreza has quit [Ping timeout: 240 seconds]
amirreza has joined #ocaml
ftrvxmtrx has joined #ocaml
joko has quit [Ping timeout: 276 seconds]
Yoric has joined #ocaml
ygrek has quit [Remote host closed the connection]
cyanure has joined #ocaml
joko has joined #ocaml
amirreza1 has joined #ocaml
amirreza1 has left #ocaml []
amirreza has quit [Ping timeout: 260 seconds]
ygrek has joined #ocaml
ikaros_ has joined #ocaml
oriba has joined #ocaml
mnabil has quit [Ping timeout: 240 seconds]
mnabil has joined #ocaml
lopex has joined #ocaml
sepp2k has joined #ocaml
alpounet has joined #ocaml
ccasin has joined #ocaml
easy4 has joined #ocaml
Yoric has quit [Quit: Yoric]
mike_mcclurg has quit [Ping timeout: 240 seconds]
mnabil has quit [Ping timeout: 240 seconds]
arubin has joined #ocaml
Tianon has quit [Ping timeout: 260 seconds]
Tianon has joined #ocaml
Tianon has quit [Changing host]
Tianon has joined #ocaml
drunK has quit [Remote host closed the connection]
mnabil has joined #ocaml
eye-scuzzy has quit [Quit: leaving]
eye-scuzzy has joined #ocaml
mnabil has quit [Ping timeout: 240 seconds]
ymasory has joined #ocaml
ikaros_ has quit [Quit: Leave the magic to Houdini]
eye-scuzzy has quit [Quit: leaving]
eye-scuzzy has joined #ocaml
ounit has joined #ocaml
<ounit> can i make match (x,y,z) with | "some triplet"-> true | _ -> false?
<orbitz> no
<ounit> my compiler says syntax error
<ounit> why not?
<orbitz> if you 're getting a syntax error you're doing something evne wronger than what you just pasted
<orbitz> post on ideone.com
<orbitz> you're doign somethign wrong elsewhere
<orbitz> it compiles fine on ideone
<ounit> the only difference between the code posted and my work code is that, the first two elements of my triple have to be evaluated in the triple
<orbitz> ounit: the code you posted is valid ocaml so I can't help unless you show me a code snippet that demonstrates your problem
<ounit> orbitz: http://ideone.com/Gsj4M
<orbitz> you cannot execute function in a pattern match
<orbitz> you could use 'when'
<orbitz> although if your case is really this simple, simply perform teh boolean expression, pattern matching isn't helping you muchhere
<ounit> okay, thats new for me that executing a function in a pattern is match is not working
<orbitz> What languages let you do it?
<orbitz> Haskell is the only one that might let you that come sot mind
<orbitz> Erlang doesn't
<ounit> yes i worked a little bit with haskell so i thought it would work in ocaml too
<ounit> how can i write a code which can for example push a button in a html file?
<orbitz> are you asking how to make a webapp in ocaml?
<ounit> i am in generell interest how its possible to tell a piece of code to activate for example a button in a webpage
<orbitz> your question doesn't make particular sense
<ounit> let me rephrase, if you want to write a programm which fills the google search page how would you do that?
<orbitz> that question is far too vague
<orbitz> are you asking how to write a program that searches google?
<orbitz> or are you asking how to write a program that interacts iwth someones web browser?
schme has joined #ocaml
schme has quit [Changing host]
schme has joined #ocaml
<ounit> orbitz: more like something which interacts with a website not through a webbrowser, getting the html-code interact (the part which i have no glue how) and send it back
<orbitz> ounit: the program doens't ned to do an HTML interaction, it can just perofrm teh HTTP request that correspodn to the query
<ounit> is that difficult?
<orbitz> not particularly
<ounit> would you use ocaml or something else?
<ounit> like perl
<orbitz> ounit: it depends on the entire applicaiton
<orbitz> ocaml can od it fine
<orbitz> querying google isn't particularly difficult
<ounit> i have no idea how to do so
<orbitz> i wouldn't worry about it now thne
<ounit> but how do i start learning it
<orbitz> first you should learn a language very well
<orbitz> and the rest will come naturally
ftrvxmtrx has quit [Read error: Connection reset by peer]
<ounit> if i know the syntax of language how do i know then how to query a page
<orbitz> if you learn a language very well you will know more than just the syntax
<orbitz> and in teh process of learning the lagnauge very well you will learn a lot of otherthings that will make it easier for you to undesrstand how to query a page
<ounit> orbitz: what languages do you know best and which of them do you recommend the most?
<orbitz> ounit: I work with Python the most, what language to recommend depend son teh problems you are intersted in solving
<ounit> but to see what languages fits the problem the best, dont you have to know those languages very well?
<orbitz> you don't have to know a language very well to have a reasonable idea of if it will be good at solving ap roblem
<orbitz> you do need some understanding of it thouhg
<orbitz> depending on your interest level you should probaly learn as many languages as you can
<orbitz> otherwise just go with whatever language peopel solving similar problems use
<ounit> i am very interested, right now besides ocaml, it is perl and java
<orbitz> just pick one and learn the pants off it
<ounit> like solving things like projecteuler?
ftrvxmtrx has joined #ocaml
<orbitz> it doesn't matter what language you pick in solving project euler, that's the point of it.
<ounit> no, i was referring to learn the pants off
<ounit> it
<orbitz> oh
<orbitz> i don't know
<orbitz> there are a million ways to learn a language
<orbitz> i wouldn't say project euler is necessarily good at it since you can get bogged down in teh trickery needed to solve harder problems and you'll never create a large application for project euler
Snark has quit [Quit: Ex-Chat]
<ounit> orbitz: can i say let g = for i=0 to 100 do Help.function g?
<orbitz> no, you reference g before it exists
<ounit> orbitz: thanks so far, maybe you can give me some more advice some other day
<orbitz> Weird, getting this error usign Lwt: Fatal error: exception Unix.Unix_error(11, "select", "((read (7 9)) (write ()) (except ()) (timeout -1))")
joko has quit [Read error: Connection reset by peer]
<mfp> orbitz: do you have a minimal test case?
<thelema> orbitz: project euler is good for developing various problem solving skills and implementing interesting algorithms, but you're right that doing project euler programs won't give you big system experience
kig has joined #ocaml
<orbitz> mfp: No unforuanttely I can't seem to consistently reproduce it
<orbitz> mfp: it seems to be on the tail end of the lwt loop though since all the work I wanted to do appears to be done
<orbitz> thelema: yeah, PE is neat, but I think it can also bog people down in finding a clever mathematical approach that, while useful, isn't pertinent to learning a language
cyanure has quit [Remote host closed the connection]
merijn has joined #ocaml
<merijn> Anyone here know of an (Oca)ml for Haskell programmers guide?
ccasin__ has joined #ocaml
<merijn> orbitz: Thanks!
Yoric has joined #ocaml
<ankit9> I'm extremely new to ocaml, reading from the manual on the home page. Trying the sample in the "modules" chapter, and i tried the code here -- http://ideone.com/ZrFa0
<ankit9> I get the correct sig for this -- a queue -> priority -> 'a -> 'a queue
<ankit9> But I had, by mistake, had the 10th line as : else Node (e, p, insert left elt prio, right) -- see the "elt" and "prio" switched here, this changed the sig to
<ankit9> priority queue -> priority -> priority -> priority queue
<ankit9> why/how was that inferred?
<ankit9> hm hm.. AFAICS (now), priority as the type parameter fit there, and fit fine for rest of the function so..
ccasin__ has quit [Quit: Leaving]
<ankit9> am I correct?
<orbitz> I don't think your insrt function is right
<ankit9> orbitz, oh? how so?
<orbitz> you always add to the left
<orbitz> ankit9: that was inferred probably because your queue contains int's and since you switching the order it has to assume that for 'a you meant priority
<orbitz> my guess
alexyk has joined #ocaml
<alexyk> thelema: why isn't there a Float.sprint, etc., for each X.print?
<orbitz> Printf.sprintf
<orbitz> ?
<orbitz> oh, batteries question nvm
<alexyk> yep
<alexyk> when one uses those printers, e.g. in List.print, one may want to use them to create a plain string also
<alexyk> is there an open_out to a string?
<thelema> alexyk: BatIO.to_string
<thelema> for example (Float.print |> to_string) is float -> string
<alexyk> thelema: thx... so don't you think we need Float.sprint etc.?
<alexyk> or the above is OK?
<thelema> agreed - they're all marked deprecated in 1.3.0
merijn has left #ocaml []
<alexyk> thelema: who's deprecared?!
<alexyk> I need my Float.print! :)
<alexyk> Int.print, etc -- I feed them to List.print
<thelema> alexyk: *.sprint are deprecated
edwin has quit [Remote host closed the connection]
<ankit9> orbitz, you are correct, i'm inserting only to the left! thanks for pointing that out!
<thelema> Float.print will stay
<alexyk> thelema: why not keep sprint?
<alexyk> it can be handy
<thelema> alexyk: Having print and sprint for everything seems wasteful if we can just have one to_string (or a better name if you think of one) that works on any printer
<alexyk> thelema: the question here is of convenience.
<alexyk> so it's hard to judge, I assume that if Printf provides both and we're used to them, everything should
<thelema> I don't think it's important enough to string print to have dedicated versions of everything. why are you string printing?
<alexyk> thelema: I'm generating TeX :)
<alexyk> it's all over the place here :)
<thelema> and you're concatenating a bunch of strings created by sprint?
<alexyk> thelema: fprintf'ing into place
<thelema> fprintf'ing into a string output?
<alexyk> to an oc
<thelema> sure
<alexyk> it may be a file
<thelema> so why do you want sprint?
<alexyk> to create a string list of column headings, for instance
<thelema> ah, I guess you don't know %a yet
<alexyk> thelema: I saw something a while ago
<alexyk> but don't remember
<thelema> fprintf oc "%d: %a\n" id (List.print Float.print) float_list
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
arubin has quit [Remote host closed the connection]
alexyk has quit [Read error: Connection reset by peer]
<ankit9> can I specify the type for a function myself? Basically, to ensure that the inferred type is indeed what I *think* it is
<ankit9> might be useful as newbie
<ankit9> writing this in a separate file, not in repl
<orbitz> ankit9: yes, although it' sguly
<orbitz> the prettiest is let f : int -> int -> int = fun x y -> x + y
<orbitz> you can also do let f (x : int) (x : int) : int = x + y) i think
<orbitz> no laste )
<ankit9> oh okay, hm first one should be fine for me, thanks!
<ankit9> orbitz, what is the norm though, specify types explicitly or not?
<orbitz> use a .mli file
<orbitz> ankit9: Some peopel specify types explicitly until they are confident int he general code they are using and remove it
<ankit9> re:mli, okk. that makes sense.
<orbitz> I have rarely found the need to specify types in a .ml file but I have not written as much ocaml code as i would like
<orbitz> I'm off, later
alexyk has joined #ocaml
<ankit9> writing in mli file should be serve the purpose for me
<ankit9> orbitz, thanks, cya
alexyk has quit [Read error: Connection reset by peer]
joewilliams is now known as joewilliams_away
alexyk has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
joewilliams_away is now known as joewilliams
alexyk has quit [Quit: alexyk]
Yoric has quit [Quit: Yoric]
alexyk has joined #ocaml
<alexyk> is there a monadic way, given takeDays: int option, dropDays: int option, to make a listRange: l |> take x |> L.drop y where x a nd y are Some's from those, if present, and only the present ones apply? Is there a maybe like in Haskell which can make it pretty?
mnabil has joined #ocaml
rudi_s has left #ocaml []
alexyk has quit [Read error: Connection reset by peer]
alexyk has joined #ocaml
ikaros has quit [Quit: Leave the magic to Houdini]
<spicey> what are the rules for naming the user-defined operators? e.g why can i call an operator ($) or (mod), but can't call it (mod$) or even (meh) ?
<thelema> mod is special
<adrien> (mod) is a special one, it doesn't obey the stanard rules afaik
<spicey> so, generally, no letters in the operators, right?
<adrien> basically, you should use one that only contains symbols
<adrien> so, yeah
<adrien> there are precedence rules, which you should read the manual for
<thelema> note: prefix and infix symbols
<spicey> yes, it's more clear now
alexyk has quit [Read error: Connection reset by peer]
<spicey> Can you recommend a project whose source I could take a look at, which would be considered written in a very good and clean ocaml style (indentations, etc)? I've read the caml programming guidelines , but would love to see what does desirable and readable look like in the wild
mbac has left #ocaml []
alexyk has joined #ocaml
alexyk has quit [Read error: Connection reset by peer]