We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
GRRR! I hate manipulating strings in Lisp. In SBCL, strings are arrays rather than lists so the usual CONS/CAR/CDR functions are irrelevant. It took me forever to learn how to use the CONCATENATE and SUBSEQ functions only to find that CONCATENATE doesn't like 100000 character strings - whether you use tail recursion or not (bye bye test case #5).
I could always use AREF and SETF to change the individual characters in the string but that is not functional programming.I ended up doing that anyway so that I could see how others tackled the problem. Many simply printed the reversed pairs instead of creating a new string.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
String-o-Permute
You are viewing a single comment's thread. Return to all comments →
GRRR! I hate manipulating strings in Lisp. In SBCL, strings are arrays rather than lists so the usual CONS/CAR/CDR functions are irrelevant. It took me forever to learn how to use the CONCATENATE and SUBSEQ functions only to find that CONCATENATE doesn't like 100000 character strings - whether you use tail recursion or not (bye bye test case #5).
I could always use AREF and SETF to change the individual characters in the string but that is not functional programming.I ended up doing that anyway so that I could see how others tackled the problem. Many simply printed the reversed pairs instead of creating a new string.