The Kawa Scheme language
The Kawa Scheme language
News - Recent Changes
Features
The Kawa Community
Getting and installing Kawa
Kawa Scheme Tutorial
Reference Documentation
Usage Reference (running Kawa)
Syntax
Program structure
Control features
Symbols and namespaces
Procedures
Numbers
Characters and text
Data structures
Eval and Environments
Debugging
Input, output, files
Types
Object, Classes and Modules
Working with XML and HTML
Miscellaneous topics
Frequently Asked Questions
The Kawa language framework
License
Index
Table of Contents
Part . Reference Documentation
Table of Contents
6. Usage Reference (running Kawa)
6.1. Command-line arguments
6.1.1. Argument processing
6.1.2. General options
6.1.3. Options for language selection
6.1.4. Options for warnings and errors
6.1.5. Options for setting variables
6.1.6. Options for the REPL console
6.1.7. Options for controlling output formatting
6.1.8. Options for compiling and optimizing
6.1.9. Options for debugging
6.1.10. Options for web servers
6.1.11. Options for the JVM
6.2. Running Command Scripts
6.2.1. Setting kawa options in the script
6.2.2. Other ways to pass options using meta-arg or –script
6.2.3. Scripts for compiled code
6.3. The REPL (read-eval-print-loop) console
6.3.1. Input line editing and history
6.3.2. Running a Command Interpreter in a new Window
6.3.3. Using DomTerm
6.4. Exiting Kawa
6.5. Compiling to byte-code
6.5.1. Compiling to a set of .class files
6.5.2. Compiling to an archive file
6.5.3. Compiling using Ant
6.5.4. Compiling to a standalone application
6.5.5. Compiling to an applet
6.5.6. Compiling to a native executable
7. Syntax
7.1. Notation
7.2. Lexical and datum syntax
7.3. Lexical syntax
7.3.1. Formal account
7.3.2. Line endings
7.3.3. Whitespace and comments
7.3.4. Identifiers
7.3.5. Numbers
7.4. Datum syntax
7.4.1. Datum labels
7.4.2. Abbreviations
7.5. Hash-prefixed forms
7.6. Primitive expression syntax
7.6.1. Literal expressions
7.6.2. Variable references
7.6.3. Procedure calls
7.7. Property access using colon notation
7.7.1. Part lookup rules
7.7.2. Specific cases
7.7.2.1. Invoking methods
7.7.2.2. Accessing fields
7.7.2.3. Type literal
7.7.2.4. Type cast
7.7.2.5. Type test
7.7.2.6. New object construction
7.7.2.7. Getting array length
7.8. Programs and Bodies
7.9. Syntax and conditional compilation
7.10. Macros
7.10.1. Pattern language
7.10.2. Identifier predicates
7.10.3. Syntax-object and datum conversions
7.10.4. Signaling errors in macro transformers
7.10.5. Convenience forms
7.11. Named quasi-literals
8. Program structure
8.1. Boolean values
8.2. Conditionals
8.3. Variables and Patterns
8.3.1. Patterns
8.4. Definitions
8.5. Local binding constructs
8.6. Lazy evaluation
8.6.1. Delayed evaluation
8.6.2. Implicit forcing
8.6.3. Blank promises
8.6.4. Lazy and eager types
8.7. Repeat patterns and expressions
8.8. Threads
8.9. Exception handling
8.9.1. Simple error objects
8.9.2. Named exceptions
8.9.3. Native exception handling
9. Control features
9.1. Mapping functions
9.2. Multiple values
10. Symbols and namespaces
10.1. Simple symbols
10.2. Namespaces and compound symbols
10.2.1. Namespace objects
10.2.2. Compound symbols
10.2.3. Namespace aliases
10.3. Keywords
10.4. Special named constants
11. Procedures
11.1. Application and Arguments Lists
11.1.1. Arguments lists
11.1.2. Explicit argument list objects
11.1.3. Argument list library
11.1.4. Apply procedures
11.2. Lambda Expressions and Formal Parameters
11.3. Procedure properties
11.3.1. Standard properties
11.4. Generic (dynamically overloaded) procedures
11.5. Partial application
12. Numbers
12.1. Numerical types
12.1.1. Exactness
12.1.2. Numerical promotion and conversion
12.2. Arithmetic operations
12.3. Numerical input and output
12.4. Quaternions
12.4.1. The
(kawa quaternions)
module
12.4.2. The
(kawa rotations)
module
12.4.2.1. Rotation Representation Conversions
12.4.2.2. Rotation Operations
12.5. Quantities and Units
12.6. Logical Number Operations
12.6.1. SRFI-60 Logical Number Operations
12.6.2. Deprecated Logical Number Operations
12.7. Performance of numeric operations
13. Characters and text
13.1. Characters
13.2. Character sets
13.3. Strings
13.3.1. Basic string procedures
13.3.2. Immutable String Constructors
13.3.3. Selection
13.3.4. String Comparisons
13.3.5. Conversions
13.3.6. Searching and matching
13.3.7. Concatenation and replacing
13.3.8. Mapping and folding
13.3.9. Replication & splitting
13.3.10. String mutation
13.3.11. Strings as sequences
13.3.11.1. Indexing a string
13.3.11.2. Indexing with a sequence
13.3.12. String Cursor API
13.4. String literals
13.4.1. Simple string literals
13.4.2. String templates
13.4.2.1. Special characters
13.4.2.2. Multiline string literals
13.4.2.3. Embedded expressions
13.4.2.4. Formatting
13.5. Unicode character classes and conversions
13.5.1. Characters
13.5.2. Deprecated in-place case modification
13.6. Regular expressions
13.6.1. Java regular expressions
13.6.2. Portable Scheme regular expressions
14. Data structures
14.1. Sequences
14.2. Lists
14.2.1. SRFI-1 list library
14.2.2. SRFI-101 Purely Functional Random-Access Pairs and Lists
14.3. Vectors
14.4. Uniform vectors
14.4.1. Relationship with Java arrays
14.5. Bytevectors
14.5.1. Converting to or from strings
14.6. Ranges
14.7. Streams - lazy lists
14.8. Multi-dimensional Arrays
14.8.1. Array shape
14.8.2. Array types
14.8.3. Array literals and printing
14.8.4. Array construction
14.8.5. Array indexing
14.8.6. Modifying arrays
14.8.7. Transformations and views
14.8.8. Miscellaneous
14.9. Hash tables
14.9.1. R6RS hash tables
14.9.1.1. Procedures
14.9.1.2. Inspection
14.9.1.3. Hash functions
14.9.2. SRFI-69 hash tables
14.9.2.1. Type constructors and predicate
14.9.2.2. Reflective queries
14.9.2.3. Dealing with single elements
14.9.2.4. Dealing with the whole contents
14.9.2.5. Hash functions
15. Eval and Environments
15.1. Locations
15.2. Parameter objects
16. Debugging
17. Input, output, files
17.1. Named output formats
17.2. Paths - file name, URLs, and URIs
17.2.1. Extracting Path components
17.3. File System Interface
17.4. Reading and writing whole files
17.4.1. Reading a file
17.4.2. Blobs
17.4.3. Writing to a file
17.4.4. Functions
17.5. Ports
17.5.1. String and bytevector ports
17.5.2. Input
17.5.3. Output
17.5.4. Prompts for interactive consoles (REPLs)
17.5.5. Line numbers and other input port properties
17.5.6. Miscellaneous
17.6. Formatted Output (Common-Lisp-style)
17.6.1. Implemented CL Format Control Directives
17.6.2. Formatting Integers
17.6.3. Formatting real numbers
17.6.4. Miscellaneous formatting operators
17.6.5. Unimplemented CL Format Control Directives
17.6.6. Extended, Replaced and Additional Control Directives
17.7. Pretty-printing
17.7.1. Pretty-printing Scheme forms
17.7.2. Generic pretty-printing functions
17.8. Resources
18. Types
18.1. Standard Types
18.2. Parameterized Types
18.3. Type tests and conversions
19. Object, Classes and Modules
19.1. Defining new classes
19.1.1. General class properties
19.1.2. Declaring fields
19.1.3. Declaring methods
19.1.4. Example
19.2. Anonymous classes
19.2.1. Lambda as shorthand for anonymous class
19.3. Enumeration types
19.4. Annotations of declarations
19.5. Modules and how they are compiled to classes
19.5.1. Name visibility
19.5.2. R7RS explicit library modules
19.5.3. How a module becomes a class
19.5.4. Same class for module and defined class
19.5.5. Static vs non-static modules
19.5.6. Module options
19.6. Importing from a library
19.6.1. Searching for modules
19.6.2. Searching for source files
19.6.3. Builtin libraries
19.6.4. Importing a SRFI library
19.6.5. Importing from a plain class
19.7. Record types
19.8. Creating New Record Types On-the-fly
19.9. Calling Java methods from Scheme
19.9.1. Calling static methods using colon notation
19.9.2. Calling instance methods using colon notation
19.9.3. Method names
19.9.4. Invoking a method with the
invoke
function
19.9.5. Using a namespace prefix
19.10. Allocating objects
19.11. Accessing object fields
19.11.1. Accessing static fields and properties
19.11.2. Accessing instance fields and properties
19.11.3. Using field and static-field methods
19.11.4. Older colon-dot notation
19.12. Mapping Scheme names to Java names
19.13. Scheme types in Java
19.14. Using Java Arrays
19.14.1. Creating new Java arrays
19.14.2. Accessing Java array elements
19.14.3. Old low-level array macros
19.15. Loading Java functions into Scheme
19.16. Evaluating Scheme expressions from Java
19.16.1. Using
javax.script
portable Java scripting
20. Working with XML and HTML
20.1. Formatting XML
20.2. Creating HTML nodes
20.3. Creating XML nodes
20.4. XML literals
20.4.1. Element constructors
20.4.2. Elements contents (children)
20.4.3. Attributes
20.4.4. QNames and namespaces
20.4.5. Other XML types
20.4.5.1. Processing instructions
20.4.5.2. XML comments
20.4.5.3. CDATA sections
20.5. Web page scripts
20.6. Self-configuring web page scripts
20.6.1. Using the OpenJDK built-in web server
20.6.2. Using a servlet container
20.6.3. Finding a matching script
20.6.4. Determining script language
20.6.5. Compilation and caching
20.7. Installing web page scripts as Servlets
20.7.1. Creating a web application
20.7.2. Compiling a web page script to a servlet
20.7.3. Installing a servlet under Tomcat
20.7.4. Installing a servlet under Glassfish
20.7.5. Servlet-specific script functions
20.8. Installing Kawa programs as CGI scripts
20.9. Functions for accessing HTTP requests
20.9.1. Request URL components
20.9.2. Request parameters
20.9.3. Request headers
20.9.4. Request body
20.9.5. Request IP addresses and ports
20.9.6. Miscellaneous request properties
20.10. Generating HTTP responses
20.11. Using non-Scheme languages for XML/HTML
20.11.1. XQuery language
20.11.2. XSL transformations
20.11.3. KRL - The Kawa Report Language for generating XML/HTML
20.11.4. Differences between KRL and BRL
21. Miscellaneous topics
21.1. Composable pictures
21.1.1. Coordinates - points and dimensions
21.1.2. Shapes
21.1.3. Colors and paints
21.1.4. Filling a shape with a color
21.1.5. Stroking (outlining) a shape
21.1.6. Affine transforms
21.1.7. Combining pictures
21.1.8. Images
21.1.9. Compositing - Controlling how pictures are combined
21.1.10. Displaying and exporting pictures
21.1.10.1. Export to SVG
21.1.10.2. Display in Swing
21.1.10.3. Convert to image
21.2. Building JavaFX applications
21.2.1. Using JavaFX with JDK 11+
21.3. Building for Android
21.3.1. Downloading and setting up the Android SDK
21.3.2. Building Kawa for Android
21.3.3. Creating the application
21.3.4. Running the application on the Android emulator
21.3.5. Running the application on your device
21.3.6. Some debugging notes
21.3.7. Other resources
21.4. Android view construction
21.4.1. View object allocation
21.4.2. Event handlers
21.5. System inquiry
21.6. Processes
21.6.1. Creating a process
21.6.2. Process literals
21.6.3. Process values and process output
21.6.4. Substitution and tokenization
21.6.5. Input/output redirection
21.6.6. Pipe-lines
21.6.7. Setting the process environment
21.6.8. Waiting for process exit
21.6.9. Exiting the current process
21.6.10. Deprecated functions
21.7. Time-related functions
21.8. Deprecated low-level functions
21.8.1. Low-level Method invocation
21.8.2. Low-level field operations
21.8.3. Old low-level array macros
22. Frequently Asked Questions
23. The Kawa language framework
24. License
24.1. License for the Kawa software
24.2. License for the Kawa manual