Talk:Swap

From Esolang
Jump to navigation Jump to search

Nice language. I think this can be programmed almost like /// and Itflabtijtslwi as long as you make sure only one string of each command actually exists in the program, so I guess it is Turing-complete. I don't immediately see a way to emulate a /// command without swapping (but ignoring overlapping substitutions) if both strings exist, though, it may even be impossible? An unrelated question, how are overlapping strings handled? --Ørjan 13:38, 4 August 2009 (UTC)

Thank you. I originally got the idea after I read the spec for ///, and it just occurred to me that it might be interesting if the two strings were swapped instead. I have added information about how overlapping strings are handled, thank you for catching that case. --Revcompgeek 15:59, 4 August 2009 (UTC)

I read the article 10 times, but I could not understand how it works at all. I do not know D, so reading the interpreter will not help either. -Oleg

I have added a detailed example that should help you understand how it works better. D is a lot like Java and somewhat like C. The main differences you need to know is that data[i1 .. i2] is an array slice of data from i1 to i2 and ~ is the concatenation operator. Anyway, let me know if it helped. --Revcompgeek 07:21, 6 August 2009 (UTC)

Overlapping description

"When instances of string1 and string2 overlap, the one that occurs first takes precedence, and if they start on the same character string1 takes precedence. Example:

~123~12312~ 12312

becomes:

123

"

When reading that description, I immediately interpreted it as exactly opposite of what the example shows. (That is, I would have thought it would give 1231212.) --Ørjan 00:00, 5 August 2009 (UTC)

Thank you again for noticing that mistake. My interpreter is almost finished (simple tests work, but I need to do more testing), so that should help clear up any ambiguities. --Revcompgeek 02:18, 5 August 2009 (UTC)