APL, 12 (9*1.25 = 11.25)5
⌽⍞⍝⍞⊖
This reverses (⌽, along the last axis) the input (⍞), and is followed by a comment (⍝ marks a line comment). Reversed, the program reverses (⊖, along the first axis) the input, and is followed by a comment. Because the input is always going to be one dimensional, in this case ⌽ and ⊖ are functionally equivalent. It is perhaps even sneakier than the GolfScript solution, so here's a cleaner solution (no comments), which scores 9.
⍬,⌽,⍞,⌽⊖,⍬
This first grabs an empty vector (⍬), flattens it (monadic ,), and reverses it (⊖, along the first axis). This still leaves an empty vector. Then it concatenates this(dyadic ,) to the input (⍞), leaving the input untouched. It then flattens (monadic ,) the already-flat input, and reverses it (⌽, along the last axis). Then it concatenates (dyadic ,) another empty vector (⍬) to the reversed input.
A variant that is perhaps bending This does nothing, and leaves the rules a little scores 9reversed input behind.
⍬,⌽,⍞,⊖,⍬
This just replaces a Reversed, this program does the same thing, based again on the fact that ⌽ withand ⊖. The first reverses along the last axis, while the second reverses along the first axis. With an input are functionally equivalent with only one axis, these have exactly the same effect, and can be interchangeable. This means I can avoid the palindrome penalty-dimesional arguments.
A sneakier version using comments, that scores only 7You really couldn't say I'm adding useless characters to break the palindrome (5*1.25 = 6.25)
⌽⍞⍝⍞⌽
Thisthe two different reverse functions are different with two-or-more-dimensional input; I'm just plainly reverses input, andtaking advantage of the rest is a comment.fact they act the same with one-dimensional input)
APL, 12 (9*1.25 = 11.25)
⍬,⌽,⍞,⌽,⍬
This first grabs an empty vector, flattens it and reverses it. This still leaves an empty vector. Then it concatenates this to the input, leaving the input untouched. It then flattens the already-flat input, and reverses it. Then it concatenates another empty vector to the reversed input.
A variant that is perhaps bending the rules a little scores 9.
⍬,⌽,⍞,⊖,⍬
This just replaces a ⌽ with ⊖. The first reverses along the last axis, while the second reverses along the first axis. With an input with only one axis, these have exactly the same effect, and can be interchangeable. This means I can avoid the palindrome penalty.
A sneakier version using comments, that scores only 7 (5*1.25 = 6.25)
⌽⍞⍝⍞⌽
This just plainly reverses input, and the rest is a comment.
APL, 5
⌽⍞⍝⍞⊖
This reverses (⌽, along the last axis) the input (⍞), and is followed by a comment (⍝ marks a line comment). Reversed, the program reverses (⊖, along the first axis) the input, and is followed by a comment. Because the input is always going to be one dimensional, in this case ⌽ and ⊖ are functionally equivalent. It is perhaps even sneakier than the GolfScript solution, so here's a cleaner solution (no comments), which scores 9.
⍬,⌽,⍞,⊖,⍬
This first grabs an empty vector (⍬), flattens it (monadic ,), and reverses it (⊖, along the first axis). This still leaves an empty vector. Then it concatenates (dyadic ,) to the input (⍞), leaving the input untouched. It then flattens (monadic ,) the already-flat input and reverses it (⌽, along the last axis). Then it concatenates (dyadic ,) another empty vector (⍬) to the reversed input. This does nothing, and leaves the reversed input behind. Reversed, this program does the same thing, based again on the fact that ⌽ and ⊖ are functionally equivalent with one-dimesional arguments.
You really couldn't say I'm adding useless characters to break the palindrome (the two different reverse functions are different with two-or-more-dimensional input; I'm just taking advantage of the fact they act the same with one-dimensional input)
APL, 12 (9*1.25 = 11.25)
⍬,⌽,⍞,⌽,⍬
This first grabs an empty vector, flattens it and reverses it. This still leaves an empty vector. Then it concatenates this to the input, leaving the input untouched. It then flattens the already-flat input, and reverses it. Then it concatenates another empty vector to the reversed input.
A variant that is perhaps bending the rules a little scores 9.
⍬,⌽,⍞,⊖,⍬
This just replaces a ⌽ with ⊖. The first reverses along the last axis, while the second reverses along the first axis. With an input with only one axis, these have exactly the same effect, and can be interchangeable. This means I can avoid the palindrome penalty.
A sneakier version using comments, that scores only 7 (5*1.25 = 6.25)
⌽⍞⍝⍞⌽
This just plainly reverses input, and the rest is a comment.
APL, 12 (9*1.25 = 11.25)
⍬,⌽,⍞,⌽,⍬
This first grabs an empty vector, flattens it and reverses it. This still leaves an empty vector. Then it concatenates this to the input, leaving the input untouched. It then flattens the already-flat input, and reverses it. Then it concatenates another empty vector to the reversed input.
A sneakier version using comments, that scores only 7 (5*1.25 = 6.25)
⌽⍞⍝⍞⌽
This just plainly reverses input, and the rest is a comment.
APL, 12 (9*1.25 = 11.25)
⍬,⌽,⍞,⌽,⍬
This first grabs an empty vector, flattens it and reverses it. This still leaves an empty vector. Then it concatenates this to the input, leaving the input untouched. It then flattens the already-flat input, and reverses it. Then it concatenates another empty vector to the reversed input.
A variant that is perhaps bending the rules a little scores 9.
⍬,⌽,⍞,⊖,⍬
This just replaces a ⌽ with ⊖. The first reverses along the last axis, while the second reverses along the first axis. With an input with only one axis, these have exactly the same effect, and can be interchangeable. This means I can avoid the palindrome penalty.
A sneakier version using comments, that scores only 7 (5*1.25 = 6.25)
⌽⍞⍝⍞⌽
This just plainly reverses input, and the rest is a comment.
APL, 12 (9*1.25 = 11.25)
⍬,⌽,⍞,⌽,⍬
This first grabs an empty vector, flattens it and reverses it. This still leaves an empty vector. Then it concatenates this to the input, leaving the input untouched. It then flattens the already-flat input, and reverses it. Then it concatenates another empty vector to the reversed input.
A sneakier version using comments, that scores only 7 (5*1.25 = 6.25)
⌽⍞⍝⍞⌽
This just plainly reverses input, and the rest is a comment.