WinDbg, 87 71 bytes
db$t0 L1;.for(r$t1=@$t0;@$p;r$t1=@$t1+1){db$t1 L1};da$t0 L(@$t1-@$t0)/2
-16 bytes by not inserting NULL, instead passing length to da
Input is passed in via an address in psuedo-register $t0
. For example:
eza 2000000 "abcdedcba" * Write string "abcdedcba" into memory at 0x02000000
r $t0 = 33554432 * Set $t0 = 0x02000000
* Edit: Something got messed up in my WinDB session, of course r $t0 = 2000000 should work
* not that crazy 33554432.
It works by replacing the right of middle char (or right-middle if the string has even length) with a null and then prints the string from the original starting memory address.
db $t0 L1; * Set $p = memory-at($t0)
.for (r $t1 = @$t0; @$p; r $t1 = @$t1 + 1) * Set $t1 = $t0 and increment until $p == 0
{
db $t1 L1 * Set $p = memory-at($t1)
};
da $t0 L(@$t1-@$t0)/2 * Print half the string
Output:
0:000> eza 2000000 "abcdeedcba"
0:000> r $t0 = 33554432
0:000> db$t0 L1;.for(r$t1=@$t0;@$p;r$t1=@$t1+1){db$t1 L1};da$t0 L(@$t1-@$t0)/2
02000000 61 a
02000000 61 a
02000001 62 b
02000002 63 c
02000003 64 d
02000004 65 e
02000005 65 e
02000006 64 d
02000007 63 c
02000008 62 b
02000009 61 a
0200000a 00 .
02000000 "abcde"
23-1 for the pointless restriction on your code not being a palindrome. It adds nothing to the challenge IMO, in very few languages would it matter. – Rɪᴋᴇʀ – 2016-11-02T23:56:21.633
25+1 for the restriction. It´s so mirroring the paliondrome challenge ... and it´s adding challenge to esolangs. I like it. Am I correct in the assumption that input will always have an uneven length? – Titus – 2016-11-03T00:04:28.967
42The non-palindrome restriction is probably a joke based on the previous challenge. Did anyone really downvote based on that? – Luis Mendo – 2016-11-03T00:27:00.450
1@Titus for that challenge, it almost always required extra work to make the code a palindrome. Here, it almost always requires no extra work to make the code not a palindrome. – Rɪᴋᴇʀ – 2016-11-03T00:27:24.437
2@EasterlyIrk Don't you see the symmetry? It's quite beautiful, if I do say so myself. But to be serious, I really don't see anything wrong with the so-called "pointless restriction" that would warrant a downvote. It might be trivial, but it's not the main focus of the challenge. The main focus of the challenge is to depalindromize the string, not to create a non-palindromic code. – Mama Fun Roll – 2016-11-03T01:23:28.123
1@MamaFunRoll I feel that it adds nothing to the challenge, and might as well not be there, and thus probably shouldn't be there. – Rɪᴋᴇʀ – 2016-11-03T01:24:34.087
1@EasterlyIrk You could also argue that because it adds nothing to the challenge, it might as well be there as nothing will happen either way. Really, in this case the final say goes to the OP. After all, it's sort of nice to have complementary challenges like this. – Mama Fun Roll – 2016-11-03T01:29:21.880
5It does prevent single-byte solutions. @diynevala +1 for the unnecessary +1. – Adám – 2016-11-03T10:29:35.753
@Adám So it is essentially "do X without Y" challenge as well. My +1 is not unnecessary, as it supports the choice to restrict palindromous code – diynevala – 2016-11-03T10:57:09.667
@LuisMendo No, it's not a joke, the [tag:restricted-source] tag exists. I have -1'd. – Erik the Outgolfer – 2016-11-03T15:14:58.327
2@EriktheGolfer But the restriction is virtually ineffective. It's very unlikely that the unrestricted code turns out to be palindromic – Luis Mendo – 2016-11-03T15:21:35.500
@LuisMendo Hypothesis: What if I made a language which happened to have an depalindromize operator (let's say
q
)? I couldn't use it if I didn't do<space>q
instead :( – Erik the Outgolfer – 2016-11-03T15:31:02.330Palindrome tag is not appropriate here, is there a "non-palindrome" tag? :) – AlexRacer – 2016-11-03T23:06:48.033
5What if the string is not a palindrome to begin with? – Xavon_Wrentaile – 2016-11-03T23:45:37.033
2What is expected output when the string is one char long? What is the expected output for empty string (is empty string a palindrome to begin with?)? – Viktor Mellgren – 2016-11-04T11:50:51.307
@LuisMendo BTW, I didn't -1 but I also didn't +1. – Rɪᴋᴇʀ – 2016-11-04T13:09:24.473
1@EasterlyIrk You must not play Magic the Gathering. – corsiKa – 2016-11-04T21:43:51.900
@Xavon_Wrentaile I agree with the notion of that. I almost only see special forms of list accessing, instead of interesting logic, simply because recognizing palindromes does not seem to be a requirement. – Zelphir Kaltstahl – 2016-11-06T12:26:41.987