The Kawa Scheme language
Table of Contents
The Kawa Scheme language
News - Recent Changes
Features
Implemented SRFIs
Compatibility with standards
The Kawa Community
Reporting bugs
General Kawa email and discussion
Acknowledgements and thanks
Technical Support for Kawa
Projects using Kawa
Ideas and tasks for contributing to Kawa
Run interactive process in separate Java Virtual Machine:
Better dynamic reload
Easier Access to Native Libraries using JNA/JNR
Types for units
Compiler should use class-file reading instead of reflection
Mutually dependent Java and Scheme modules
Use Java-7 MethodHandles and invokedynamic
Parameterized types
Optimized function types and values using MethodHandles
Full continuations
Faster tailcalls
TreeList-optimization
Asynchronous evaluation
REPL console and other REPL improvement
XQuery-3.0 functionality
XQuery-updates
Common Lisp support
JEmacs improvements
Improved IDE integration
Plugin for NetBeans IDE
Plugin for Eclipse IDE
Improve Emacs integration
Hop-style web programming
String localization
Data binding
Decimal arithmetic and repeated decimals
Optional strict typing along with an explicit
dynamic
type
Getting and installing Kawa
Getting Kawa
Getting the development sources using Git
Getting and running Java
Installing and using the binary distribution
Installing and using the source distribution
Build Kawa using
configure
and
make
Configure options
Building on Windows using MinGW
Building on Windows using Cygwin
Building the documentation
Plain HTML documentation
Fancier HTML documentation
Using ebook readers or the –browse-manual option
Building a printable PDF file
Build Kawa using
ant
Kawa Scheme Tutorial
Introduction
Booleans
Numbers
Functions
Variables
Composable pictures
Lists and sequences
Creating and using objects
Types and declarations
Exceptions and errors
Classes
Other Java features
Reference Documentation
How to start up and run Kawa
Command-line arguments
Argument processing
General options
Options for language selection
Options for warnings and errors
Options for setting variables
Options for the REPL console
Options for controlling output formatting
Options for compiling and optimizing
Options for debugging
Options for web servers
Options for the JVM
Running Command Scripts
Setting kawa options in the script
Other ways to pass options using meta-arg or –script
Scripts for compiled code
The REPL (read-eval-print-loop) console
Input line editing and history
Running a Command Interpreter in a new Window
Using DomTerm
Exiting Kawa
Compiling to byte-code
Compiling to a set of .class files
Compiling to an archive file
Compiling using Ant
Compiling to a standalone application
Compiling to an applet
Compiling to a native executable
Syntax
Notation
Lexical and datum syntax
Lexical syntax
Formal account
Line endings
Whitespace and comments
Identifiers
Numbers
Datum syntax
Datum labels
Abbreviations
Hash-prefixed forms
Primitive expression syntax
Literal expressions
Variable references
Procedure calls
Property access using colon notation
Part lookup rules
Specific cases
Invoking methods
Accessing fields
Type literal
Type cast
Type test
New object construction
Getting array length
Programs and Bodies
Syntax and conditional compilation
Macros
Pattern language
Identifier predicates
Syntax-object and datum conversions
Signaling errors in macro transformers
Convenience forms
Named quasi-literals
Program structure
Boolean values
Conditionals
Variables and Patterns
Patterns
Definitions
Local binding constructs
Lazy evaluation
Delayed evaluation
Implicit forcing
Blank promises
Lazy and eager types
Repeat patterns and expressions
Threads
Exception handling
Simple error objects
Named exceptions
Native exception handling
Control features
Mapping functions
Multiple values
Symbols and namespaces
Simple symbols
Namespaces and compound symbols
Namespace objects
Compound symbols
Namespace aliases
Keywords
Special named constants
Procedures
Application and Arguments Lists
Arguments lists
Explicit argument list objects
Argument list library
Apply procedures
Lambda Expressions and Formal Parameters
Procedure properties
Standard properties
Generic (dynamically overloaded) procedures
Partial application
Quantities and Numbers
Numerical types
Exactness
Numerical promotion and conversion
Arithmetic operations
Numerical input and output
Quaternions
The
(kawa quaternions)
module
The
(kawa rotations)
module
Rotation Representation Conversions
Rotation Operations
Quantities and Units
Logical Number Operations
SRFI-60 Logical Number Operations
Deprecated Logical Number Operations
Performance of numeric operations
Characters and text
Characters
Character sets
Strings
Basic string procedures
Immutable String Constructors
Selection
String Comparisons
Conversions
Searching and matching
Concatenation and replacing
Mapping and folding
Replication & splitting
String mutation
Strings as sequences
Indexing a string
Indexing with a sequence
String Cursor API
String literals
Simple string literals
String templates
Special characters
Multiline string literals
Embedded expressions
Formatting
Unicode character classes and conversions
Characters
Deprecated in-place case modification
Regular expressions
Java regular expressions
Portable Scheme regular expressions
Data structures
Sequences
Lists
SRFI-1 list library
SRFI-101 Purely Functional Random-Access Pairs and Lists
Vectors
Uniform vectors
Relationship with Java arrays
Bytevectors
Converting to or from strings
Ranges
Streams - lazy lists
Multi-dimensional Arrays
Array shape
Array types
Array literals and printing
Array construction
Array indexing
Modifying arrays
Transformations and views
Miscellaneous
Hash tables
R6RS hash tables
Procedures
Inspection
Hash functions
SRFI-69 hash tables
Type constructors and predicate
Reflective queries
Dealing with single elements
Dealing with the whole contents
Hash functions
Eval and Environments
Locations
Parameter objects
Debugging
Input, output, and file handling
Named output formats
Paths - file name, URLs, and URIs
Extracting Path components
File System Interface
Reading and writing whole files
Reading a file
Blobs
Writing to a file
Functions
Ports
String and bytevector ports
Input
Output
Prompts for interactive consoles (REPLs)
Line numbers and other input port properties
Miscellaneous
Formatted Output (Common-Lisp-style)
Implemented CL Format Control Directives
Formatting Integers
Formatting real numbers
Miscellaneous formatting operators
Unimplemented CL Format Control Directives
Extended, Replaced and Additional Control Directives
Pretty-printing
Pretty-printing Scheme forms
Generic pretty-printing functions
Resources
Types
Standard Types
Parameterized Types
Type tests and conversions
Object, Classes and Modules
Defining new classes
General class properties
Declaring fields
Declaring methods
Example
Anonymous classes
Lambda as shorthand for anonymous class
Enumeration types
Annotations of declarations
Modules and how they are compiled to classes
Name visibility
R7RS explicit library modules
How a module becomes a class
Same class for module and defined class
Static vs non-static modules
Module options
Importing from a library
Searching for modules
Searching for source files
Builtin libraries
Importing a SRFI library
Importing from a plain class
Record types
Creating New Record Types On-the-fly
Calling Java methods from Scheme
Calling static methods using colon notation
Calling instance methods using colon notation
Method names
Invoking a method with the
invoke
function
Using a namespace prefix
Allocating objects
Accessing object fields
Accessing static fields and properties
Accessing instance fields and properties
Using field and static-field methods
Older colon-dot notation
Mapping Scheme names to Java names
Scheme types in Java
Using Java Arrays
Creating new Java arrays
Accessing Java array elements
Old low-level array macros
Loading Java functions into Scheme
Evaluating Scheme expressions from Java
Using
javax.script
portable Java scripting
Working with XML and HTML
Formatting XML
Creating HTML nodes
Creating XML nodes
XML literals
Element constructors
Elements contents (children)
Attributes
QNames and namespaces
Other XML types
Processing instructions
XML comments
CDATA sections
Web page scripts
Self-configuring web page scripts
Using the OpenJDK built-in web server
Using a servlet container
Finding a matching script
Determining script language
Compilation and caching
Installing web page scripts as Servlets
Creating a web application
Compiling a web page script to a servlet
Installing a servlet under Tomcat
Installing a servlet under Glassfish
Servlet-specific script functions
Installing Kawa programs as CGI scripts
Functions for accessing HTTP requests
Request URL components
Request parameters
Request headers
Request body
Request IP addresses and ports
Miscellaneous request properties
Generating HTTP responses
Using non-Scheme languages for XML/HTML
XQuery language
XSL transformations
KRL - The Kawa Report Language for generating XML/HTML
Differences between KRL and BRL
Miscellaneous topics
Composable pictures
Coordinates - points and dimensions
Shapes
Colors and paints
Filling a shape with a color
Stroking (outlining) a shape
Affine transforms
Combining pictures
Images
Compositing - Controlling how pictures are combined
Displaying and exporting pictures
Export to SVG
Display in Swing
Convert to image
Building JavaFX applications
Using JavaFX with JDK 7
Building for Android
Downloading and setting up the Android SDK
Building Kawa for Android
Creating the application
Running the application on the Android emulator
Running the application on your device
Some debugging notes
Other resources
Android view construction
View object allocation
Event handlers
System inquiry
Processes
Creating a process
Process literals
Process values and process output
Substitution and tokenization
Input/output redirection
Pipe-lines
Setting the process environment
Waiting for process exit
Exiting the current process
Deprecated functions
Time-related functions
Deprecated low-level functions
Low-level Method invocation
Low-level field operations
Old low-level array macros
Frequently Asked Questions
The Kawa language framework
License
License for the Kawa software
License for the Kawa manual
Index
Index