Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

60%
+1 −0
Challenges Add two negabinary integers

Japt, 8 bytes Input as an array of negabinary digit arrays, output as a negabinary digit array. xì2n)ì2n Try it or run all test cases (headers & footers convert to & from digit arrays)...

posted 3y ago by Shaggy‭  ·  edited 3y ago by Shaggy‭

Answer
#3: Post edited by user avatar Shaggy‭ · 2021-07-10T00:43:27Z (over 3 years ago)
  • # [Japt](https://github.com/ETHproductions/japt), 8 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • Input as an array of negabinary digit arrays, output as a negabinary digit array.
  • xì2n)ì2n
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=Tm3s&code=eOwybinsMm4&footer=Vuw&input=MTAKMTAxMQ) or [run all test cases](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=bew&code=eOwybinsMm4&footer=Vuw&input=W1sxLDBdLFsxLDFdLFsxLDExMF0sWzEwLDFdLFsxMCwxMDExXSxbMTAxMDEwMSwxMTEwMTAwXV0tbQ)
  • xì2n)ì2n :Implicit input of 2D digit array
  • x :Reduce by addition after
  • ì : Converting each from base
  • 2n : -2
  • ) :End reduce
  • ì2n :Convert to base -2 digit array
  • # [Japt](https://github.com/ETHproductions/japt), 8 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • Input as an array of negabinary digit arrays, output as a negabinary digit array.
  • xì2n)ì2n
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=Tm3s&code=eOwybinsMm4&footer=Vuw&input=MTAKMTAxMQ) or [run all test cases](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=bew&code=eOwybinsMm4&footer=Vuw&input=W1sxLDBdLFsxLDFdLFsxLDExMF0sWzEwLDFdLFsxMCwxMDExXSxbMTAxMDEwMSwxMTEwMTAwXV0tbQ) (headers & footers convert to & from digit arrays)
  • xì2n)ì2n :Implicit input of 2D digit array
  • x :Reduce by addition after
  • ì : Converting each from base
  • 2n : -2
  • ) :End reduce
  • ì2n :Convert to base -2 digit array
#2: Post edited by user avatar Shaggy‭ · 2021-07-08T14:53:22Z (over 3 years ago)
  • # [Japt](https://github.com/ETHproductions/japt), 8 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • Input as an array of negabinary digit arrays, output as a negabinary digit array.
  • xì2n)ì2n
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=bew&code=eOwybinsMm4&footer=Vuw&input=WzEwLDEwMTFd) or [run all test cases](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=bew&code=eOwybinsMm4&footer=Vuw&input=W1sxLDBdLFsxLDFdLFsxLDExMF0sWzEwLDFdLFsxMCwxMDExXSxbMTAxMDEwMSwxMTEwMTAwXV0tbQ)
  • # [Japt](https://github.com/ETHproductions/japt), 8 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • Input as an array of negabinary digit arrays, output as a negabinary digit array.
  • xì2n)ì2n
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=Tm3s&code=eOwybinsMm4&footer=Vuw&input=MTAKMTAxMQ) or [run all test cases](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=bew&code=eOwybinsMm4&footer=Vuw&input=W1sxLDBdLFsxLDFdLFsxLDExMF0sWzEwLDFdLFsxMCwxMDExXSxbMTAxMDEwMSwxMTEwMTAwXV0tbQ)
  • xì2n)ì2n :Implicit input of 2D digit array
  • x :Reduce by addition after
  • ì : Converting each from base
  • 2n : -2
  • ) :End reduce
  • ì2n :Convert to base -2 digit array
#1: Initial revision by user avatar Shaggy‭ · 2021-07-08T09:22:33Z (over 3 years ago)
# [Japt](https://github.com/ETHproductions/japt), 8 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)

Input as an array of negabinary digit arrays, output as a negabinary digit array.

    xì2n)ì2n

[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=bew&code=eOwybinsMm4&footer=Vuw&input=WzEwLDEwMTFd) or [run all test cases](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&header=bew&code=eOwybinsMm4&footer=Vuw&input=W1sxLDBdLFsxLDFdLFsxLDExMF0sWzEwLDFdLFsxMCwxMDExXSxbMTAxMDEwMSwxMTEwMTAwXV0tbQ)