Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active August 29, 2015 14:09
Show Gist options
  • Save CMCDragonkai/96680fb72b932415d4ac to your computer and use it in GitHub Desktop.
Save CMCDragonkai/96680fb72b932415d4ac to your computer and use it in GitHub Desktop.
OMetaJS: List Of Higher Order
ometa List {
listOf :p = apply(p):head (',' apply(p))*:tail -> [head].concat(tail),
listOfDigits = listOf('digit'):l -> l,
END
}
var result = List.matchAll(
'1,2,3,4,5',
'listOfDigits'
);
console.log(result);
// result [1, 2, 3, 4, 5]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment