feat: update sub-string-list
Signed-off-by: SouthFox <master@southfox.me>
This commit is contained in:
parent
4e408e45d7
commit
1d3d292fa7
1 changed files with 22 additions and 18 deletions
14
game.scm
14
game.scm
|
@ -166,24 +166,28 @@
|
||||||
`(pre ,(string-join ink-script "\n")))
|
`(pre ,(string-join ink-script "\n")))
|
||||||
|
|
||||||
|
|
||||||
(define (sub-string-list string-list start len part)
|
(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? (car string-list))
|
||||||
(if (> (string-length (car string-list)) start)
|
(if (> (string-length (car string-list)) start)
|
||||||
(append part
|
(append part
|
||||||
(list (substring (car string-list) 0 start)
|
(if (= start 0 )
|
||||||
(substring (car string-list) start (+ start len)))
|
'()
|
||||||
|
(substring (car string-list) 0 start))
|
||||||
|
(list (substring (car string-list) start (+ start len)))
|
||||||
(if (= (+ start len) (string-length (car string-list)))
|
(if (= (+ start len) (string-length (car string-list)))
|
||||||
'()
|
'()
|
||||||
(list (substring (car string-list) (+ start len) (string-length (car string-list)))))
|
(list (substring (car string-list) (+ start len) (string-length (car string-list)))))
|
||||||
(cdr string-list))
|
(cdr string-list))
|
||||||
(sub-string-list (cdr string-list)
|
(sub-string-list-iter (cdr string-list)
|
||||||
(- start (string-length (car string-list)))
|
(- start (string-length (car string-list)))
|
||||||
len
|
len
|
||||||
(append part (list (car string-list)))))
|
(append part (list (car string-list)))))
|
||||||
(sub-string-list (cdr string-list)
|
(sub-string-list-iter (cdr string-list)
|
||||||
(- start (string-length (car (last-pair (car string-list)))))
|
(- start (string-length (car (last-pair (car string-list)))))
|
||||||
len
|
len
|
||||||
(append part (list (car string-list))))))
|
(append part (list (car string-list))))))
|
||||||
|
(sub-string-list-iter string-list start len '()))
|
||||||
|
|
||||||
;; Main
|
;; Main
|
||||||
(set! *template* template-task)
|
(set! *template* template-task)
|
||||||
|
|
Loading…
Reference in a new issue