Created
April 3, 2021 19:08
-
-
Save kraftdorian/fea66059d6e3b1932ff7b84936ddd29d to your computer and use it in GitHub Desktop.
Prolog style list in JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const usePrologStyleList = (array) => { | |
const [head, ...tail] = array; | |
return [head, tail]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use case:
Result: