# Category:Tcl

**Tcl**

This

**programming language**may be used to instruct a computer to perform a task.

Official website |
---|

Execution method: | Compiled (bytecode) |
---|---|

Garbage collected: | Yes |

Parameter passing methods: | By value |

Type safety: | Safe |

Type strength: | Weak |

Type compatibility: | Duck |

Type expression: | Implicit |

Type checking: | Dynamic |

Lang tag(s): | tcl |

See Also: |

**Tcl** (short for **T**ool **C**ommand **L**anguage)
is a scripting language with very simple syntax, dynamic typing,
automatic storage allocation and garbage collection
and native Unicode support.

**Tcl** is often combined with the Tk library,
which provides support for graphics and GUI.

As a result, it is often referred to as **Tcl/Tk**.

Tcl is known to be supported under a variety of popular operating systems,
including UNIX, Linux, BSD, Windows, WinCE, PocketPC,
Mac OS X and BeOS.

Tcl is distributed under the BSD License.

- Current version
- Tcl/Tk 8.6.3 (2014-11-12)

The Tcl language has been implemented in multiple lower-level languages.
The most common one is **libtcl**, written in C, which is
the engine used to power tclsh and wish, but others exist.
Notably, these include Jacl and Eagle, which implement
Tcl in Java and C# respectively.

Its creator, John Ousterhout, wrote about it:

*“I got the idea for Tcl while on sabbatical leave at DEC's Western Research Laboratory in the fall of 1987. I started actually implementing it when I got back to Berkeley in the spring of 1988; by summer of that year it was in use in some internal applications of ours, but there was no Tk. The first external releases of Tcl were in 1989, I believe. I started implementing Tk in 1989, and the first release of Tk was in 1991.”*

The principal pre-built distributions of Tcl are all based on libtcl;
the main ones are ActiveTcl from ActiveState,
and tclkit from Equi4 Software *et al*.

Older versions of the language are distributed as part of
Apple's OSX and all Linux distributions.

## Contents

## Language Syntax[edit]

### Grammar[edit]

Note that this is a simplified language grammar, and it is normal
to think of the language at a higher level where these differences don't show.

script::=command? ((“\n”|“;”)script)command::=“#” characters “\n” /* comment */|word(space word)*/* sequence of space-separated words; * first is command name */|/* empty */ word::=“{*}”?“{” characters “}” /* braces must be balanced */|“{*}”?“"” charSubsts “"” /* double-quotes must be balanced */|“{*}”?charSubsts charSubsts::=“[” script “]” charSubsts?/* brackets must be balanced */|“$” varName charSubsts?|“${” varName “}” charSubsts?|“\\” escapeSequence charSubsts?|ordinaryChar charSubsts?

The syntax of the language is defined more exactly in the Tcl(n) manual page.

### Conceptual Command Syntax[edit]

Though formally not part of the language syntax, the syntactic style of the language's standard commands mostly follow a few basic syntactic principles:

- Commands are variadic, and frequently accept arbitrary numbers of arguments.
- Commands that take options will prefix the option name with a single ASCII hyphen, “-”, and if a value parameter to the option is required, that parameter will be in a subsequent argument to the option name.
- Option names are not single character long strings after removing the hyphen (except in rare cases) and
`getopt`

-style argument combination is never supported. - Commands perform callbacks by evaluating a caller-provided Tcl script.
- During-execution callback scripts are evaluated in the context of their caller.
- After-execution callback scripts are evaluated in the global scope.

- Commands cannot discover how their arguments were quoted.

### Key Commands[edit]

The following commands are simply normal commands, and can be renamed, deleted, traced, etc., just like any other command, but they are also used in virtually all Tcl scripts and so overriding their behavior is typically an indication of code that is likely to fail. (People do that anyway, but they are almost always careful to ensure that the existing semantics of the commands with these names are still supported.)

**set** *varName* ?*value*?

- Sets a named variable to a value and returns the current value of the variable. If
*value*is omitted, reads from the variable.

**expr** *arg*...

- Concatenates the
*arg*uments and evaluates them as an expression.

**if** *expr* ?**then**? *script* ?**elseif** *expr* ?**then**? *script* ...? ?**else**? ?*script*?

