Skip to content

Commit

Permalink
[61_7] Goldfish: update syntax and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
da-liii committed Oct 6, 2024
1 parent 84b6231 commit ee059f3
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 66 deletions.
61 changes: 34 additions & 27 deletions TeXmacs/plugins/goldfish/doc/goldfish.en.tm
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,9 @@
</input>
</session>

<paragraph|SRFI>
<paragraph|Godfish Standard Libraries>

SRFI implementation for Goldfish Scheme will be built-in for the Goldfish
Scheme session. Here is the concise guide to load the SRFIs.
For more, please visit: <slink|https://github.com/LiiiLabs/goldfish>.

<\wide-tabular>
<tformat|<table|<row|<\cell>
Expand Down Expand Up @@ -177,71 +176,79 @@
</cell>|<\cell>
<scm|(import (scheme time))>
</cell>>|<row|<\cell>
<hlink|SRFI 1|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-1.scm>
<hlink|(liii base)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/list.scm>
</cell>|<\cell>
List Library
Liii Base Library
</cell>|<\cell>
<scm|(import (srfi srfi-1))>
<scm|(import (liii base))>
</cell>>|<row|<\cell>
<hlink|SRFI 8|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-8.scm>
<hlink|(liii list)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/list.scm>
</cell>|<\cell>
Provide <scm|receive>
Liii List Library
</cell>|<\cell>
<scm|(import (srfi srfi-8))>
<scm|(import (liii list))>
</cell>>|<row|<\cell>
<hlink|SRFI 9|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-9.scm>
<hlink|(liii bitwise)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/bitwise.scm>
</cell>|<\cell>
Provide <scm|define-record-type>
Liii Bitwise Library
</cell>|<\cell>
<scm|(import (srfi srfi-9))>
<scm|(import (liii bitwise))>
</cell>>|<row|<\cell>
<hlink|SRFI 13|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-13.scm>
<hlink|(liii string)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/string.scm>
</cell>|<\cell>
String Library
Liii String Library
</cell>|<\cell>
<scm|(import (srfi srfi-13))>
<scm|(import (liii string))>
</cell>>|<row|<\cell>
<hlink|SRFI 16|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-16.scm>
<hlink|(liii vector)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/vector.scm>
</cell>|<\cell>
Provide <scm|case-lambda>
Liii Vector Library
</cell>|<\cell>
<scm|(import (srfi srfi-16))>
<scm|(import (liii vector))>
</cell>>|<row|<\cell>
<hlink|SRFI 39|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-39.scm>
<hlink|(liii hash-table)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/hash-table.scm>
</cell>|<\cell>
Parameter objects
Liii Hash Table Library
</cell>|<\cell>
<scm|(import (srfi srfi-39))>
<scm|(import (liii hash-table))>
</cell>>|<row|<\cell>
<hlink|SRFI 78|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-78.scm>
<hlink|(liii os)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/os.scm>
</cell>|<\cell>
Lightweight testing
Liii OS Library
</cell>|<\cell>
<scm|(import (srfi srfi-78))>
<scm|(import (liii os))>
</cell>>>>
</wide-tabular>

<\session|goldfish|default>
<\unfolded-io>
\<gtr\>\
<|unfolded-io>
(import (srfi srfi-1))
(import (liii list))
<|unfolded-io>
<goldfish-result|(rootlet)>
</unfolded-io>

<\unfolded-io>
\<gtr\>\
<|unfolded-io>
(reduce + 0 (list 1 2 3))
(iota 5 1)
<|unfolded-io>
<goldfish-result|(1 2 3 4 5)>
</unfolded-io>

<\unfolded-io>
\<gtr\>\
<|unfolded-io>
(reduce + 0 (iota 3 1))
<|unfolded-io>
<goldfish-result|6>
</unfolded-io>

