flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 4.00.1 http://bit.ly/UHeZyT | http://www.ocaml.org | Public logs at http://tunes.org/~nef/logs/ocaml/
pkrnj has joined #ocaml
walter has joined #ocaml
srcerer has joined #ocaml
zRecursive has joined #ocaml
mfp has quit [Ping timeout: 245 seconds]
darkf has joined #ocaml
Neros has quit [Ping timeout: 264 seconds]
madroach has quit [Ping timeout: 264 seconds]
travisbrady has quit [Quit: travisbrady]
madroach has joined #ocaml
Xom has quit [Quit: ChatZilla 0.9.90.1 [Firefox 22.0/20130618035212]]
Xom has joined #ocaml
lifeng has quit [Ping timeout: 240 seconds]
dnm has quit [Ping timeout: 276 seconds]
demonimin has quit [Ping timeout: 264 seconds]
ygrek has joined #ocaml
asmanur_ has joined #ocaml
asmanur has quit [Ping timeout: 276 seconds]
q66 has quit [Quit: Leaving]
manud has quit [Ping timeout: 264 seconds]
manud has joined #ocaml
ben_zen has joined #ocaml
Xom has quit [Quit: ChatZilla 0.9.90.1 [Firefox 22.0/20130618035212]]
pkrnj has quit [Quit: Computer has gone to sleep.]
ygrek has quit [Ping timeout: 264 seconds]
introom has joined #ocaml
pkrnj has joined #ocaml
lusory has quit [Quit: leaving]
levi has joined #ocaml
shinnya has quit [Ping timeout: 264 seconds]
lusory has joined #ocaml
ygrek has joined #ocaml
n06rin has joined #ocaml
<n06rin> guys, recomend me good books for learning ocaml.
<n06rin> simple english is better
<whitequark> real world ocaml
ggole has joined #ocaml
lifeng has joined #ocaml
<n06rin> have pdf version?
<whitequark> don't think there is any
<whitequark> but the book will be released soon
<levi> You can read the pre-release version online.
<n06rin> yes, i find these
<technomancy> Real World OCaml is pretty great
Snark has joined #ocaml
caligula has quit [Quit: Konversation terminated!]
caligula has joined #ocaml
yacks has quit [Read error: Connection reset by peer]
demonimin has joined #ocaml
weie has joined #ocaml
manud has quit [Quit: manud]
zpe has joined #ocaml
Arsenik has joined #ocaml
ygrek has quit [Ping timeout: 264 seconds]
zpe has quit [Ping timeout: 264 seconds]
pkrnj has quit [Quit: Textual IRC Client: www.textualapp.com]
yacks has joined #ocaml
hkBst has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
Arsenik has quit [Remote host closed the connection]
zRecursive has left #ocaml []
Simn has joined #ocaml
zpe has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
technoma` has joined #ocaml
technomancy has quit [Remote host closed the connection]
ygrek has joined #ocaml
Simn has quit [Read error: Connection reset by peer]
gautamc has quit [Read error: Connection reset by peer]
Simn has joined #ocaml
gautamc has joined #ocaml
zpe has joined #ocaml
ben_zen has quit [Ping timeout: 245 seconds]
zpe has quit [Ping timeout: 246 seconds]
introom has quit [Remote host closed the connection]
milosn has quit [Read error: Operation timed out]
ollehar has joined #ocaml
Kakadu has joined #ocaml
n06rin has quit [Read error: Connection reset by peer]
zpe has joined #ocaml
zpe has quit [Ping timeout: 268 seconds]
gautamc has quit [Read error: Connection reset by peer]
gautamc has joined #ocaml
zpe has joined #ocaml
mcclurmc has joined #ocaml
ulfdoz has joined #ocaml
mfp has joined #ocaml
Neros has joined #ocaml
<kerneis> mrvn: about destdir and oasis, the bug has been reported https://forge.ocamlcore.org/tracker/index.php?func=detail&aid=718&group_id=54&atid=291
caligula has quit [Ping timeout: 240 seconds]
caligula has joined #ocaml
<gasche> after months of reading reddit and occasionally submitting stuff here and there, I still have no clue about why my submitted links sometime gather no point at all on r/programming and never seem to appear in the list
caligula has quit [Ping timeout: 245 seconds]
osa1 has joined #ocaml
q66 has joined #ocaml
caligula has joined #ocaml
<kerneis> gasche: I read hacker news, which has the "hellban" system which is even worse
<kerneis> now I don't post anything, just lurke
<ggole> Hacker news is pretty awful
<ggole> Although every now and then there is interesting discussion.
<kerneis> yes, I read read a few links from http://www.daemonology.net/hn-daily/ every day
<kerneis> I find an interesting place, from a sociological point of view
<kerneis> I find it*
def-lkb_ is now known as def-lkb
ollehar has quit [Ping timeout: 276 seconds]
skchrko has joined #ocaml
<Kakadu> hi
<Kakadu> AFAIR ocamlbuild/oasis don't support creating syntax extensions for camlp4/5 and using them immediately
<Kakadu> Is bug about it already created or I should make one?
Drup has joined #ocaml
justdit has joined #ocaml
<Kakadu> also, do u know something about integration menhit with ocamlbuild?
<Kakadu> s/u/you/
<Drup> Kakadu: "ocamlbuild -use-menhir"
<Kakadu> Drup: thanks
mort___ has joined #ocaml
<ggole> Isn't it a bit worrying that all these various things are special cased in ocamlbuild? :/
_andre has joined #ocaml
Sim_n has joined #ocaml
Simn has quit [Ping timeout: 245 seconds]
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 245 seconds]
<Kakadu> can I pass -rectypes to menhir somehow?
* Kakadu don't see any useful in menhir --help
darkf_ has quit [Ping timeout: 245 seconds]
darkf_ has joined #ocaml
ulfdoz has quit [Ping timeout: 264 seconds]
darkf_ is now known as darkf
mort___ has quit [Quit: Leaving.]
n06rin has joined #ocaml
Anarchos has joined #ocaml
Xom has joined #ocaml
justdit has quit [Ping timeout: 268 seconds]
vpm has quit [Excess Flood]
vpm has joined #ocaml
ulfdoz has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
<gasche> Kakadu: try --ocamlc "ocamlc -rectypes"
<gasche> you can also just avoid the --infer option and not have menhir call ocamlc at all
<Kakadu> Cool
<Kakadu> The last step is to put it to myocamlbuild somehow
<gasche> hm
<gasche> Kakadu: there is a known bug in ocamlbuild that make it not send the ocaml flags to menhir when expected
<gasche> this is fixed in trunk and will thus be fixed in the next version
<gasche> but in the meantime, there is also a known workaround
<gasche> just use a .mlypack file with the name of your .mly module inside, and compile that file
<gasche> eg. if you have toto.mly, define blah.mlypack with content "Toto", and 'ocamlbuild blah.cmo' will do what you expect if you have the rectypes tag activated
<gasche> (you can give the same name to the .mly and the .mlypack, and it works)
n06rin has quit [Quit: Leaving.]
<kerneis> mlypack? so many magical extensions
ollehar has joined #ocaml
<whitequark> gasche: why do you need --infer at all ?
<whitequark> I don't understand it
<Kakadu> thanks, gasche
Neros has quit [Remote host closed the connection]
Yoric has joined #ocaml
Yoric has quit [Ping timeout: 264 seconds]
<gasche> kerneis: menhir supports building a grammar from several .mly files
<gasche> .mlypack was a natural choice to enable building that
<gasche> the full story is that the bug "ocamlbuild doesn't pass the right options to menhir" was noticed by Nicolas and fixed... but only in the part handling compilation from mlypack
<gasche> there was some duplication with the code handling single .mly and, by mistake, this one wasn't fixed
<kerneis> ah, never used menhir
<gasche> which is why the workaround work
<gasche> it's actually quite neat
<kerneis> maybe I should (struggling with a grammar file currently)
<gasche> but now I need to look at the manual to answer whitequark's question
mikleog has joined #ocaml
<Anarchos> gasche i am looking for a grammar tool allowing concatenation as an operator and even if possible "abuse of notation" as we do in maths....
<gasche> I'm not sure what "allowing concatenation as an operator" means, given that in a yacc/menhir grammar (foo bar) will already parse any foo followed by any bar
<gasche> but menhir will not make grammar descriptions syntactically lighter than yacc
<gasche> and it is restricted to LR grammars, so if you are looking for significantly ambiguous grammars you should probably use a GLR tool instead
<whitequark> gasche: menhir has x?, x* and x+
<whitequark> it's sort of lighter (but I'm not sure if that is what you meant)
<gasche> that's right
<gasche> I forgot about those
<gasche> generally I consider menhir's syntax to be more readable, but also more explicit than yacc's, because of the variable naming
<gasche> (optional but that I personally strongly prefer to reading numeric positions in productions)
* whitequark nods
<whitequark> also, menhir's higher-order rules read to much much more readable code.
<whitequark> pair, separated_list, etc, are invaluable
<ggole> What's that for, things like 'a, b, c'?
<Anarchos> ggole what is the context ?
<gasche> yep
<ggole> Nice. I do find it annoying every time I have to write one of those.
<gasche> separated_list(var, comma) or something like that
<gasche> re. "why --infer", here is what the menhir manual says: http://ocaml.nopaste.dk/p58360
<gasche> summary: because rule inlining duplicate code, inferring types before makes for more readable messages
<gasche> typing error messages
<whitequark> I see, thanks
ygrek has joined #ocaml
mort___ has joined #ocaml
mort___ has quit [Client Quit]
mort___ has joined #ocaml
<whitequark> how do I add a path ocamlfind can traverse?
<whitequark> for example I have an llvm package in /usr/lib/ocaml/llvm-3.4/META.llvm
<whitequark> OCAMLPATH.
venk` has joined #ocaml
<gasche> whitequark: note that if the software called "ocamlfind install ..." at install-time, the META file should have been copied to a place ocamlfind knows about already
venk has quit [Ping timeout: 245 seconds]
mikleog has quit [Read error: Connection reset by peer]
mort___ has quit [Quit: Leaving.]
smondet has joined #ocaml
dtg has quit [Ping timeout: 264 seconds]
mort___ has joined #ocaml
dtg has joined #ocaml
<whitequark> gasche: well, I'm trying to combine opam and .deb packaged LLVM
<gasche> ok
dsheets has joined #ocaml
<whitequark> (because I want to run all this on CI, there are no proper packages for most of the stuff I want, and opam install llvm compiles it, which is unacceptable for CI)
<gasche> hm
<kerneis> whitequark: man findlib.conf
<gasche> there is ongoing work on distributing binary packages with OPAM I think, you should ask thomasga
<kerneis> the "path" variable is what you want
<gasche> besides, I'm not sure installing through OPAM would mean each CI run would recompile
<whitequark> kerneis: thanks. OCAMLPATH worked for me though
<gasche> can you not save the OPAM environment over multiple runs?
<whitequark> gasche: that's how Travis works: no
<gasche> Travis doesn't allow to save some base environment shared between all runs?
<kerneis> no, you've got 20 minutes, full stop
<kerneis> if I remember correctly
<gasche> meh
<kerneis> and apt-get
<gasche> hm
<whitequark> yeah
<gasche> so you could put that base environment on a distant sever
<gasche> and wget it at the beginning of the build :-'
<kerneis> yeah, that would work
<whitequark> so, I've successfully compiled llvm with ocaml bindings as a deb package for ocaml 4
<whitequark> but it fails to link
<gasche> completely different topic: kerneis, when discussing the .mllib stuff with Damien, I learned to my surprise that .p.cmx weren't an ocamlbuild invention
<kerneis> ha
<whitequark> from the messages, it looks like it did not discover that it needs to do -lc++
<whitequark> is it a known bug with ubuntu?
<whitequark> I recall something about -Wl,-no-as-needed
<gasche> kerneis: in a sense that's good news, because it means it's legitimate to ask for compiler fixes on .foo.cmx issues
<whitequark> -cclib -lstdc++ fixes that
<gasche> it also means that we should probably not try to phase them out of ocamlbuild (but of course reducing the redundancy in implementation would be nice)
<gasche> hm
<gasche> Travis CI looks like yet another proprietary service that is eager to have your project infrastructure depend upon it
<gasche> that said, there is probably much less opportunity for lock-in than for many other things
<kerneis> the worse that can happen is that you lose your CI tool
<kerneis> like "no more tests"
<kerneis> which is the case for a lot of projects anyway :-)
<pippijn> gasche: travis ci is minimally intrusive
<kerneis> it depends how much you rely on it, just like github
<kerneis> but at least, they don't own your data
<pippijn> also, isn't it open source?
<kerneis> (the way github owns your wiki or issue tracker for instance)
<pippijn> right, that's bad
<pippijn> eh
<pippijn> no, the wiki is not true
<pippijn> but yes, the issue tracker
<pippijn> the wiki is just another git repo
<kerneis> oh, right
<pippijn> it would be nice if the pages were also a separate git repo
<pippijn> not a branch
<pippijn> it feels dirty..
<kerneis> well, a branch can be a completely different repo, in a sense
<gasche> regardless of exportability of data, switching away from a centralized service always has a non-neglectible cost
<kerneis> at least, have a separate root
<kerneis> but yes, it's a bit ugly
<pippijn> kerneis: sure it can, and it is, but I don't have to like it
<gasche> you'll not be happy with wiki pages in the git repo if you don't have a simple procedure to make them available somewhere else
ben_zen has joined #ocaml
<gasche> I witnessed that again when Google Reader closed
<gasche> of course, a feed list is easy to import/export, but migration was in fact significantly harder than I thought it would be
<kerneis> what do you use now btw?
<gasche> (in particular for people that had, say, starred favorite items to be able to find them back quickly)
<pippijn> exporting the github wiki in a read-only fashion is very easy
<gasche> right now I'm using OpenShift to host a TinyTiny RSS instance for me
<gasche> I'm only moderately happy with TT-RSS interface but it makes do
<pippijn> making it into another wiki is not as easy
dsheets has quit [Ping timeout: 245 seconds]
<kerneis> yes, TT-RSS is a bit annoying, rsslounge is unmaintained and buggy
<kerneis> I finally switched back to rss2email
<kerneis> it does the job, and I spend my life in my email client anyway
<gasche> I'm better at batching RSS feeds than batch emails
<kerneis> oh, I scheduled it to run only once per night
<gasche> that's a good idea
<kerneis> it has in fact improved my batching
<kerneis> I should do the same with email
<gasche> one minor problem with self-hosted solutions is that you become aware of their technical stack
<kerneis> I host my emails anyway, so…
<kerneis> but it's time-consuming, you shouldn't do it unless you find it fun
<gasche> I'm deeply saddened when I have to deploy PHP software, and have been not trying ownCloud for that very single reason
<gasche> whereas I couldn't care less what Google Reader was using internally
<kerneis> oh yeah, I switched to flickr recently for that reason
<kerneis> sharing photos with my family was just too annoying
<kerneis> this is getting very off-topic, sorry
<pippijn> this channel doesn't have a strict topic policy
<kerneis> so, after three dozen iterations over several months, I think I finally have an almost satisfaying makefile for CIL
<pippijn> CIL as in the C parser?
<kerneis> and I feel anxious about doing git push
<kerneis> pippijn: yes
<pippijn> hmm
<pippijn> I should finish my C parser :)
<kerneis> no, you should use CIL ;-) (or cabs, which is included in CIL, if you don't want the lowering part)
<pippijn> maybe
<pippijn> maybe I should fix CIL
<kerneis> if you have any issue with CIL, please submit bug reports
<pippijn> I never used it
<kerneis> ok
<pippijn> I just compared my parser with it at some point
<pippijn> my parser wasn't serious, anyway
<pippijn> it was my first ocaml project
<pippijn> CIL has some polynomial time edge cases in the parser
<Kakadu> Well, my parser-combinators have become faster
<Kakadu> (I switched to generate Ast instead of pretty printing immediately)
zpe_ has joined #ocaml
<Kakadu> What I do not understand is why LR parsing with pretty printing works 2s and Combinators with pretty printing 26
<pippijn> pretty printing?
<Kakadu> but Yacc with Ast works 0.5 s and Combinators with Ast - 2s
<pippijn> oh
<Kakadu> pretty printing immediately withoud building Ast
<pippijn> so at first you had pretty printing directly?
<pippijn> ok
zpe has quit [Ping timeout: 246 seconds]
<pippijn> well, I don't know either :)
<pippijn> what are you making?
<Kakadu> Just testing how slow combinators are
<pippijn> you wrote them?
<Kakadu> a kind of
<Kakadu> original combintors library was slow and I decided to rewrite them by hands
<pippijn> ok
<Kakadu> So I dropped nice error reporting and probably something else
<pippijn> do they work in linear time?
<gasche> the obvious guess would be that the Yacc versions and the combinator-parser versions did not print things in the same way
Anarchos has quit [Ping timeout: 246 seconds]
<gasche> (eg. you changed something in the productions that made them run massively more slowly)
<Kakadu> gasche: output files seems to be the same
<gasche> or maybe they recognize the same input in different ways, and the combinator-produced AST is massively harder to pretty-printer
<gasche> that would be surprising but could make sense
<gasche> I would still guess it's a difference in semantics in the pretty-printing part, not a parsetree-structure difference
<gasche> Kakadu: what happens if you write the pretty-printer by pattern-matching on the AST
<gasche> and plug that implementation after both the LR and the combinator parser?
<Kakadu> em
<gasche> (this is why we write AST in the first place; they are the free structure that can allow any transformation from them)
dsheets has joined #ocaml
<Kakadu> I mentioned that above
<Kakadu> 0,5s for yacc and 2s for combinators
<kerneis> yeah, another ocamlbuild bug!
<Kakadu> it is what I did
yacks has quit [Quit: Leaving]
<kerneis> it doesn't work to put a "foo.docdir/index.html" inside a .itarget
<kerneis> at least not for CIL
<Kakadu> ALso I have count how often pretty printers are called: numbers seems to be same
<gasche> Kakadu: so your 0.5s timing includes the final pretty-printing time?
<gasche> what happens if you do not pretty-print at all, and simply ignore the resulting AST?
<kerneis> okay, it was an include issue
<Kakadu> gasche: It is only ast construction. pretty printing ast is not included in 0.5
<gasche> so if you plug the pretty-printer after this AST construction
travisbrady has joined #ocaml
<gasche> what performance figures do you get in both cases?
<Drup> gasche: "(16:43:48) Kakadu: What I do not understand is why LR parsing with pretty printing works 2s and Combinators with pretty printing 26"
lifeng has quit [Ping timeout: 264 seconds]
lifeng has joined #ocaml
<flux> I was under the impression that it was common knowledge that parser generators generate very fast parsers?
ben_zen has quit [Ping timeout: 240 seconds]
mort___ has quit [Ping timeout: 276 seconds]
<Kakadu> hm
<Kakadu> Generating Ast and generating pretty printer of this Ast take 8 and 50s for yacc and combinators respectively
tane has joined #ocaml
<flux> kakadu, btw, did you try tuning gc parameters?
<Kakadu> yeah, with minor heap 8Gb combinators are becoming faster
<Kakadu> faster than 26 seconds
hkBst has quit [Quit: Konversation terminated!]
Drup has quit [Ping timeout: 268 seconds]
ollehar has quit [Quit: ollehar]
walter has quit [Quit: This computer has gone to sleep]
travisbrady has quit [Quit: travisbrady]
travisbrady has joined #ocaml
yacks has joined #ocaml
Drup has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
nlucaroni has joined #ocaml
dsheets has quit [Ping timeout: 245 seconds]
chrisdotcode__ has joined #ocaml
chrisdotcode has quit [Ping timeout: 276 seconds]
jpdeplaix has quit [Ping timeout: 264 seconds]
dnm has joined #ocaml
jpdeplaix has joined #ocaml
ben_zen has joined #ocaml
skchrko has quit [Quit: Leaving]
ben_zen has quit [Ping timeout: 264 seconds]
milosn has joined #ocaml
wwilly has joined #ocaml
<wwilly> bonsoir
wmeyer has joined #ocaml
<wmeyer> ping adrien [usual business]
<rks`> wmeyer: 10:19:49 < adrien> I left for my holidays but I have the next patch mostly ready; I'll rewrite mkconfig.sh and mkmyocamlbuild_config.sh completely to avoid the sed-abomination too (and then I have one cosmetic issue left)
demonimin has quit [Ping timeout: 264 seconds]
<rks`> (that was like 2 days ago)
demonimin has joined #ocaml
technoma` is now known as technomancy
<wmeyer> rks`: thank you, makes sense
<rks`> you're welcome
<wmeyer> rks`: i saw commits of gasche
chrisdotcode has joined #ocaml
<wmeyer> to camlbuild
<rks`> right?
<wmeyer> ( rks` in the meantime however I am going to wait for adrien to confirm)
<wmeyer> nice that he has take a great care, i had not much time these days
chrisdotcode__ has quit [Ping timeout: 276 seconds]
<rks`> (to confirm what? :D)
<rks`> (I'm lost here)
<wmeyer> rks`: that he still works on this patches
<wmeyer> eh, agda does not work on ARM
<wmeyer> actually yes, I might try to fix it
Anarchos has joined #ocaml
ygrek has quit [Ping timeout: 256 seconds]
osa1 has quit [Remote host closed the connection]
osa1 has joined #ocaml
mcclurmc has quit [Quit: Leaving.]
dsheets has joined #ocaml
zachrab_ has joined #ocaml
<zachrab_> ok
<zachrab_> im in a coding competition for the next 1.5 hours
<Anarchos> who ever tried dypgen ?
<zachrab_> so whoever could help me that would be awesome
<zachrab_> how can i split on whitespace?
<ggole> There's a split function in Str iirc
zpe_ has quit [Remote host closed the connection]
<Qrntz> Str.split (Str.regexp " ") your_string_here
travisbrady has quit [Quit: travisbrady]
wmeyer has quit [Ping timeout: 240 seconds]
osa1 has quit [Remote host closed the connection]
<zachrab_> how can i regex
<zachrab_> Sys.argv(2)
testcocoon has quit [Ping timeout: 264 seconds]
osa1 has joined #ocaml
<zachrab_> im receiving cards like so 10D
<zachrab_> AH
travisbrady has joined #ocaml
dsheets has quit [Ping timeout: 256 seconds]
<ggole> I'd probably sscanf that
zachrab_ has quit [Read error: Connection reset by peer]
zachrab_ has joined #ocaml
ulfdoz has quit [Ping timeout: 246 seconds]
<ggole> try sscanf Sys.argv.(2) "%d%c" (fun n c -> NumberCard n, suit_of_char c) with ...
hinayana has joined #ocaml
testcocoon has joined #ocaml
willy_ has joined #ocaml
<zachrab_> how can i use regex?
<zachrab_> ggole: what does with ... mean?
<ggole> Put the rest of the code there.
<rixed> See Str module of stdlib ; if you are after perl regex there are external libs for that
wwilly has quit [Ping timeout: 264 seconds]
<zachrab_> ggole: is sscanf a library native to ocaml?
<ggole> Yep
<ggole> Scanf.sscanf
<ggole> Brave to use ocaml for a competition if you don't know the stdlib :p
<zachrab_> ggole: we were given obscure languages
<zachrab_> as options
<ggole> Oh, good fun!
<ggole> (I'm a little disappointed, if not surprised, to hear that OCaml is considered obscure.)
<zachrab_> ggole: sscanf scans the string and passes the the characters to the variables
<technomancy> ggole: think of it as a secret weapon
<zachrab_> ggole: can you walk me through this problem
<zachrab_> Problem #5
<ggole> zachrab_, where's the fun in that :(
<zachrab_> ggole:
<zachrab_> ggole: haha ok
<zachrab_> fine
<zachrab_> but can you explain what the line does so i can understand and write the rest of the code?
<ggole> Basically you can "parse" quite easily by trying to sscanf the arguments in Sys.argv
<zachrab_> ggole: ok
<zachrab_> so can you explain that line?
<rixed> what line?
<ggole> <zachrab_> im receiving cards like so 10D
<zachrab_> ggole: yes
pkrnj has joined #ocaml
<ggole> What I'm doing is parsing that form of text
<ggole> That's the "%d%c"
<zachrab_> ok but you can receive AH
<zachrab_> how about facecards?
<ggole> Right, that'll produce an exception
<zachrab_> k
<ggole> Then you catch that in the with
<rixed> zachrab_: if scanf fail then try facecard?
<ggole> And try the next possibility
<rixed> having pattern matching on strings for cases like this would be very nice, now that I think about it. Isn't it an extension that does this?
<rixed> something like match card with "%u%c" -> ... | "AH" -> ... etc
<rixed> of course you'd have to bind %u and %c, so : match card with "%u%c" as u, c -> ...
<ggole> You really want to be able to look at parts of strings
demonimin has quit [Ping timeout: 246 seconds]
<chris2> wow, |> and @@ are nice in 4.01
<Anarchos> chris2 you mean they are standard ?
<chris2> yep
<chris2> @@ should have been called $ but i guess that doesn't fit into the precedence table :P
<ggole> Hmm, thinking about it you'd have to be able to indicate a position to start matching at
<zachrab_> ggole: back to your line
<ggole> You could imagine something like match a at i with | [|Foo; Bar 1; ...|] -> ...
<zachrab_> (fun n c -> NumberCard n, suit_of_char c)
<ggole> (For arrays.)
<ggole> zachrab_, those are just a guess at what data you would like to construct to represent your card.
<zachrab_> so sscanf Sys.argv.(2) "%d%c" parses
<Anarchos> chris2 where did you see them ? The official manual is still in version 4.00
<zachrab_> ggole: can you explain the syntax: (fun n c -> NumberCard n, suit_of_char c)
<ggole> If the sscanf succeeds at recognising %d%c, it will call the function with those parts as arguments.
<chris2> and then i looked into the source tarball :)
<ggole> So that's just a function.
<zachrab_> so n is the name of function?
<zachrab_> oh i see
<ggole> No, it's an argument.
<ggole> The function is anonymous.
demonimin has joined #ocaml
<zachrab_> so i can say (sum_cards n c -> NumberCard n, Suit c)
<Anarchos> chris2 i am on version version 4.02.0+dev0-2013-06-13, i will take an eye on it
<zachrab_> why the NumberCard and suit_of_char?
tane has quit [Quit: Verlassend]
<ggole> NumberCard is a made up constructor name. Usually you would have already defined a type for that.
<zachrab_> constructor
<ggole> suit_of_char would be a function that you write to construct a suit from a single character.
<zachrab_> k
<Anarchos> chris2 i don't see the point of @@ ; it is normal direction for composition...
<ggole> Yeah, you would represent a card as something like type card = Numbered of int | Jack | Queen | King | Ace
<ggole> Whatever you like there.
<ggole> This is your job. :)
hinayana has quit [Quit: Quitte]
<chris2> Anarchos: no need for ()
<chris2> Anarchos: print_endline @@ "foo" ^ "bar"
<Anarchos> chris2 oh i see, question of priority of operator ?
<ggole> Each of the capitalised names there represents one possibility for the form of that data type: OCaml calls them 'constructors'.
<chris2> Anarchos: yep. haskell has that as $ and it's very popular
<zachrab_> i can write the suit_of_car function with if control structures for suit correspondance
<chris2> does opam need a "system" ocaml if i get it as a binary package?
<zachrab_> can you explain the constructor
<Anarchos> chris2 i ever thought that the f(x) syntax suits better people for people with a mathematical backgrount
<ggole> It's basically a datatype allowing you to represent "this can be X or Y", possibly with arguments for each.
<chris2> Anarchos: mathematicans rarely nest very deep :)
ulfdoz has joined #ocaml
<Anarchos> chris2 they define shortcuts :)
<chris2> also one sees f x there
<chris2> in category theory, abstract algebra etc
<zachrab_> ggole: i dont follow
<zachrab_> its an instance
<zachrab_> ocaml is object oriented?
<Anarchos> zachrab_ yes
<zachrab_> oh snap
<zachrab_> ggole: so I should make a card number class?
<ggole> Just a data type
<ggole> type card = Numbered of int | Jack | Queen | King | Ace
<zachrab_> k
<zachrab_> how do i make it a data type?
<ggole> The above code is a data type definition.
<Xom> what do people uses classes for in ocaml anyway
<ggole> After you enter that in the toplevel or whatever, you'll be able to construct elements of that type.
<ggole> I... don't, usually
<ggole> They are pretty complicated.
<def-lkb> for structural-subtyping maybe, or providing convenient interface to OO library
<rixed> Xom: a good paper on the subject: http://pauillac.inria.fr/~xleroy/talks/icfp99.ps.gz
<zachrab_> im getting Error: Unbound value sscanf
<ggole> Use Scanf.sscaf
<ggole> Or 'open Scanf' beforehand
<zachrab_> Error: Unbound constructor NumberCard
<zachrab_> how can i make the the numbercard constructor?
<zachrab_> separate file?
<zachrab_> and import it?
<zachrab_> whats the syntax for making a constructor?
<def-lkb> type card = NumberCard of int ??
Snark has quit [Quit: leaving]
<def-lkb> you should read a tutorial
<ggole> Well, you need to think about what is going on rather than just paste the code
<ggole> In this case the constructor is supposed to name an element of the card type
<ggole> If you've defined that as type card = Numbered of int | Jack | Queen | King | Ace as I suggested, it needs to be one of those.
testcocoon has quit [Ping timeout: 264 seconds]
<zachrab_> ggole: i dont follow
<ggole> :/
<ggole> Replace it with 'Numbered'.
<rixed> zachrab_: what language are you already familiar with (so we can translate the jargon)
<zachrab_> ha thx
<zachrab_> im a rubyist
<zachrab_> that would help immensely
<rixed> zachrab_: hm, what else?
<rixed> zachrab_: I don't know ruby :)
<rixed> zachrab_: any tyoed language?
<rixed> tyoed->typed
<zachrab_> no
<rixed> zachrab_: ouch
<zachrab_> a
<zachrab_> ya
mort___ has joined #ocaml
<rixed> in order to be able to create, say a "Numbered 7" you have to define a type with the constructor Numbered beforehand
<rixed> with the type card = ... given above
<rixed> from that point on you have a type named "card" so you can create values of that type.
<rixed> for instance, let foo = Numbered 7
dsheets has joined #ocaml
<zachrab_> im getting syntax error for
<zachrab_> type card = Numbered of int | "Jack" | "Queen" | "King" | "Ace"
<zachrab_> thats my type constructor
<ggole> Ditch the "s
<ousado> have you considered looking at existing code?
<rixed> zachrab_: "Jack" is not a constructor, Jack is.
<rixed> type card = Numbered of int | Jack | Queen and so on
<rixed> But given your problem you should save only color and value, so I'd say:
<rixed> type suit = Clubs | Diamonds | Hearts | Spades
<rixed> use int for values.
<rixed> then you want a function from string to (int * suit)
<rixed> this function use Scanf.sscanf as described
<rixed> makes sense?
zpe has joined #ocaml
mcclurmc has joined #ocaml
<zachrab_> Error: Unbound value suit_of_char
<rixed> something like: let card_of_string s = try Scanf.sscanf s "%u%c" (fun v c -> v, suit_of_char c) with _ -> Scanf.sscanf s "%c%c" (fun v s -> value_of_figure v, suit_of_char c)
<rixed> etc
<Drup> zachrab_: instead of trying to blindly grasp some piece of code, you should read a proper tutorial
ben_zen has joined #ocaml
<rixed> of course suit_of_char and value_of_figure are not in the stdlib :)
<rixed> you'd have to write them, but they are very simple
<rixed> Drup: he has only 1h left, he's in the middle of a coding competition :)
<rixed> let suit_of_char = function 'C' -> Clubs | 'D' -> Diamonds and so on
<Drup> huh, that's weird to do a coding competition in a langage you don't know ...
<rixed> let value_of_figure = function 'J' -> you got it
<rixed> Drup: apparently that's all the fun about it
<rixed> That's a good way to force poeple into trying other languages
<ousado> .. which has been extended to a social engineering competition
<rixed> ousado: that's probably part of it :)
<Drup> rixed: then, you're not helping :3
<ousado> such excercises are not about solving these toy problems, they are about learning how to aquire what it takes to solve them.
<ggole> zachrab_: you have to suit_of_char *before* its use
<ggole> *to write
darkf has quit [Quit: Leaving]
zpe has quit [Ping timeout: 240 seconds]
<rixed> He need a minimum of understanding of the syntax before he can write anything himself
<Drup> that's perfect for it.
<rixed> Once he will see how short and understandable his final code is he will come back to learn for real I hope :)
ben_zen has quit [Ping timeout: 240 seconds]
shinnya has joined #ocaml
testcocoon has joined #ocaml
mort___ has quit [Ping timeout: 276 seconds]
zachrab_ has quit [Remote host closed the connection]
morolin has quit [Read error: Operation timed out]
zachrab_ has joined #ocaml
zachrab_ has quit [Remote host closed the connection]
zpe has joined #ocaml
zpe has quit [Ping timeout: 268 seconds]
dsheets has quit [Ping timeout: 245 seconds]
dsheets has joined #ocaml
ggole has quit []
pkrnj has quit [Quit: Computer has gone to sleep.]
<gasche> heh
<gasche> you have a contest about a language you don't know, and you come on the IRC channel asking people to solve problem for you?
<gasche> *problems
<gasche> that is both dumb and not very respectful of other's people time
dsheets has quit [Ping timeout: 240 seconds]
<gasche> the 4.01+beta is out
zpe has joined #ocaml
redfire has joined #ocaml
zpe has quit [Ping timeout: 240 seconds]
<Anarchos> gasche thanks !!
_andre has quit [Quit: leaving]
gautamc has quit [Read error: Connection reset by peer]
gautamc has joined #ocaml
zpe has joined #ocaml
Neros has joined #ocaml
zpe has quit [Ping timeout: 245 seconds]
k3VB6u4d has quit [Excess Flood]
k3VB6u4d has joined #ocaml
ulfdoz has quit [Ping timeout: 268 seconds]
travisbrady has quit [Quit: travisbrady]
zpe has joined #ocaml
zpe has quit [Ping timeout: 268 seconds]
ollehar has joined #ocaml
x-s4nd3r has joined #ocaml
x-s4nd3r has quit [Changing host]
x-s4nd3r has joined #ocaml
redfire has quit [Quit: WeeChat 0.4.1]
x-s4nd3r has quit [Remote host closed the connection]
willy_ has quit [Remote host closed the connection]
mcclurmc has quit [Quit: Leaving.]
x-s4nd3r has joined #ocaml
pkrnj has joined #ocaml
x-s4nd3r has quit [Quit: i'll be back in a moment, just gotta do some stuff...]
k3VB6u4d has quit [Excess Flood]
k3VB6u4d has joined #ocaml
venk` is now known as vpit3833
structuralist has joined #ocaml
k3VB6u4d has left #ocaml []
pango_ has joined #ocaml
pango has quit [Read error: Operation timed out]
pango_ is now known as pango
smondet has quit [Quit: NYC PEOPLE: Concert on Sat 17th: http://lucrativejacket.com]
chrisdotcode__ has joined #ocaml
chrisdotcode__ has quit [Remote host closed the connection]
chrisdotcode has quit [Ping timeout: 264 seconds]
Anarchos has quit [Quit: Vision[0.9.7-H-130604]: i've been blurred!]
dsheets has joined #ocaml
mort___ has joined #ocaml
dsheets has quit [Ping timeout: 276 seconds]
ben_zen has joined #ocaml
ben_zen has quit [Ping timeout: 268 seconds]
pkrnj has quit [Quit: Computer has gone to sleep.]
ollehar has quit [Ping timeout: 264 seconds]
pkrnj has joined #ocaml
Sim_n is now known as Simn
zRecursive has joined #ocaml
Simn has quit [Quit: Leaving]
chris2 has quit [Quit: Lost terminal]
chris2 has joined #ocaml
mfp has quit [Ping timeout: 246 seconds]