Compare commits
2 commits
4e408e45d7
...
6425e62a20
Author | SHA1 | Date | |
---|---|---|---|
6425e62a20 | |||
1d3d292fa7 |
1 changed files with 31 additions and 18 deletions
49
game.scm
49
game.scm
|
@ -165,25 +165,38 @@
|
||||||
))
|
))
|
||||||
`(pre ,(string-join ink-script "\n")))
|
`(pre ,(string-join ink-script "\n")))
|
||||||
|
|
||||||
|
;; Lib
|
||||||
|
(define (sub-string-list string-list start len)
|
||||||
|
(define (sub-string-list-iter string-list start len part)
|
||||||
|
(if (string? (car string-list))
|
||||||
|
(if (> (string-length (car string-list)) start)
|
||||||
|
(append part
|
||||||
|
(if (= start 0 )
|
||||||
|
'()
|
||||||
|
(substring (car string-list) 0 start))
|
||||||
|
(list (substring (car string-list) start (+ start len)))
|
||||||
|
(if (= (+ start len) (string-length (car string-list)))
|
||||||
|
'()
|
||||||
|
(list (substring (car string-list) (+ start len) (string-length (car string-list)))))
|
||||||
|
(cdr string-list))
|
||||||
|
(sub-string-list-iter (cdr string-list)
|
||||||
|
(- start (string-length (car string-list)))
|
||||||
|
len
|
||||||
|
(append part (list (car string-list)))))
|
||||||
|
(sub-string-list-iter (cdr string-list)
|
||||||
|
(- start (string-length (car (last-pair (car string-list)))))
|
||||||
|
len
|
||||||
|
(append part (list (car string-list))))))
|
||||||
|
(sub-string-list-iter string-list start len '()))
|
||||||
|
|
||||||
(define (sub-string-list string-list start len part)
|
(define (find-string-list-len string-list)
|
||||||
(if (string? (car string-list))
|
(define (find-string-list-len-iter string-list offset)
|
||||||
(if (> (string-length (car string-list)) start)
|
(if (string? (car string-list))
|
||||||
(append part
|
(if (string-index (car string-list) #\newline)
|
||||||
(list (substring (car string-list) 0 start)
|
(+ (string-index (car string-list) #\newline) offset)
|
||||||
(substring (car string-list) start (+ start len)))
|
(find-string-list-len-iter (cdr string-list) (+ (string-length (car string-list)) offset)))
|
||||||
(if (= (+ start len) (string-length (car string-list)))
|
(find-string-list-len-iter (cdr string-list) (+ (string-length (car (last-pair (car string-list)))) offset) )))
|
||||||
'()
|
(find-string-list-len-iter string-list 0))
|
||||||
(list (substring (car string-list) (+ start len) (string-length (car string-list)))))
|
|
||||||
(cdr string-list))
|
|
||||||
(sub-string-list (cdr string-list)
|
|
||||||
(- start (string-length (car string-list)))
|
|
||||||
len
|
|
||||||
(append part (list (car string-list)))))
|
|
||||||
(sub-string-list (cdr string-list)
|
|
||||||
(- start (string-length (car (last-pair (car string-list)))))
|
|
||||||
len
|
|
||||||
(append part (list (car string-list))))))
|
|
||||||
|
|
||||||
;; Main
|
;; Main
|
||||||
(set! *template* template-task)
|
(set! *template* template-task)
|
||||||
|
|
Loading…
Reference in a new issue