Skip to content

Instantly share code, notes, and snippets.

@unel
Created April 20, 2023 07:28
Show Gist options
  • Save unel/ba04eac683439404ed18f151e72573a0 to your computer and use it in GitHub Desktop.
Save unel/ba04eac683439404ed18f151e72573a0 to your computer and use it in GitHub Desktop.
contains.js
const contains = (s1, s2) => (
((letn) => (
letn(
[
[...s1],
[...s2],
],
(a1, a2) => Boolean(
a1.reduce((a, c, i) => (
(a)
|| (
(c === a2[0])
&& (
letn(
[
a1.reduce((r, e, ii) => (
(
(
(ii >= i)
&& ((ii) < (i + a2.length))
)
? ([...r, e])
: (r)
)
), [])
],
(a11) => (
a11.reduce(
(r, c, i) => (
((r) && (c == a2[i]))
),
(a11.length === a2.length)
)
),
)
)
)
), false)
),
)
))
((v, c) => c(...v))
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment