300
CHICKEN User's Manual - The User's Manual

CHICKEN User's Manual - The User's Manualcode.call-cc.org/releases/3.2.0/chicken.pdf · 2010. 7. 31. · 1 The User's Manual

  • Upload
    others

  • View
    27

  • Download
    0

Embed Size (px)

Citation preview

  • CHICKEN User's Manual - The User's Manual

  • Chicken User's Manual1 The User's Manual...........................................................................................................................................1

    2 Getting started..................................................................................................................................................22.1 Scheme...............................................................................................................................................22.2 Chicken..............................................................................................................................................22.3 Chicken repositories, websites, and community................................................................................42.4 Installing Chicken..............................................................................................................................52.5 Development environments...............................................................................................................52.6 The Read-Eval-Print loop..................................................................................................................6

    2.6.1 Scripts................................................................................................................................72.7 The compiler...................................................................................................................................................82.8 Installing an egg............................................................................................................................................102.9 Accessing C libraries....................................................................................................................................10

    3 Basic mode of operation................................................................................................................................12

    4 Using the compiler.........................................................................................................................................134.1 Compiler command line format.......................................................................................................134.2 Runtime options...............................................................................................................................174.3 Examples..........................................................................................................................................18

    4.3.1 A simple example (with one source file).........................................................................194.3.2 An example with multiple files........................................................................................20

    4.4 Extending the compiler.................................................................................................................................214.5 Distributing compiled C files........................................................................................................................22

    5 Using the interpreter......................................................................................................................................245.1 Interpreter command line format.....................................................................................................245.2 Writing Scheme scripts....................................................................................................................255.3 Toplevel commands.........................................................................................................................265.4 toplevel-command............................................................................................................................275.5 History access..................................................................................................................................275.6 set-describer!....................................................................................................................................285.7 Auto-completion and edition...........................................................................................................285.8 Accessing documentation................................................................................................................28

    6 Supported language.......................................................................................................................................30

    7 Deviations from the standard.......................................................................................................................31

    8 Extensions to the standard............................................................................................................................33

    9 Non-standard read syntax.............................................................................................................................379.1 Multiline Block Comment...............................................................................................................379.2 Expression Comment.......................................................................................................................379.3 External Representation...................................................................................................................379.4 Syntax Expression............................................................................................................................379.5 Location Expression.........................................................................................................................379.6 Keyword...........................................................................................................................................389.7 Multiline String Constant.................................................................................................................389.8 Multiline String Constant with Embedded Expressions..................................................................389.9 Foreign Declare................................................................................................................................399.10 Sharp Prefixed Symbol..................................................................................................................399.11 Bang...............................................................................................................................................39

    CHICKEN User's Manual - The User's Manual

    i

  • Chicken User's Manual9 Non-standard read syntax9.11.1 Line Comment...............................................................................................................399.11.2 Eof Object......................................................................................................................399.11.3 DSSSL Formal Parameter List Annotation...................................................................399.11.4 Read Mark Invocation...................................................................................................39

    9.12 Case Sensitive Expression..........................................................................................................................409.13 Case Insensitive Expression........................................................................................................................409.14 Conditional Expansion................................................................................................................................40

    10 Non-standard macros and special forms...................................................................................................4110.1 Making extra libraries and extensions available............................................................................41

    10.1.1 require-extension...........................................................................................................4110.1.2 define-extension.............................................................................................................42

    10.2 Binding forms for optional arguments........................................................................................................4310.2.1 optional.......................................................................................................................................4310.2.2 case-lambda.................................................................................................................................4310.2.3 let-optionals................................................................................................................................4310.2.4 let-optionals*..............................................................................................................................44

    10.3 Other binding forms....................................................................................................................................4410.3.1 and-let*.......................................................................................................................................4410.3.2 rec................................................................................................................................................4410.3.3 cut................................................................................................................................................4410.3.4 define-values...............................................................................................................................4510.3.5 fluid-let........................................................................................................................................4510.3.6 let-values.....................................................................................................................................4510.3.7 let*-values...................................................................................................................................4510.3.8 letrec-values................................................................................................................................4510.3.9 parameterize................................................................................................................................4610.3.10 receive.......................................................................................................................................4610.3.11 set!-values.................................................................................................................................46

    10.4 Substitution forms and macros....................................................................................................................4610.4.1 define-constant............................................................................................................................4610.4.2 define-inline................................................................................................................................4710.4.3 define-macro...............................................................................................................................4710.4.4 define-for-syntax.........................................................................................................................47

    10.5 Conditional forms.......................................................................................................................................4710.5.1 select...........................................................................................................................................4810.5.2 unless..........................................................................................................................................4810.5.3 when............................................................................................................................................48

    10.6 Record structures........................................................................................................................................4810.6.1 define-record...............................................................................................................................4810.6.2 define-record-printer...................................................................................................................4910.6.3 define-record-type.......................................................................................................................49

    10.7 Other forms.................................................................................................................................................4910.7.1 assert...........................................................................................................................................4910.7.2 cond-expand................................................................................................................................5010.7.3 ensure..........................................................................................................................................5010.7.4 eval-when....................................................................................................................................5010.7.5 include.........................................................................................................................................5110.7.6 nth-value.....................................................................................................................................5110.7.7 time.............................................................................................................................................51

    CHICKEN User's Manual - The User's Manual

    ii

  • Chicken User's Manual11 Pattern matching..........................................................................................................................................52

    11.1 Pattern Matching Expressions........................................................................................................5211.2 Patterns...........................................................................................................................................5411.3 Match Failure.................................................................................................................................5611.4 Record Structures Pattern..............................................................................................................5611.5 Code Generation............................................................................................................................57

    12 Declarations..................................................................................................................................................5812.1 declare............................................................................................................................................5812.2 always-bound.................................................................................................................................5812.3 block...............................................................................................................................................5812.4 block-global...................................................................................................................................5812.5 hide.................................................................................................................................................5812.6 bound-to-procedure........................................................................................................................5912.7 c-options.........................................................................................................................................5912.8 check-c-syntax...............................................................................................................................5912.9 constant..........................................................................................................................................5912.10 export...........................................................................................................................................5912.11 emit-exports.................................................................................................................................5912.12 emit-external-prototypes-first......................................................................................................6012.13 disable-interrupts..........................................................................................................................6012.14 disable-warning............................................................................................................................6012.15 import...........................................................................................................................................6012.16 inline............................................................................................................................................6012.17 inline-limit...................................................................................................................................6112.18 interrupts-enabled........................................................................................................................6112.19 keep-shadowed-macros................................................................................................................6112.20 lambda-lift....................................................................................................................................6112.21 link-options..................................................................................................................................6112.22 no-argc-checks.............................................................................................................................6212.23 no-bound-checks..........................................................................................................................6212.24 no-procedure-checks....................................................................................................................6212.25 post-process..................................................................................................................................6212.26 number-type.................................................................................................................................6212.27 fixnum-arithmetic........................................................................................................................6212.28 run-time-macros...........................................................................................................................6312.29 standard-bindings.........................................................................................................................6312.30 extended-bindings........................................................................................................................6312.31 usual-integrations.........................................................................................................................6312.32 unit...............................................................................................................................................6312.33 unsafe...........................................................................................................................................6412.34 unused..........................................................................................................................................6412.35 uses...............................................................................................................................................64

    13 Parameters....................................................................................................................................................6513.1 make-parameter..............................................................................................................................6513.2 case-sensitive.................................................................................................................................6513.3 dynamic-load-libraries...................................................................................................................6513.4 command-line-arguments..............................................................................................................6513.5 current-read-table...........................................................................................................................6613.6 exit-handler....................................................................................................................................6613.7 eval-handler....................................................................................................................................6613.8 force-finalizers...............................................................................................................................66

    CHICKEN User's Manual - The User's Manual

    iii

  • Chicken User's Manual13 Parameters13.9 implicit-exit-handler......................................................................................................................6613.10 keyword-style...............................................................................................................................6613.11 load-verbose.................................................................................................................................6613.12 program-name..............................................................................................................................6713.13 repl-prompt..................................................................................................................................6713.14 reset-handler.................................................................................................................................67

    14 Unit library...................................................................................................................................................6814.1 Arithmetic......................................................................................................................................68

    14.1.1 add1/sub1.......................................................................................................................6814.1.2 Binary integer operations...............................................................................................6814.1.3 bit-set?............................................................................................................................6814.1.4 fixnum?..........................................................................................................................6814.1.5 Arithmetic fixnum operations........................................................................................6914.1.6 Arithmetic floating-point operations.............................................................................6914.1.7 signum............................................................................................................................7014.1.8 finite?.............................................................................................................................70

    14.2 File Input/Output.........................................................................................................................................7014.2.1 current-output-port......................................................................................................................7014.2.2 current-error-port........................................................................................................................7014.2.3 flush-output.................................................................................................................................7014.2.4 port-name....................................................................................................................................7114.2.5 port-position................................................................................................................................7114.2.6 set-port-name!.............................................................................................................................71

    14.3 Files.............................................................................................................................................................7114.3.1 delete-file....................................................................................................................................7114.3.2 file-exists?...................................................................................................................................7114.3.3 rename-file..................................................................................................................................72

    14.4 String ports..................................................................................................................................................7214.4.1 get-output-string..........................................................................................................................7214.4.2 open-input-string.........................................................................................................................7214.4.3 open-output-string.......................................................................................................................72

    14.5 Feature identifiers.......................................................................................................................................7214.5.1 features........................................................................................................................................7314.5.2 feature?........................................................................................................................................7314.5.3 register-feature!...........................................................................................................................7314.5.4 unregister-feature!.......................................................................................................................73

    14.6 Keywords....................................................................................................................................................7314.6.1 get-keyword................................................................................................................................7314.6.2 keyword?.....................................................................................................................................7414.6.3 keyword→string.............................................................................................................................7414.6.4 string→keyword.............................................................................................................................74

    14.7 Exceptions...................................................................................................................................................7414.7.1 condition-case.............................................................................................................................7414.7.2 breakpoint...................................................................................................................................75

    14.8 Environment information and system interface..........................................................................................7614.8.1 argv.............................................................................................................................................7614.8.2 exit..............................................................................................................................................7614.8.3 build-platform.............................................................................................................................7714.8.4 chicken-version...........................................................................................................................7714.8.5 errno............................................................................................................................................7714.8.6 getenv..........................................................................................................................................77

    CHICKEN User's Manual - The User's Manual

    iv

  • Chicken User's Manual14 Unit library14.8.7 machine-byte-order.....................................................................................................................7714.8.8 machine-type...............................................................................................................................7814.8.9 on-exit.........................................................................................................................................7814.8.10 software-type.............................................................................................................................7814.8.11 software-version........................................................................................................................7814.8.12 c-runtime...................................................................................................................................7914.8.13 system.......................................................................................................................................79

    14.9 Execution time............................................................................................................................................7914.9.1 cpu-time......................................................................................................................................7914.9.2 current-milliseconds....................................................................................................................7914.9.3 current-seconds...........................................................................................................................8014.9.4 current-gc-milliseconds...............................................................................................................80

    14.10 Interrupts and error-handling....................................................................................................................8014.10.1 enable-warnings........................................................................................................................8014.10.2 error...........................................................................................................................................8014.10.3 get-call-chain.............................................................................................................................8014.10.4 print-call-chain..........................................................................................................................8114.10.5 print-error-message...................................................................................................................8114.10.6 procedure-information..............................................................................................................8114.10.7 reset...........................................................................................................................................8114.10.8 warning.....................................................................................................................................8114.10.9 singlestep..................................................................................................................................81

    14.11 Garbage collection....................................................................................................................................8214.11.1 gc...............................................................................................................................................8214.11.2 memory-statistics......................................................................................................................8214.11.3 set-finalizer!..............................................................................................................................8214.11.4 set-gc-report!.............................................................................................................................82

    14.12 Other control structures.............................................................................................................................8214.12.1 promise?....................................................................................................................................83

    14.13 String utilities............................................................................................................................................8314.13.1 reverse-list→string........................................................................................................................83

    14.14 Generating uninterned symbols................................................................................................................8314.14.1 gensym......................................................................................................................................8314.14.2 string→uninterned-symbol...........................................................................................................83

    14.15 Standard Input/Output...............................................................................................................................8314.15.1 port?..........................................................................................................................................8414.15.2 print...........................................................................................................................................8414.15.3 print*.........................................................................................................................................84

    14.16 User-defined named characters.................................................................................................................8414.16.1 char-name..................................................................................................................................84

    14.17 Blobs.........................................................................................................................................................8514.17.1 make-blob.................................................................................................................................8514.17.2 blob?..........................................................................................................................................8514.17.3 blob-size....................................................................................................................................8514.17.4 blob→string..................................................................................................................................8514.17.5 string→blob..................................................................................................................................8514.17.6 blob=?.......................................................................................................................................86

    14.18 Vectors......................................................................................................................................................8614.18.1 vector-copy!..............................................................................................................................8614.18.2 vector-resize..............................................................................................................................86

    14.19 The unspecified value...............................................................................................................................8614.19.1 void...........................................................................................................................................86

    CHICKEN User's Manual - The User's Manual

    v

  • Chicken User's Manual14 Unit library14.20 Continuations............................................................................................................................................86

    14.20.1 call/cc........................................................................................................................................8714.20.2 continuation-capture.................................................................................................................8714.20.3 continuation?.............................................................................................................................8714.20.4 continuation-graft......................................................................................................................8714.20.5 continuation-return....................................................................................................................87

    14.21 Setters........................................................................................................................................................8814.21.1 setter..........................................................................................................................................8814.21.2 getter-with-setter.......................................................................................................................88

    14.22 Reader extensions.....................................................................................................................................8814.22.1 define-reader-ctor......................................................................................................................8814.22.2 set-read-syntax!.........................................................................................................................8814.22.3 set-sharp-read-syntax!...............................................................................................................8914.22.4 set-parameterized-read-syntax!.................................................................................................8914.22.5 copy-read-table.........................................................................................................................89

    14.23 Property lists.............................................................................................................................................9014.23.1 get..............................................................................................................................................9014.23.2 put!............................................................................................................................................9014.23.3 remprop!....................................................................................................................................9014.23.4 symbol-plist..............................................................................................................................9014.23.5 get-properties............................................................................................................................90

    15 Unit eval........................................................................................................................................................9215.1 Loading code..................................................................................................................................92

    15.1.1 load.................................................................................................................................9215.1.2 load-relative...................................................................................................................9215.1.3 load-noisily....................................................................................................................9315.1.4 load-library.....................................................................................................................9315.1.5 set-dynamic-load-mode!................................................................................................93

    15.2 Read-eval-print loop...................................................................................................................................9415.2.1 repl..............................................................................................................................................94

    15.3 Macros.........................................................................................................................................................9415.3.1 get-line-number...........................................................................................................................9415.3.2 macro?.........................................................................................................................................9415.3.3 macroexpand...............................................................................................................................9415.3.4 macroexpand-1............................................................................................................................9515.3.5 undefine-macro!..........................................................................................................................9515.3.6 syntax-error.................................................................................................................................95

    15.4 Loading extension libraries.........................................................................................................................9515.4.1 repository-path............................................................................................................................9515.4.2 extension-information.................................................................................................................9515.4.3 provide........................................................................................................................................9615.4.4 provided?.....................................................................................................................................9615.4.5 require.........................................................................................................................................9615.4.6 set-extension-specifier!...............................................................................................................96

    15.5 System information.....................................................................................................................................9715.5.1 chicken-home..............................................................................................................................97

    15.6 Eval.............................................................................................................................................................9715.6.1 eval..............................................................................................................................................97

    CHICKEN User's Manual - The User's Manual

    vi

  • Chicken User's Manual16 Unit data-structures.....................................................................................................................................98

    16.1 Lists................................................................................................................................................9816.1.1 alist-ref...........................................................................................................................9816.1.2 alist-update!...................................................................................................................9816.1.3 atom?..............................................................................................................................9816.1.4 rassoc.............................................................................................................................9816.1.5 butlast.............................................................................................................................9916.1.6 chop................................................................................................................................9916.1.7 compress........................................................................................................................9916.1.8 flatten.............................................................................................................................9916.1.9 intersperse......................................................................................................................9916.1.10 join.............................................................................................................................10016.1.11 shuffle........................................................................................................................10016.1.12 tail?.............................................................................................................................100

    16.2 Queues.......................................................................................................................................................10016.2.1 list→queue....................................................................................................................................10016.2.2 make-queue...............................................................................................................................10116.2.3 queue?.......................................................................................................................................10116.2.4 queue→list....................................................................................................................................10116.2.5 queue-add!.................................................................................................................................10116.2.6 queue-empty?............................................................................................................................10116.2.7 queue-first.................................................................................................................................10116.2.8 queue-last..................................................................................................................................10216.2.9 queue-remove!..........................................................................................................................10216.2.10 queue-push-back!....................................................................................................................10216.2.11 queue-push-back-list!..............................................................................................................102

    16.3 Sorting.......................................................................................................................................................10216.3.1 merge.........................................................................................................................................10216.3.2 sort............................................................................................................................................10316.3.3 sorted?.......................................................................................................................................103

    16.4 Random numbers......................................................................................................................................10316.4.1 random-seed..............................................................................................................................103

    16.5 Strings.......................................................................................................................................................10316.5.1 conc...........................................................................................................................................10316.5.2 →string.........................................................................................................................................10416.5.3 string-chop................................................................................................................................10416.5.4 string-chomp.............................................................................................................................10416.5.5 string-compare3........................................................................................................................10416.5.6 string-intersperse.......................................................................................................................10416.5.7 string-split.................................................................................................................................10516.5.8 string-translate...........................................................................................................................10516.5.9 string-translate*.........................................................................................................................10516.5.10 substring=?..............................................................................................................................10516.5.11 substring-index........................................................................................................................106

    16.6 Combinators..............................................................................................................................................10616.6.1 any?...........................................................................................................................................10616.6.2 constantly..................................................................................................................................10616.6.3 complement...............................................................................................................................10616.6.4 compose....................................................................................................................................10616.6.5 conjoin......................................................................................................................................10716.6.6 disjoin........................................................................................................................................10716.6.7 each...........................................................................................................................................10716.6.8 flip.............................................................................................................................................108

    CHICKEN User's Manual - The User's Manual

    vii

  • Chicken User's Manual16 Unit data-structures16.6.9 identity......................................................................................................................................10816.6.10 project.....................................................................................................................................10816.6.11 list-of.......................................................................................................................................10816.6.12 noop........................................................................................................................................10816.6.13 o..............................................................................................................................................108

    16.7 Binary searching.......................................................................................................................................10916.7.1 binary-search.............................................................................................................................109

    17 Unit extras...................................................................................................................................................11017.1 String-port extensions..................................................................................................................110

    17.1.1 call-with-input-string...................................................................................................11017.1.2 call-with-output-string.................................................................................................11017.1.3 with-input-from-string.................................................................................................11017.1.4 with-output-to-string....................................................................................................110

    17.2 Formatted output.......................................................................................................................................11117.2.1 printf..........................................................................................................................................11117.2.2 fprintf........................................................................................................................................11117.2.3 sprintf........................................................................................................................................11117.2.4 format........................................................................................................................................112

    17.3 Random numbers......................................................................................................................................11217.3.1 random-seed..............................................................................................................................11217.3.2 random......................................................................................................................................11217.3.3 randomize..................................................................................................................................112

    17.4 Input/Output extensions............................................................................................................................11317.4.1 make-input-port.........................................................................................................................11317.4.2 make-output-port.......................................................................................................................11317.4.3 pretty-print................................................................................................................................11317.4.4 pretty-print-width......................................................................................................................11317.4.5 read-byte...................................................................................................................................11317.4.6 write-byte..................................................................................................................................11417.4.7 read-file.....................................................................................................................................11417.4.8 read-line....................................................................................................................................11417.4.9 write-line...................................................................................................................................11417.4.10 read-lines.................................................................................................................................11417.4.11 read-string...............................................................................................................................11517.4.12 read-string!..............................................................................................................................11517.4.13 write-string..............................................................................................................................11517.4.14 read-token...............................................................................................................................11517.4.15 with-error-output-to-port.........................................................................................................11517.4.16 with-input-from-port...............................................................................................................11517.4.17 with-output-to-port..................................................................................................................116

    18 Unit srfi-1....................................................................................................................................................117

    19 Unit srfi-4....................................................................................................................................................11819.1 make-XXXvector.........................................................................................................................11819.2 u8vector→blob................................................................................................................................11819.3 s8vector→blob.................................................................................................................................11819.4 u16vector→blob..............................................................................................................................11819.5 s16vector→blob...............................................................................................................................11819.6 u32vector→blob..............................................................................................................................11819.7 s32vector→blob...............................................................................................................................119

    CHICKEN User's Manual - The User's Manual

    viii

  • Chicken User's Manual19 Unit srfi-419.8 f32vector→blob...............................................................................................................................11919.9 f64vector→blob...............................................................................................................................11919.10 u8vector→blob/shared...................................................................................................................11919.11 s8vector→blob/shared...................................................................................................................11919.12 u16vector→blob/shared.................................................................................................................11919.13 s16vector→blob/shared.................................................................................................................11919.14 u32vector→blob/shared.................................................................................................................11919.15 s32vector→blob/shared.................................................................................................................11919.16 f32vector→blob/shared..................................................................................................................11919.17 f64vector→blob/shared..................................................................................................................11919.18 blob→u8vector..............................................................................................................................12019.19 blob→s8vector...............................................................................................................................12019.20 blob→u16vector............................................................................................................................12019.21 blob→s16vector.............................................................................................................................12019.22 blob→u32vector............................................................................................................................12019.23 blob→s32vector.............................................................................................................................12019.24 blob→f32vector.............................................................................................................................12019.25 blob→f64vector.............................................................................................................................12119.26 blob→u8vector/shared...................................................................................................................12119.27 blob→s8vector/shared...................................................................................................................12119.28 blob→u16vector/shared.................................................................................................................12119.29 blob→s16vector/shared.................................................................................................................12119.30 blob→u32vector/shared.................................................................................................................12119.31 blob→s32vector/shared.................................................................................................................12119.32 blob→f32vector/shared..................................................................................................................12119.33 blob→f64vector/shared..................................................................................................................12119.34 subu8vector................................................................................................................................12219.35 subu16vector..............................................................................................................................12219.36 subu32vector..............................................................................................................................12219.37 subs8vector................................................................................................................................12219.38 subs16vector..............................................................................................................................12219.39 subs32vector..............................................................................................................................12219.40 subf32vector...............................................................................................................................12219.41 subf64vector...............................................................................................................................12219.42 read-u8vector.............................................................................................................................12319.43 read-u8vector!............................................................................................................................12319.44 write-u8vector............................................................................................................................123

    20 Unit srfi-13..................................................................................................................................................124

    21 Unit srfi-14..................................................................................................................................................125

    22 Unit srfi-69..................................................................................................................................................12622.1 Hash Table Procedures................................................................................................................126

    22.1.1 make-hash-table...........................................................................................................12622.1.2 hash-table?...................................................................................................................12622.1.3 hash-table-size.............................................................................................................12622.1.4 hash-table-equivalence-function..................................................................................12722.1.5 hash-table-hash-function..............................................................................................12722.1.6 hash-table-min-load.....................................................................................................12722.1.7 hash-table-max-load.....................................................................................................12722.1.8 hash-table-weak-keys...................................................................................................127

    CHICKEN User's Manual - The User's Manual

    ix

  • Chicken User's Manual22 Unit srfi-6922.1.9 hash-table-weak-values................................................................................................12722.1.10 hash-table-has-initial?................................................................................................12822.1.11 hash-table-initial........................................................................................................12822.1.12 hash-table-keys..........................................................................................................12822.1.13 hash-table-values.......................................................................................................12822.1.14 hash-table→alist............................................................................................................12822.1.15 alist→hash-table............................................................................................................12822.1.16 hash-table-ref.............................................................................................................12922.1.17 hash-table-ref/default.................................................................................................12922.1.18 hash-table-exists?.......................................................................................................12922.1.19 hash-table-set!............................................................................................................12922.1.20 hash-table-update!......................................................................................................12922.1.21 hash-table-update!/default.........................................................................................13022.1.22 hash-table-copy..........................................................................................................13022.1.23 hash-table-delete!.......................................................................................................13022.1.24 hash-table-remove!....................................................................................................13022.1.25 hash-table-clear!.........................................................................................................13022.1.26 hash-table-merge........................................................................................................13122.1.27 hash-table-merge!......................................................................................................13122.1.28 hash-table-map...........................................................................................................13122.1.29 hash-table-fold...........................................................................................................13122.1.30 hash-table-for-each....................................................................................................13122.1.31 hash-table-walk..........................................................................................................132

    22.2 Hashing Functions....................................................................................................................................13222.2.1 number-hash..............................................................................................................................13222.2.2 object-uid-hash..........................................................................................................................13222.2.3 symbol-hash..............................................................................................................................13222.2.4 keyword-hash............................................................................................................................13222.2.5 string-hash.................................................................................................................................13322.2.6 string-ci-hash.............................................................................................................................13322.2.7 eq?-hash....................................................................................................................................13322.2.8 eqv?-hash..................................................................................................................................13322.2.9 equal?-hash...............................................................................................................................13322.2.10 hash.........................................................................................................................................13322.2.11 hash-by-identity......................................................................................................................134

    23 Unit match..................................................................................................................................................135

    24 Unit regex....................................................................................................................................................13624.1 grep..............................................................................................................................................13624.2 glob→regexp....................................................................................................................................13624.3 glob?.............................................................................................................................................13624.4 regexp...........................................................................................................................................13724.5 regexp*.........................................................................................................................................13724.6 regexp?.........................................................................................................................................13824.7 regexp-optimize...........................................................................................................................13824.8 string-match.................................................................................................................................13824.9 string-match-positions.................................................................................................................13924.10 string-search...............................................................................................................................13924.11 string-search-positions...............................................................................................................13924.12 string-split-fields........................................................................................................................13924.13 string-substitute..........................................................................................................................140

    CHICKEN User's Manual - The User's Manual

    x

  • Chicken User's Manual24 Unit regex24.14 string-substitute*........................................................................................................................14024.15 regexp-escape.............................................................................................................................14024.16 make-anchored-pattern..............................................................................................................140

    25 Unit srfi-18..................................................................................................................................................14225.1 thread-signal!...............................................................................................................................14225.2 thread-quantum............................................................................................................................14225.3 thread-quantum-set!.....................................................................................................................14325.4 thread-suspend!............................................................................................................................14325.5 thread-resume!.............................................................................................................................14325.6 thread-wait-for-i/o!......................................................................................................................14325.7 time→milliseconds..........................................................................................................................14325.8 milliseconds→time..........................................................................................................................143

    26 Unit posix....................................................................................................................................................14526.1 Constants......................................................................................................................................145

    26.1.1 File-control Commands...............................................................................................14526.1.2 Standard I/O file-descriptors........................................................................................14526.1.3 Open flags....................................................................................................................14626.1.4 Permission bits.............................................................................................................147

    26.2 Directories.................................................................................................................................................14826.2.1 change-directory.......................................................................................................................14826.2.2 current-directory.......................................................................................................................14926.2.3 create-directory.........................................................................................................................14926.2.4 delete-directory.........................................................................................................................14926.2.5 directory....................................................................................................................................14926.2.6 directory?..................................................................................................................................14926.2.7 glob...........................................................................................................................................14926.2.8 canonical-path...........................................................................................................................15026.2.9 set-root-directory!.....................................................................................................................150

    26.3 Pipes..........................................................................................................................................................15026.3.1 call-with-input-pipe...................................................................................................................15026.3.2 call-with-output-pipe.................................................................................................................15026.3.3 close-input-pipe.........................................................................................................................15126.3.4 close-output-pipe.......................................................................................................................15126.3.5 create-pipe.................................................................................................................................15126.3.6 open-input-pipe.........................................................................................................................15126.3.7 open-output-pipe.......................................................................................................................15126.3.8 pipe/buf.....................................................................................................................................15126.3.9 with-input-from-pipe.................................................................................................................15226.3.10 with-output-to-pipe.................................................................................................................152

    26.4 Fifos..........................................................................................................................................................15226.4.1 create-fifo..................................................................................................................................15226.4.2 fifo?...........................................................................................................................................152

    26.5 File descriptors and low-level I/O.............................................................................................................15326.5.1 duplicate-fileno.........................................................................................................................15326.5.2 file-close....................................................................................................................................15326.5.3 file-open....................................................................................................................................15326.5.4 file-mkstemp.............................................................................................................................15326.5.5 file-read.....................................................................................................................................15426.5.6 file-select...................................................................................................................................15426.5.7 file-write....................................................................................................................................154

    CHICKEN User's Manual - The User's Manual

    xi

  • Chicken User's Manual26 Unit posix26.5.8 file-control.................................................................................................................................15426.5.9 open-input-file*.........................................................................................................................15426.5.10 open-output-file*.....................................................................................................................15526.5.11 port→fileno.................................................................................................................................155

    26.6 Retrieving file attributes...........................................................................................................................15526.6.1 file-access-time.........................................................................................................................15526.6.2 file-change-time........................................................................................................................15526.6.3 file-modification-time...............................................................................................................15526.6.4 file-stat......................................................................................................................................15526.6.5 file-position...............................................................................................................................15626.6.6 file-size......................................................................................................................................15626.6.7 regular-file?...............................................................................................................................15626.6.8 file-owner..................................................................................................................................15626.6.9 file-permissions.........................................................................................................................15626.6.10 file-read-access?......................................................................................................................15726.6.11 file-write-access?....................................................................................................................15726.6.12 file-execute-access?................................................................................................................15726.6.13 stat-regular?.............................................................................................................................15726.6.14 stat-directory?.........................................................................................................................15726.6.15 stat-char-device?.....................................................................................................................15726.6.16 stat-block-device?...................................................................................................................15726.6.17 stat-fifo?..................................................................................................................................15726.6.18 stat-symlink?...........................................................................................................................15726.6.19 stat-socket?..............................................................................................................................157

    26.7 Changing file attributes.............................................................................................................................15826.7.1 file-truncate...............................................................................................................................15826.7.2 set-file-position!........................................................................................................................15826.7.3 change-file-mode......................................................................................................................15826.7.4 change-file-owner.....................................................................................................................158

    26.8 Processes...................................................................................................................................................15926.8.1 current-process-id.....................................................................................................................15926.8.2 parent-process-id.......................................................................................................................15926.8.3 process-group-id.......................................................................................................................15926.8.4 process-execute.........................................................................................................................15926.8.5 process-fork...............................................................................................................................15926.8.6 process-run................................................................................................................................16026.8.7 process-signal............................................................................................................................16026.8.8 process-wait..............................................................................................................................16026.8.9 process.......................................................................................................................................16026.8.10 process*...................................................................................................................................16126.8.11 sleep........................................................................................................................................16126.8.12 create-session..........................................................................................................................161

    26.9 Hard and symbolic links...........................................................................................................................16126.9.1 symbolic-link?..........................................................................................................................16126.9.2 create-symbolic-link.................................................................................................................16226.9.3 read-symbolic-link....................................................................................................................16226.9.4 file-link......................................................................................................................................162

    26.10 Retrieving user & group informa