[plt-scheme] Re: Help requested for HtDP Exercise 16.3.4 Challenge Part 2
Hi Veer --
Thank you for your comments. Are they intended as general guidelines
to solving this problem or as a response to my specific approach. I
only ask because I believe the approach you've suggested in the one I
tried to adopt. Perhaps because it was buried so far down in the post
you didn't see it?
At any rate, I believe I've isolated the problem with my function. It
not only returns all paths, in the manner you've described, but also
all intermediate paths as well. So instead of returning (list(list
'ts)(list 'ts 'libs 'docs) after running (find-all-paths ts 'read), it
produces --
(list(list 'ts)(list 'ts 'libs 'docs)(list 'ts 'libs)(list 'ts))
The last two paths are intermediate, and I can't quite figure out what
is causing them to arise...
If you can offer any further insight into the nature of this problem,
I certainly would appreciate your help.
Thanks!
Dave Yrueta
On May 11, 4:01 am, Veer <diggerr... at gmail.com> wrote:
> Here are 2 important points i use when problem is complex.
>
> 1. Remember what a function produces , without going into the
> details how it produces
> 2. How to combine what we have with what function produces
>
> Here are the some clues , i hope i don't confuse you more .
>
> ;;find? : dir symbol -> list-of-paths or false
> (define (find? a-dir a-sym) ..)
>
> ;;1. If file is found in a current directory(find-in-files?) what to do we
> ;; have and what to do with other dirs in this current dir
> ;; a. (dir-name a-dir)
> ;; b. (find-in-dirs? (dir-dirs a-dir) a-sym) produces what?
> (false or list-of-paths)
>
> ;;Hint: How will you combine the two and
> ;; if b is a list-of-paths then we need to
> ;; insert or prefix "what" to each element in list-of-paths
>
> ;;2. If file is not found in current dir then
> ;; a. Do we search for dirs in current dir if so which function to use
> ;; b. What that function return and what is needed to be inserted into
> ;; it
>
> ;;find-in-dirs? : list-of-dirs symbol -> list-of-paths or false
> (define (find-in-dirs? alods a-sym) ..)
>
> ;;1. alods is empty ...
>
> ;;2. (find? (first alods) a-sym) produces what ?
>
> ;; a. if 2 is false what to do
> ;; b. else we have (find? (first alods) a-sym)
>
> ;; Now for b. we have list-of-paths and we also have
> ;; a list-of-paths from (find-in-dirs? (rest alods) a-sym)
> ;; Only thing is needed to combine them
> ;; remember find-in-dirs? returns what?
>
> ;;find-in-files?: list-of-files a-sym -> boolean
> (define (find-in-files? alofs a-sym) ..)
>
> ;;insert-or-prefix-funcion :
>
> Veer
>
>
>
> On Sun, May 11, 2008 at 10:29 AM, dave yrueta <dyru... at gmail.com> wrote:
> > Hi Matthias --
>
> > >BTW, I didn't see any check-expects and test-examples but this could
> > > be due to your formatting.
>
> > Did not run check-expects (forgot that existed) but do have test
> > examples with desired outcomes under each function purpose statement.
> > Also contrasted expected outcomes with actual outcomes at the end of
> > the post.
>
> > >You might be better off posting a url to a
> > > solution.
>
> > Here it is --
>
> > http://docs.google.com/Doc?id=dhdqh3jf_10g9gt37ds
>
> > I apologize for the length of the post. I have a hard time keeping it
> > brief while justifying each move with respect to the design recipe.
>
> > On May 10, 5:47 pm, Matthias Felleisen <matth... at ccs.neu.edu> wrote:
> > > On May 10, 2008, at 7:50 PM, dave yrueta wrote:
>
> > > > I've found it difficult to isolate the problem within a single
> > > > function since they are all interrelated.
>
> > > Sorry no time to look thru details BUT when you have mut rec specs of
> > > data, you get mut rec functions to process them. And yes, in that
> > > case it's nearly impossible to write independent tests (and find
> > > problems).
>
> > > ;; ---
>
> > > BTW, I didn't see any check-expects and test-examples but this could
> > > be due to your formatting. You might be better off posting a url to a
> > > solution. My Mail client scrambles your posting.
>
> > > -- Matthias
>
> > > _________________________________________________
> > > For list-related administrative tasks:
> > > h>ttp://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> > _________________________________________________
> > For list-related administrative tasks:
> > http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme