is there a traditional name for something like this:

`beginsWith([1,2,3,4], [1,2]) //=> true`

like subset but order matters
@laduke If the values need to exist consecutively, it is sometimes referred to as an

`infix`

. If they just need to exist somewhere in the larger list in the same order, `subsequence`

is sometimes used.
@ram-bot

```
const isPrefix = curry((sub, xs) => {
if (sub.length === 0) return true
if (xs.length === 0 || !equals(sub[0], xs[0])) return false
return isPrefix(tail(sub), tail(xs))
})
const tails = xs => reduceRight((ts, x) => prepend(prepend(x, ts[0]), ts), [[]], xs)
const isInfix = curry((sub, xs) => any(isPrefix(sub), tails(xs)))
isInfix([1, 2], [3, 4, 1, 2, 5, 6])
```

`true`

@ram-bot

```
const isSubsequence = (sub, xs) => {
if (sub.length === 0) return true
if (xs.length === 0) return false
const [subHead, ...subTail] = sub,
[xsHead, ...xsTail] = xs
if (equals(subHead, xsHead)) return isSubsequence(subTail, xsTail)
return isSubsequence(sub, xsTail)
}
isSubsequence([1, 2], [1, 3, 2, 4])
```

`Unexpected token [`

try again

@ram-bot

```
const isSubsequence = (sub, xs) => {
if (sub.length === 0) return true
if (xs.length === 0) return false
if (equals(sub[0], xs[0])) return isSubsequence(tail(sub), tail(xs))
return isSubsequence(sub, tail(xs))
}
isSubsequence([1, 2], [1, 3, 2, 4])
```

`true`

@scott-christopher thanks!

my naive isPrefix needed those length === 0 checks. Now I can use yours!

`const isPrefixOf = R.invoker(1, 'startsWith');`

@laduke ^

is there a handy utility function within ramda that allows piping a value through some validators?

pseudo-code:

`pipe(isNumber, isOver10, isUnder20)(value)`

ah!

`allPass`

thanks!

xD

`s/validators/predicates/`

anyone use gulp?

@6ewis I do, but I've pretty much just set it up and forgotten about it. Feel free to PM me if you want though.