Chapter 2. Getting Started

Section 2.1. Interacting with Scheme

While Scheme provides various input and output procedures, the REPL takes care of reading expressions and printing their values. This frees you to concentrate on writing your program without worrying about how its results will … Read the rest

Chapter 1. Introduction

Scheme supports many types of data values, or objects, including characters, strings, symbols, lists or vectors of objects, and a full set of numeric data types, including complex, real, and arbitrary-precision rational numbers.

The storage required to hold the contents … Read the rest

Slices

It often happens that you need to work with only a few elements from a given list. For example, the Bedrock Library keeps information about their patrons in a large file. Each line in the file describes one patron … Read the rest

Process Management

The system Function

The simplest way to launch a child process in Perl to run a program is the system function. For example, to invoke the Unix date command from within Perl, it looks like:

system "date";


The child process … Read the rest

Smart Matching and given-when

The Smart Match Operator

The smart match operator, ~~, looks at both of its operands and decides on its own how it should compare them. If the operands look like numbers, it does a numeric comparison. If they look … Read the rest

Strings and Sorting

Finding a Substring with index

Finding a substring depends on where you have lost it. If you happen to have lost it within a bigger string, you’re in luck because the index function can help you out. Here’s how it … Read the rest

Directory Operations

Moving Around the Directory Tree

Your program runs with a “working directory,” which is the starting point for relative pathnames. That is, if you refer to the file fred, that means fred in the current working directory.

The chdir … Read the rest

File Tests

File Test Operators

Before we start a program that creates a new file, let’s make sure that the file doesn’t already exist so that we don’t accidentally overwrite a vital spreadsheet datafile or that important birthday calendar. For this, we … Read the rest

Perl Modules

There is a lot more to Perl than what we’re able to show you in this book, and there are a lot of people doing a lot of interesting things with Perl. If there is a problem to solve, then … Read the rest

More Control Structures

The unless Control Structure

In an if control structure, the block of code is executed only when the conditional expression is true. If you want to execute a block of code only when the conditional is false, change … Read the rest