<\unfolded-io>
\<gtr\>\
<|unfolded-io>
(import (srfi srfi-78))
(import (liii check))
<|unfolded-io>
<goldfish-result|(rootlet)>
</unfolded-io>
Expand Down
67 changes: 34 additions & 33 deletions TeXmacs/plugins/goldfish/doc/goldfish.zh.tm
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,9 @@
</input>
</session>

<paragraph|SRFI>
<paragraph|\<#91D1\>\<#9C7C\>\<#6807\>\<#51C6\>\<#5E93\>>

SRFI\<#7684\>\<#5B9E\>\<#73B0\>\<#662F\>\<#91D1\>\<#9C7C\>Scheme\<#548C\>S7
Scheme\<#7684\>\<#663E\>\<#8457\>\<#533A\>\<#522B\>\<#4E4B\>\<#4E00\>\<#FF0C\>\<#5728\>\<#91D1\>\<#9C7C\>Scheme\<#4F1A\>\<#8BDD\>\<#4E2D\>\<#FF0C\>\<#6211\>\<#4EEC\>\<#53EF\>\<#4EE5\>\<#4F7F\>\<#7528\>\<#4E0B\>\<#8868\>\<#4E2D\>\<#7684\>SRFI\<#5B9E\>\<#73B0\>\<#3002\>
\<#66F4\>\<#591A\>\<#6807\>\<#51C6\>\<#5E93\>\<#FF0C\>\<#8BF7\>\<#8BBF\>\<#95EE\>\<#91D1\>\<#9C7C\>Scheme\<#5B98\>\<#7F51\>\<#FF1A\><slink|https://gitee.com/LiiiLabs/goldfish>

<\wide-tabular>
<tformat|<table|<row|<\cell>
Expand Down Expand Up @@ -167,77 +166,79 @@
</cell>|<\cell>
<scm|(import (scheme time))>
</cell>>|<row|<\cell>
<hlink|SRFI 1|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-1.scm>
<hlink|(liii base)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/list.scm>
</cell>|<\cell>
\<#5217\>\<#8868\>\<#51FD\>\<#6570\>\<#5E93\>
Liii Base Library
</cell>|<\cell>
<scm|(import (srfi srfi-1))>
<scm|(import (liii base))>
</cell>>|<row|<\cell>
<hlink|SRFI 8|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-8.scm>
<hlink|(liii list)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/list.scm>
</cell>|<\cell>
\<#63D0\>\<#4F9B\><scm|receive>
Liii List Library
</cell>|<\cell>
<scm|(import (srfi srfi-8))>
<scm|(import (liii list))>
</cell>>|<row|<\cell>
<hlink|SRFI 9|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-9.scm>
<hlink|(liii bitwise)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/bitwise.scm>
</cell>|<\cell>
\<#63D0\>\<#4F9B\><scm|define-record-type>
Liii Bitwise Library
</cell>|<\cell>
<scm|(import (srfi srfi-9))>
<scm|(import (liii bitwise))>
</cell>>|<row|<\cell>
<hlink|SRFI 13|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-13.scm>
<hlink|(liii string)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/string.scm>
</cell>|<\cell>
\<#5B57\>\<#7B26\>\<#4E32\>\<#51FD\>\<#6570\>\<#5E93\>
Liii String Library
</cell>|<\cell>
<scm|(import (srfi srfi-13))>
<scm|(import (liii string))>
</cell>>|<row|<\cell>
<hlink|SRFI 16|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-16.scm>
<hlink|(liii vector)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/vector.scm>
</cell>|<\cell>
\<#63D0\>\<#4F9B\><code*|case-lambda>
Liii Vector Library
</cell>|<\cell>
<scm|(import (srfi srfi-16))>
<scm|(import (liii vector))>
</cell>>|<row|<\cell>
<hlink|SRFI 39|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-39.scm>
<hlink|(liii hash-table)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/hash-table.scm>
</cell>|<\cell>
\<#53C2\>\<#6570\>\<#5316\>\<#5BF9\>\<#8C61\>
Liii Hash Table Library
</cell>|<\cell>
<scm|(import (srfi srfi-39))>
<scm|(import (liii hash-table))>
</cell>>|<row|<\cell>
<hlink|SRFI 78|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-78.scm>
<hlink|(liii os)|$TEXMACS_PATH/plugins/goldfish/goldfish/liii/os.scm>
</cell>|<\cell>
\<#8F7B\>\<#91CF\>\<#7EA7\>\<#6D4B\>\<#8BD5\>\<#6846\>\<#67B6\>
Liii OS Library
</cell>|<\cell>
<scm|(import (srfi srfi-78))>
</cell>>|<row|<\cell>
<hlink|SRFI 216|$TEXMACS_PATH/plugins/goldfish/goldfish/srfi/srfi-216.scm>
</cell>|<\cell>
SICP\<#517C\>\<#5BB9\>\<#5E93\>
</cell>|<\cell>
<scm|(import (srfi sicp))>
<scm|(import (liii os))>
</cell>>>>
</wide-tabular>

