Skip to main content
shorter yet
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Factor, 50 4646 41 bytes

[ [ >bin reverse [ 97 v- neg ]n mapvneg bin> ] map ] 

Try it online!Try it online!

-4 bytes thanks to @Bubbler! -5 bytes thanks to @Bubbler!

Even though removing control characters is just [ control? ] reject it's not worth the 15% discount.

  • [ ... ] map Map over the code points in the input string.
  • >bin Convert a code point to a binary string.
  • reverse Reverse it.
  • [ 97 v- neg ]n mapvneg Invert the string (1s become 0s and vice-versa).
  • bin> Convert from a binary string to decimal.

Factor, 50 46 bytes

[ [ >bin reverse [ 97 - neg ] map bin> ] map ] 

Try it online!

-4 bytes thanks to @Bubbler!

Even though removing control characters is just [ control? ] reject it's not worth the 15% discount.

  • [ ... ] map Map over the code points in the input string.
  • >bin Convert a code point to a binary string.
  • reverse Reverse it.
  • [ 97 - neg ] map Invert the string (1s become 0s and vice-versa).
  • bin> Convert from a binary string to decimal.

Factor, 50 46 41 bytes

[ [ >bin reverse 97 v-n vneg bin> ] map ] 

Try it online!

-4 bytes thanks to @Bubbler! -5 bytes thanks to @Bubbler!

Even though removing control characters is just [ control? ] reject it's not worth the 15% discount.

  • [ ... ] map Map over the code points in the input string.
  • >bin Convert a code point to a binary string.
  • reverse Reverse it.
  • 97 v-n vneg Invert the string (1s become 0s and vice-versa).
  • bin> Convert from a binary string to decimal.
shorter
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Factor, 5050 46 bytes

[ [ >bin reverse [ 48 = 4997 48- ?neg ] map bin> ] map ] 

Try it online!Try it online!

-4 bytes thanks to @Bubbler!

Even though removing control characters is just [ control? ] reject it's not worth the 15% discount.

  • [ ... ] map Map over the code points in the input string.
  • >bin Convert a code point to a binary string.
  • reverse Reverse it.
  • [ 48 = 4997 48- ?neg ] map Invert the string (1s become 0s and vice-versa).
  • bin> Convert from a binary string to decimal.

Factor, 50 bytes

[ [ >bin reverse [ 48 = 49 48 ? ] map bin> ] map ] 

Try it online!

Even though removing control characters is just [ control? ] reject it's not worth the 15% discount.

  • [ ... ] map Map over the code points in the input string.
  • >bin Convert a code point to a binary string.
  • reverse Reverse it.
  • [ 48 = 49 48 ? ] map Invert the string (1s become 0s and vice-versa).
  • bin> Convert from a binary string to decimal.

Factor, 50 46 bytes

[ [ >bin reverse [ 97 - neg ] map bin> ] map ] 

Try it online!

-4 bytes thanks to @Bubbler!

Even though removing control characters is just [ control? ] reject it's not worth the 15% discount.

  • [ ... ] map Map over the code points in the input string.
  • >bin Convert a code point to a binary string.
  • reverse Reverse it.
  • [ 97 - neg ] map Invert the string (1s become 0s and vice-versa).
  • bin> Convert from a binary string to decimal.
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Factor, 50 bytes

[ [ >bin reverse [ 48 = 49 48 ? ] map bin> ] map ] 

Try it online!

Even though removing control characters is just [ control? ] reject it's not worth the 15% discount.

  • [ ... ] map Map over the code points in the input string.
  • >bin Convert a code point to a binary string.
  • reverse Reverse it.
  • [ 48 = 49 48 ? ] map Invert the string (1s become 0s and vice-versa).
  • bin> Convert from a binary string to decimal.