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

71%
+3 −0
Challenges Make $2 + 2 = 5$

Japt -x, 6 5 bytes Takes input as an array of integers p!UdÍ Try it p!UdÍ :Implicit input of array U p :Push ! : Logical NOT of Ud : Any true (not zero) when ...

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

Answer
#5: Post edited by user avatar Shaggy‭ · 2021-09-14T14:07:37Z (over 2 years ago)
  • # [Japt](https://github.com/ETHproductions/japt) [`-x`](https://codegolf.meta.stackexchange.com/a/14339/), <s>6</s> 5 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • p!UdÍ
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LXg&code=cCFVZM0&input=WzIsMl0)
  • # [Japt](https://github.com/ETHproductions/japt) [`-x`](https://codegolf.meta.stackexchange.com/a/14339/), <s>6</s> 5 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • Takes input as an array of integers
  • p!UdÍ
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LXg&code=cCFVZM0&input=WzIsMl0)
  • p!UdÍ :Implicit input of array U
  • p :Push
  • ! : Logical NOT of
  • Ud : Any true (not zero) when
  • Í : Subtracted from 2
  • :Implicit output of sum of resulting array
#4: Post edited by user avatar Shaggy‭ · 2021-08-29T17:15:31Z (over 2 years ago)
  • # [Japt](https://github.com/ETHproductions/japt) [`-x`](https://codegolf.meta.stackexchange.com/a/14339/), 6 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • Takes input as an array of integers.
  • dÍ?U:5
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LXg&code=ZM0/VTo1&input=WzIsMl0)
  • dÍ?U:5 :Implicit input of array U
  • d :Any truthy (not 0) when
  • Í : Subtracted from 2
  • ?U :If so, return U
  • :5 :Else return 5
  • :Implicit output reduced by addition
  • # [Japt](https://github.com/ETHproductions/japt) [`-x`](https://codegolf.meta.stackexchange.com/a/14339/), <s>6</s> 5 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • p!UdÍ
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LXg&code=cCFVZM0&input=WzIsMl0)
#3: Post edited by user avatar Shaggy‭ · 2021-08-27T10:57:41Z (over 2 years ago)
  • # [Japt](https://github.com/ETHproductions/japt) [`-x`](https://codegolf.meta.stackexchange.com/a/14339/), 6 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • Takes input as an array of integers.
  • dÍ?U:5
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LXg&code=ZM0/VTo1&input=WzIsMl0)
  • # [Japt](https://github.com/ETHproductions/japt) [`-x`](https://codegolf.meta.stackexchange.com/a/14339/), 6 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • Takes input as an array of integers.
  • dÍ?U:5
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LXg&code=ZM0/VTo1&input=WzIsMl0)
  • dÍ?U:5 :Implicit input of array U
  • d :Any truthy (not 0) when
  • Í : Subtracted from 2
  • ?U :If so, return U
  • :5 :Else return 5
  • :Implicit output reduced by addition
#2: Post edited by user avatar Shaggy‭ · 2021-08-27T10:51:48Z (over 2 years ago)
  • # [Japt](https://github.com/ETHproductions/japt) [`-x`](https://codegolf.meta.stackexchange.com/a/14339/), 6 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • dÍ?U:5
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LXg&code=ZM0/VTo1&input=WzIsMl0)
  • # [Japt](https://github.com/ETHproductions/japt) [`-x`](https://codegolf.meta.stackexchange.com/a/14339/), 6 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
  • Takes input as an array of integers.
  • dÍ?U:5
  • [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LXg&code=ZM0/VTo1&input=WzIsMl0)
#1: Initial revision by user avatar Shaggy‭ · 2021-08-27T10:51:10Z (over 2 years ago)
# [Japt](https://github.com/ETHproductions/japt) [`-x`](https://codegolf.meta.stackexchange.com/a/14339/), 6 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)

    dÍ?U:5

[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LXg&code=ZM0/VTo1&input=WzIsMl0)