<\session|goldfish|default>
<\unfolded-io>
\<gtr\>\
<|unfolded-io>
(import (srfi srfi-1))
(import (liii list))
<|unfolded-io>
<goldfish-result|(rootlet)>
</unfolded-io>

<\unfolded-io>
\<gtr\>\
<|unfolded-io>
(reduce + 0 (list 1 2 3))
(iota 5 1)
<|unfolded-io>
<goldfish-result|(1 2 3 4 5)>
</unfolded-io>

<\unfolded-io>
\<gtr\>\
<|unfolded-io>
(reduce + 0 (iota 3 1))
<|unfolded-io>
<goldfish-result|6>
</unfolded-io>

<\unfolded-io>
\<gtr\>\
<|unfolded-io>
(import (srfi srfi-78))
(import (liii check))
<|unfolded-io>
<goldfish-result|(rootlet)>
</unfolded-io>
Expand Down
9 changes: 7 additions & 2 deletions TeXmacs/plugins/goldfish/progs/code/liii-keyword.scm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@

(define (liii-list)
(map symbol->string
'(list-view flatmap list-null? list-not-null? not-null-list?)))
'(list-view flatmap flatten list-null? list-not-null? not-null-list?)))

(define (liii-string)
(map symbol->string
'(string-starts? string-ends? string-remove-prefix string-remove-suffix)))

(define (liii-os)
(map symbol->string
Expand All @@ -50,7 +54,8 @@


(tm-define (liii-keywords)
`(,@(liii-base) ,@(liii-check) ,@(liii-list) ,@(liii-os) ,@(liii-queue)
`(,@(liii-base) ,@(liii-check) ,@(liii-list)
,@(liii-string) ,@(liii-os) ,@(liii-queue)
,@(liii-stack) ,@(liii-sys) ,@(liii-uuid)))

(tm-define (liii-keywords-define)
Expand Down
6 changes: 2 additions & 4 deletions TeXmacs/plugins/r7rs/progs/code/srfi-keyword.scm
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
"string-pad-right" "string-trim" "string-trim-right" "string-trim-both"
; SRFI-13: String comparison
"string-compare" "string=" "string<>"
; SRFI-13: String Prefixes & Suffixes
"string-prefix?" "string-suffix?"
; SRFI-13: String searching
"string-index" "string-index-right" "string-skip" "string-skip-right" "string-count"
"string-contains"
Expand All @@ -78,8 +76,8 @@

(tm-define (srfi-60-keywords)
(list
"logand" "logior" "logxor" "lognot" "logand"
"logbit?" "ash"))
"bitwise-and" "bitwise-ior" "bitwise-xor" "bitwise-not"
"arithmetic-shift" "ash"))

(tm-define (srfi-70-keywords)
(list
Expand Down

0 comments on commit ee059f3

Please sign in to comment.