[Snek] [keith-packard/snek] 18b37d: Allow indexing strings by negative values

Keith Packard noreply at github.com
Sun Dec 22 17:52:48 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/keith-packard/snek
  Commit: 18b37d9db47337100610c6757be3754f979156db
      https://github.com/keith-packard/snek/commit/18b37d9db47337100610c6757be3754f979156db
  Author: Keith Packard <keithp at keithp.com>
  Date:   2019-12-22 (Sun, 22 Dec 2019)

  Changed paths:
    M snek-string.c

  Log Message:
  -----------
  Allow indexing strings by negative values

Just like tuples and lists, strings can be indexed by negative values,
which go from the end.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: a449cefc6ecc257a867acafc5164afb05e73d0fd
      https://github.com/keith-packard/snek/commit/a449cefc6ecc257a867acafc5164afb05e73d0fd
  Author: Keith Packard <keithp at keithp.com>
  Date:   2019-12-22 (Sun, 22 Dec 2019)

  Changed paths:
    M snek-list.c

  Log Message:
  -----------
  Make indexing lists by negative values a bit clearer

Turn into a positive value, cast to the right type, then subtract.

Signed-off-by: Keith Packard <keithp at keithp.com>


  Commit: 689c7fc6bdaa4ec447913e030853b35478d8694a
      https://github.com/keith-packard/snek/commit/689c7fc6bdaa4ec447913e030853b35478d8694a
  Author: Keith Packard <keithp at keithp.com>
  Date:   2019-12-22 (Sun, 22 Dec 2019)

  Changed paths:
    M test/Makefile
    A test/get.py

  Log Message:
  -----------
  Add test for indexing lists, tuples and strings

Signed-off-by: Keith Packard <keithp at keithp.com>


Compare: https://github.com/keith-packard/snek/compare/17436d8c4daf...689c7fc6bdaa


More information about the Snek mailing list