• The Sidef programming language
  • Introduction
  • 1. Preface
  • 2. Getting Started
    • 2.1. Installation
    • 2.2. Running
    • 2.3. Hello world
  • 3. Sidef interpreter
    • 3.1. Command-line options
    • 3.2. One-line programs
    • 3.3. Interactive mode
    • 3.4. Parser warnings
    • 3.5. Dumping the AST
    • 3.6. Optimization
    • 3.7. Deparsing
    • 3.8. Precompilation
    • 3.9. Compilation
  • 4. Syntax and semantics
    • 4.1. Comments
    • 4.2. Built-in types
      • 4.2.1. Nil and Null
      • 4.2.2. Bool
      • 4.2.3. Number
      • 4.2.4. Integer
      • 4.2.5. Rational
      • 4.2.6. Float
      • 4.2.7. Complex
      • 4.2.8. String
      • 4.2.9. Regex
      • 4.2.10. File
      • 4.2.11. FileHandle
      • 4.2.12. Dir
      • 4.2.13. DirHandle
      • 4.2.14. Array
      • 4.2.15. Pair
      • 4.2.16. NamedParam
      • 4.2.17. Vector
      • 4.2.18. Matrix
      • 4.2.19. Hash
      • 4.2.20. Set
      • 4.2.21. Bag
      • 4.2.22. Block
    • 4.3. Language constructs
      • 4.3.1. If
      • 4.3.2. With
      • 4.3.3. Goto
      • 4.3.4. While
      • 4.3.5. Do/While
      • 4.3.6. For
      • 4.3.7. Loop
      • 4.3.8. Gather/Take
      • 4.3.9. Given/When
      • 4.3.10. Try/Catch
      • 4.3.11. Break
      • 4.3.12. Next
      • 4.3.13. Continue
    • 4.4. Methods
    • 4.5. Operator precedence
    • 4.6. Method precedence
    • 4.7. Metaoperators
    • 4.8. Variables
    • 4.9. Variable references
    • 4.10. Constants
    • 4.11. Multidimensional arrays
    • 4.12. Blocks
    • 4.13. Functions
    • 4.14. Modules
    • 4.15. Classes
    • 4.16. Types
    • 4.17. Subsets
    • 4.18. Lazy evaluation
    • 4.19. Lazy methods
    • 4.20. Multiple dispatch
    • 4.21. Functional pattern matching
  • 5. Programming tasks
    • 5.1. 1
      • 5.1.1. 100 doors
    • 5.2. 2
      • 5.2.1. 24 game
        • 5.2.1.1. Solve
    • 5.3. 4
      • 5.3.1. 4-rings or 4-squares puzzle
    • 5.4. 9
      • 5.4.1. 99 Bottles of Beer
      • 5.4.2. 9 billion names of God the integer
    • 5.5. A
      • 5.5.1. A* search algorithm
      • 5.5.2. A B
      • 5.5.3. ABC Problem
      • 5.5.4. Abstract type
      • 5.5.5. Abundant deficient and perfect number classifications
      • 5.5.6. Abundant odd numbers
      • 5.5.7. Accumulator factory
      • 5.5.8. Ackermann function
      • 5.5.9. Add a variable to a class instance at runtime
      • 5.5.10. Address of a variable
      • 5.5.11. AKS test for primes
      • 5.5.12. Align columns
      • 5.5.13. Almost prime
      • 5.5.14. Amicable pairs
      • 5.5.15. Anagrams
        • 5.5.15.1. Deranged anagrams
      • 5.5.16. Angle difference between two bearings
      • 5.5.17. Animate a pendulum
      • 5.5.18. Anonymous recursion
      • 5.5.19. Anti-primes
      • 5.5.20. Append a record to the end of a text file
      • 5.5.21. Apply a callback to an array
      • 5.5.22. Apply a digital filter direct form II transposed
      • 5.5.23. Approximate Equality
      • 5.5.24. Arbitrary-precision integers included
      • 5.5.25. Archimedean spiral
      • 5.5.26. Arithmetic
        • 5.5.26.1. Complex
        • 5.5.26.2. Integer
        • 5.5.26.3. Rational
      • 5.5.27. Arithmetic-geometric mean
        • 5.5.27.1. Calculate Pi
      • 5.5.28. Arithmetic coding
        • 5.5.28.1. As a generalized change of radix
      • 5.5.29. Arithmetic evaluation
      • 5.5.30. Array concatenation
      • 5.5.31. Array length
      • 5.5.32. Array search
      • 5.5.33. Arrays
      • 5.5.34. Assertions
      • 5.5.35. Associative array
        • 5.5.35.1. Creation
        • 5.5.35.2. Iteration
      • 5.5.36. Attractive numbers
      • 5.5.37. Average loop length
      • 5.5.38. Averages
        • 5.5.38.1. Arithmetic mean
        • 5.5.38.2. Mean angle
        • 5.5.38.3. Mean time of day
        • 5.5.38.4. Median
        • 5.5.38.5. Mode
        • 5.5.38.6. Pythagorean means
        • 5.5.38.7. Root mean square
        • 5.5.38.8. Simple moving average
      • 5.5.39. AVL tree
    • 5.6. B
      • 5.6.1. Babbage problem
      • 5.6.2. Balanced brackets
      • 5.6.3. Barnsley fern
      • 5.6.4. Base58Check encoding
      • 5.6.5. Base64 decode data
      • 5.6.6. Base64 encode data
      • 5.6.7. Bell numbers
      • 5.6.8. Benford's law
      • 5.6.9. Bernoulli numbers
      • 5.6.10. Best shuffle
      • 5.6.11. Bilinear interpolation
      • 5.6.12. Binary digits
      • 5.6.13. Binary search
      • 5.6.14. Bitmap
        • 5.6.14.1. Bresenham's line algorithm
        • 5.6.14.2. Write a PPM file
      • 5.6.15. Bitwise operations
      • 5.6.16. Boolean values
      • 5.6.17. Box the compass
      • 5.6.18. Brace expansion
      • 5.6.19. Brazilian numbers
      • 5.6.20. Break OO privacy
      • 5.6.21. Brownian tree
      • 5.6.22. Bulls and cows
        • 5.6.22.1. Player
      • 5.6.23. Burrows Wheeler transform
    • 5.7. C
      • 5.7.1. Caesar cipher
      • 5.7.2. Calculating the value of e
      • 5.7.3. Calendar
      • 5.7.4. Calendar - for REAL programmers
      • 5.7.5. Call a function
      • 5.7.6. Call an object method
      • 5.7.7. Cantor set
      • 5.7.8. Carmichael 3 strong pseudoprimes
      • 5.7.9. Cartesian product of two or more lists
      • 5.7.10. Case-sensitivity of identifiers
      • 5.7.11. Casting out nines
      • 5.7.12. Catalan numbers
        • 5.7.12.1. Pascal's triangle
      • 5.7.13. Catamorphism
      • 5.7.14. Chaos game
      • 5.7.15. Character codes
      • 5.7.16. Chebyshev coefficients
      • 5.7.17. Check Machin-like formulas
      • 5.7.18. Check that file exists
      • 5.7.19. Checksumcolor
      • 5.7.20. Chernick's Carmichael numbers
      • 5.7.21. Cheryl's Birthday
      • 5.7.22. Chinese remainder theorem
      • 5.7.23. Chinese zodiac
      • 5.7.24. Cholesky decomposition
      • 5.7.25. Cipolla's algorithm
      • 5.7.26. Circles of given radius through two points
      • 5.7.27. Classes
      • 5.7.28. Closest-pair problem
      • 5.7.29. Closures
        • 5.7.29.1. Value capture
      • 5.7.30. Collections
      • 5.7.31. Color quantization
      • 5.7.32. Color wheel
      • 5.7.33. Colour bars
        • 5.7.33.1. Display
      • 5.7.34. Colour pinstripe
        • 5.7.34.1. Display
      • 5.7.35. Combinations
      • 5.7.36. Combinations and permutations
      • 5.7.37. Combinations with repetitions
      • 5.7.38. Comma quibbling
      • 5.7.39. Command-line arguments
      • 5.7.40. Comments
      • 5.7.41. Compare a list of strings
      • 5.7.42. Compile-time calculation
      • 5.7.43. Compound data type
      • 5.7.44. Concurrent computing
      • 5.7.45. Conjugate transpose
      • 5.7.46. Constrained genericity
      • 5.7.47. Constrained random points on a circle
      • 5.7.48. Continued fraction
        • 5.7.48.1. Arithmetic
          • 5.7.48.1.1. Construct from rational number
      • 5.7.49. Convert decimal number to rational
      • 5.7.50. Convert seconds to compound duration
      • 5.7.51. Convex hull
      • 5.7.52. Conway's Game of Life
      • 5.7.53. Copy a string
      • 5.7.54. Count in factors
      • 5.7.55. Count in octal
      • 5.7.56. Count occurrences of a substring
      • 5.7.57. Count the coins
      • 5.7.58. Cramer's rule
      • 5.7.59. Create a file
      • 5.7.60. Create a two-dimensional array at runtime
      • 5.7.61. Create an HTML table
      • 5.7.62. CSV data manipulation
      • 5.7.63. CSV to HTML translation
      • 5.7.64. Cuban primes
      • 5.7.65. Cumulative standard deviation
      • 5.7.66. Currency
      • 5.7.67. Currying
      • 5.7.68. Cycle detection
      • 5.7.69. Cyclotomic Polynomial
    • 5.8. D
      • 5.8.1. Damm algorithm
      • 5.8.2. Date format
      • 5.8.3. Date manipulation
      • 5.8.4. Day of the week
      • 5.8.5. Days between dates
      • 5.8.6. Death Star
      • 5.8.7. Decimal floating point number to binary
      • 5.8.8. Decision tables
      • 5.8.9. Deepcopy
      • 5.8.10. Define a primitive data type
      • 5.8.11. Delegates
      • 5.8.12. Delete a file
      • 5.8.13. Deming's Funnel
      • 5.8.14. Department Numbers
      • 5.8.15. Detect division by zero
      • 5.8.16. Determinant and permanent
      • 5.8.17. Determine if a string has all the same characters
      • 5.8.18. Determine if a string has all unique characters
      • 5.8.19. Determine if a string is collapsible
      • 5.8.20. Determine if a string is numeric
      • 5.8.21. Determine if a string is squeezable
      • 5.8.22. Determine if only one instance is running
      • 5.8.23. Dice game probabilities
      • 5.8.24. Digital root
        • 5.8.24.1. Multiplicative digital root
      • 5.8.25. Dijkstra's algorithm
      • 5.8.26. Dinesman's multiple-dwelling problem
      • 5.8.27. Discordian date
      • 5.8.28. Display a linear combination
      • 5.8.29. Diversity prediction theorem
      • 5.8.30. DNS query
      • 5.8.31. Dot product
      • 5.8.32. Doubly-linked list
        • 5.8.32.1. Element definition
      • 5.8.33. Dragon curve
      • 5.8.34. Draw a clock
      • 5.8.35. Draw a cuboid
      • 5.8.36. Draw a sphere
      • 5.8.37. Dynamic variable names
    • 5.9. E
      • 5.9.1. Egyptian division
      • 5.9.2. Egyptian fractions
      • 5.9.3. EKG sequence convergence
      • 5.9.4. Element-wise operations
      • 5.9.5. Elementary cellular automaton
        • 5.9.5.1. Infinite length
        • 5.9.5.2. Random Number Generator
      • 5.9.6. Elliptic curve arithmetic
      • 5.9.7. Emirp primes
      • 5.9.8. Empty directory
      • 5.9.9. Empty program
      • 5.9.10. Empty string
      • 5.9.11. Enforced immutability
      • 5.9.12. Entropy
        • 5.9.12.1. Narcissist
      • 5.9.13. Enumerations
      • 5.9.14. Environment variables
      • 5.9.15. Equilibrium index
      • 5.9.16. Ethiopian multiplication
      • 5.9.17. Euler's identity
      • 5.9.18. Euler's sum of powers conjecture
      • 5.9.19. Euler method
      • 5.9.20. Evaluate binomial coefficients
      • 5.9.21. Even or odd
      • 5.9.22. Evolutionary algorithm
      • 5.9.23. Exceptions
        • 5.9.23.1. Catch an exception thrown in a nested call
      • 5.9.24. Executable library
      • 5.9.25. Execute a system command
      • 5.9.26. Execute Brain****
      • 5.9.27. Execute HQ9
      • 5.9.28. Exponentiation operator
      • 5.9.29. Exponentiation order
      • 5.9.30. Extend your language
      • 5.9.31. Extensible prime generator
      • 5.9.32. Extract file extension
      • 5.9.33. Extreme floating point values
    • 5.10. F
      • 5.10.1. Factorial
      • 5.10.2. Factorions
      • 5.10.3. Factors of a Mersenne number
      • 5.10.4. Factors of an integer
      • 5.10.5. Fairshare between two and more
      • 5.10.6. Farey sequence
      • 5.10.7. Fast Fourier transform
      • 5.10.8. FASTA format
      • 5.10.9. Faulhaber's formula
      • 5.10.10. Faulhaber's triangle
      • 5.10.11. Feigenbaum constant calculation
      • 5.10.12. Fermat numbers
      • 5.10.13. Fibonacci matrix-exponentiation
      • 5.10.14. Fibonacci n-step number sequences
      • 5.10.15. Fibonacci sequence
      • 5.10.16. Fibonacci word
        • 5.10.16.1. Fractal
      • 5.10.17. File extension is in extensions list
      • 5.10.18. File input
        • 5.10.18.1. Output
      • 5.10.19. File modification time
      • 5.10.20. File size
      • 5.10.21. File size distribution
      • 5.10.22. Filter
      • 5.10.23. Find common directory path
      • 5.10.24. Find duplicate files
      • 5.10.25. Find first and last set bit of a long integer
      • 5.10.26. Find largest left truncatable prime in a given base
      • 5.10.27. Find limit of recursion
      • 5.10.28. Find palindromic numbers in both binary and ternary bases
      • 5.10.29. Find the intersection of a line with a plane
      • 5.10.30. Find the intersection of two lines
      • 5.10.31. Find the last Sunday of each month
      • 5.10.32. Find the missing permutation
      • 5.10.33. First-class functions
        • 5.10.33.1. Use numbers analogously
      • 5.10.34. First class environments
      • 5.10.35. First missing positive
      • 5.10.36. First perfect square in base N with N unique digits
      • 5.10.37. First power of 2 that has leading decimal digits of 12
      • 5.10.38. Five weekends
      • 5.10.39. Fivenum
      • 5.10.40. FizzBuzz
      • 5.10.41. Flatten a list
      • 5.10.42. Flow-control structures
      • 5.10.43. Floyd's triangle
      • 5.10.44. Floyd-Warshall algorithm
      • 5.10.45. Forest fire
      • 5.10.46. Fork
      • 5.10.47. Formatted numeric output
      • 5.10.48. Forward difference
      • 5.10.49. Four bit adder
      • 5.10.50. Four is magic
      • 5.10.51. Fractal tree
      • 5.10.52. Fractran
      • 5.10.53. Free polyominoes enumeration
      • 5.10.54. French Republican calendar
      • 5.10.55. FTP
      • 5.10.56. Function composition
      • 5.10.57. Function definition
      • 5.10.58. Function frequency
      • 5.10.59. Fusc sequence
    • 5.11. G
      • 5.11.1. Gamma function
      • 5.11.2. Gapful numbers
      • 5.11.3. Gauss-Jordan matrix inversion
      • 5.11.4. Gaussian elimination
      • 5.11.5. General FizzBuzz
      • 5.11.6. Generate Chess960 starting position
      • 5.11.7. Generate lower case ASCII alphabet
      • 5.11.8. Generator
        • 5.11.8.1. Exponential
      • 5.11.9. Generic swap
      • 5.11.10. Get system command output
      • 5.11.11. Globally replace text in several files
      • 5.11.12. Gray code
      • 5.11.13. Grayscale image
      • 5.11.14. Greatest common divisor
      • 5.11.15. Greatest element of a list
      • 5.11.16. Greatest subsequential sum
      • 5.11.17. Guess the number
        • 5.11.17.1. With feedback
        • 5.11.17.2. With feedback player
      • 5.11.18. GUI
        • 5.11.18.1. Maximum window dimensions
    • 5.12. H
      • 5.12.1. Hailstone sequence
      • 5.12.2. Hamming numbers
      • 5.12.3. Handle a signal
      • 5.12.4. Happy numbers
      • 5.12.5. Harshad or Niven series
      • 5.12.6. Hash from two arrays
      • 5.12.7. Hash join
      • 5.12.8. Haversine formula
      • 5.12.9. Hello world
        • 5.12.9.1. Graphical
        • 5.12.9.2. Line printer
        • 5.12.9.3. Newline omission
        • 5.12.9.4. Standard error
        • 5.12.9.5. Text
        • 5.12.9.6. Web server
      • 5.12.10. Here document
      • 5.12.11. Heronian triangles
      • 5.12.12. Hickerson series of almost integers
      • 5.12.13. Higher-order functions
      • 5.12.14. Hilbert curve
      • 5.12.15. History variables
      • 5.12.16. Hofstadter-Conway 10 000 sequence
      • 5.12.17. Hofstadter Figure-Figure sequences
      • 5.12.18. Hofstadter Q sequence
      • 5.12.19. Holidays related to Easter
      • 5.12.20. Honeycombs
      • 5.12.21. Horizontal sundial calculations
      • 5.12.22. Horner's rule for polynomial evaluation
      • 5.12.23. Hostname
      • 5.12.24. Hough transform
      • 5.12.25. HTTP
      • 5.12.26. HTTPS
        • 5.12.26.1. Authenticated
      • 5.12.27. Huffman coding
      • 5.12.28. Humble numbers
    • 5.13. I
      • 5.13.1. I Q Puzzle
      • 5.13.2. IBAN
      • 5.13.3. Identity matrix
      • 5.13.4. Imaginary base numbers
      • 5.13.5. Implicit type conversion
      • 5.13.6. Include a file
      • 5.13.7. Increment a numerical string
      • 5.13.8. Index finite lists of positive integers
      • 5.13.9. Infinity
      • 5.13.10. Inheritance
        • 5.13.10.1. Multiple
        • 5.13.10.2. Single
      • 5.13.11. Input loop
      • 5.13.12. Integer comparison
      • 5.13.13. Integer overflow
      • 5.13.14. Integer roots
      • 5.13.15. Integer sequence
      • 5.13.16. Interactive programming
      • 5.13.17. Inverted syntax
      • 5.13.18. Iterated digits squaring
    • 5.14. J
      • 5.14.1. Jacobi symbol
      • 5.14.2. Jaro distance
      • 5.14.3. Jensen's Device
      • 5.14.4. Jewels and Stones
      • 5.14.5. JortSort
      • 5.14.6. Josephus problem
      • 5.14.7. JSON
      • 5.14.8. Julia set
    • 5.15. K
      • 5.15.1. K-d tree
      • 5.15.2. Kaprekar numbers
      • 5.15.3. Keyboard input
        • 5.15.3.1. Flush the keyboard buffer
        • 5.15.3.2. Obtain a Y or N response
      • 5.15.4. Knapsack problem
        • 5.15.4.1. 0-1
        • 5.15.4.2. Bounded
        • 5.15.4.3. Continuous
        • 5.15.4.4. Unbounded
      • 5.15.5. Knight's tour
      • 5.15.6. Knuth's algorithm S
      • 5.15.7. Knuth's power tree
      • 5.15.8. Knuth shuffle
      • 5.15.9. Koch curve
      • 5.15.10. Kolakoski sequence
      • 5.15.11. Kosaraju
      • 5.15.12. Kronecker product
      • 5.15.13. Kronecker product based fractals
    • 5.16. L
      • 5.16.1. Lah numbers
      • 5.16.2. Langton's ant
      • 5.16.3. Largest int from concatenated ints
      • 5.16.4. Largest number divisible by its digits
      • 5.16.5. Last Friday of each month
      • 5.16.6. Last letter-first letter
      • 5.16.7. Leap year
      • 5.16.8. Least common multiple
      • 5.16.9. Left factorials
      • 5.16.10. Leonardo numbers
      • 5.16.11. Letter frequency
      • 5.16.12. Levenshtein distance
        • 5.16.12.1. Alignment
      • 5.16.13. Linear congruential generator
      • 5.16.14. List comprehensions
      • 5.16.15. List rooted trees
      • 5.16.16. Literals
        • 5.16.16.1. Floating point
        • 5.16.16.2. Integer
        • 5.16.16.3. String
      • 5.16.17. Logical operations
      • 5.16.18. Long multiplication
      • 5.16.19. Long primes
      • 5.16.20. Longest common prefix
      • 5.16.21. Longest common subsequence
      • 5.16.22. Longest Common Substring
      • 5.16.23. Longest increasing subsequence
      • 5.16.24. Longest string challenge
      • 5.16.25. Look-and-say sequence
      • 5.16.26. Loop over multiple arrays simultaneously
      • 5.16.27. Loops
        • 5.16.27.1. Break
        • 5.16.27.2. Continue
        • 5.16.27.3. Do-while
        • 5.16.27.4. Downward for
        • 5.16.27.5. For
        • 5.16.27.6. For with a specified step
        • 5.16.27.7. Foreach
        • 5.16.27.8. Infinite
        • 5.16.27.9. N plus one half
        • 5.16.27.10. Nested
        • 5.16.27.11. While
      • 5.16.28. LU decomposition
      • 5.16.29. Lucas-Lehmer test
      • 5.16.30. Ludic numbers
      • 5.16.31. Luhn test of credit card numbers
      • 5.16.32. Lychrel numbers
      • 5.16.33. LZW compression
    • 5.17. M
      • 5.17.1. Möbius function
      • 5.17.2. Mad Libs
      • 5.17.3. Magic squares of doubly even order
      • 5.17.4. Magic squares of odd order
      • 5.17.5. Make directory path
      • 5.17.6. Man or boy test
      • 5.17.7. Mandelbrot set
      • 5.17.8. Map range
      • 5.17.9. Markov chain text generator
      • 5.17.10. Matrix-exponentiation operator
      • 5.17.11. Matrix multiplication
      • 5.17.12. Matrix transposition
      • 5.17.13. Maximum triangle path sum
      • 5.17.14. Maze generation
      • 5.17.15. MD4
      • 5.17.16. MD5
        • 5.17.16.1. Implementation
      • 5.17.17. Menu
      • 5.17.18. Mersenne primes
      • 5.17.19. Mertens function
      • 5.17.20. Metallic ratios
      • 5.17.21. Metaprogramming
      • 5.17.22. Metronome
      • 5.17.23. Mian-Chowla sequence
      • 5.17.24. Middle three digits
      • 5.17.25. Miller Rabin primality test
      • 5.17.26. Minimum positive multiple in base 10 using only 0 and 1
      • 5.17.27. Modular arithmetic
      • 5.17.28. Modular exponentiation
      • 5.17.29. Modular inverse
      • 5.17.30. Modulinos
      • 5.17.31. Monte Carlo methods
      • 5.17.32. Montgomery reduction
      • 5.17.33. Monty Hall problem
      • 5.17.34. Most frequent k chars distance
      • 5.17.35. Move-to-front algorithm
      • 5.17.36. Multifactorial
      • 5.17.37. Multiline shebang
      • 5.17.38. Multiple distinct objects
      • 5.17.39. Multiplication tables
      • 5.17.40. Multiplicative order
      • 5.17.41. Multisplit
      • 5.17.42. Munchausen numbers
      • 5.17.43. Munching squares
      • 5.17.44. Mutual recursion
    • 5.18. N
      • 5.18.1. N'th
      • 5.18.2. N-queens problem
      • 5.18.3. N-smooth numbers
      • 5.18.4. Named parameters
      • 5.18.5. Names to numbers
      • 5.18.6. Narcissist
      • 5.18.7. Narcissistic decimal number
      • 5.18.8. Native shebang
      • 5.18.9. Natural sorting
      • 5.18.10. Negative base numbers
      • 5.18.11. Nested function
      • 5.18.12. Next highest int from digits
      • 5.18.13. Non-continuous subsequences
      • 5.18.14. Non-decimal radices
        • 5.18.14.1. Convert
        • 5.18.14.2. Input
        • 5.18.14.3. Output
      • 5.18.15. Nth root
      • 5.18.16. Null object
      • 5.18.17. Number names
      • 5.18.18. Number reversal game
      • 5.18.19. Numeric separator syntax
      • 5.18.20. Numerical integration
        • 5.18.20.1. Adaptive Simpson's method
        • 5.18.20.2. Gauss-Legendre Quadrature
    • 5.19. O
      • 5.19.1. Odd word problem
      • 5.19.2. Old lady swallowed a fly
      • 5.19.3. Old Russian measure of length
      • 5.19.4. One-dimensional cellular automata
      • 5.19.5. One of n lines in a file
      • 5.19.6. Operator precedence
      • 5.19.7. Optional parameters
      • 5.19.8. Orbital elements
      • 5.19.9. Order disjoint list items
      • 5.19.10. Order two numerical lists
      • 5.19.11. Ordered Partitions
      • 5.19.12. Ordered words
    • 5.20. P
      • 5.20.1. Palindrome dates
      • 5.20.2. Palindrome detection
      • 5.20.3. Palindrome pairs
      • 5.20.4. Palindromic gapful numbers
      • 5.20.5. Pangram checker
      • 5.20.6. Parallel calculations
      • 5.20.7. Parsing
        • 5.20.7.1. RPN calculator algorithm
        • 5.20.7.2. RPN to infix conversion
        • 5.20.7.3. Shunting-yard algorithm
      • 5.20.8. Partial function application
      • 5.20.9. Partition an integer X into N primes
      • 5.20.10. Pascal's triangle
        • 5.20.10.1. Puzzle
      • 5.20.11. Pascal matrix generation
      • 5.20.12. Pathological floating point problems
      • 5.20.13. Peano curve
      • 5.20.14. Pell's equation
      • 5.20.15. Penrose tiling
      • 5.20.16. Pentagram
      • 5.20.17. Percentage difference between images
      • 5.20.18. Percolation
        • 5.20.18.1. Mean run density
        • 5.20.18.2. Site percolation
      • 5.20.19. Perfect numbers
      • 5.20.20. Perfect shuffle
      • 5.20.21. Perfect totient numbers
      • 5.20.22. Perlin noise
      • 5.20.23. Permutation test
      • 5.20.24. Permutations
      • 5.20.25. Permutations by swapping
      • 5.20.26. Permutations with repetitions
      • 5.20.27. Permutations with some identical elements
      • 5.20.28. Pernicious numbers
      • 5.20.29. Phrase reversals
      • 5.20.30. Pi
      • 5.20.31. Pick random element
      • 5.20.32. Pierpont primes
      • 5.20.33. Pig the dice game
        • 5.20.33.1. Player
      • 5.20.34. Pisano period
      • 5.20.35. Plasma effect
      • 5.20.36. Playfair cipher
      • 5.20.37. Playing cards
      • 5.20.38. Plot coordinate pairs
      • 5.20.39. Pointers and references
      • 5.20.40. Polymorphic copy
      • 5.20.41. Polymorphism
      • 5.20.42. Polynomial long division
      • 5.20.43. Polynomial regression
      • 5.20.44. Polynomial synthetic division
      • 5.20.45. Population count
      • 5.20.46. Power set
      • 5.20.47. Powerful numbers
      • 5.20.48. Price fraction
      • 5.20.49. Primality by trial division
      • 5.20.50. Primalty by Wilson's theorem
      • 5.20.51. Prime conspiracy
      • 5.20.52. Prime decomposition
      • 5.20.53. Primes - allocate descendants to their ancestors
      • 5.20.54. Primorial numbers
      • 5.20.55. Priority queue
      • 5.20.56. Probabilistic choice
      • 5.20.57. Problem of Apollonius
      • 5.20.58. Program name
      • 5.20.59. Program termination
      • 5.20.60. Proper divisors
      • 5.20.61. Pythagoras tree
      • 5.20.62. Pythagorean quadruples
      • 5.20.63. Pythagorean triples
    • 5.21. Q
      • 5.21.1. Quaternion type
      • 5.21.2. Queue
        • 5.21.2.1. Definition
        • 5.21.2.2. Usage
      • 5.21.3. Quickselect algorithm
      • 5.21.4. Quine
    • 5.22. R
      • 5.22.1. Ramanujan's constant
      • 5.22.2. Ramer-Douglas-Peucker line simplification
      • 5.22.3. Ramsey's theorem
      • 5.22.4. Random number generator device
      • 5.22.5. Random number generator included
      • 5.22.6. Random numbers
      • 5.22.7. Range expansion
      • 5.22.8. Ranking methods
      • 5.22.9. Rate counter
      • 5.22.10. Read a configuration file
      • 5.22.11. Read a file character by character
        • 5.22.11.1. UTF8
      • 5.22.12. Read a file line by line
      • 5.22.13. Read a specific line from a file
      • 5.22.14. Read entire file
      • 5.22.15. Readline interface
      • 5.22.16. Real constants and functions
      • 5.22.17. Recaman's sequence
      • 5.22.18. Reduced row echelon form
      • 5.22.19. Reflection
        • 5.22.19.1. List methods
      • 5.22.20. Regular expressions
      • 5.22.21. Remove duplicate elements
      • 5.22.22. Remove lines from a file
      • 5.22.23. Rename a file
      • 5.22.24. Rep-string
      • 5.22.25. Repeat
      • 5.22.26. Repeat a string
      • 5.22.27. Resistor mesh
      • 5.22.28. Respond to an unknown method call
      • 5.22.29. Return multiple values
      • 5.22.30. Reverse a string
      • 5.22.31. Reverse the gender of a string
      • 5.22.32. Reverse words in a string
      • 5.22.33. Rock-paper-scissors
      • 5.22.34. Roman numerals
        • 5.22.34.1. Decode
        • 5.22.34.2. Encode
      • 5.22.35. Roots of a function
      • 5.22.36. Roots of a quadratic function
      • 5.22.37. Roots of unity
      • 5.22.38. Rosetta Code
        • 5.22.38.1. Count examples
        • 5.22.38.2. Fix code tags
        • 5.22.38.3. Rank languages by popularity
      • 5.22.39. Rot-13
      • 5.22.40. RSA code
      • 5.22.41. Run-length encoding
      • 5.22.42. Run as a daemon or service
      • 5.22.43. Runge-Kutta method
      • 5.22.44. Runtime evaluation
        • 5.22.44.1. In an environment
    • 5.23. S
      • 5.23.1. S-Expressions
      • 5.23.2. Safe primes and unsafe primes
      • 5.23.3. Sailors coconuts and a monkey problem
      • 5.23.4. Same Fringe
      • 5.23.5. Sattolo cycle
      • 5.23.6. Scope
        • 5.23.6.1. Function names and labels
      • 5.23.7. Search a list
      • 5.23.8. Search a list of records
      • 5.23.9. Secure temporary file
      • 5.23.10. SEDOLs
      • 5.23.11. Self-describing numbers
      • 5.23.12. Semiprime
      • 5.23.13. Semordnilap
      • 5.23.14. Send an unknown method call
      • 5.23.15. Separate the house number from the street name
      • 5.23.16. Sequence nth number with exactly n divisors
      • 5.23.17. Sequence of non-squares
      • 5.23.18. Sequence of primes by trial division
      • 5.23.19. Sequence of primorial primes
      • 5.23.20. Sequence smallest number greater than previous term with exactly n divisors
      • 5.23.21. Sequence smallest number with exactly n divisors
      • 5.23.22. Set
      • 5.23.23. Set consolidation
      • 5.23.24. Seven-sided dice from five-sided dice
      • 5.23.25. Sexy primes
      • 5.23.26. SHA-1
      • 5.23.27. SHA-256
      • 5.23.28. Shell one-liner
      • 5.23.29. Shoelace formula for polygonal area
      • 5.23.30. Short-circuit evaluation
      • 5.23.31. Shortest common supersequence
      • 5.23.32. Show the epoch
      • 5.23.33. Sierpinski arrowhead curve
      • 5.23.34. Sierpinski carpet
      • 5.23.35. Sierpinski curve
      • 5.23.36. Sierpinski pentagon
      • 5.23.37. Sierpinski square curve
      • 5.23.38. Sierpinski triangle
        • 5.23.38.1. Graphical
      • 5.23.39. Sieve of Eratosthenes
      • 5.23.40. Simple windowed application
      • 5.23.41. Simulated annealing
      • 5.23.42. Singleton
      • 5.23.43. Singly-linked list
        • 5.23.43.1. Element definition
        • 5.23.43.2. Element insertion
        • 5.23.43.3. Traversal
      • 5.23.44. Sleep
      • 5.23.45. Smarandache prime-digital sequence
      • 5.23.46. Smith numbers
      • 5.23.47. Snake
      • 5.23.48. Sockets
      • 5.23.49. Sort a list of object identifiers
      • 5.23.50. Sort an array of composite structures
      • 5.23.51. Sort an integer array
      • 5.23.52. Sort disjoint sublist
      • 5.23.53. Sort numbers lexicographically
      • 5.23.54. Sort stability
      • 5.23.55. Sort three variables
      • 5.23.56. Sort using a custom comparator
      • 5.23.57. Sorting algorithms
        • 5.23.57.1. Bead sort
        • 5.23.57.2. Bogosort
        • 5.23.57.3. Bubble sort
        • 5.23.57.4. Circle Sort
        • 5.23.57.5. Cocktail sort
        • 5.23.57.6. Comb sort
        • 5.23.57.7. Counting sort
        • 5.23.57.8. Cycle sort
        • 5.23.57.9. Gnome sort
        • 5.23.57.10. Heapsort
        • 5.23.57.11. Insertion sort
        • 5.23.57.12. Merge sort
        • 5.23.57.13. Pancake sort
        • 5.23.57.14. Patience sort
        • 5.23.57.15. Permutation sort
        • 5.23.57.16. Quicksort
        • 5.23.57.17. Radix sort
        • 5.23.57.18. Selection sort
        • 5.23.57.19. Shell sort
        • 5.23.57.20. Sleep sort
        • 5.23.57.21. Stooge sort
        • 5.23.57.22. Strand sort
      • 5.23.58. Soundex
      • 5.23.59. Sparkline in unicode
      • 5.23.60. Speech synthesis
      • 5.23.61. Spelling of ordinal numbers
      • 5.23.62. Spiral matrix
      • 5.23.63. Split a character string based on change of character
      • 5.23.64. SQL-based authentication
      • 5.23.65. Square-free integers
      • 5.23.66. Square but not cube
      • 5.23.67. Stable marriage problem
      • 5.23.68. Stack
      • 5.23.69. Stair-climbing puzzle
      • 5.23.70. Standard deviation
      • 5.23.71. Statistics
        • 5.23.71.1. Basic
        • 5.23.71.2. Normal distribution
      • 5.23.72. Stem-and-leaf plot
      • 5.23.73. Stern-Brocot sequence
      • 5.23.74. Stirling numbers of the first kind
      • 5.23.75. Stirling numbers of the second kind
      • 5.23.76. Stream Merge
      • 5.23.77. String append
      • 5.23.78. String case
      • 5.23.79. String comparison
      • 5.23.80. String concatenation
      • 5.23.81. String interpolation included
      • 5.23.82. String length
      • 5.23.83. String matching
      • 5.23.84. String prepend
      • 5.23.85. Strip a set of characters from a string
      • 5.23.86. Strip block comments
      • 5.23.87. Strip comments from a string
      • 5.23.88. Strip control codes and extended characters from a string
      • 5.23.89. Strip whitespace from a string
        • 5.23.89.1. Top and tail
      • 5.23.90. Strong and weak primes
      • 5.23.91. Subleq
      • 5.23.92. Subset sum problem
      • 5.23.93. Substitution Cipher
      • 5.23.94. Substring
        • 5.23.94.1. Top and tail
      • 5.23.95. Subtractive generator
      • 5.23.96. Successive prime differences
      • 5.23.97. Sudoku
      • 5.23.98. Suffix tree
      • 5.23.99. Sum and product of an array
      • 5.23.100. Sum and Product Puzzle
      • 5.23.101. Sum digits of an integer
      • 5.23.102. Sum multiples of 3 and 5
      • 5.23.103. Sum of a series
      • 5.23.104. Sum of squares
      • 5.23.105. Sum to 100
      • 5.23.106. Sunflower fractal
      • 5.23.107. Super-d numbers
      • 5.23.108. Superellipse
      • 5.23.109. Superpermutation minimisation
      • 5.23.110. Sutherland-Hodgman polygon clipping
      • 5.23.111. Symmetric difference
      • 5.23.112. System time
    • 5.24. T
      • 5.24.1. Table creation
        • 5.24.1.1. Postal addresses
      • 5.24.2. Take notes on the command line
      • 5.24.3. Tarjan
      • 5.24.4. Taxicab numbers
      • 5.24.5. Temperature conversion
      • 5.24.6. Terminal control
        • 5.24.6.1. Clear the screen
        • 5.24.6.2. Coloured text
        • 5.24.6.3. Dimensions
        • 5.24.6.4. Display an extended character
        • 5.24.6.5. Preserve screen
        • 5.24.6.6. Ringing the terminal bell
        • 5.24.6.7. Unicode output
      • 5.24.7. Test integerness
      • 5.24.8. Text between
      • 5.24.9. Text processing
        • 5.24.9.1. 1
        • 5.24.9.2. 2
        • 5.24.9.3. Max licenses in use
      • 5.24.10. Textonyms
      • 5.24.11. The ISAAC Cipher
      • 5.24.12. The Twelve Days of Christmas
      • 5.24.13. Thiele's interpolation formula
      • 5.24.14. Thue-Morse
      • 5.24.15. Time a function
      • 5.24.16. Tokenize a string
      • 5.24.17. Tokenize a string with escaping
      • 5.24.18. Tonelli-Shanks algorithm
      • 5.24.19. Top rank per group
      • 5.24.20. Topic variable
      • 5.24.21. Topological sort
      • 5.24.22. Totient function
      • 5.24.23. Towers of Hanoi
      • 5.24.24. Trabb Pardo Knuth algorithm
      • 5.24.25. Tree traversal
      • 5.24.26. Trigonometric functions
      • 5.24.27. Truncatable primes
      • 5.24.28. Truncate a file
      • 5.24.29. Truth table
      • 5.24.30. Twelve statements
      • 5.24.31. Two Sum
    • 5.25. U
      • 5.25.1. Ulam spiral for primes
      • 5.25.2. Unbias a random generator
      • 5.25.3. Undefined values
      • 5.25.4. Unicode strings
      • 5.25.5. Unicode variable names
      • 5.25.6. Universal Turing machine
      • 5.25.7. Unix
        • 5.25.7.1. Ls
      • 5.25.8. Unprimeable numbers
      • 5.25.9. URL decoding
      • 5.25.10. URL encoding
      • 5.25.11. User input
        • 5.25.11.1. Graphical
        • 5.25.11.2. Text
      • 5.25.12. UTF-8 encode and decode
    • 5.26. V
      • 5.26.1. Vampire number
      • 5.26.2. Van der Corput sequence
      • 5.26.3. Van Eck sequence
      • 5.26.4. Variable-length quantity
      • 5.26.5. Variadic function
      • 5.26.6. Vector
      • 5.26.7. Vector products
      • 5.26.8. Verify distribution uniformity
        • 5.26.8.1. Chi-squared test
      • 5.26.9. Vigenère cipher
      • 5.26.10. Visualize a tree
      • 5.26.11. Vogel's approximation method
      • 5.26.12. Voronoi diagram
    • 5.27. W
      • 5.27.1. Walk a directory
        • 5.27.1.1. Non-recursively
        • 5.27.1.2. Recursively
      • 5.27.2. Water collected between towers
      • 5.27.3. Web scraping
      • 5.27.4. Weird numbers
      • 5.27.5. Welch's t-test
      • 5.27.6. Window creation
      • 5.27.7. Wireworld
      • 5.27.8. Word break problem
      • 5.27.9. Word frequency
      • 5.27.10. Word wrap
      • 5.27.11. Write entire file
      • 5.27.12. Write float arrays to a text file
      • 5.27.13. Write language name in 3D ASCII
    • 5.28. X
      • 5.28.1. Xiaolin Wu's line algorithm
      • 5.28.2. XML
        • 5.28.2.1. DOM serialization
        • 5.28.2.2. Input
        • 5.28.2.3. Output
        • 5.28.2.4. XPath
      • 5.28.3. XML Validation
    • 5.29. Y
      • 5.29.1. Y combinator
      • 5.29.2. Yin and yang
    • 5.30. Z
      • 5.30.1. Zebra puzzle
      • 5.30.2. Zeckendorf number representation
      • 5.30.3. Zero to the zero power
      • 5.30.4. Zhang-Suen thinning algorithm
      • 5.30.5. Zig-zag matrix
      • 5.30.6. Zumkeller numbers
  • 6. The End
Powered by GitBook

The Sidef programming language

Empty program