vile / scheme / testdata / frontends / selected.vile
23 lines · 23 sloc · 1.06 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw
1import(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:))
7bytes := make-bytevector(8,0)
8bv:bytevector-u64-set!(bytes,0,18446744073709551615,bv:endianness(big))
9wide := bv:bytevector-u64-ref(bytes,0,bv:endianness(big))
10bv:bytevector-u16-set!(bytes,0,#x1234,bv:endianness(big))
11codec := io:make-transcoder(io:utf-16-codec(),
12 io:eol-style(none),io:error-handling-mode(raise))
13roundtrip := io:bytevector->string(io:string->bytevector("Aλ",codec),codec)
14en:define-enumeration(color,(red,green,blue),colors)
15table := ht:make-hashtable(ht:string-ci-hash,un:string-ci=?)
16ht:hashtable-set!(table,"Straße",41)
17ht:hashtable-update!(table,"STRASSE",fn(x){x+1},0)
18list(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),quote(big)))
24