- Evaluates expressions in order until one of them yields a true value, and then evaluate the associated script, or evaluate the script from the
**else**clause otherwise. The**then**and**else**keyword-arguments are both optional, but it is conventional to always include the**else**for readability (**then**only tends to be used with multiline conditions). Arbitrarily many**elseif**clauses are allowed.

**switch** ?*options*? *value* *body***switch** ?*options*? *value* *val1* *script* ?*val2* *script* ...?

- Finds the first
*val*n that matches*value*(the default matching rule is exact equality, this is overrideable using the*options*) and evaluate its script. The final*val*can be**default**to supply a catch-all case, and if a*script*is a**-**then the*script*from the following clause is used. If a single*body*is supplied, it is interpreted as a list of clauses.

**while** *expr script*

- While the expression evaluates to true, evaluate the
*script*.

**for** *init expr incr script*

- Evaluate the
*init*script, and then while the expression evaluates to true, evaluate the*script*, evaluating the*incr*script after each iteration. This is very similar to C's`for`

keyword.

**foreach** *varName list script*

**foreach** *varNameList list* ?*varNameList list* ...? *script*

- Evaluate the
*script*for each value in*list*, setting*varName*to that value. In the more general case, there is more than one*list*and there are multiple variable names per list allowing striding.

**break**

- Make the current loop finish executing early.

**continue**

- Make the next iteration of the current loop start early.

**error** *message* ...

- Generate an error exception. The additional optional arguments allow finer control over the exception.

**eval** *arg*...

- Concatenate the arguments and evaluate the resulting string as a script. Note that from Tcl 8.5 onwards, this should only be used very rarely; the expansion syntax covers the vast majority of previous uses for
**eval**.

**list** *arg*...

- Create a list out of the arguments and return it. The resulting list is also guaranteed to be a well-formed script that will evaluate the sequence of arguments as a command and arguments without further substitution, making the
**list**command useful for predictable code synthesis.

**proc** *name formalArgs body*

- Define a new command called
*name*that pushes a new stack frame, accepts arguments and binds them to the list of local variable names given in*formalArgs*and then evaluates*body*.

**return** ?*options*? ?*value*?

