79670100

Date: 2025-06-18 06:18:04
Score: 1
Natty:
Report link
Thanks to Selaka Nanayakkara for the response.I translated this answer into DolphinDB script and added the case for negative movement. 

def myRoll(x, mutable n) {
    len = size(x)
    n = n % len
    
    if (n == 0) return x
    
    if (n > 0) {
        result = move(x, n)
        result[0:n] = x[len-n:]
        return result
    } 
    else {
        n = abs(n)
        result = move(x, -n)
        result[len-n:] = x[0:n]
        return result
    }
}
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Boye