chive
1 Split pkgs Reference
2 system
system/  verbose
system/  v
3 base64
base64-encode-string
base64-decode-string
4 port
port->bytes/  base64
port->string/  base64
5 class
dynamic-init-field
7.4

chive

 (require chive) package: chive

an extended scheme library to easily cook practical applications.

    1 Split pkgs Reference

    2 system

    3 base64

    4 port

    5 class

1 Split pkgs Reference

2 system

procedure

(system/verbose cmd)  boolean?

  cmd : string?
displays the executed logs and returns a boolean result of the executing of the cmd.

procedure

(system/v cmd)  boolean?

  cmd : string?
an alias procedure of system/verbose.

Examples:
 
(system/v "pwd")
==executed==> pwd
/Users/yanying/chive/
; => #t

3 base64

procedure

(base64-encode-string str)  string?

  str : string?
encode a string in base64.

procedure

(base64-decode-string str)  string?

  str : string?
decode a string in base64.

Examples:
 
(base64-encode-string "str")  ;=> "c3Ry\r\n"
(base64-decode-string "c3Ry=\r\n")   ;=> "str"

4 port

procedure

(port->bytes/base64 p)  bytes?

  p : port?
read content from a port and convert it to bytes.

procedure

(port->string/base64 p)  string?

  p : port?
read content from a port and convert it to a string.

Examples:
 
(port->bytes/base64 (open-input-file "/Users/ken/temp.rkt")) ;=> #"c3Ry=\r\n"
(port->string/base64 (open-input-file "/Users/ken/temp.rkt")) ;=> "c3Ry=\r\n"
 

5 class

extend racket’s class:

procedure

(dynamic-init-field fields)

  (init-filed field1 field2 field3 ...)
  fields : list?
dynamic init a class’s field from a list.

Examples:
         chive/class)
 
(get-field id
           (new (class object% (dynamic-init-field '(id first_name last_name)) (super-new))
                [id 5]
                [first_name "Yanying"]
                [last_name "Wang"]))
; => 5