vile / scheme / testdata / frontends / selected.scm
23 lines · 23 sloc · 1.18 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw
1(import (prefix (vile bytevectors) bv:)
2 (prefix (vile io ports) io:)
3 (prefix (vile enums) en:)
4 (prefix (vile hashtables) ht:)
5 (prefix (vile sorting) so:)
6 (prefix (vile unicode) un:))
7(define bytes (make-bytevector 8 0))
8(bv:bytevector-u64-set! bytes 0 18446744073709551615 (bv:endianness big))
9(define wide (bv:bytevector-u64-ref bytes 0 (bv:endianness big)))
10(bv:bytevector-u16-set! bytes 0 #x1234 (bv:endianness big))
11(define codec (io:make-transcoder (io:utf-16-codec)
12 (io:eol-style none) (io:error-handling-mode raise)))
13(define roundtrip (io:bytevector->string (io:string->bytevector "Aλ" codec) codec))
14(en:define-enumeration color (red green blue) colors)
15(define table (ht:make-hashtable ht:string-ci-hash un:string-ci=?))
16(ht:hashtable-set! table "Straße" 41)
17(ht:hashtable-update! table "STRASSE" (lambda (x) (+ x 1)) 0)
18(list wide (bv:bytevector-u16-ref bytes 0 (bv:endianness big))
19 roundtrip (en:enum-set->list (colors blue red)) (color green)
20 (ht:hashtable-size table) (ht:hashtable-ref table "strasse" #f)
21 (so:list-sort < (list 3 1 2 1))
22 (un:string-normalize-nfc "e\x301;")
23 (eq? (bv:endianness big) 'big))
24