Browse Source

Korrektur

master
Silas Vedder 2 years ago
parent
commit
2e7be5e159
  1. 48
      bible-tools.scm
  2. 4
      guix.scm
  3. 4
      hall.scm

48
bible-tools.scm

@ -0,0 +1,48 @@
(define-module (bible-tools)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-98)
#:use-module (rnrs io ports)
#:use-module (rnrs bytevectors)
#:export (mapcan
get-bible
string->bible
book
chapter
verse
text
get-book
get-chapter
get-verse
with-bible))
(define (mapcan f l) (apply append (map f l)))
(define (make-bible-path name)
(string-append (get-environment-variable "HOME") "/.bible/" name ".tsv"))
(define (get-bible name)
(call-with-input-file (make-bible-path name) (compose utf8->string get-bytevector-all)))
(define (string->verse string)
(string-split string #\tab))
(define (string->bible string)
(map string->verse
(filter (lambda (str) (not (string=? str "")))
(string-split string #\newline))))
(define book car)
(define chapter cadddr)
(define verse (compose cadddr cdr))
(define text (compose cadddr cddr))
(define (get-num bible query part)
(filter (lambda (v) (= query (string->number (part v)))) bible))
(define (get-book book-name bible)
(filter (lambda (v) (string=? book-name (book v))) bible))
(define (get-chapter chapter-number book)
(get-num book chapter-number chapter))
(define (get-verse verse-number chapter)
(get-num chapter verse-number verse))
(define (with-bible b f)
(when (procedure? f)
(f (string->bible (get-bible b)))))

4
guix.scm

@ -20,9 +20,9 @@
(method git-fetch)
(uri (git-reference
(url "https://git.silasvedder.xyz/silasfox/bible-tools.git")
(commit "8b23959fed8d15ba074a354b85c42cc587d9c0a2")))
(commit "9b6ff8e")))
(file-name "bible-tools-1.0-checkout")
(sha256 (base32 "119l6fbj7x0rs0jnczjhkyqmiiwbx2b944985qykgmdb557p5bhf"))))
(sha256 (base32 "0rnmg8ni5swf04j0cf93nbl1z5353gq19fpw2xa9p2zad7phnw52"))))
(build-system gnu-build-system)
(arguments
`(#:modules

4
hall.scm

@ -10,7 +10,8 @@
(license gpl3+)
(dependencies `())
(skip ())
(files (libraries ((directory "bible-tools" ())))
(files (libraries ((directory "bible-tools" ())
(scheme-file "bible-tools")))
(tests ((directory "tests" ())))
(programs
((directory
@ -20,6 +21,7 @@
((text-file "ChangeLog")
(text-file "AUTHORS")
(text-file "NEWS")
(text-file "README.org")
(symlink "README" "README.org")
(text-file "HACKING")
(text-file "COPYING")

Loading…
Cancel
Save