summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-02-09 18:19:00 -0500
committerBen Sima <ben@bsima.me>2022-02-09 18:19:00 -0500
commitf57b987ce66957a86baa846a813d5d3ddee6c6db (patch)
treeb81fdeb7b9478aa2522c53173d9b86bf53ceecbd
parentc2de6ff2bdf08620a4697733ea32c2ae847612f8 (diff)
Fix simple errors in Serval and core
-rw-r--r--Biz/Serval.scm5
-rw-r--r--bs/core.scm17
2 files changed, 13 insertions, 9 deletions
diff --git a/Biz/Serval.scm b/Biz/Serval.scm
index 303acdb..0e6be55 100644
--- a/Biz/Serval.scm
+++ b/Biz/Serval.scm
@@ -39,9 +39,10 @@
#:use-module ((srfi srfi-9)
#:select (define-record-type))
#:use-module ((bs core)
- #:select (rest fmt prn comment))
+ #:select (first second rest turn fmt prn comment))
#:use-module ((bs test)
#:select (testing))
+ #:use-module ((bs shell) #:prefix Shell.)
#:export (main))
(define *data-dir* "/var/lib/serval")
@@ -64,7 +65,7 @@
["ssh" (run-in-kit! args)]
["info" (prn "TODO: show kit")]
["ls" ("TODO: list available kits")]
- [else (prn "help")])))
+ [else (prn "TODO: help text")])))
(define-record-type @Kit
(Kit name nix-path system-path host-address
diff --git a/bs/core.scm b/bs/core.scm
index 943e586..73b328d 100644
--- a/bs/core.scm
+++ b/bs/core.scm
@@ -4,7 +4,7 @@
#:use-module ((ice-9 rdelim) #:select (read-line))
#:use-module (srfi srfi-1)
#:export (fmt printf pr prn
- first ffirst rest last butlast
+ first ffirst second rest last butlast
true? false? some? empty?
-> ->> fn /. curry comp
repeat for seq turn
@@ -59,15 +59,18 @@
(define (empty? a)
(equal? a '()))
-(define (first a)
- (car a))
+(define (first coll)
+ (car coll))
-(define (ffirst a)
- (first (first a)))
+(define (ffirst coll)
+ (first (first coll)))
-(define (rest a)
+(define (rest coll)
"Returns a list of the items after the first."
- (cdr a))
+ (cdr coll))
+
+(define (second coll)
+ (first (rest coll)))
(define (last coll)
"Return the last time in coll, in linear time."