Talk:2L

From Esolang
Jump to: navigation, search

4L?

Seems to me like 2L has four symbols: +, *, other characters (= nop), and "out of bounds" (= ends program). The last one is debatable, but I think it does have at least three, unless spaces are forbidden (which would render the example invalid). --Graue 22:44, 7 Jul 2005 (GMT)

Agreed. NOP is definately a significant part of this language. --Rune 12:59, 8 Jul 2005 (GMT)
While I'm loathe to lose my beautiful 2, I'm inclined to agree that nop in 2L is indeed significant. --GregorR 16:03, 19 Jul 2005 (GMT)

What if each space were treated as a +? Would that be interesting? --Graue 17:01, 19 Jul 2005 (GMT)

I suspect not, because if the value on the tape is nonzero, any region of empty space would cause the program pointer to spin unendingly.
However, if the meanings of * were inverted every time * was executed (keep around another bit of state and toggle it), even-length sequences of * would be nops, and one could consider filling the entire space with *. But I suspect that would create a new problem: the difficulty of hitting a + on the intended even/odd row/column.
(I guess this sort of musing should really be on Talk:1L but whatever.) --Chris Pressey 02:13, 20 November 2010 (UTC)

implementation

I have created an implementation for 2L in Python, where can I host it? poiuy_qwert 05:45, 27 June 2007 (UTC)

On this wiki, if the file is public domain. (Use DottyWeb function if you wish) --Zzo38 07:18, 20 November 2010 (UTC)

Starting State?

The spec and this article both state "The program pointer starts at the upper left corner (0,0) moving down", yet the example program in the spec starts with the program pointer moving right. Furthermore, this article contradicts itself after an example by stating "The program pointer starts in the upper-left corner, facing right." I haven't followed the "hello world" example all the way through, but it also seems to depend on the program pointer starting off moving right. Are the examples in error, or is the spec in error, or am I totally missing something? --Nthern 04:48, 17 July 2007 (UTC)

I don't know, but GregorR changed the article from right to down in [1], on July 28 2005. --Ørjan 18:54, 17 July 2007 (UTC)
Perhaps he did that to bring the article into alignment with the spec. It seems to me that the spec contradicts itself, and the article should point that out rather than repeating the contradiction. I'm just waiting for someone who has actual experience with the language to clarify the situation. --Nthern 21:25, 18 July 2007 (UTC)
Well, the top of the article says moving down, the 2L Turing-completeness proof page assumes its going down, and in the author's implementation it starts going down. My implementation and my "Hello, World!" example both assume it starts going down. So that only leaves the one example in the article that is contradictory. Im going to change the example to going down. --poiuy_qwert 07:02, 4 February 2008 (UTC)

Precedence

I came upon this issue when trying to implement 1L_AOI and I see it doesn't seem to be explicitly specified for 2L either. When both * and + apply, which is enacted first? For example, in

>>>*+

(where >>> indicates the direction of travel of the instruction pointer) is the tape cell incremented before we change direction, or do we change direction first and then increment the tape cell? --Chris Pressey 04:48, 9 February 2011 (UTC)

I guess, given that both Gregor and Graue's implementations handle + by letting the program pointer pass over it and then backing the program pointer up one cell, the de facto precedence is to execute any * before executing +. --Chris Pressey 04:48, 12 February 2011 (UTC)

The value of TL1?

The spec is pretty clear that "[Tape Location] 1 doesn't actually hold a value, it mearly [sic] causes an IO operation if you attempt to increment or decrement it." That, however, leaves open the question of which way you should turn when you encounter a + and the memory pointer is sitting over TL1. --Chris Pressey 05:46, 12 February 2011 (UTC)

First example program

The first example program does not operate as advertised on Gregor's interpreter, Graue's interpreter, or my own. The trace is as follows:

Start going south, immediately hit a +. There is a zero intially in TL2, so turn left. Go over two *s travelling east, so there is now a 2 in TL2. Hit a +, turn right; then another, turn right; then another, turn right. Now facing north, you hit the * directly under the +. So you move the memory pointer right, to TL3, which contains zero. You hit the + and turn left, and go west, and halt.

This is the case even if the north and south actions of # are reversed (although you end up over TL1, so you hit the undefined case I just mentioned in the previous section. It looks like Gregor's implementation treats TL1 as a zero, though.) --Chris Pressey 06:13, 12 February 2011 (UTC)

Second example program ("Hello, world!")

The second example program on the page (poiuy_qwert's "Hello, world!" program) relies on TL1 being mutable. The spec is fairly clear that TL1 "doesn't actually hold a value", and neither Gregor's implementation nor Graue's implementation treats TL1 as mutable. --Chris Pressey 06:22, 12 February 2011 (UTC)