- Return from the current stack frame with the given
*value*(or the empty string if that's omitted). The*options*allow for greater control of the underlying exception semantics used.

**catch** *body* ?*varName*? ?*optVarName*?

- Evaluate the
*body*script, and return the exception status produced (e.g., 0 for no exception). If*varName*is given, the result or error message is stored in it. If*optVarName*is present (from Tcl 8.5 onwards) then a dictionary characterizing the exception status is stored in it.

**upvar** ?*level*? *otherVarName localVarName* ?*otherVarName localVarName* ...?

- Bind each of the
*otherVarName*variables (as looked up at stack level*level*, or the parent stack frame of the current procedure if that is omitted) to the corresponding*localVarName*. Following this, the two refer to the same variable until the termination of the current stack frame.

**uplevel** ?*level*? *arg*...

- Concatenate the arguments and evaluate them as a script in the stack frame given by
*level*(or the stack frame that called the current procedure if that is omitted). Due to syntactic ambiguities, it is recommended that the*level*always be specified explicitly.

#### From Tcl 8.5[edit]

**apply** *lambdaTerm arg…*

- Applies a lambda term to zero or more arguments. Lambda terms are two- or three-element tuples, the first element being the formal parameter description, the second being the script that implements the lambda (just as with
**proc**) and the optional third being the context namespace (with the default being the global namespace).

**dict** *subcommand* …

- Manipulates dictionaries, values that describe a (sparse) mapping from arbitrary keys to arbitrary values (well, so long as both are themselves values).

#### From Tcl 8.6[edit]

**coroutine** *name command arg…*

- Create a coroutine called
*name*, which is implemented by the execution of*command*together with any supplied arguments. The*name*is the name of a command that will be used to resume the coroutine.

**yield** ?*value*?

- Yield from a coroutine, with optional value (empty if not supplied). Result will be the optional resumption argument to the coroutine's command.

**tailcall** *command arg…*

- Stops the execution of the current context and replaces it with a call to the given
*command*with any arguments.

**oo::class create** *name body*

- Creates a class called
*name*with definition*body*. Instances of*name*are created with “*name***new***arg…*” and “*name***create***instanceName arg…*”. (Note that the syntax for**oo::class**is a consequence of this.)

## Language Semantics[edit]

### Value Model[edit]

Tcl's value model operates on two levels.

- Classically, it is defined purely on unmodifiable strings over a language of unencoded UNICODE characters.
- Practically, values are polymorphic and hold a cache of the last type-interpretation that they were used with, together with an optional UTF-8 string representation. They are reference-counted and are not modifiable (unless the code in question holds the only reference, which is a significant efficiency gain; if the value is shared, it is shallow-copied upon modification). Although only reference-counted, they are effectively garbage-collected since circular data structures cannot be constructed (performing such construction requires holding two references to the same object, which forces a copy to be taken and breaks the reference loop). The net effect of this is just like the UNICODE string classical model, except much faster.

The language supports the following basic types, together with many defined by extension packages:

- Unicode strings
- Binary strings
- Integers of unbounded width
- Double-precision IEEE floats
- Booleans
- Lists of values
- Dictionaries mapping values to values
- Assorted "cache" types used to boost performance:
- Command handles (several types)
- Variable handles (several types)
- Compiled regular expressions
- Compiled scripts (several types)
- etc.

Note that all variables can hold values of *any* type; the language does not impose type constraints on variables at all. However, it is possible to use variable traces to enforce a type constraint if so desired.

## External Links[edit]

## Todo[edit]

Reports:Tasks_not_implemented_in_Tcl

## Subcategories

This category has the following 4 subcategories, out of 4 total.

## Pages in category "Tcl"

The following 914 pages are in this category, out of 914 total.

### A

- A+B
- ABC Problem
- Abstract type
- Abundant, deficient and perfect number classifications
- Accumulator factory
- Ackermann function
- Active Directory/Connect
- Active Directory/Search for a user
- Active object
- Add a variable to a class instance at runtime
- Addition-chain exponentiation
- Address of a variable
- AKS test for primes
- Align columns
- Aliquot sequence classifications
- Almost prime
- Amb
- Amicable pairs
- Anagrams
- Anagrams/Deranged anagrams
- Animate a pendulum
- Animation
- Anonymous recursion
- Append a record to the end of a text file
- Apply a callback to an array
- Arbitrary-precision integers (included)
- Archimedean spiral
- Arena storage pool
- Arithmetic evaluation
- Arithmetic-geometric mean
- Arithmetic-geometric mean/Calculate Pi
- Arithmetic/Complex
- Arithmetic/Integer
- Arithmetic/Rational
- Array concatenation
- Array length
- Arrays
- ASCII art diagram converter
- Aspect Oriented Programming
- Assertions
- Assertions in design by contract
- Associative array/Creation
- Associative array/Iteration
- Atomic updates
- Audio frequency generator
- Audio Overlap Loop
- AudioAlarm
- Average loop length
- Averages/Arithmetic mean
- Averages/Mean angle
- Averages/Mean time of day
- Averages/Median
- Averages/Mode
- Averages/Pythagorean means
- Averages/Root mean square
- Averages/Simple moving average
- AVL tree

### B

- Babbage problem
- Balanced brackets
- Balanced ternary
- Base64 encode data
- Benford's law
- Bernoulli numbers
- Best shuffle
- Bilinear interpolation
- Binary digits
- Binary search
- Binary strings
- Birthday problem
- Bitcoin/address validation
- Bitcoin/public point to address
- Bitmap
- Bitmap/Bresenham's line algorithm
- Bitmap/Bézier curves/Cubic
- Bitmap/Bézier curves/Quadratic
- Bitmap/Flood fill
- Bitmap/Histogram
- Bitmap/Midpoint circle algorithm
- Bitmap/PPM conversion through a pipe
- Bitmap/Read a PPM file
- Bitmap/Read an image through a pipe
- Bitmap/Write a PPM file
- Bitwise IO
- Bitwise operations
- Boolean values
- Box the compass
- Brace expansion
- Break OO privacy
- Brownian tree
- Bulls and cows
- Bulls and cows/Player

### C

- Caesar cipher
- Calendar
- Calendar - for "REAL" programmers
- Call a foreign-language function
- Call a function
- Call a function in a shared library
- Call an object method
- Canny edge detector
- Card shuffles
- Carmichael 3 strong pseudoprimes
- Case-sensitivity of identifiers
- Casting out nines
- Catalan numbers
- Catalan numbers/Pascal's triangle
- Catamorphism
- Catmull–Clark subdivision surface
- Character codes
- Chat server
- Check input device is a terminal
- Check Machin-like formulas
- Check output device is a terminal
- Check that file exists
- Checkpoint synchronization
- Chinese remainder theorem
- Chinese zodiac
- Cholesky decomposition
- Circles of given radius through two points
- Classes
- Closest-pair problem
- Closures/Value capture
- Code segment unload
- Collections
- Color of a screen pixel
- Color quantization
- Colour bars/Display
- Colour pinstripe/Display
- Colour pinstripe/Printer
- Combinations
- Combinations and permutations
- Combinations with repetitions
- Comma quibbling
- Command-line arguments
- Comments
- Compare a list of strings
- Compare sorting algorithms' performance
- Compile-time calculation
- Compound data type
- Concurrent computing
- Conditional structures
- Conjugate transpose
- Constrained random points on a circle
- Continued fraction
- Continued fraction/Arithmetic/Construct from rational number
- Continued fraction/Arithmetic/G(matrix NG, Contined Fraction N)
- Continued fraction/Arithmetic/G(matrix NG, Contined Fraction N1, Contined Fraction N2)
- Convert decimal number to rational
- Convert seconds to compound duration
- Conway's Game of Life
- Copy a string
- Count in factors
- Count in octal
- Count occurrences of a substring
- Count the coins
- CRC-32
- Create a file
- Create a file on magnetic tape
- Create a two-dimensional array at runtime
- Create an HTML table
- Create an object at a given address
- Create an object/Native demonstration
- CSV data manipulation
- CSV to HTML translation
- Cumulative standard deviation
- Currency
- Currying
- CUSIP
- Cut a rectangle

### D

- Date format
- Date manipulation
- Day of the week
- Deal cards for FreeCell
- Death Star
- Decimal floating point number to binary
- Decision tables
- Deconvolution/1D
- Deconvolution/2D+
- Deepcopy
- Define a primitive data type
- Delegates
- Delete a file
- Deming's Funnel
- Detect division by zero
- Determine if a string is numeric
- Determine if only one instance is running
- Dice game probabilities
- Digital root
- Digital root/Multiplicative digital root
- Dijkstra's algorithm
- Dinesman's multiple-dwelling problem
- Dining philosophers
- Discordian date
- Display a linear combination
- Distributed programming
- DNS query
- Documentation
- Dot product
- Doubly-linked list/Definition
- Doubly-linked list/Element definition
- Doubly-linked list/Element insertion
- Doubly-linked list/Traversal
- Dragon curve
- Draw a clock
- Draw a cuboid
- Draw a rotating cube
- Draw a sphere
- Dutch national flag problem
- Dynamic variable names

### E

- Echo server
- Egyptian fractions
- Element-wise operations
- Elementary cellular automaton
- Elementary cellular automaton/Infinite length
- Elementary cellular automaton/Random Number Generator
- Elliptic curve arithmetic
- Emirp primes
- Empty directory
- Empty program
- Empty string
- Enforced immutability
- Entropy
- Entropy/Narcissist
- Enumerations
- Environment variables
- Equilibrium index
- Ethiopian multiplication
- Euler method
- Evaluate binomial coefficients
- Even or odd
- Events
- Evolutionary algorithm
- Exceptions
- Exceptions/Catch an exception thrown in a nested call
- Executable library
- Execute a Markov algorithm
- Execute a system command
- Execute Brain****
- Execute HQ9+
- Execute SNUSP
- Exponentiation operator
- Exponentiation order
- Extend your language
- Extensible prime generator
- Extract file extension
- Extreme floating point values

### F

- Factorial
- Factors of a Mersenne number
- Factors of an integer
- Farey sequence
- Fast Fourier transform
- FASTA format
- Fibonacci n-step number sequences
- Fibonacci sequence
- Fibonacci word
- Fibonacci word/fractal
- File extension is in extensions list
- File input/output
- File modification time
- File size
- Filter
- Find common directory path
- Find duplicate files
- Find first and last set bit of a long integer
- Find largest left truncatable prime in a given base
- Find limit of recursion
- Find palindromic numbers in both binary and ternary bases
- Find the last Sunday of each month
- Find the missing permutation
- Find URI in text
- First class environments
- First-class functions
- First-class functions/Use numbers analogously
- Five weekends
- FizzBuzz
- Flatten a list
- Flipping bits game
- Flow-control structures
- Floyd's triangle
- Floyd-Warshall algorithm
- Forest fire
- Fork
- Formal power series
- Formatted numeric output
- Forward difference
- Four bit adder
- Fractal tree
- Fractran
- FTP
- Function composition
- Function definition
- Function frequency

### G

- Galton box animation
- Gamma function
- Gaussian elimination
- General FizzBuzz
- Generalised floating point addition
- Generate Chess960 starting position
- Generate lower case ASCII alphabet
- Generator/Exponential
- Generic swap
- Get system command output
- Globally replace text in several files
- Go Fish
- Gray code
- Grayscale image
- Greatest common divisor
- Greatest element of a list
- Greatest subsequential sum
- Greyscale bars/Display
- Guess the number
- Guess the number/With feedback
- Guess the number/With feedback (player)
- GUI component interaction
- GUI enabling/disabling of controls
- GUI/Maximum window dimensions

### H

- Hailstone sequence
- Hamming numbers
- Handle a signal
- Happy numbers
- Harshad or Niven series
- Hash from two arrays
- Hash join
- Haversine formula
- Hello world/Graphical
- Hello world/Line printer
- Hello world/Newbie
- Hello world/Newline omission
- Hello world/Standard error
- Hello world/Text
- Hello world/Web server
- Here document
- Heronian triangles
- Hickerson series of almost integers
- Higher-order functions
- History variables
- Hofstadter Figure-Figure sequences
- Hofstadter Q sequence
- Hofstadter-Conway $10,000 sequence
- Holidays related to Easter
- Honeycombs
- Horizontal sundial calculations
- Horner's rule for polynomial evaluation
- Host introspection
- Hostname
- Hough transform
- HTTP
- HTTPS
- HTTPS/Authenticated
- HTTPS/Client-authenticated
- Huffman coding

### I

- I before E except after C
- IBAN
- Identity matrix
- Idiomatically determine all the characters that can be used for symbols
- Idiomatically determine all the lowercase and uppercase letters
- Image convolution
- Image noise
- Implicit type conversion
- Include a file
- Increment a numerical string
- Index finite lists of positive integers
- Infinity
- Inheritance/Multiple
- Inheritance/Single
- Input loop
- Input/Output for Lines of Text
- Input/Output for Pairs of Numbers
- Integer comparison
- Integer overflow
- Integer sequence
- Interactive programming
- Introspection
- Inverted index
- Inverted syntax
- IPC via named pipe
- IRC gateway
- Iterated digits squaring

### J

### K

- K-d tree
- K-means++ clustering
- Kahan summation
- Kaprekar numbers
- Kernighans large earthquake problem
- Keyboard input/Flush the keyboard buffer
- Keyboard input/Keypress check
- Keyboard input/Obtain a Y or N response
- Keyboard macros
- Knapsack problem/0-1
- Knapsack problem/Bounded
- Knapsack problem/Continuous
- Knapsack problem/Unbounded
- Knight's tour
- Knuth shuffle
- Knuth's algorithm S
- Kronecker product

### L

- Langton's ant
- Largest int from concatenated ints
- Last Friday of each month
- Last letter-first letter
- Leap year
- Least common multiple
- Left factorials
- Letter frequency
- Levenshtein distance
- Levenshtein distance/Alignment
- Linear congruential generator
- Linux CPU utilization
- List comprehensions
- Literals/Floating point
- Literals/Integer
- Literals/String
- Logical operations
- Long multiplication
- Longest common prefix
- Longest common subsequence
- Longest increasing subsequence
- Longest string challenge
- Look-and-say sequence
- Loop over multiple arrays simultaneously
- Loops/Break
- Loops/Continue
- Loops/Do-while
- Loops/Downward for
- Loops/For
- Loops/For with a specified step
- Loops/Foreach
- Loops/Infinite
- Loops/N plus one half
- Loops/Nested
- Loops/While
- LU decomposition
- Lucas-Lehmer test
- Lucky and even lucky numbers
- Ludic numbers
- Luhn test of credit card numbers
- Lychrel numbers
- LZW compression

### M

- MAC Vendor Lookup
- Machine code
- Mad Libs
- Magic squares of odd order
- Main step of GOST 28147-89
- Make a backup file
- Make directory path
- Man or boy test
- Mandelbrot set
- Map range
- Matrix arithmetic
- Matrix multiplication
- Matrix transposition
- Matrix-exponentiation operator
- Maximum triangle path sum
- Maze generation
- Maze solving
- MD4
- MD5
- MD5/Implementation
- Median filter
- Memory allocation
- Memory layout of a data structure
- Menu
- Metaprogramming
- Metered concurrency
- Metronome
- Middle three digits
- Miller–Rabin primality test
- Minesweeper game
- Modular arithmetic
- Modular exponentiation
- Modular inverse
- Modulinos
- Monte Carlo methods
- Montgomery reduction
- Monty Hall problem
- Morse code
- Most frequent k chars distance
- Mouse position
- Move-to-front algorithm
- Multi-dimensional array
- Multifactorial
- Multiline shebang
- Multiple distinct objects
- Multiple regression
- Multiplication tables
- Multiplicative order
- Multisplit
- Munching squares
- Musical scale
- Mutex
- Mutual recursion

### N

- N'th
- N-body problem
- N-queens problem
- Named parameters
- Names to numbers
- Naming conventions
- Narcissist
- Narcissistic decimal number
- Natural sorting
- Nautical bell
- Nested function
- Non-continuous subsequences
- Non-decimal radices/Convert
- Non-decimal radices/Input
- Non-decimal radices/Output
- Nonoblock
- Nth root
- Null object
- Number names
- Number reversal game
- Numeric error propagation
- Numerical integration
- Numerical integration/Gauss-Legendre Quadrature
- NYSIIS

### O

- Object serialization
- Odd word problem
- Old lady swallowed a fly
- Old Russian measure of length
- One of n lines in a file
- One-dimensional cellular automata
- One-time pad
- OpenGL
- OpenGL Pixel Shader
- Operator precedence
- Optional parameters
- Order disjoint list items
- Order two numerical lists
- Ordered Partitions
- Ordered words

### P

- Palindrome detection
- Pangram checker
- Paraffins
- Parallel calculations
- Parametrized SQL statement
- Parse an IP Address
- Parse command-line arguments
- Parse EBNF
- Parsing/RPN calculator algorithm
- Parsing/RPN to infix conversion
- Parsing/Shunting-yard algorithm
- Partial function application
- Pascal matrix generation
- Pascal's triangle
- Pascal's triangle/Puzzle
- Pattern matching
- Penney's game
- Pentagram
- Percentage difference between images
- Percolation/Bond percolation
- Percolation/Mean cluster density
- Percolation/Mean run density
- Percolation/Site percolation
- Perfect numbers
- Perfect shuffle
- Perlin noise
- Permutation test
- Permutations
- Permutations by swapping
- Permutations with repetitions
- Permutations/Derangements
- Permutations/Rank of a permutation
- Pernicious numbers
- Phrase reversals
- Pi
- Pick random element
- Pig the dice game
- Pig the dice game/Player
- Pinstripe/Display
- Pinstripe/Printer
- Play recorded sounds
- Playfair cipher
- Playing cards
- Plot coordinate pairs
- Pointers and references
- Poker hand analyser
- Polymorphic copy
- Polymorphism
- Polynomial long division
- Polynomial regression
- Polynomial synthetic division
- Population count
- Power set
- Pragmatic directives
- Price fraction
- Primality by trial division
- Prime decomposition
- Priority queue
- Probabilistic choice
- Problem of Apollonius
- Process SMIL directives in XML data
- Program name
- Program termination
- Proof
- Proper divisors
- Pythagorean triples

### R

- Ramsey's theorem
- Random number generator (device)
- Random number generator (included)
- Random numbers
- Range expansion
- Range extraction
- Ranking methods
- Rate counter
- Ray-casting algorithm
- RCRPG
- Read a configuration file
- Read a file character by character/UTF8
- Read a file line by line
- Read a specific line from a file
- Read entire file
- Real constants and functions
- Record sound
- Reduced row echelon form
- Reflection/Get source
- Reflection/List methods
- Reflection/List properties
- Regular expressions
- Remote agent/Agent interface
- Remote agent/Agent logic
- Remote agent/Simulation
- Remove duplicate elements
- Remove lines from a file
- Rename a file
- Rendezvous
- Rep-string
- Repeat
- Repeat a string
- Resistor mesh
- Respond to an unknown method call
- Retrieve and search chat history
- Return multiple values
- Reverse a string
- Reverse the gender of a string
- Reverse words in a string
- RIPEMD-160
- Rock-paper-scissors
- Roman numerals/Decode
- Roman numerals/Encode
- Roots of a function
- Roots of a quadratic function
- Roots of unity
- Rosetta Code/Count examples
- Rosetta Code/Find bare lang tags
- Rosetta Code/Find unimplemented tasks
- Rosetta Code/Fix code tags
- Rosetta Code/Rank languages by popularity
- Rosetta Code/Run examples
- Rot-13
- RSA code
- Run as a daemon or service
- Run-length encoding
- Runge-Kutta method
- Runtime evaluation
- Runtime evaluation/In an environment

### S

- S-Expressions
- Safe addition
- Sailors, coconuts and a monkey problem
- Same Fringe
- Scope modifiers
- Scope/Function names and labels
- Search a list
- Search a list of records
- Secure temporary file
- SEDOLs
- Self-describing numbers
- Self-referential sequence
- Semiprime
- Semordnilap
- Send an unknown method call
- Send email
- Separate the house number from the street name
- Sequence of non-squares
- Sequence of primes by trial division
- Set
- Set consolidation
- Set of real numbers
- Set puzzle
- Seven-sided dice from five-sided dice
- SHA-1
- SHA-256
- Shell one-liner
- Short-circuit evaluation
- Shortest common supersequence
- Show the epoch
- Sierpinski carpet
- Sierpinski triangle
- Sierpinski triangle/Graphical
- Sieve of Eratosthenes
- Simple database
- Simple windowed application
- Simulate input/Keyboard
- Simulate input/Mouse
- Singleton
- Singly-linked list/Element definition
- Singly-linked list/Traversal
- Sleep
- Smith numbers
- SOAP
- Sockets
- Sokoban
- Solve a Hidato puzzle
- Solve a Holy Knight's tour
- Solve a Hopido puzzle
- Solve a Numbrix puzzle
- Solve the no connection puzzle
- Sort a list of object identifiers
- Sort an array of composite structures
- Sort an integer array
- Sort disjoint sublist
- Sort stability
- Sort using a custom comparator
- Sorting algorithms/Bead sort
- Sorting algorithms/Bogosort
- Sorting algorithms/Bubble sort
- Sorting algorithms/Cocktail sort
- Sorting algorithms/Comb sort
- Sorting algorithms/Counting sort
- Sorting algorithms/Cycle sort
- Sorting algorithms/Gnome sort
- Sorting algorithms/Heapsort
- Sorting algorithms/Insertion sort
- Sorting algorithms/Merge sort
- Sorting algorithms/Pancake sort
- Sorting algorithms/Patience sort
- Sorting algorithms/Permutation sort
- Sorting algorithms/Quicksort
- Sorting algorithms/Radix sort
- Sorting algorithms/Selection sort
- Sorting algorithms/Shell sort
- Sorting algorithms/Sleep sort
- Sorting algorithms/Stooge sort
- Sorting algorithms/Strand sort
- Soundex
- Sparkline in unicode
- Special characters
- Special variables
- Speech synthesis
- Spiral matrix
- Split a character string based on change of character
- SQL-based authentication
- Stable marriage problem
- Stack
- Stack traces
- Stair-climbing puzzle
- Start from a main routine
- Starting a web browser
- State name puzzle
- Statistics/Basic
- Statistics/Normal distribution
- Stem-and-leaf plot
- Stern-Brocot sequence
- Straddling checkerboard
- Stream Merge
- String append
- String case
- String comparison
- String concatenation
- String interpolation (included)
- String length
- String matching
- String prepend
- Strip a set of characters from a string
- Strip block comments
- Strip comments from a string
- Strip control codes and extended characters from a string
- Strip whitespace from a string/Top and tail
- Subleq
- Subset sum problem
- Substitution Cipher
- Substring
- Substring/Top and tail
- Subtractive generator
- Sudoku
- Sum and product of an array
- Sum digits of an integer
- Sum multiples of 3 and 5
- Sum of a series
- Sum of squares
- Sum to 100
- Sutherland-Hodgman polygon clipping
- Symmetric difference
- Synchronous concurrency
- System time

### T

- Table creation
- Table creation/Postal addresses
- Take notes on the command line
- Taxicab numbers
- Temperature conversion
- Terminal control/Clear the screen
- Terminal control/Coloured text
- Terminal control/Cursor movement
- Terminal control/Cursor positioning
- Terminal control/Dimensions
- Terminal control/Display an extended character
- Terminal control/Hiding the cursor
- Terminal control/Inverse video
- Terminal control/Preserve screen
- Terminal control/Ringing the terminal bell
- Terminal control/Unicode output
- Ternary logic
- Test a function
- Test integerness
- Text processing/1
- Text processing/2
- Text processing/Max licenses in use
- Text to HTML
- Textonyms
- The ISAAC Cipher
- The Twelve Days of Christmas
- Thiele's interpolation formula
- Thue-Morse
- Tic-tac-toe
- Time a function
- Time-based One-time Password Algorithm
- Tokenize a string
- Tokenize a string with escaping
- Top rank per group
- Topological sort
- Topological sort/Extracted top item
- Topswops
- Total circles area
- Towers of Hanoi
- Trabb Pardo–Knuth algorithm
- Tree traversal
- Trigonometric functions
- Truncatable primes
- Truncate a file
- Truth table
- Twelve statements

### U

- Ulam spiral (for primes)
- Unbias a random generator
- Undefined values
- Unicode strings
- Unicode variable names
- Universal Turing machine
- Unix/ls
- Untrusted environment
- Update a configuration file
- URL decoding
- URL encoding
- URL parser
- Use another language to call a function
- User defined pipe and redirection operators
- User input/Graphical
- User input/Text
- Using a Speech engine to highlight words
- UTF-8 encode and decode

### V

- Validate International Securities Identification Number
- Vampire number
- Van der Corput sequence
- Variable size/Get
- Variable size/Set
- Variable-length quantity
- Variables
- Variadic function
- Vector
- Vector products
- Verify distribution uniformity/Chi-squared test
- Verify distribution uniformity/Naive
- Vigenère cipher
- Vigenère cipher/Cryptanalysis
- Visualize a tree
- Vogel's approximation method
- Voronoi diagram

### W

- Walk a directory/Non-recursively
- Walk a directory/Recursively
- Water collected between towers
- Web scraping
- Welch's t-test
- Window creation
- Window creation/X11
- Window management
- Wireworld
- Word wrap
- World Cup group stage
- Write entire file
- Write float arrays to a text file
- Write language name in 3D ASCII
- Write to Windows event log

- Execution method/Compiled/Bytecode
- Garbage collection/Yes
- Parameter passing/By value
- Typing/Safe
- Typing/Weak
- Typing/Compatibility/Duck
- Typing/Expression/Implicit
- Typing/Checking/Dynamic
- Programming Languages
- Programming paradigm/Concurrent
- Programming paradigm/Dynamic
- Programming paradigm/Event-driven
- Programming paradigm/Imperative
- Programming paradigm/Object-oriented
- Programming paradigm/Procedural
- Programming paradigm/Reflective
- Codepad languages