mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
szell has quit [Read error: 110 (Connection timed out)]
gk has joined #ocaml
<gk> hello, any ocamllex/ocamlyacc gurus here?
hsuh has joined #ocaml
szell has joined #ocaml
mwc has joined #ocaml
hsuh has quit ["gone lucid dreaming"]
pango_ has quit [Remote closed the connection]
seafood_ has joined #ocaml
pango_ has joined #ocaml
LordMetroid has quit ["Leaving"]
goalieca has quit ["Ex-Chat"]
Jedai has quit [Read error: 104 (Connection reset by peer)]
thelema has joined #ocaml
^authentic has joined #ocaml
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
ramkrsna has joined #ocaml
ikaros has joined #ocaml
thelema has quit ["BitchX-1.1-final -- just do it."]
thelema has joined #ocaml
adu has joined #ocaml
Tetsuo has joined #ocaml
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
goalieca has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
vladimir_trs has joined #ocaml
<vladimir_trs> Hello?
<adu> hi
<adu> do you need help?
<vladimir_trs> sort of...
<vladimir_trs> do you know how to build a windows exe file with ocamlopt?
<adu> nope, have you read the manual?
<vladimir_trs> yep, more than once...
<vladimir_trs> yes, this exact manual
<adu> hmm
<adu> what happens?
<adu> I mean what happens if you do "ocamlopt -o Something.exe"
<vladimir_trs> I have a simple helloworld-ish program, let's say it's name is "helloworld.ml" I can build it with ocamlc, no problem. Trying the same with ocamlopt gives "LINK : fatal error LNK1181: cannot open input file 'advapi32.lib'"
<adu> o
<vladimir_trs> I found that "advapi32.lib" in the platform sdk directory and tried to give it to ocamlopt with -ccopt -Ldir.
<adu> thats what I would have done
<vladimir_trs> So, "advapi32.lib" is in my "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib"
<adu> ok
<vladimir_trs> I tried it as follows: ocamlopt -o helloworld.exe helloworld.ml -ccopt -L"C:\PROGRA~1\MICROS~1.NET\Vc7\PLATFO~1\Lib\"
<adu> try: ocamlopt -o helloworld.exe helloworld.ml -ccopt "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib\advapi32.lib"
<adu> i wonder if its a problem with spaces...
<vladimir_trs> I've tried with spaces, without spaces (8.3 path) - it said "ignoring unknown option -LC:\bla-bla-bla..." and then again couldn't find advapi32.lib
<adu> there shouldn't be a space between the L and the "
<adu> that is if you are doing -ccopt -L"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib\advapi32.lib"
<vladimir_trs> Now it said "unrecognized source file type 'C:\Program', object file assumed", shall I try the short path?
<adu> OK, if you use L there should be no advapi32.lib, if you don't use L then put advapi32.lib on the end
<adu> yes, that is a problem with spaces
<vladimir_trs> yes, that's how I typed it.
<adu> try this: -ccopt -L"'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib\'
<adu> nono
<adu> -ccopt -L"'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib\'"
<adu> that
filp has joined #ocaml
<vladimir_trs> I tried with space between L and ", without, with quotes and without quotes, long path, short path - same error.
<adu> double quotes?
<adu> like that ^
<adu> see the " ' ... ' "
<adu> try that one
<vladimir_trs> single quotes inside of double ones?
<adu> single or \" doesn't matter
<adu> but it might on windows... i don't know windows
<vladimir_trs> nope... the same error.
<adu> how about with: -ccopt "'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib\advapi32.lib'"
<vladimir_trs> unrecognized source file type ''C:\Program', object file assumed
<vladimir_trs> spaces...
prince has quit [Client Quit]
<flux> vladimir_trs, I don't remember the switch (maybe -v), but you can suggest the compiler to provide more verbose output
<flux> vladimir_trs, perhaps one option would be to try coping the .lib -file to some path which doesn't have spaces in it
<adu> hmm, maybe: -ccopt """C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib\advapi32.lib"""
<adu> thats three doublequotes
<vladimir_trs> and with short path: cl : Command line warning D4024 : unrecognized source file type ''C:\PROGRA~1\MICROS~1.NET\Vc7\PLATFO~1\Lib\advapi32.lib'', object file assumed
<adu> hmm
<vladimir_trs> flux, I tried ocamlopt -v, it said that my compiler is of version 3.10.0 and standard library is in C:\ocaml\lib
<adu> have you tried -cclib -l"C:\PROGRA~1\MICROS~1.NET\Vc7\PLATFO~1\Lib\advapi32.lib"
<adu> or maybe trying the dll instead...
<vladimir_trs> with "-cclib -l"C:\PROGRA~1\MICROS~1.NET\Vc7\PLATFO~1\Lib\advapi32.lib" it said "LINK : fatal error LNK1104: cannot open file 'libC:\PROGRA~1\MICROS~1.NET\Vc7\PLATFO~1\Lib\advapi32.lib.lib' Error during linking"
<vladimir_trs> weird... it put "lib" in front of it... where does it think it is, on some linux?...
<vladimir_trs> and then it added ".lib" after....
Yoric[DT] has joined #ocaml
<flux> vladimir_trs, maybe it was -verbose then
Yoric[DT] has quit ["Ex-Chat"]
hkBst has joined #ocaml
OChameau has joined #ocaml
cmeme has quit [Read error: 104 (Connection reset by peer)]
cmeme has joined #ocaml
adu has quit ["Bye"]
thelema has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
Tetsuo has quit [Remote closed the connection]
mlh has joined #ocaml
<vladimir_trs> ocamlopt worked on Linux without a glitch....
<vladimir_trs> some windows-specific problems...
ygrek has joined #ocaml
Demitar has quit ["Burn the land and boil the sea. You can't take the sky from me."]
yangsx has quit [Read error: 110 (Connection timed out)]
vladimir_trs has left #ocaml []
mfp_ has joined #ocaml
mfp has quit [Read error: 110 (Connection timed out)]
seafood_ has quit []
goalieca has quit ["keep your stick on the ice"]
thelema has joined #ocaml
magnusth has joined #ocaml
OChameau has quit [Read error: 110 (Connection timed out)]
OChameau has joined #ocaml
magnusth is now known as magthe
coucou747 has joined #ocaml
magthe has quit ["Ex-Chat"]
magthe has joined #ocaml
schme has joined #ocaml
Yoric[DT] has joined #ocaml
Jedai has joined #ocaml
seafood_ has joined #ocaml
schme has quit [Read error: 110 (Connection timed out)]
m3ga has joined #ocaml
mlh_ has joined #ocaml
sckot has joined #ocaml
mlh has quit [Read error: 110 (Connection timed out)]
munga has joined #ocaml
Anarchos has joined #ocaml
<Anarchos> hello
<magthe> hello Anarchos
mqtt has joined #ocaml
<Anarchos> i am looking for information about caml_enter_blocking_section_hook
m3ga has quit ["disappearing into the sunset"]
FZ has joined #ocaml
<Anarchos> I get this error when making opt : ./../ocamlcompopt.sh -shared -o unix.cmxs -I . unix.cmxa >>>>>>> unix.cmxs.startup.o: In function `caml_curry7': (.text+0x3): undefined reference to `caml_young_ptr'
<Anarchos> i never encountered those cmxs before
<rwmjones> Anarchos, that doesn't look good ... what platform is this? what compiler version?
seafood_ has quit []
<rwmjones> iirc caml_young_ptr is in libcamlru
<rwmjones> iirc caml_young_ptr is in libcamlrun
<Anarchos> rwjones beos. they are in libcamlrun, anyway i am not sure of the linker options
RobertFischer has joined #ocaml
<Anarchos> how to know what is linked in unix.cmxa ?
mqtt has left #ocaml []
LordMetroid has joined #ocaml
RobertFischer is now known as away
ikaros has quit [Remote closed the connection]
ikaros has joined #ocaml
ikaros has quit [Remote closed the connection]
ikaros has joined #ocaml
away has quit ["Taking off -- check out http://smokejumperit.com and http://enfranchisedmind.com/blog/"]
RobertFischer has joined #ocaml
ikaros has quit [Remote closed the connection]
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
ttt-- has joined #ocaml
coucou747 is now known as PeolpleHatePerl
RobertFischer has quit []
RobertFischer has joined #ocaml
PeolpleHatePerl is now known as PeopleHatePerl
postalchris has joined #ocaml
Morphous has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit ["Ex-Chat"]
munga has quit ["Leaving"]
Amorphous has joined #ocaml
ramkrsna has quit ["Leaving"]
pango_ has quit [Remote closed the connection]
postalchris has quit ["Leaving."]
* thelema feels happy with xavier's response on QPL
pango_ has joined #ocaml
* thelema will start collecting patches to compiler on github (although they're likely not to make it into community-ocaml, it might be useful to have such a central repository.
<hcarty> thelema: Would something along the lines of a regular "git rebase" make it clearer regarding what is original vs changed? You may do this already...
<thelema> hcarty: I can't and won't do git-rebase on the public tree.
<hcarty> Why is that?
<hcarty> I'm relatively new to git, so I ask out of ignorance
mikeX_ has joined #ocaml
<thelema> hcarty: git references objects by SHA1 hash.
<hcarty> OH, right... I read about that. So a rebase screws up the hash
<thelema> this hash encodes information about not just the current change, but where in the tree of modifications it is.
<thelema> if you rebase, you delete a bunch of objects and replace them with nearly identical ones at a different place in the tree.
<thelema> the rebase screws up clones' ability to refer to your objects.
sckot has left #ocaml []
<RobertFischer> thelema: What's so cool about distributed version control? I guess I'm an old fogey already, but I donna get it.
<thelema> it's not inherent in the design, but seems to be a requirement for a useful implementation: strong branching and merging tools
<RobertFischer> That is true. Branching and merging do suck in SVN/CVS. Is it really that much easier in Git, though?
<RobertFischer> (I'm totally willing to believe "yes" if that's what you tell me.)
<thelema> yes. git branching is history-aware, so it takes into account any bits that have already merged.
<thelema> (actually there's a few merging algorithms that one can choose from, or let git just pick the most appropriate)
<RobertFischer> Hrm. Maybe I will have to take a look. Git's apparently got reasonable SVN integration, too.
<RobertFischer> The SVN integration is critical for compatibility with a whole host of build tools.
mikeX has quit [Read error: 110 (Connection timed out)]
<thelema> yes, git-svn is good, but not perfect... see this blog post for some current info on someone talking about git+svn compatbility: http://blogs.gnome.org/timj/2008/04/07/07042008-on-moving-gtk-to-git/
rwmjones_ has joined #ocaml
mikeX has joined #ocaml
<ertai> RobertFischer: SVN integration or history translation is critical
<ertai> RobertFischer: If you can convince people to switch to a new SCM you "just" need history conversion tools.
<RobertFischer> ertai: The problem isn't the people, it's the tools. I need some way of integrating Git with whatever build and CI system I've got.
<RobertFischer> ertai: If you can get me an SVN plug-in for Hudson, it'll make my day.
<RobertFischer> ertai: s/git/SVN/
<RobertFischer> ARRGH!
<RobertFischer> My brain isn't working.
<RobertFischer> If you can get me a Git plug-in for Hudson, it'll make my day.
<RobertFischer> (There we go.)
<thelema> git's GPL license has made plugins less common than if it were LGPL...
LordMetroid has quit [Connection reset by peer]
LordMetroid has joined #ocaml
<thelema> git seems designed for CLI interaction (which makes scripting pretty easy)
<ertai> RobertFischer: git.codecritters.com/projects/hudson.git ?
<thelema> but doesn't make GUI integration as easy as if it had an API.
LordMetroid has quit [Read error: 104 (Connection reset by peer)]
lordmetroid_ has joined #ocaml
<ertai> RobertFischer: there is also "Hudson Mercurial plugin" at http://hudson.gotdns.com/wiki/display/HUDSON/Mercurial+Plugin
<thelema> what is an "extensible continuous integration engine"?
mikeX_ has quit [Read error: 110 (Connection timed out)]
* ertai knows nothing about Hudson
<ertai> thelema: the name seems pretty clear thought a "continuous integration" tool with an extensible design
<ertai> ... support for plugins
<thelema> okay, does "continuous integration" mean anything more than "helps lots of people check into a SCM"?
lordmetroid_ has quit [Client Quit]
LordMetroid has joined #ocaml
<thelema> heh. changeset support. I created my git repo for this purpose - the ability to see each commit as a change and see what it changed.
<thelema> hudson sounds like something easily written as a few git commit hooks.
<thelema> I guess it's more than that because of the pretty interface...
<RobertFischer> ertai: I kne about the Mercurial Plug-in. Mercurial's pretty popular at the Ruby.MN user group that I frequent.
<mwc> RobertFischer, one thing git does well that mercurial is still weak on is non-linear history
<thelema> ci == "don't break the build" checks on commit?
<ertai> RobertFischer: mercurial have the advantage of a cleaner UI than git even if it can be as good as the darcs one, and is more portable
<ertai> thelema: basically yes
<ertai> thelema: do you have a clear pointer (explanation) about this non-linear history thing
<ertai> thelema: just to make things clear
<RobertFischer> thelema: Yes, "continuous integration" is a WHOLE lot more than SCM management. It's the backbone of maintaining code quality, and the place where audits, deployments, integration checks, etc. are done. Particularly in the world of business software development, where people other than coders want to know about the status of code, it's a critical system. And if you don't realize why, I'd be more than happy to hang out for a
* RobertFischer breathes.
<thelema> ertai: non-linear history just has to do with how a commit can have multiple parents - a merge.
<thelema> if you allow this, some of the algorithms get hairy.
<RobertFischer> The pretty interface on a CI server is just gravy. I was a big CruiseControl person for a long time, and that's got an ugly-as-sin interface. :)
<RobertFischer> I'll have to check out git, if merges really are so slick.
<mwc> one nice thing about git is that you can try a merge or a rebase fearlessly
<thelema> then git's model of 'check in early, check in often' won't appeal to you so much.
Tetsuo has joined #ocaml
<mwc> if you fuck it up badly, just grab the previous HEAD out of git reflog, and then reset HEAD to that
<RobertFischer> mwc: How is that different from SVN?
<RobertFischer> thelema: Who as that in response to?
<mwc> it depends on how the VCS manages history
<mwc> git doesn't through away anything until told to by git gc\
<thelema> mwc: the fix isn't quite trivial to a git newbie, but is very nice for someone pretty knowledgable.
<thelema> RobertFischer: for you.
<thelema> I like the model of local commits wild and free, and more and more checks - higher-quality commits as you get closer to your release branch.
<RobertFischer> thelema: I'm a big fan of "check in early, check in often". It's the only way to survive on even moderately sized teams. What would make you think I wouldn't like that approach?
<thelema> RobertFischer: the insistence on forced quality checks on every commit.
<mwc> yeah, that sounds to me like you hack on something until it's polished shiny, then check it in
<mwc> on the other hand, you could do that with git too
bluestorm has joined #ocaml
<mwc> just don't push your changes to the master/central branch the CI system uses until you're satisfied
<RobertFischer> The quality checks are done by the CI server, which is the production-bound set of code. So, yes, don't check broke stuff into that.
<thelema> mwc: that's what I love about git - you don't have to forgo SCM while you hack.
<thelema> RobertFischer: without distributed SCM, you have to 'not use SCM' between commits to the CI.
<mwc> RobertFischer, looks to me like Hudson is actually using git themselves :)
<mwc> I'd be surprised if they don't have a git plugin already
<RobertFischer> That's pretty awesome, actually.
<RobertFischer> I'll take a look.
<thelema> mwc: someone has created a git repo of hudson, that's all.
<RobertFischer> You don't have to have things polished and shiny to get into that production-bound set of code. But you do have to not check in broke stuff.
<mwc> thelema, ahhh
<RobertFischer> And it'd be nice to have local SCM which then gets pushed to the CI set of code when I want to. The fear of doing that has always been the merge back in sucking so bad.
<thelema> and that's what I like about git - trivial branching/merging + super-fast checkins means that I can make a branch for my short term work and commit to it as often as I save to disk.
<mwc> RobertFischer, the other nice thing is that with commit --amend, you can work incrementally if you like to have "logical" commits, ie, one bit of functionality/bugfix.
<mwc> on the other hand, you lose the ability to pick that apart with most VCSs
<mwc> now, if you leave them all as atomic patches, you can get gross history
<mwc> but that's where git-rebase comes in
<mwc> you can happily squash them together later, just before you push
<RobertFischer> Yeah. I guess I assumed that it was going to be just as painful to do the merges with Git, so the idea of a VCS based on doing them often really turned me off.
bla has quit [Connection timed out]
<thelema> mwc: that's where local branches come in - they get squished into one commit when they get merged.
<mwc> thelema, you rebase/squash yourself? or is there some fu I'm not aware of
<thelema> I rebased a little when doing some git-svn integration, but i realized that merging was as good and didn't rewrite history.
* thelema doesn't like rewriting history.
<mwc> Yeah
<mwc> Rewrite history freely in your private repo
<mwc> don't rewrite history on a "Public" branch
<thelema> anything you push or that can get pulled from - no rewriting.
<mwc> so generally master would be the one I expect to share
<mwc> once stuff's on master, I don't rebase
<mwc> on the other hand, it's all good local branches
<ertai> RobertFischer, thelema: talking about slick merges I think that darcs is really the best
<mwc> ertai, oh, they fixed their O(N!) merge problem?
<mwc> I saw that Darcs 2.0.0 is out
<ertai> mwc: yes
<mwc> It's a pity darcs is written in Haskell
* mwc calms angry murmurs
<mwc> darcs was the first VCS I used, and it got me hooked, I use VCS for everything now
<mwc> but it won't run on my powerbook reliably, since GHC on Linux/ppc is touchy
<mwc> that's the nice thing about git being written in C
<mwc> On the other hand, a Caml darcs would be no problem either
<ertai> mwc: IMHO it's far less a pity than writting it in C + scripts
* thelema has a little code for an OCaml git
<mwc> ertai, sure, but if it means I can't use it on half my development machines...
<mwc> I'll just find something else
<ertai> mwc: you are sure that problems your mentioning about GHC still holds?
<ertai> mwc: I think you should give it a second chance
<hcarty> ertai: Does darcs have a way now to keep a clear history of changes without manual tagging? That was the main reason I switched away from it...
<ertai> honestly darcs still don't scale as better as git for very big projects but is far more clearer than everything else, and so should be used at least for small-to-medium sized projects
<hcarty> I still think darcs has the best UI
<hcarty> But I use git now because of the painless branching
<mwc> ertai, it might now. I know I was still having troubles with GHC segfaulting as late as 6.8.1
<mwc> but yeah, now that I'm happy and comfortable with git, I see no reason to go back
<ertai> mwc: (1) hum too bad, (2) ok
<mwc> furthermore, I have a little conceit about how the repository is stored. Git stores the revisions, everythign else it seems stores edges: in the DAG, git stores nodes, darcs stores edges. I'm convinced the former is the right thing to do
<mwc> but that's really not too relevent
<ertai> hcarty: about history of changes darcs still have the same model where changes are not fully ordered and only dependencies force some order
<mwc> ertai, yeah, theory of patches, that's the great thing about darcs
<ertai> hcarty: and tags are still the way to depend on everything else
<mwc> somebody who knew math thought long and hard about an algebraic structure
<thelema> mwc: sometimes one is more useful than the other, with a little CPU power, the transform goes easily
bla has joined #ocaml
mmmultiworks has joined #ocaml
<mwc> ertai, now that darcs has fixed their factorial merge disaster case, it should work nicer on large projects
<ertai> moreover I think that darcs is the first to be able to go to "semantics patches"
<ertai> mwc: right, but there is still room for improvments, and so few contributors...
<ertai> mwc: there quite a lot of users but so few want to contribute :(
<RobertFischer> "semntics patches"?
<RobertFischer> That just sounds scary.
<mwc> RobertFischer, it was designed by a quantum physicist (I am also one)
<mwc> so part of that world view is that evolution is defined by unitary operators, which are invertible
<RobertFischer> Not filling me with confidence.
<mwc> that's the key thing: every patch it can represent is invertible, and it can compute commutators
<thelema> mwc: meaning it can't represent non-invertible patches?
<mwc> thelema, precisely
<ertai> thelema: right
<thelema> does such a thing exist? I thought I could patch -r anything
<thelema> err, -R
<mwc> now, the point of that is that two people get together with a repo, and they have pulled patches from other repos, but in different orders
<ertai> thelema: move, add, remove, hunks, replace, sequences
<mwc> so now, potentially, their histories are totally out of order
<mwc> the theory of patches gives darcs the intelligence needed to exchange patches from one to the other
<ertai> thelema: one that is not easily invertible is "copy"
<thelema> ertai: I don't think I create many patches with "copy" commands in them.
<mwc> though, what I wrote there was misleading, there really isn't "history"
<ertai> RobertFischer: "semantic patches" would be able to store meaningful code/data changes instead of text changes
<mwc> there's just a set of patches that get you hear
<mwc> *here
<ertai> thelema: in svn at least copy is builtin and move is emulated by copy + remove
<thelema> ah, copy files. not copy as a diff hunk.
<ertai> thelema: right
<RobertFischer> ertai: And that's exactly what scares me about it. I'm not sure I trust my computer to know what a "meaningful" change is.
* thelema is scared by this non-tree history.
<RobertFischer> ertai: I don't even trust developers to know what a "meaningful" change is.
<RobertFischer> (See my previous conversation on CI.)
<ertai> RobertFischer: well, there is two ways either the system guess what your ctanges are by "diffing"
<thelema> I think git handles this same case through tree operations, not through any theory of patches.
<thelema> RobertFischer: I admit that most DVCS do require a bit more brain CPU to reason about than SVN/CVS
<ertai> RobertFischer: or you tell to it, that's sounds futuristic but I'm pretty sure it will be needed some day
<ertai> thelema: this makes git (and others) a lot less understandable because of the hairy algorithms
<ertai> in this talk I've tried to explain the simplicity of the merge algorithm of darcs
<ertai> that is just based on inversion and commutation of patches
<ertai> RobertFischer: there is only one ~semantic patch type in darcs today and it's the "Token Replace" patch
<RobertFischer> thelema: I don't mind the CPU party, or diff changes, as long as it's always right. :)
<ertai> that basically do the global-replace of your editor but at the level of patches, and therefor merge a lot better than the expansion of it.
<mwc> ertai, here's something I've wondered: if I change the regex that darcs uses to recognize tokens, do I break the invertibility of Replace?
<ertai> no because the regex makes part of the patch
<mwc> I recall there's a knob to configure how darcs recognizes the tokens
<mwc> hmmm, good
<ertai> Replace of regex * token * token
<ertai> invert (Replace re old new) = Replace re new old)
<ertai> s/)$//
<thelema> RobertFischer: let me know if I can help you learn git - like Unix, it seems that having a teacher can really help the process. Learning from the docs is hard in both cases.
mmmultiworks has quit [Read error: 110 (Connection timed out)]
<mwc> one other thing about git: it's a distrubuted FS with a built-in VCS ;)
<hcarty> git does suffer from a lot of older tutorials now being very out-dated
<mwc> git's docs remind me of Springer-Verlag books
<thelema> mwc: apparently linus has changed his mind on that.
<mwc> thelema, it still is at the lowest level
<RobertFischer> thelema: Appreciate that. We'll talk another time.
<mwc> #git is pretty friendly too
<thelema> mwc: very true - they responded very well to my silly inquiry about a QPL-extra-compatible git
<ertai> thelema, mwc: can I ask you some git things :)
<mwc> sure, just remember I don't claim to be an expert, but I seem to get by
<bluestorm> thelema: what did they say ?
<bluestorm> (and did github accepted do remove the "make distribution" on your project ?)
<bluestorm> -ed
<ertai> I've a cloned repo on gitorious and I don't know what kind of command could be use to get upstream changes
<ertai> pull?, fetch?, merge?, rebase?
<bluestorm> ertai: i've seen somewhere a project to make git interface look more like darcs's one
<ertai> bluestorm: right vng is one of them, it provides a really shiny commit replacment command (record), but no cool thing to pull
<ertai> I've done a "git remote add mainline git://", and "git fetch -v mainline" seems to be a good start
<mwc> right
<mwc> so fetch goes and gets the objects that repo has that you don't
<bluestorm> yes, i was thinking of vng actually
<mwc> where objects are blobs, tags, commits, trees
<thelema> ertai: I use git pull to grab from remote repos.
<mwc> so now you could merge them in
<thelema> git-pull = git-fetch + merge
<mwc> right, pull is used to merge changes from an upstream you track
<mwc> ertai, do you have your own work on the branch you want to merge upstream into?
<ertai> mwc, thelema: thanks it works
<thelema> bluestorm: they pointed out that separate might be satisfied by the SCM without packs always having delta chunks.
mbishop_ has joined #ocaml
<ertai> Yes I have allready done that using commit + push on my remote clone + request for pull
<mwc> Xavier's email on the list seemed like he didn't think it was a big deal, ie, that modified + original sources together was as good as patches + original
<mwc> ertai, perfect. the last thing you might want to to is rebase onto the remote's HEAD
<ertai> rebase is for local commits right?
<thelema> mwc: yes, but he'd prefer that the repo wasn't public. And I don't see what difference that really makes.
<mwc> yeah
<mwc> the idea is really that your changes against the upstream branch appear as a consistent linear history attached to the upstream's HEAD
<mwc> as opposed to a branch anchored off an ancestor
<RobertFischer> [TOTALLY OFF TOPIC] Mad props to rwmjones for the documentation in CocanWiki's source.
<mwc> actually, that's probably more on topic than the last 30 minutes
<ertai> ;)
<ertai> git can understand darcs has having a working+safe+transparent+automatic rebase
<mwc> more or less, yes
<thelema> ertai: at the expense of losing the nice semi-fixed tree view of history
<ertai> thelema: you talk about the "ugly and noisy tree view of history"?
<ertai> :)
mbishop has quit [Read error: 113 (No route to host)]
marmottine has joined #ocaml
<thelema> ertai: yes, I like having some structure to hold.
<mwc> I think larger projects like to have that history for social and legal reasons as well
<ertai> thelema: you can have it (tag) it's just not mandatory
<ertai> mwc: you still have the dates for those
<mwc> also, with darc's commutative patches, I think it would be hard to get cryptographic security
<mwc> ie, with one hash, I can confirm the entire history is untainted
<mwc> I suppose one could sort the set of patches into canonical order and hash them, though
<ertai> mwc: tag do that
<ertai> In some sense if you tag after each record you get the full history
<mwc> so, time for me to go study for the last exam
<mwc> adios for now
mwc has left #ocaml []
magthe has quit ["Ex-Chat"]
Yoric[DT] has joined #ocaml
ttt-- has quit [Read error: 110 (Connection timed out)]
mbishop_ has quit [Read error: 113 (No route to host)]
jprieur has joined #ocaml
kotarak has joined #ocaml
<thelema> did anyone come up with a better name for DimArray?
LordMetroid has quit [Read error: 104 (Connection reset by peer)]
<bluestorm> seeing these type d1234 = foo d1 d2 d3 d4 things, i was considering a camlp4 extension to automatically generate the type-level boilerplate code
<bluestorm> do you think it could be kind of useful ?
<bluestorm> (may there be compilation-time performance issues with inlining complex types at camlp4 time instead of creating aliases as it is done now ?)
<thelema> the only optimization I see is in turning "d1234" into "dec d1 d2 d3 d4"
RobertFischer has quit ["Taking off -- check out http://smokejumperit.com and http://enfranchisedmind.com/blog/"]
<thelema> There might be, but I think internally it has to use the fully expanded version instead of the alias anyway, so probbaly not.
mbishop_ has joined #ocaml
|Catch22| has joined #ocaml
filp has quit ["Bye"]
rwmjones_ has quit ["Closed connection"]
ttt-- has joined #ocaml
mbishop_ has quit [Read error: 113 (No route to host)]
mbishop_ has joined #ocaml
OChameau has quit [Read error: 110 (Connection timed out)]
ttt-- has quit [Read error: 110 (Connection timed out)]
goalieca has joined #ocaml
mbishop_ is now known as mbishop
PeopleHatePerl has quit ["bye ca veut dire tchao en anglais"]
Linktim has joined #ocaml
sporkmonger_ has quit [Read error: 110 (Connection timed out)]
RobertFischer has joined #ocaml
* RobertFischer returns.
* RobertFischer returns.
<RobertFischer> Dude -- why am I not getting a signal?
RobertFischer has left #ocaml []
RobertFischer has joined #ocaml
<RobertFischer> Ping?
* RobertFischer lives again.
<thelema> RobertFischer: pong
ra has joined #ocaml
<RobertFischer> I've been having trouble with messages getting swallowed by freenode.
kelaouchi has quit [Client Quit]
FZ has quit ["ChatZilla 0.9.81 [Firefox 2.0.0.13/2008031114]"]
<ra> Hi! Sys.command returns the exit code of the command... is there anything else that I can use to get a channel to read the stdout output of the command?
<thelema> easiest way involves having the command write to a file and then reading that file. Use a pipe if you can.
<thelema> or you can use Unix.create_process
<pango_> ra: check the Unix module, for example Unix.open_process_in (they're many others)
jlouis has joined #ocaml
<pango_> oups open_process_out even, for what you're asking for
<ra> I assume that the Unix module is not cross-platform :-)
<pango_> ra: not 100% of it
<pango_> (grmbl, that *was* open_process_in after all)
<thelema> some of it works under win32
<thelema> the cygwin port allows 100%
<thelema> native win32 has the open_process stuff
<pango_> yup, see bottom of page http://caml.inria.fr/pub/docs/manual-ocaml/manual035.html for exceptions
<ra> I know there's hump, but is there something like c++'s boost for ocaml? a peer-reviewed collection of libraries of stable status?
<RobertFischer> I'm not sure there's a concept of "stable status" in the Ocaml community.
Linktim has quit [Read error: 110 (Connection timed out)]
mbishop_ has joined #ocaml
<thelema> ra: I'm working on an extended ocaml stdlib. All pretty stable code.
<ra> RobertFischer, could you elaborate? I learning OCaml and I am pondering if I should be choosing it as a language to do system development in.. From what I have learned so far, the language and tools are great, the stdlib not so very much
<thelema> stdlib is great, it's just not encyclopedic like .net or java
<RobertFischer> ra: Most people immediately grab extlib to extend the standard library. Beyond that, there's a lot of discussion/exploration/wheel reinvention going on. And that's kind of my point -- there's no good sense about what libraries are really solid and natural, and which aren't. The community just works differently here as opposed to -- say -- Apache Commons.
<ra> yes, that's what I meant.
<RobertFischer> So there's lots of good libraries. Most of them work pretty well. But there's no collection of them which are the kind of "standard extensions".
<mbishop_> the hump isn't good enough?
<RobertFischer> Personally, I think it has a lot to do with how transformative Ocaml coding is.
<mbishop_> I trust their "alpha/beta/stable" labels heh
* thelema is working on taking the best from the extended libraries and making an improved stdlib out of it.
<RobertFischer> How's that stuff vetted?
<ra> mbishop, as a person who is new to the language it's a bit offputting
<RobertFischer> ra: Why?
LordMetroid has joined #ocaml
<ra> looks a bit like sourceforge, half of the projects seem dead -- there is no barrier for entry
<thelema> RobertFischer: my personal taste in code.
<thelema> RobertFischer: I have plans for a test suite, but prefer working on more code.
<RobertFischer> Half the projects in the Hump seem dead?
<ra> well, the ones I was looking at are either dead or alpha
<RobertFischer> thelema: Oh. You're answering my "vetted" question. That was a question for mbishop re: the Hump.
<thelema> RobertFischer: oops.
<RobertFischer> thelema: NP. It was an interesting answer. :)
mbishop has quit [Read error: 113 (No route to host)]
<ra> I don't want to step on anyones toes :-) it's just the impression that I am getting. For perl, CPAN, for C++ RogueWave & Boost, for C# .NET, I feel there is no equivalent for OCaml and it would be useful.
<ra> I'll look into extlib and thelema's work.. seems interesting work
<thelema> ra: look into godi - that's the ocaml equivalent of CPAN
<RobertFischer> Yeah. That's probably the closest thing to what you're looking for.
<RobertFischer> People were at least willing to put effort into their project to get it into Godi, which gives you a barrier to entry.
<jlouis> ra, it is an academically rooted language. Don't expect there to be much tooling to interface with the other crap that is out there
kotarak_ has joined #ocaml
<jlouis> I generally do not find that to be a big problem though. It is fairly easy to roll your own when nobody has written anything
<jlouis> and if somebody has written some code, it is fairly easy to read it through. Either for direct use or for inspiration
<ra> godi seems nice :-D found a BDB interface, I was looking for one
<mbishop_> ocaml is at least a little less "academically rooted" than other MLs heh
<ra> jlouis: yeah, I guess I'm just being impatient.. there is hope, there is potential :-)
<jlouis> All MLs have potential.
coucou747 has joined #ocaml
<Smerdyakov> ra, you must be working only on trivial projects if the time it would take you to write your own library wrappers would dominate.
postalchris has joined #ocaml
<jlouis> It is much more interesting to work in unexplored land indeed.
kotarak has quit [Read error: 110 (Connection timed out)]
<ra> Smerdyakov, yes and no, I am not yet using Ocaml for anything yet, just learning the language -- as such only trivial projects.. for the rest of my time I work on a trading system written in C++
kotarak_ is now known as kotraka
kotraka is now known as kotarak
sporkmonger has joined #ocaml
<jlouis> C++ is so unproductive. It forces you to understand the low-level machine things
<bluestorm> ra: rwm jones has done a bit of "system-level" programming in OCaml
<bluestorm> (eg. work on virtualization interfaces if i understand correctly)
filp has joined #ocaml
mbishop` has joined #ocaml
<qwr> jlouis: imho that's not a problem with C++. the language being a damn mess is, though. ;)
<jlouis> heh
lordmetroid_ has joined #ocaml
mbishop` is now known as mbishop
bluestorm has quit ["Konversation terminated!"]
<ra> qwr: I agree, I haven't used a pointer in almost a year, but we had to pass a flag to GCC to up the maximum template instantiation level from 64 levels to 128 levels...
mbishop_ has quit [Read error: 113 (No route to host)]
<qwr> ra: I tried to make some libraries with C++ templates a few years ago... It was depressing - although I could create some interesting generic abstractions, it was a total PITA.
mbishop_ has joined #ocaml
* qwr kind of admires the writers of boost libraries - at least they are persistent
<qwr> (and able to come up with wicked clever hacks...)
LordMetroid has quit [Connection timed out]
<qwr> but well, I'm probably just too stupid to use C++ :P
schme has joined #ocaml
mbishop has quit [Read error: 110 (Connection timed out)]
<jlouis> or not persistent enough. C++ takes ages to learn because there are so many nasty quirks you have to know
<jonafan> i'm over c++
<coucou747> jlouis> hum... it's not true...\
<coucou747> you just have to understand how works the memory (heap and stack)
lordmetroid_ has quit [Client Quit]
LordMetroid has joined #ocaml
<coucou747> jlouis> and it's very interresting :) now we can't make waht sun made...
<coucou747> work in only one language it's not a good idea...
marmottine has quit [Remote closed the connection]
Yoric[DT] has quit ["Ex-Chat"]
jprieur has quit ["Connection reset by beer"]
ygrek has quit [Remote closed the connection]
Demitar has joined #ocaml
ofaurax has joined #ocaml
hkBst has quit ["Konversation terminated!"]
mbishop_ has quit [Read error: 113 (No route to host)]
mbishop_ has joined #ocaml
kotarak has quit ["Xaide, leka nosht."]
seafood_ has joined #ocaml
a13x has joined #ocaml
<a13x> need help with this piece of code: http://pastebin.com/m523a7275
<a13x> circular type dependency problem
<thelema> a13x: what's the problem?
<a13x> circular dependency
<thelema> just define them all in a big type x and type y and type z
<a13x> here is new version: http://pastebin.com/m7981135
<a13x> "and"?
<thelema> err, type x = blah and y = blah and z = blah
<a13x> but there is a class in the middle
<thelema> it'll be a bit more complex because of the object in there...
<a13x> is it even doable?
<thelema> you might get away with putting a class type in there...
* thelema looks in the language reference for the syntax
<thelema> well, you could get around this problem by using polymorphic variants, I think.
<thelema> hmm...
<thelema> recognizerParameters seems an odd type... I'd expect some sort of name->typed_val mapping, but you use just a list?
<a13x> it is to make it easier to understand the code
<a13x> or what i am trying to do
<thelema> anyway...
<thelema> any reason you can't use a record instead of a class?
<ra> good night
ra has left #ocaml []
<a13x> what is a record?
<thelema> type recognizer_func = { recognize : event list -> event list; reconstruct : event list -> event list} and recognizer = recognizerParameter list -> recognizer_func and recognizerParameter = Discreet of int | Continuous of float | Identity of identity | List of recognizerParameter list and identytp = Sense of int | Action of int | Pattern of recognizer * recognizerParameter list and event = Event of (float * float * identity)
<thelema> a13x: a record is like a c struct
<a13x> oh, i see
<a13x> no
<a13x> a recognizer is really like a type of machine
<RobertFischer> Ocaml does structural typing, doesn't i?
<RobertFischer> (it)?
<thelema> RobertFischer: sometimes. and sometimes no. polymorphic variants and objects are. records and variants aren't.
<RobertFischer> thelema: Thanks. That clarifies my confusion.
<a13x> so, a recognizer has two functions
<thelema> type recognizer_func = { recognize : event list -> event list; reconstruct : event list -> event list}
<thelema> and recognizer = recognizerParameter list -> recognizer_func
<thelema> and recognizerParameter = Discreet of int | Continuous of float | Identity of identity | List of recognizerParameter list
<thelema> and identity = Sense of int | Action of int | Pattern of recognizer * recognizerParameter list
<thelema> and event = Event of (float * float * identity)
<a13x> and it also has an instance of some values
<thelema> this works.
<thelema> so there's some other data involved too...
<a13x> yes but recognize is a function
* thelema tries it with class types
<a13x> oh
<a13x> i see
<a13x> trouble is the recognize and reconstruct are pairs
<thelema> and? I don't see any trouble.
<a13x> the functions come in pairs
<a13x> designed to work on parameter list
<a13x> one parameter list is incompatible with another
<a13x> for another pair
<thelema> okay... I assume you see recognizer = recognizerParameter list -> recognizer_func
<a13x> no
ofaurax has quit ["Leaving"]
<a13x> recognizers are like different instructions
<thelema> any other methods of a recognizer?
<a13x> or machines
<a13x> recognizers have parameter list (knobs)
<a13x> they take data to work on
<a13x> and output some data
<a13x> no more methods are needed
<thelema> any inheritance?
<a13x> an outside function will use only the two functions
<a13x> you mean like local vars?
<a13x> or
<a13x> rather
<thelema> no, like object inheritance.
<thelema> inheriting from a parent class
schme has quit [Connection timed out]
<thelema> you can still have local vars in this interface
<a13x> maybe
<a13x> well
<a13x> yes
<a13x> recognizerA will implement recognizer functions
<a13x> by the way
jprieur has joined #ocaml
<a13x> how do i do the equivalent of java interfaces?
<thelema> you don't. Objects are structurally typed.
<a13x> ok, thanks
mbishop_ has quit [Read error: 113 (No route to host)]
<a13x> so what i am trying to do is say that there will be some different recognizers
<a13x> with different recognizer functions
mbishop_ has joined #ocaml
<a13x> which have different "knobs"
* thelema doesn't see any problem with using records.
<thelema> do those knobs have to include identities?
<a13x> yes
<thelema> (I just find it interesting how you could have one recognizer as argument to another...)
<thelema> anyway, the group of types I pasted allows this.
filp has quit ["Bye"]
<a13x> it seems like this will work
<a13x> thanks a lot for your help
<a13x> this is a pattern matching problem
<thelema> each recognizer will have to know what order the parameters come in - you might as well not have that as part of the definition of recognizer, though.
<a13x> pattern recognition
<thelema> you might as well have that just be part of their individual definitions.
<thelema> unless they'll need to be able to construct new recognizers at runtime...
<a13x> yes
<a13x> i will do that at runtime
<a13x> actually
<a13x> not the code, only new knobs will be created
<thelema> I hope you know what you're doing.
Ramzi has joined #ocaml
<Ramzi> Hello. thelema, are you in?
<a13x> i mean, the recognize function will spit out recognizers with preset parameters
<a13x> thanks a lot for your help
<thelema> hi Ramzi
<Ramzi> Heya, how are you today?
<thelema> happy I finally got my wireless network card working again.
<Ramzi> Happy is a good state.
seafood_ has quit []
<qwr> actually you have equivalent to java interfaces
<qwr> partial class types
<Ramzi> You said you've studied theory of computing, right?
<Smerdyakov> Who hasn't!
<thelema> Ramzi: lots of people who got CS degrees in "java programming"
<Ramzi> Well, maybe he's willing to lecture in IRC. :-)
<thelema> Smerdyakov: that was for you.
<Smerdyakov> thelema, who hasn't!
<Ramzi> Anyway, I'm in here because I really like your teaching style. I responded to it last week during my learning of OCaml.
<thelema> Smerdyakov: people who got CS degrees in java programming haven't studied theory of computing.
<Ramzi> I'm trying to learn about Pushdown Automata.
<Ramzi> I have a sense of them. I understand that the non-deterministic kind are equivalent to CFGs, and such.
<thelema> Ramzi: okay, grab a character and the top element of the stack, and go to a new state and push some stuff on the stack.
<Ramzi> Also at this point in the class I know FAs, both deterministic and non, and how to convert ndfa to dfa and reduce them. etc.
<thelema> Ramzi: good.
<Ramzi> But what I'm not comfortable with is writing a PDA or reading one.
<Ramzi> Could you help me write a PDA?
<thelema> can you simulate one if you have it on paper?
<Ramzi> Yes.
<Ramzi> Well, it'd be hard to simulate a ndPDA.
<jlouis> Unfortunately a lot of "CS" degrees are C# or Java
<Ramzi> At my school it is possible to graduate without taking theory of computing.
<thelema> Ramzi: you'd have to keep track of a set of (state,stack) pairs
<thelema> Ramzi: it's tedius, but not particularly difficult
<thelema> *tedious
<Ramzi> Uh, the notation for transitions I have looks like a 3-tuple followed by a 2-tuple.
<Ramzi> ( (a,b,c) (d,e) )
<thelema> Ramzi: (current_state, input_char, read off stack) -> (new_state, write onto stack)?
<Ramzi> That's the ticket.
* thelema hasn't even needed to get his automata theory book.
<qwr> a13x: here a function argument is a class that is required to have 2 particular methods: let f (a : <bar: int -> string; foo: int; ..>) = 42
<thelema> Ramzi: and you want to write a PDA?
<thelema> Ramzi: I assume you've already gone through the construction of a^nb^n, no?
<Ramzi> Okay. So, give a PDA that recognizes all words in the language (twice as many a's as b's)
<thelema> err, construction of a PDS to recognize a^nb^n
<a13x> qwr: thanks
<thelema> Ramzi: okay, we can do that one.
<Ramzi> We did the PDA stuff a while ago, but I'm studying for a test tomorrow. I'm not really familiar with it.
<Ramzi> I already have the CFG for it.
* thelema wouldn't convert CFG to PDA (although you could)
<Ramzi> S -> aSaSbS | aSbSaS | bSaSaS | e
<Ramzi> Hmm..
<Ramzi> Is there a mechanical process for translating CFG to PDA?
<thelema> IIRC, yes. we had to work through it to prove CFG == PDA. I don't remember it offhand, though.
<Ramzi> I think I am able to "see" CFGs easier. So it might be better for me to just convert.
<Ramzi> Okay. Nevermind then.
<Ramzi> So how should I start thinking about this problem?
<thelema> (I could look it up and then teach it to you.)
<Ramzi> I mean, I obviously know what it means to have twice as many a's and b's.
<Ramzi> No, let's just try jumping straight in.
<thelema> so you need to count a's and b's and make sure the count is even by the end.
<Ramzi> So we'll accept on empty stack.
<thelema> err, if you counted every other a and every b, and you had equal numbers, you'd accept, no?
<Ramzi> I don't know.
<thelema> we want |a/2| = |b|
<RobertFischer> Okay, I can't get the structural typing to take.
<thelema> so that we have |a| = 2|b|
<RobertFischer> The error is: File "./duckTyping.ml", line 38, characters 5-12:
<RobertFischer> This expression has type two_dee_point but is here used with type
<RobertFischer> < move2 : int * int -> 'a; .. >
<RobertFischer> Types for method move2 are incompatible
mbishop_ has quit [Read error: 113 (No route to host)]
<Ramzi> yes
* thelema abuses notation -- |x| = number of xes in string.
<Ramzi> What is the stack alphabet going to be?
<thelema> well, we'll have to count both positive and negative because there could be b's before the a's and a's before b's
<RobertFischer> I've got to run....but if anyone's got an idea on that, drop me a message.
<Ramzi> so you want to write 1 and -1 to the stack?
<thelema> you could do that. or you could use a and b
<thelema> to indicate which you have more of.
<RobertFischer> Nevermind...back for about 15.
<RobertFischer> So, anyone want to take on some structural typing fun with me?
<Ramzi> So, if we end with an a on the top, we have more than double a's. If we end with b, we have more b's. If we end on empty, it means we have twice as many a's as b's
<Ramzi> thelema: I almost feel you want to help Robert. Maybe he is more deserving of help as of current.
<Ramzi> But that's up to you, of course.
<thelema> Ramzi: I can help both, I think...
<Ramzi> lol
<thelema> Ramzi: so you need some states for when you've more a's, so that even you get a b, you remove the a from the stack, and some states where if you get a b, you add a b to the stack.
<thelema> RobertFischer: I think the problem is the return type - can you insist nudge returns unit?
<qwr> RobertFischer: http://ocaml.paste.f-box.org/46
<qwr> RobertFischer: you missed sequencing and tried to use curried methods as uncurried ones taking tuples
<RobertFischer> Well, first of all, I have to stop with the commas.
<Ramzi> Could I, everytime I see an a, push a 1. And everytime I see a b, I push a -2. And at the end of the input, I just add up the stack and if it's 0 i'm done?
<RobertFischer> qwr: In human terms, you're saying that the fact I'm coding Ruby in the other window is messing with my head.
<qwr> RobertFischer: if so, then probably yes
Tetsuo has quit [Remote closed the connection]
<thelema> qwr: or that. good call.
<thelema> Ramzi: can you push multiple things onto the stack at once?
a13x has quit ["Leaving"]
<Ramzi> I don't know. lol. Sometimes I see that a write on the stack has like 11, but I don't know if that's shorthand for pushing 1 on two frames.
<thelema> Ramzi: ok, good.
<thelema> you can push multiple things, you just need to do it one at a time.
<Ramzi> ok
<RobertFischer> Oh, sweet.
<RobertFischer> Thank you very much.
<Ramzi> so if I see a b, i push two things
<thelema> use an auziliary state that pushes the second time
<Ramzi> and if I see an a, i pop two things
<RobertFischer> qwr and thelema: Thanks. I needed someone else's eyes.
<thelema> RobertFischer: you're welcome
postalchris has quit [Read error: 110 (Connection timed out)]
<thelema> if you're b-heavy and you see a b, push two things. if you're b-heavy and see an a, pop one thing.
<thelema> actually, you seem to only need one symbol for the stack alphabet.
<thelema> if you're a-heavy and you see a b, pop two things, if you're a-heavy and see an a, push one thing.
<Ramzi> i guess i'm not seeing where you get your logic for the behavior of the program.
<qwr> RobertFischer: also, x <- foo should have unit type, so additional ; () after it is redundant
<Ramzi> or why a-heavy b-heavy is relevant.
<Ramzi> maybe a literal example will clarify that for me.
<RobertFischer> qwr: Yeah, that's hold-over from random flailing in an effort to figure out the type. Thanks for the head's up -- I'll wipe it out.
<Ramzi> baabbaaaaaab
<thelema> Ramzi: bbbaaaaaa
<Ramzi> Okay.
<Ramzi> We'll use yours.
<thelema> push2, push2, push2, pop, pop, pop, pop, pop, pop
<thelema> but with aaaaaabbb, we can't pop on an empty stack.
<Ramzi> right
<Ramzi> so we push1push1.....pop2 pop2 pop2?
<thelema> yes.
<Ramzi> now a mix.
<Ramzi> aba
<Ramzi> So we begin being a heavy. so we push 1.
<thelema> looks like the push2 idea won't work.
RobertFischer has quit []
<Ramzi> so were you just feeling the problem out?
<thelema> can you see any way to push 1/2?
mbishop_ has joined #ocaml
<Ramzi> no
<thelema> (It's called leading you through a thinking process. but don't think I've written and checked a solution for this - my answer might turn out to have a problem too.)
<thelema> can we push every other time we see an a?
<Ramzi> I have other problems. Maybe I need to be walked through a solution before I am lead to a solution.
<Ramzi> yes, if we alternate states
<Ramzi> So let's push1 every other time we see a.
<Ramzi> hmm
<thelema> (waiting is a very useful teaching method)
<Ramzi> So we need states to distinguish whether we're pushing on a or not.
<Ramzi> and we need states to distinguish which heaviness it is.
<thelema> if we say we're writing a NPDA, we can just do both, and one path will succeed or all will fail.
<thelema> (since we don't have any way of telling whether the stack is empty)
<Ramzi> how many rules do you see this pda having?
<thelema> I see 2 states at the moment, and three rules for the first state, and three for the second.
<thelema> this is subject to revision, of course.
<Ramzi> maybe i should try doodling on paper instead of visualizing in my head.
<thelema> the second is definitely harder.
<thelema> I think we can get away with one state for 'even a's' and one for 'odd a's'
<thelema> oops, more rules than 3 needed.
<thelema> let's use two symbols on the tape, that way we can distinguish popping an a from popping a b.
<Ramzi> what if I push2 on every b.
<Ramzi> and pop2 on every other a?
<thelema> S0: a-S1, b-push, b-pop S1: a-S0-push, a-S0-pop, b-push, b-pop
<thelema> pushing2 and popping2 seems the same as pushing 1 and popping 1
LordMetroid has quit [Connection timed out]
<Ramzi> so i need a program that will end on empty stack no matter what the input, given that it's valid input.
<Ramzi> but i can't pop all the time because sometimes i might go below empty.
<thelema> Ramzi: yup. we guarantee that by pushing and popping different symbols, and using non-determinism to choose the right thing to do each time.
<Ramzi> wait, what was wrong with my last idea?
<Ramzi> push2 on everyb and pop2 on every other a.
<Ramzi> can you find an example where that doesn't wokr
<thelema> why not just push/pop 1 in either case?
<thelema> aab
<Ramzi> oh right
<Ramzi> so i can only pop when i know the stack is poppable
<thelema> or you can try both, nondeterministically, and the correct path will succeed, and if you build it right, all the incorrect paths will fail.
<Ramzi> and i know the stack is poppable if a b is on the top
<thelema> you can't check if a b is on the top without popping it.
<Ramzi> maybe i should be exploiting nondeterminism.
<thelema> you'll need nondeterminism to write this nicely.
<Ramzi> well, pop it and put it back on.
<thelema> yes, but if it's not there, that course will cause the machine to fail.
<Ramzi> if the top of the stack is empty, and you see an a, push an a.
<Ramzi> if the top of the stack is an a, and you see an a, push an a.
<Ramzi> if the top of the stack is an a, and you see a b, hmm...
<Ramzi> how about a state to indicate more than 2 or less than 2
<qwr> hmm
<Ramzi> alright. i'm not seeing it right now.
<thelema> okay, draw two states. S0 and S1. S0 is an accept state.
<Ramzi> draw it like an fa?
<thelema> Ramzi: that's how I was taught to draw PDA's, like FA's with more annotation on the transitions
<Ramzi> okay
<Ramzi> then what
* qwr wonders, that recursive-descent can be viewed somewhat like pda using language stack and grabbing tokens instead of having tokens pushed into it?
<thelema> Ramzi: draw a transition from S0 to itself -- b, pop e, push b
<thelema> e - epsilon
<thelema> I don't remember the notation for don't push/ don't pop
<Ramzi> okay
<thelema> another transition from S0->S0 -- input b, pop a, push e
<thelema> transition from S0->S1 -- input a, pop e, push e
<thelema> put copies of the 'input b' transitions on S1 (to itself)
<thelema> S1 -> S0 -- input a, pop b, push e
<thelema> S1 -> S0 -- input a, pop e, push a
<thelema> 7 transitions total
<thelema> stack symbols: a,b input symbols: a,b
<Ramzi> ok
<qwr> (nevermind)
<thelema> anything underspecified?
<Ramzi> no
<thelema> let's try it on aab
<Ramzi> so the top of the stack is e, our input is a, so we push a and we're in s0.
<thelema> start state: s0
<Ramzi> then i don't know what to do on a.
<thelema> stack: e, read a -> S1, stack e
<thelema> S1, e read a -> S0 stack a
<Ramzi> oh man.
<thelema> S0, a read b -> S0 stack a
<thelema> S0, a read b -> S0 stack e
<thelema> S0, a read b -> S0 stack ab
<thelema> (just last two lines)
<thelema> Ramzi: too complicated?
<Ramzi> i missed my transition.
<Ramzi> let's try again. we have aab
<thelema> your turn to type.
<Ramzi> So we begin in S0. We have an a as an input.
<Ramzi> e is at the top of the stack. So we go to S1, and keep e at the top.
<Ramzi> Now we read an a. Since we're in s1, and we have a as an input, and e at the top of the stack, we push a on top.
<Ramzi> And go to S0.
<Ramzi> So the stack at this point is [a]
<thelema> (we also try to read b, but there's no b, so this route fails)
<thelema> s/read/pop/
<Ramzi> Now we read a b. Since we're in S0, we see a b. And a is at the top, so we pop the a, and put an e.
<Ramzi> Now the stack is empty, and we're in S0. So we win.
<Ramzi> I mean, and the input is done
<Ramzi> but this would accept "b" also, wouldn't it?
<thelema> we accept.
LordMetroid has joined #ocaml
<thelema> no, the stack wouldn't be empty.
<Ramzi> oh right
<thelema> want to try simluating another string?
<Ramzi> no, i think i got the string simulation. I had a solution to this question and it had 12 transitions.
<Ramzi> I'm wondering if there is an easier way to see solutions by using more transitions.
<thelema> more states, yes. more transitions, I don't think so...
<Ramzi> Let's do the language of more than twice as many a's than b's.
<thelema> pretty easy addition to the existing solution.
<Ramzi> So we change the accepting state to, the string ends with a on top
<thelema> ??? I'd add a new state, with some epsilon transitions and a loop on itself to eat any a's on the stack.
<Smerdyakov> Maybe you guys should take this conversation somewhere else, eh?
lordmetroid_ has joined #ocaml
<thelema> Smerdyakov: fair enough - not ocaml related.
<Ramzi> oops
<Ramzi> #ramzi-learning
yangsx has joined #ocaml