eschulte pushed a commit to branch go
in repository elpa.
commit 47a39c1be1d035f2ce75bf32aa97c1040aa6b66f
Author: Eric Schulte <[email protected]>
Date: Tue May 15 19:50:30 2012 -0400
more complex but more intuitive and useful `range'
---
sgf.el | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/sgf.el b/sgf.el
index ed6d0fe..712b6fb 100644
--- a/sgf.el
+++ b/sgf.el
@@ -208,7 +208,17 @@
(defun board-size (board) (round (sqrt (length board))))
-(defun range (size) (number-sequence 0 (- size 1)))
+(defun range (a &optional b)
+ (block nil
+ (let (tmp)
+ (unless b
+ (cond ((> a 0) (decf a))
+ ((= a 0) (return nil))
+ ((> 0 a) (incf a)))
+ (setq b a a 0))
+ (if (> a b) (setq tmp a a b b tmp))
+ (let ((res (number-sequence a b)))
+ (if tmp (nreverse res) res)))))
(defvar black-piece "X")