• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A categorical programming language


Commit MetaInfo

Revisãoec13b168d1f54a4e1c71d97a4676dc5347fa68c3 (tree)
Hora2023-09-19 12:57:12
AutorCorbin <cds@corb...>
CommiterCorbin

Mensagem de Log

Flesh out a basic tree-insertion tool.

This is sufficient to implement a basic set of expressions, but it's
neither enumerable nor tagged, and doesn't have trails.

Mudança Sumário

Diff

--- a/bk/bk.scm
+++ b/bk/bk.scm
@@ -1,3 +1,30 @@
1-(import (git))
1+(import scheme
2+ (chicken blob)
3+ (chicken process-context)
4+ srfi-1
5+ (only matchable match match-lambda)
6+ (git))
27
3-(print 42)
8+(define indices '(0 1 2))
9+(define (mode expr) (if (symbol? expr) #o100644 #o040000))
10+
11+(define (insert-tree repo)
12+ (match-lambda
13+ [(? symbol? s)
14+ (blob-id (create-blob repo (string->blob (symbol->string s))))]
15+ [t (let ((tb (make-tree-builder repo)))
16+ (begin
17+ (for-each
18+ (lambda (i expr)
19+ (tree-builder-insert
20+ tb ((insert-tree repo) expr) (number->string i) (mode expr)))
21+ indices t)
22+ (tree-id (tree-builder-write tb))))]))
23+
24+(define (bk-insert path expr)
25+ (let ((repo (repository-open (symbol->string path))))
26+ (print ((insert-tree repo) expr))))
27+
28+(match (map (lambda (s) (read (open-input-string s)))
29+ (command-line-arguments))
30+ [('insert path expr) (bk-insert path expr)])
--- a/bk/default.nix
+++ b/bk/default.nix
@@ -15,6 +15,7 @@ in pkgs.stdenv.mkDerivation {
1515 buildInputs = [
1616 pkgs.chicken
1717 ] ++ (with eggs; [
18+ srfi-1 matchable
1819 (git.overrideAttrs (attrs: {
1920 prePatch = ''
2021 sed -i -e '/asize/d' libgit2.scm
--- a/bk/eggs.scm
+++ b/bk/eggs.scm
@@ -1,6 +1,8 @@
1+srfi-1
2+matchable
3+; git requires a bunch of stuff not handled by egg2nix
14 git
25 foreigners
36 module-declarations
4-srfi-1
57 test
68 with-current-directory