[Haskell-cafe] Subsequence near solved hopefully

Remi Turk rturk at science.uva.nl
Sun Oct 17 14:38:24 EDT 2004


On Sun, Oct 17, 2004 at 08:05:09PM +0200, Ketil Malde wrote:
> Remi Turk <rturk at science.uva.nl> writes:
> 
> > You might also want to look at the earlier `any prefix of tails'
> > suggestion, as it makes the solution a rather simple one-liner.
> 
> Wouldn't that be looking for a sub*string*, and not a (general)
> sub*sequence* (which I think does not have to be contigous?)

Hm, not "substring" as in String at least, but that solution does
give the following results:

Prelude List> sub "ell" "hello"
True
Prelude List> sub [3..5] [1..10]
True
Prelude List> sub [2,4] [1..5]
False
Prelude List> sub [2..6] [1..5]
False

Do you mean "subset" with "subsequence"?

Groetjes,
Remi

-- 
Nobody can be exactly like me. Even I have trouble doing it.


More information about the Haskell-Cafe mailing list