Last active
August 12, 2017 17:21
-
-
Save djhurio/fab7e2e64b2a73e54591e230fb2f7630 to your computer and use it in GitHub Desktop.
Test cases for code golf challenge "Disappearing Elements" for R
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
# https://codegolf.stackexchange.com/questions/138570/disappearing-elements | |
f=function(S,X)Reduce(`[`,-X-1,S,,T) | |
f(el(strsplit("codegolf", "")), c(1, 4, 4, 0, 2)) | |
f(el(strsplit("abc", "")), 0) | |
f(el(strsplit("abc", "")), vector("integer")) | |
f(el(strsplit("abc", "")), c(2, 0, 0)) | |
f("", vector("integer")) | |
f(el(strsplit("codegolfing", "")), c(10, 9, 8, 3, 2, 1, 0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment