dark_light changed the topic of #ocaml to: OCaml 3.09.2 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/
danly has quit ["Leaving"]
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- IRC with a difference"]
danly has joined #ocaml
flux-_ has quit [Read error: 104 (Connection reset by peer)]
flux__ has joined #ocaml
Mr_Awesome has joined #ocaml
chessguy has joined #ocaml
david_koontz_ has joined #ocaml
CosmicRay has joined #ocaml
Mr_Awesomer has joined #ocaml
david_koontz has quit [Read error: 110 (Connection timed out)]
duncanm has joined #ocaml
danly has quit [Read error: 110 (Connection timed out)]
batdog is now known as batdog|gone
batdog|gone is now known as batdog
sponge45 has joined #ocaml
Mr_Awesome has quit [Read error: 113 (No route to host)]
dibblego has quit ["Leaving"]
CosmicRay has quit ["Client exiting"]
<jordan-> what is illegal about doing: let f = (fun x -> match x with (x <> x) -> false) ;;
<sponge45> (x <> x) is not a valid pattern. Do you mean: let f = fun x -> x <> x ?
<sponge45> which is weird by the way.
ramkrsna has joined #ocaml
<jordan-> Ah Isee
<jordan-> another quick question: how can I convert a char to a string?
<jordan-> I don't see a function in the pervasives
<jordan-> or the char or string libraries
<sponge45> String.make 1 'x'
<Mr_Awesomer> that always annoyed me that you have to do that
<jordan-> ah! great thanks
Mr_Awesomer is now known as Mr_Awesome
duncanm has quit [Read error: 110 (Connection timed out)]
Mr_Awesome has quit ["and the Awesome Level drops"]
buluca_ has joined #ocaml
duncanm has joined #ocaml
buluca has quit [Read error: 145 (Connection timed out)]
Smerdyakov has quit ["Leaving"]
<Shimei> You could always just "string_of_char c = String.make 1 c" if it bugs you.
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- 100,000+ downloads can't be wrong"]
danly has joined #ocaml
danly has left #ocaml []
khaladan_ has joined #ocaml
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
falconair has quit [Read error: 110 (Connection timed out)]
_velco has joined #ocaml
danly has joined #ocaml
buluca_ has quit [Read error: 104 (Connection reset by peer)]
danly has quit [Read error: 113 (No route to host)]
delamarche has joined #ocaml
sponge45 has left #ocaml []
danly has joined #ocaml
delamarc1e has joined #ocaml
_velco has quit ["I'm outta here ..."]
delamarche has quit [Read error: 110 (Connection timed out)]
danly has quit [No route to host]
khaladan_ has joined #ocaml
_velco has joined #ocaml
bluestorm has joined #ocaml
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
<eradman> j
Snark has joined #ocaml
buluca has joined #ocaml
Skal has joined #ocaml
x__ has joined #ocaml
velco has joined #ocaml
love-pingoo has joined #ocaml
pango_ has quit [Remote closed the connection]
x__ is now known as pango
Skal has quit [Read error: 104 (Connection reset by peer)]
_fab has joined #ocaml
yondalf has joined #ocaml
bluestorm has quit [Remote closed the connection]
_shawn has quit [Read error: 104 (Connection reset by peer)]
kral has joined #ocaml
<kral> hi
<kral> what do you guys think about "Practical OCaml"? Can it be a good buy for a ocaml newbie?
yondalf has quit [Read error: 110 (Connection timed out)]
slipstream has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
yondalf has joined #ocaml
yondalf_ has joined #ocaml
yondalf has quit [Read error: 110 (Connection timed out)]
fab_ has joined #ocaml
_fab has quit [Read error: 110 (Connection timed out)]
kral has quit [Remote closed the connection]
swater has joined #ocaml
yondalf__ has joined #ocaml
yondalf_ has quit [Read error: 110 (Connection timed out)]
duncanm has quit [Read error: 110 (Connection timed out)]
yondalf__ has quit ["leaving"]
khaladan_ has joined #ocaml
pango has quit [Excess Flood]
pango has joined #ocaml
benben has quit [Read error: 110 (Connection timed out)]
benben has joined #ocaml
khaladan has quit [Read error: 110 (Connection timed out)]
khaladan_ is now known as khaladan
bluestorm_ has joined #ocaml
duncanm has joined #ocaml
khaladan_ has joined #ocaml
bluestorm_ has quit [Read error: 104 (Connection reset by peer)]
khaladan- has joined #ocaml
khaladan has quit [Read error: 110 (Connection timed out)]
khaladan- is now known as khaladan
khaladan- has joined #ocaml
Foxyloxy has joined #ocaml
khaladan_ has quit [Connection timed out]
bluestorm_ has joined #ocaml
khaladan has quit [Connection timed out]
khaladan- is now known as khaladan
Sweetshark has joined #ocaml
<Sweetshark> Hi guys! Im thinking about learning a modern language that compiles to fast native code. My requirements are: good interfaces to Python and C for generic API support, clean language enabling OOP and functional programming, platformindependance, compiler producing fast native code. Can ocaml provide this? How does it compare to Haskell and Eiffel?
<flux__> there is a mechanism for interfacing perl from ocaml, but I haven't seen a similar one for python
<flux__> though, given there there is ocaml4perl, I would imagine ocaml4python wouldn't be impossible to develope
<flux__> interfacing with C is quite easy. I understand there are some easier mechanism for some other languages, though (MLton?)
<flux__> I know nothing of eiffel, so..
<flux__> compared to haskell ocaml provides (mostly) strict evaluation, module-system, built-in oo, no type classes
<mellum> I find the C interface to be *very* error prone.
<mellum> But maybe that's just me.
<flux__> without comparing to anything else, I would say ocaml is a solid language with a solid implementation (only one, though), generates somewhat fast code, while the bytecode is sufficient for many uses. it also has many libraries and c-bindings around, including opengl, sdl and libgtk2.
<flux__> mellum, yeah, well it depends what kind of interface you're porting..
<flux__> mellum, it can be tedious
<mellum> But interfacing C with *any* garbage-collected language is probably error prone.
<pango> http://pycaml.sourceforge.net/ (by the author of offlineimap)
<flux__> pango, nice
<pango> however the guy seems to have gone to Haskell now...
<flux__> I wonder if python is worth learning, if one knows perl and ocaml
<bluestorm_> btw, do you think SML is worth learning ?
<flux__> I'm getting already things done in ocaml, so I don't bother :)
<flux__> although it would provide some nice things, there would undoubtably be some frustrations..
<dbueno> flux__: Someone needs to make CM-for-OCaml.
<flux__> dbueno, CM?
<dbueno> Then we wouldn't have to deal with ocamldep+Makefiles.
<dbueno> Compilation Manager: http://www.smlnj.org/doc/CM/index.html
<flux__> frustrations such as missing labeled/optional arguments (can be mostly worked around with anonymous records), no object system, no variants, no polymorphic record fields..
<dbueno> You create a file that lists your source files... it figures out the build order, builds everything necessary, and loads everything necessary into the running toplevel.
<flux__> I don't think the current system is too much of a barrier
<flux__> although of course there is room for improvement
<flux__> you are aware of ocamldsort, aren't you?
<dbueno> flux__: It's a barrier if you're used to CM. =]
<dbueno> But not "too much" of one, I agree.
<flux__> I must admit I sometimes fix my ocaml builds with make clean ;)
<flux__> fortunately the interface checking is quite strict
<flux__> so it's extremely difficult to get a broken build..
<flux__> ocaml could maybe integrate something like ocaml -build *.ml{i,} -o endproduce and it would Just Work (TM) ;)
<dbueno> Right --- that would be cool.
<flux__> actually ocamlfind could have some potential for that
<flux__> which is a great tool
<flux__> I put my own software into ocamlfind too, so I can easily link them in from anywhere
<dbueno> I've never used ocamlfind.
<dbueno> I don't even know what it does.
<flux__> it's a 'package manager' for ocaml libraries
<dbueno> Ah.
<flux__> so like ocamlfind ocamlc -linkpkg -package postgresql -o myprogram mysource.ml will compile it with postgresql and with its dependencies
<flux__> ocamlfind ocamlc -linkpkg -package sdl,sdl.sdlttf,unix,threads .. works also
<dbueno> Interesting.
<dbueno> I'll have to look into that.
<pango> I've found "A critique of standard ML", by Appel, an interesting read. Even if the interest is slowly becoming historical (the paper has been written in late '92), it states very clearly the strong points of ML (SML/OCaml/Haskell) languages
<bluestorm_> url ? :)
<pango> it's also probably interesting to see how the different language variants tackled with the mentionned problems (for example, it explains why OCaml uses capitals for constructors)
<flux__> does it explain, why they cannot be partially evaluated ;(
<pango> flux__: I think Xavier says somewhere that constructors-as-functions was not very readable in his opinion, so the feature was dropped after Caml light
<pango> (probably in the "seniors" mailing list)
<pango> like they call it in the beginners ml :)
chris2 has joined #ocaml
<Sweetshark> flux__, pango: thanks for the infos!
<pango> np
khaladan_ has joined #ocaml
<flux__> pango, I made a fun little wrapper (useful maybe?) to your annotator: http://www.modeemi.cs.tut.fi/~flux/software/annotgrep
<flux__> use it like (fe. in emacs): annotgrep Mymodule.mytype *.ml
<Sweetshark> flux__: oh, and I think python is worth learning when knowing perl. dunno about ocaml and if it makes up everything else python has going for it ...
<pango> ic... btw my implementation is not optimally efficient :)
<flux__> pango, I can see that, it takes seconds on a small file :)
<pango> since beginnings and endings are scanned in increasing order, hashtables are not the best datastructure
<flux__> but, atleast it's simple
<pango> flux__: you can even call it a hack ;)
<flux__> well, it could easily be so slow that it would be unusable ;)
<flux__> I wonder how the Map-module without iterators fits this
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
<flux__> performance-optimization-wise that is
<flux__> I suppose you could replace Hashtbl with an array
<flux__> to get a tremendous performance boost
<flux__> it would waste some memory, though ;)
<pango> flux__: I wonder if streams could be used, to iterate over three streams in parallel :)
<flux__> pango, I was actually thinking that too.. might be doable
<flux__> it would then take practically no time
<flux__> is the input already sorted?
<pango> the annotation file you mean ? well, maybe sorted by beginning offsets, but I'm not sure
<pango> I didn't think of using streams to rule out maps for sorting... Still, better maps (extlib's ?) would be needed
<flux__> with streams you could just sort the input and never use maps?
<pango> mmh I'm not sure... it could also make the design more fragile
<pango> mmh it must be possible to generate a stream of sorted elements out of a standard Set
<pango> removing smallest elements as we go
khaladan_ has joined #ocaml
<flux__> pango, so, did you figure out how to use functional streams?-)
<pango> uh, didn't had time to look into that again
<pango> seems one needs to use revised syntax... http://209.85.129.104/search?q=cache:SRrMMSW-KZAJ:www.frbox.net/viewtopic-177424.html+fparser+ocaml&hl=fr&gl=fr&ct=clnk&cd=12&client=firefox
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
<flux__> hmm.. funny.. debian only has fstream.{cmx,cmi,mli}, but no fstream.cmo..
<pango> /usr/lib/ocaml/3.09.1/camlp4/pa_fstream.cmo
<pango> /usr/lib/ocaml/3.09.1/camlp4/pa_fstream.cmx
<pango> /usr/lib/ocaml/3.09.1/camlp4/pa_fstream.o
<flux__> yes, but fstream, not pa_fstream
<pango> don't know what fstream.* are for
<flux__> it comes with a runtime library part also
<flux__> google for fstream.mli
<pango> aha
<flux__> I have one machine with self-build ocaml
<flux__> it has fstream.cmo in the source dir, but it's not installed
<flux__> a bug maybe? or maybe I'm not understanding everything..
<pango> same with ocaml-nox package
<flux__> actually it's probably something I don't understand, as I just produced a binary
<flux__> my fparser [: 1; 2 :] translates into 1; 2 though, which I doubt is the intended effect
postalchris has joined #ocaml
<flux__> methinks that thingy is somewhat buggy
<flux__> but this http://www.modeemi.cs.tut.fi/~flux/software/foo.ml compiles with ocamlc -o foo -pp 'camlp4o pa_fstream.cmo' -I +camlp4 fstream.cmo foo.ml
<flux__> and does _something_
<flux__> but the generated code (camlp4o pa_extend.cmo pa_fstream.cmo pr_o.cmo foo.ml) doesn't seem very bright (also witnessed by the produced warning)
<flux__> I also think that fstream.cmo needs to be available for that to compile
descender has quit ["Why has elegance found so little following? Elegance has the disadvantage that hard work is needed to achieve it and a good e]
smimou has joined #ocaml
chessguy has joined #ocaml
Smerdyakov has joined #ocaml
<pango> flux__: in 3.10 snapshot, the only mentions of fparser are in old Changelog entries and camlp4-old subdir, so I suspect it won't be supported by 3.10
danly has joined #ocaml
love-pingoo has quit ["Leaving"]
khaladan_ has joined #ocaml
malc_ has joined #ocaml
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
velco has quit ["Ex-Chat"]
Sweetshark has quit [Read error: 145 (Connection timed out)]
delamarc1e has quit []
Sweetshark has joined #ocaml
Sweetsha1k has joined #ocaml
ikaros_ has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
love-pingoo has joined #ocaml
Sweetshark has quit [Read error: 110 (Connection timed out)]
pango has quit [Remote closed the connection]
Sweetshark has joined #ocaml
Sweetsha1k has quit [Read error: 60 (Operation timed out)]
pango has joined #ocaml
_velco is now known as velco
david_koontz_ has quit [Client Quit]
fremo has quit ["Lost terminal"]
delamarche has joined #ocaml
swater_ has joined #ocaml
swater has quit [Read error: 110 (Connection timed out)]
Sweetshark has quit [Read error: 60 (Operation timed out)]
Sweetshark has joined #ocaml
chris2 has quit ["Leaving"]
Snark has quit ["Leaving"]
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- IRC has never been so good"]
klapmuetz has quit [Read error: 110 (Connection timed out)]
ikaros_ has quit [Read error: 104 (Connection reset by peer)]
ikaros has joined #ocaml
swater_ has quit ["Quat"]
love-pingoo has quit ["Connection reset by pear"]
delamarche has quit [Read error: 113 (No route to host)]
delamarche has joined #ocaml
chessguy has joined #ocaml
velco has quit ["I'm outta here ..."]
dbueno has quit [Read error: 113 (No route to host)]
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- IRC with a difference"]
Sweetsha1k has joined #ocaml
smimou has quit ["bli"]
Sweetshark has quit [Read error: 145 (Connection timed out)]
dibblego has joined #ocaml
dbueno has joined #ocaml
marti1 has joined #ocaml
<marti1> hi everyone
<marti1> have a silly question: the following code gives me errors:
<marti1> module M = Map.Make(String)
<marti1> type 'a table = 'a M.t
<marti1> module IdTy : OrderedSet =
<marti1> struct
<marti1> type t = string * 'a
<marti1> end
<marti1> module S = Set.Make(IdTy)
<marti1> type 'a set = 'a S.t
<marti1> I want to convert a map with from string to 'a to a set of string * 'a. How do I do?
<malc_> for one thing your IdTy is lacking a compare
<marti1> yeah that's true - but no matter - I don't even get that far
<malc_> use fold
<marti1> File "Symtab.ml", line 21, characters 26-28:
<marti1> Unbound type parameter 'a
<marti1> is the error message
<malc_> erm.. you pasted much less than 21 lines here
<malc_> besides type t= string * 'a does indeed lack an 'a on the lhs
<marti1> you want to see the whole thing?
<marti1> (*
<marti1> module for storing symbols
<marti1> for now, we sacrifice speed for simplicity by not doing the Appel trick
<marti1> of creating a hash map (w/ side effects) to create integer values for
<marti1> each string symbol to make comparison faster.
<marti1> *)
<marti1> open AbsSymtab
<marti1> module Symtab : AbsSymtab =
<marti1> struct
<marti1> module M = Map.Make(String)
<marti1> type 'a table = 'a M.t
<marti1> module IdTy : OrderedSet =
<marti1> struct
<marti1> type t = string * 'a
<marti1> end
<marti1> module S = Set.Make(IdTy)
<bluestorm_> YourMap.fold (fun key value set -> YourSet.add set (key, value)) your_map YourSet.empty
<marti1> type 'a set = 'a S.t
<marti1> let empty = M.empty
<marti1> let insert = M.add
<marti1> exception Symbol_not_found
<bluestorm_> hum
<marti1> let lookup key tab =
<marti1> try
<bluestorm_> use http://pastebin.be to paste code
<marti1> M.find key tab
<marti1> with Not_found -> raise Symbol_not_found
<marti1> let exists key tab =
<marti1> try
<marti1> M.find key tab;
<marti1> true
<marti1> with Not_found -> false
<marti1> end
<marti1> SORRY!
<bluestorm_> ^^
<marti1> do you see what I'm trying to do?
<marti1> bluestorm_: ok, thaks
<malc_> marti1: read what i said to you, read what bluestorm did
<malc_> it's all there
<malc_> i belive
<marti1> ok, thanks guys
<malc_> s;belive;believe
<marti1> bluestorm_, malc_: check out http://pastebin.be/3396/ -- it shows what I'm trying to do. I've implemented added the 'a to the type declaration in OrderedSet, and I've added the compare function. Now my error says: Unbound module type OrderedSet. I still feel like there's something deeply wrong.
<bluestorm_> ( http://pastebin.be/3397/ looks better ^^)
<marti1> ahh! wait - I think I'm being silly - give me a couple more minutes!! ;-)
<bluestorm_> i really don't know much about modules and functors and so on
<marti1> ok - if anyone can check this out and tell me what I'm doing wrong -- no more silly errors! ;-) http://pastebin.be/3398/
<marti1> bluestorm_: thx
<malc_> marti1: your t type can not be polymorphic
fab_ has quit [Read error: 110 (Connection timed out)]
<marti1> ok, pardon if this sounds intransigent but why not?
<malc_> because Set.OrderedType is monomorphic :)
<marti1> ok, fair enough ;-)
fab_ has joined #ocaml
<marti1> could you think of a work around? I'd like to be able to use the symbol tables to bind strings to "anything" - e.g. one for variables, one for types, etc..
<malc_> i will go and have a smoke and think about it.. and knowing myself i'm 100% sure nothing good will come out of it
<marti1> cool, thx
<marti1> quick question: what does +'a mean? I know 'a === <T> in C++...
fab_ has quit [Remote closed the connection]
<marti1> malc_: thx again - did the smoke enlighten you ? I think I'm screwed - you're right, Set is monomorphic, but Map is polymorphic. I probably can't reconcile the two in a module.
postalchris has left #ocaml []
<marti1> at least without concretizing the table entries in the map
<malc_> marti1: i have this intuition too.. but i guess asking this on ML would be a good thing
<malc_> and ... no ...
<malc_> not yet at least
<marti1> ok, malc_ thanks for you're help. And what does mattam mean?
<marti1> oh it's a name
<marti1> anyway, time to go to bed
<marti1> bye everyone!
<malc_> ciao
marti1 has left #ocaml []
delamarche has quit []
bluestorm_ has quit [Remote closed the connection]
descender has joined #ocaml
klapmuetz has joined #ocaml
malc_ has quit ["leaving"]
yondalf has joined #ocaml