| { |
| "task": { |
| "id": "case_40", |
| "name": "sum_last_two_digits", |
| "summary": "Sum the last and previous to last digits of a number", |
| "examples": [ |
| { |
| "input": [ |
| "BOS", |
| 6, |
| 19, |
| 28, |
| 14, |
| 10, |
| 7, |
| 28, |
| 20, |
| 6 |
| ], |
| "output": [ |
| "BOS", |
| 6, |
| 10, |
| 10, |
| 5, |
| 1, |
| 7, |
| 10, |
| 2, |
| 6 |
| ] |
| }, |
| { |
| "input": [ |
| "BOS", |
| 25, |
| 18, |
| 22, |
| 10, |
| 10, |
| 23, |
| 20, |
| 3, |
| 7 |
| ], |
| "output": [ |
| "BOS", |
| 7, |
| 9, |
| 4, |
| 1, |
| 1, |
| 5, |
| 2, |
| 3, |
| 7 |
| ] |
| }, |
| { |
| "input": [ |
| "BOS", |
| 16, |
| 26, |
| 26, |
| 9, |
| 27, |
| 27, |
| 15, |
| 14, |
| 14 |
| ], |
| "output": [ |
| "BOS", |
| 7, |
| 8, |
| 8, |
| 9, |
| 9, |
| 9, |
| 6, |
| 5, |
| 5 |
| ] |
| }, |
| { |
| "input": [ |
| "BOS", |
| 27, |
| 20, |
| 0, |
| 11, |
| 25, |
| 21, |
| 28, |
| 11, |
| 24 |
| ], |
| "output": [ |
| "BOS", |
| 9, |
| 2, |
| 0, |
| 2, |
| 7, |
| 3, |
| 10, |
| 2, |
| 6 |
| ] |
| }, |
| { |
| "input": [ |
| "BOS", |
| 23, |
| 2, |
| 21, |
| 20, |
| 1, |
| 23, |
| 11, |
| 5, |
| 1 |
| ], |
| "output": [ |
| "BOS", |
| 5, |
| 2, |
| 3, |
| 2, |
| 1, |
| 5, |
| 2, |
| 5, |
| 1 |
| ] |
| } |
| ], |
| "is_categorical": true |
| }, |
| "program": "tens_place = rasp.Map(lambda x: x // 10, rasp.tokens).named(\"tens_place\")\nones_place = rasp.Map(lambda x: x % 10, rasp.tokens).named(\"ones_place\")\nsum_digits = rasp.SequenceMap(lambda x, y: x + y, tens_place, ones_place).named(\"sum_digits\")\nreturn sum_digits", |
| "components": [ |
| { |
| "id": "L0_MLP", |
| "hook": "blocks.0.mlp.hook_post", |
| "role": { |
| "tag": "MAPPER", |
| "note": "Derives the tens-place digit and also the ones-place digit from each input number." |
| }, |
| "rasp_vars": [ |
| "tens_place, ones_place" |
| ], |
| "labels": [ |
| "tens_place_2, ones_place_3" |
| ] |
| }, |
| { |
| "id": "L1_MLP", |
| "hook": "blocks.1.mlp.hook_post", |
| "role": { |
| "tag": "COMBINER", |
| "note": "Adds the tens-place and ones-place digits to produce the final per-token output." |
| }, |
| "rasp_vars": [ |
| "sum_digits" |
| ], |
| "labels": [ |
| "sum_digits_1" |
| ] |
| } |
| ] |
| } |
|
|