Re: Pr. Euler 18, recursion problem

2008-10-09 Thread Lie Ryan
On Mon, 06 Oct 2008 00:14:37 -0700, process wrote: > On Oct 6, 8:13 am, Aidan <[EMAIL PROTECTED]> wrote: >> process wrote: >> > I am trying to solve project euler problem 18 with brute force(I will >> > move on to a better solution after I have done that for problem 67). >> >http://projecteuler.ne

Re: Pr. Euler 18, recursion problem

2008-10-06 Thread Aidan
process wrote: On Oct 6, 8:13 am, Aidan <[EMAIL PROTECTED]> wrote: process wrote: I am trying to solve project euler problem 18 with brute force(I will move on to a better solution after I have done that for problem 67). http://projecteuler.net/index.php?section=problems&id=18 However I can't g

Re: Pr. Euler 18, recursion problem

2008-10-06 Thread process
On Oct 6, 8:13 am, Aidan <[EMAIL PROTECTED]> wrote: > process wrote: > > I am trying to solve project euler problem 18 with brute force(I will > > move on to a better solution after I have done that for problem 67). > >http://projecteuler.net/index.php?section=problems&id=18 > > > However I can't g

Re: Pr. Euler 18, recursion problem

2008-10-05 Thread Aidan
process wrote: I am trying to solve project euler problem 18 with brute force(I will move on to a better solution after I have done that for problem 67). http://projecteuler.net/index.php?section=problems&id=18 However I can't get the recursive function right. I always have to use return right?

Pr. Euler 18, recursion problem

2008-10-05 Thread process
I am trying to solve project euler problem 18 with brute force(I will move on to a better solution after I have done that for problem 67). http://projecteuler.net/index.php?section=problems&id=18 However I can't get the recursive function right. I always have to use return right? Unless I am prin

Re: pyparser and recursion problem

2007-07-27 Thread pyscottishguy
Hey, Thanks for the further explanations. I'm going to play around more with the 'recursive grammar' and 'parse-time dynamic grammar element' stuff so that I understand it a bit better. I liked the changes you suggested. The alternative grammar definitely makes the code easier to understand, plu

Re: pyparser and recursion problem

2007-07-27 Thread Paul McGuire
On Jul 26, 10:40 pm, [EMAIL PROTECTED] wrote: > Hey, > > Thanks Neil and Paul! > > After reading Neil's advice I started playing around with the > setParseAction method, and then I found Paul's script > 'macroExpander.py' (http://pyparsing.wikispaces.com/space/showimage/ > macroExpander.py). > Gr

Re: pyparser and recursion problem

2007-07-26 Thread pyscottishguy
Hey, Thanks Neil and Paul! After reading Neil's advice I started playing around with the setParseAction method, and then I found Paul's script 'macroExpander.py' (http://pyparsing.wikispaces.com/space/showimage/ macroExpander.py). With only a few modifications to macroExpander.py (and reversing

Re: pyparser and recursion problem

2007-07-26 Thread Paul McGuire
On Jul 26, 3:27 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > Hopefully I'll have time to help you a bit more later, or Paul > MaGuire will swoop down in his pyparsing powered super-suit. ;) > There's no need to fear...! Neil was dead on, and your parser is almost exactly right. Congratulations

Re: pyparser and recursion problem

2007-07-26 Thread Neil Cerutti
On 2007-07-26, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Using pyparser, I'm trying to parse a string like this: > >:Start: first SECOND THIRD :SECOND: second1 | second2 :THIRD: third1 | > FOURTH :FOURTH: fourth1 | fourth2 > > I want the parser to do the following: > 1) Get the text for the :

pyparser and recursion problem

2007-07-26 Thread pyscottishguy
Hi, Using pyparser, I'm trying to parse a string like this: :Start: first SECOND THIRD :SECOND: second1 | second2 :THIRD: third1 | FOURTH :FOURTH: fourth1 | fourth2 I want the parser to do the following: 1) Get the text for the :Start: label e.g ('first SECOND THIRD') 2) Do nothing with the l

Re: Inheritance and recursion problem

2006-11-25 Thread Fredrik Lundh
Spiro wrote: > XWindow have all drawing functionality and Windows[] object which holds > all child windows. > > Function Draw looks like this: > def Draw(self): > self.Back.blit > for wnd in self.Windows: > wnd.Draw(OffsetX, OffsetY) > > Now in main module i make objec

Inheritance and recursion problem

2006-11-25 Thread Spiro
Hi all, i'm trying to make some user interface objects in python. I have classes XWindow and XMainWindow(XWindow) (XMainWindow inherited from XWindow) XWindow have all drawing functionality and Windows[] object which holds all child windows. Function Draw looks like this: def Draw(self):

recursion problem

2005-03-03 Thread vegetax
I am trying to make convert a directory "tree" in a list of list, but cant find the algoritm =( ,for example a directory tree like : +root +doc ele1 ele2 +doc3 ele3 +doc2 ele4 ele5 should convert into: root[ doc, [ele1,ele2,doc3,[ele3]], doc2, [ele4],