Jelly, 6 bytes
żSṀE?€
A dyadic link taking a list of numbers on each side and returning the resulting list.
Try it online! or see a test-suite*.
How?
żSṀE?€ - Link: list of numbers L, list of numbers R e.g. [1,3,3.2,2.3], [3,1,3.2,2.6]
ż - zip - interleave L & R [[1,3],[3,1],[3.2,3.2],[2.3,2.6]]
€ - for each pair:
? - { if:
E - ...condition: equal 0 0 1 0
S - ...then: sum 6.4
Ṁ - ...else: maximum 3 3 2.6
- } ... -> [3 ,3 ,6.4 ,2.6]
An alternative is this monadic link taking a list of the two lists, also 6 bytes:
+»=?"/
* I don't think I've ever created a test-suite footer almost three times the byte count of the code before!
Jelly, 6 bytes
żSṀE?€
A dyadic link taking a list of numbers on each side and returning the resulting list.
Try it online! or see a test-suite*.
How?
żSṀE?€ - Link: list of numbers L, list of numbers R e.g. [1,3,3.2,2.3], [3,1,3.2,2.6]
ż - zip - interleave L & R [[1,3],[3,1],[3.2,3.2],[2.3,2.6]]
€ - for each pair:
? - { if:
E - ...condition: equal 0 0 1 0
S - ...then: sum 6.4
Ṁ - ...else: maximum 3 3 2.6
- } ... -> [3 ,3 ,6.4 ,2.6]
An alternative is this monadic link taking a list of the two lists, also 6 bytes:
+»=?"/
* I don't think I've ever created a test-suite footer almost three times the byte count of the code before!
Jelly, 6 bytes
żSṀE?€
A dyadic link taking a list of numbers on each side and returning the resulting list.
Try it online! or see a test-suite*.
How?
żSṀE?€ - Link: list of numbers L, list of numbers R e.g. [1,3,3.2,2.3], [3,1,3.2,2.6]
ż - zip - interleave L & R [[1,3],[3,1],[3.2,3.2],[2.3,2.6]]
€ - for each pair:
? - { if:
E - ...condition: equal 0 0 1 0
S - ...then: sum 6.4
Ṁ - ...else: maximum 3 3 2.6
- } ... -> [3 ,3 ,6.4 ,2.6]
An alternative is this monadic link taking a list of the two lists, also 6 bytes:
+»=?"/
* I don't think I've ever created a test-suite footer almost three times the byte count of the code before!
Jelly, 6 bytes
żSṀE?€
A dyadic link taking a list of numbers on each side and returning the resulting list.
Try it online! or see a test-suite*.
How?
żSṀE?€ - Link: list of numbers L, list of numbers R e.g. [1,3,3.2,2.3], [3,1,3.2,2.6]
ż - zip - interleave L & R [[1,3],[3,1],[3.2,3.2],[2.3,2.6]]
€ - for each pair:
? - { if:
E - ...condition: equal 0 0 1 0
S - ...then: sum 6.4
Ṁ - ...else: maximum 3 3 2.6
- } ... -> [3 ,3 ,6.4 ,2.6]
An alternative is this monadic link taking a list of the two lists, also 6 bytes:
+»=?"/
* I don't think I've ever created a test-suite footer almost three times the byte count of the code before!
Jelly, 6 bytes
żSṀE?€
A dyadic link taking a list of numbers on each side and returning the resulting list.
Try it online! or see a test-suite*.
How?
żSṀE?€ - Link: list of numbers L, list of numbers R e.g. [1,3,3.2,2.3], [3,1,3.2,2.6]
ż - zip - interleave L & R [[1,3],[3,1],[3.2,3.2],[2.3,2.6]]
€ - for each pair:
? - { if:
E - ...condition: equal 0 0 1 0
S - ...then: sum 6.4
Ṁ - ...else: maximum 3 3 2.6
- } ... -> [3 ,3 ,6.4 ,2.6]
* I don't think I've ever created a test-suite footer almost three times the byte count of the code before!
Jelly, 6 bytes
żSṀE?€
A dyadic link taking a list of numbers on each side and returning the resulting list.
Try it online! or see a test-suite*.
How?
żSṀE?€ - Link: list of numbers L, list of numbers R e.g. [1,3,3.2,2.3], [3,1,3.2,2.6]
ż - zip - interleave L & R [[1,3],[3,1],[3.2,3.2],[2.3,2.6]]
€ - for each pair:
? - { if:
E - ...condition: equal 0 0 1 0
S - ...then: sum 6.4
Ṁ - ...else: maximum 3 3 2.6
- } ... -> [3 ,3 ,6.4 ,2.6]
An alternative is this monadic link taking a list of the two lists, also 6 bytes:
+»=?"/
* I don't think I've ever created a test-suite footer almost three times the byte count of the code before!
Jelly, 6 bytes
żSṀE?€
A dyadic link taking a list of numbers on each side and returning the resulting list.
Try it online! or see a test-suite*.
How?
żSṀE?€ - Link: list of numbers L, list of numbers R e.g. [1,3,3.2,2.3], [3,1,3.2,2.6]
ż - zip - interleave L & R [[1,3],[3,1],[3.2,3.2],[2.3,2.6]]
€ - for each pair:
? - { if:
E - ...condition: equal 0 0 1 0
S - ...then: sum 6.4
Ṁ - ...else: maximum 3 3 2.6
- } ... -> [3 ,3 ,6.4 ,2.6]
* I don't think I've ever created a test-suite footer almost three times the byte count of the code before!
Jelly, 6 bytes
żSṀE?€
Try it online! or see a test-suite*.
* I don't think I've ever created a test-suite footer almost three times the byte count of the code before!
Jelly, 6 bytes
żSṀE?€
A dyadic link taking a list of numbers on each side and returning the resulting list.
Try it online! or see a test-suite*.
How?
żSṀE?€ - Link: list of numbers L, list of numbers R e.g. [1,3,3.2,2.3], [3,1,3.2,2.6]
ż - zip - interleave L & R [[1,3],[3,1],[3.2,3.2],[2.3,2.6]]
€ - for each pair:
? - { if:
E - ...condition: equal 0 0 1 0
S - ...then: sum 6.4
Ṁ - ...else: maximum 3 3 2.6
- } ... -> [3 ,3 ,6.4 ,2.6]
* I don't think I've ever created a test-suite footer almost three times the byte count of the code before!