Skip to main content
added 46 characters in body
Source Link
nimi
  • 35.9k
  • 4
  • 34
  • 99

Haskell, 5252 51 bytes

map q
q"z"="a"
q[x]|x>'`'=[succ x]
q x=show$readx|x>"`"=succ<$>x|1<2=show$read x-1

As Haskell doesn't allow lists of mixed types, letters and numbers are taken and returned as strings.

Try it online!Try it online!

Check for every list element: if the string is "z", return "a"; if it's a singlethe first character whichof the string is > '`' (i.e. a letter, not a digit), return the successor of the char as a(s) in the string; else it must be number, so convert to an integer, subtract 1 and turn into a string again.

Edit: -1 byte thanks to @cole.

Haskell, 52 bytes

map q
q"z"="a"
q[x]|x>'`'=[succ x]
q x=show$read x-1

As Haskell doesn't allow lists of mixed types, letters and numbers are taken and returned as strings.

Try it online!

Check for every list element: if the string is "z", return "a"; if it's a single character which is > '`' (i.e. a letter, not a digit), return the successor of the char as a string; else it must be number, so convert to an integer, subtract 1 and turn into a string again.

Haskell, 52 51 bytes

map q
q"z"="a"
q x|x>"`"=succ<$>x|1<2=show$read x-1

As Haskell doesn't allow lists of mixed types, letters and numbers are taken and returned as strings.

Try it online!

Check for every list element: if the string is "z", return "a"; if the first character of the string is > '`' (i.e. a letter, not a digit), return the successor of the char(s) in the string; else it must be number, so convert to an integer, subtract 1 and turn into a string again.

Edit: -1 byte thanks to @cole.

Source Link
nimi
  • 35.9k
  • 4
  • 34
  • 99

Haskell, 52 bytes

map q
q"z"="a"
q[x]|x>'`'=[succ x]
q x=show$read x-1

As Haskell doesn't allow lists of mixed types, letters and numbers are taken and returned as strings.

Try it online!

Check for every list element: if the string is "z", return "a"; if it's a single character which is > '`' (i.e. a letter, not a digit), return the successor of the char as a string; else it must be number, so convert to an integer, subtract 1 and turn into a string again.