Version 78 of Learning Tcl

Updated 2013-09-20 13:27:51 by pooryorick

Learn to Program is the Contents page for topics that are related to the art of programming in general.

See Also

Learning Tcl
The specifics of Tcl
Casual Programming - Amateurs, beginners et al
BOOK Structure and Interpretation of Computer Programs
formerly used as the textbook of the MIT introductory programming class; widely considered a classic text in computer science
BOOK Concepts, Techniques, and Models of Computer Programming
How to be a Programmer: A Short, Comprehensive, and Personal Summary, Robert L. Read, 2002

Description

There are, of course many resources out there in the world, that teach beginners the art of computer programming. One of the more well-known is The Structure and Interpretation of Computer Programs, but it uses LISP rather than Tcl. Tcl is a fantastic first language for someone interested in getting into computer programming, and this page introduces Tcl obliquely by introducing the general art of programming, using Tcl as a resource to illustrate the concepts.

Values and side effects

Some commands return useful values, some have side effects, and some do both.

The value of [[puts] is invariant. It always returns the empty string, so it's never useful:

set a [puts hello]

Therefore, [[puts] has a side effect, but no useful value.

[[set] has a side effect. It creates a new variable and assigns a value to it. [[set] also returns the value that it assigned to the variable, which can be useful sometimes. To set two variables to the same value, one could write:

set b [set a hello]

Therefore, [[set] has a side effect and also has a useful value.

[[string length] is an example of a command that doesn't have any side effects but does have a useful value. It changes nothing in the world of a Tcl script. It doesn't create or delete any commands or variables, and it doesn't write any data to any channels. However, it returns a value that tells us something we might want to know:

string length hello

The last category is commands that have no side effect and no value. There are none of these!

Basics

scope

Data Structure

data structure

Program Structure

control structure
proc
closure
continuation
coroutine
Generator
iterator

State

static variables
Tcl references in Tcl

Calculation

Processing

parsing
serialization
data analysis

Design

Model / View / Controller

Paradigm

Functional Programming

The Role of Scripting Languages

Why adding Tcl calls to a C/C++ application is a bad idea

Technique

debugging

More Theory

The following pages introduce various computer science topics, but don't yet have any other place to live in this table of contents

Scripted Compiler