On Mon, Jul 26, 2010 at 09:58, Michael Wood <esiot...@gmail.com> wrote:
> On 26 July 2010 09:25, B Smith-Mannschott <bsmith.o...@gmail.com> wrote:
> [...]
>> That said, don't use my code. It's hideous. And by now, I'm sure
>> there's a cleaner solution possible for my approach:
>>
>> The idea is to split the input string into a lazy list of substrings
>> alternating between strings containing no "<" and strings composed
>> soley of "<". We then consume these strings 2 at a time, using the
>> length of the second to modify the first before passing it through.
>> The concatenation of the resulting lazy sequence of strings is the
>> solution.
>
> Interesting idea, but how would you handle this?
>
> "abcd<<ef<<<<gh"?

I don't. I made the assumption (always dangerous) that the deletions
can never be longer than the content that comes before them.  It
seemed a reasonable initial assumption, considering that the original
problem statement is underspecified:

1. ab<<<  empty string result, or invalid input?
2. <abcd  does it "wait" for the a and then eat it up, or crash?
3. ab<c<<  does the final < delete the a, or prevent the deletion of b?

// Ben

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to