53
3
In the standard loopholes, the following is forbidden:
Claiming that your answer is written in "MyOwnLanguage", where the command
x
means "read a sequence of numbers, split them into groups of three, and print the last numbers of those groups where the second number is less than the first"
Here, we are going to do the exact same thing.
Task
Given a sequence of positive integers, whose length is divisible by 3, split them into groups of three, and print the last numbers of those groups where the second number is less than the first.
Testcases
Input Output
[] []
[1,2,3,4,5,6,7,8,9] []
[2,1,3,5,4,6,8,7,9] [3,6,9]
[3,1,4,1,5,9,2,6,5] [4]
[100,99,123] [123]
[123,123,456] []
[456,123,789] [789]
Scoring
This is code-golf. Shortest answer in bytes wins.
Standard loopholes apply, so remember not to have a built-in command x
that does this task.
33Hmmm... Now I'm really tempted to create
MyOwnLanguage
and add thex
command... :P – James – 2017-05-09T05:55:05.6036remember not to have a built-in‽ Well, if we already have it, we can use it, no? – Adám – 2017-05-09T06:28:22.903
Is it neccessary to print the Output, or can you just return it as well? – MetaColon – 2017-05-09T06:33:35.407
@MetaColon you can return it as well. – Leaky Nun – 2017-05-09T06:34:08.057
3@Adám According to the standard loopholes, you cannot have a language containing the built-in
x
specifically performing that function. – Leaky Nun – 2017-05-09T06:34:34.62735@LeakyNun Yes you can, you just cannot make such a language because of the challenge. If your language predates the challenge, it is acceptable. – Adám – 2017-05-09T06:38:04.123
I'd be surprised if nobody has written a built-in doing exactly this, just in case somebody would post this exact question. A couple of esoteric languages have been created by users from this site after all. – Mast – 2017-05-09T09:21:46.200
@theonlygusti the task is the one defined as an example function in the loophole text... what's not to get? – Baldrickk – 2017-05-09T09:31:05.630
@Mast Only a couple? – boboquack – 2017-05-09T10:42:31.383
is the sequence formatting important? (as in would acceptable input be space separated and output be one per line? or should the output be the same format as the input or...) – Tom Tanner – 2017-05-09T10:55:01.567
@TomTanner Any permissible input/output format is permissible. – Leaky Nun – 2017-05-09T10:55:42.020
9If I call the builtin
p
, can I use it? – Mindwin – 2017-05-09T16:02:54.880I think so, also if you call the language "MyOwlLanguage". – G B – 2017-05-10T06:32:57.910
1Take the question's id as source code in whatever base, and execute the first answer, profit. Predates any upcoming questions :p – Caramiriel – 2017-05-10T07:07:19.530
1
@Caramiriel: https://xkcd.com/1185/
– Adam – 2017-05-11T10:37:37.2771@Adam: Wasn't meant as a serious answer, but that pretty much sums up why that isnt such a good idea. +1 – Caramiriel – 2017-05-11T11:14:05.417
Would returning a nested array be allowed? e.g.
[[3],[6],[9]]
– Shaggy – 2018-01-12T16:51:38.920