feat: add find-string-list-len
Signed-off-by: SouthFox <master@southfox.me>
This commit is contained in:
parent
1d3d292fa7
commit
6425e62a20
1 changed files with 10 additions and 1 deletions
11
game.scm
11
game.scm
|
@ -165,7 +165,7 @@
|
||||||
))
|
))
|
||||||
`(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 string-list start len)
|
||||||
(define (sub-string-list-iter string-list start len part)
|
(define (sub-string-list-iter string-list start len part)
|
||||||
(if (string? (car string-list))
|
(if (string? (car string-list))
|
||||||
|
@ -189,6 +189,15 @@
|
||||||
(append part (list (car string-list))))))
|
(append part (list (car string-list))))))
|
||||||
(sub-string-list-iter string-list start len '()))
|
(sub-string-list-iter string-list start len '()))
|
||||||
|
|
||||||
|
(define (find-string-list-len string-list)
|
||||||
|
(define (find-string-list-len-iter string-list offset)
|
||||||
|
(if (string? (car string-list))
|
||||||
|
(if (string-index (car string-list) #\newline)
|
||||||
|
(+ (string-index (car string-list) #\newline) offset)
|
||||||
|
(find-string-list-len-iter (cdr string-list) (+ (string-length (car string-list)) offset)))
|
||||||
|
(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))
|
||||||
|
|
||||||
;; Main
|
;; Main
|
||||||
(set! *template* template-task)
|
(set! *template* template-task)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue