Skip to content

Instantly share code, notes, and snippets.

@oliverturner
Created November 17, 2017 16:30
Show Gist options
  • Save oliverturner/ccd1757c763e4383ad55e4d4769b4b1a to your computer and use it in GitHub Desktop.
Save oliverturner/ccd1757c763e4383ad55e4d4769b4b1a to your computer and use it in GitHub Desktop.
const clone = (x) => [...x]
const push = (y) => (x) => [...x, y]
const pop = (x) => x.slice(0, -1)
const unshift = (y) => (x) => [y, ...x]
const shift = (x) => x.slice(1)
const sort = (fn) => (x) => x.sort(fn)
const delete = (i) => (x) => [...x.slice(0, i), ...x.slice(i + 1)]
const splice = (s, c, ...y) => x => [...x.slice(0, s), ...y, ...x.slice(s+c)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment