Category:Factor
This programming language may be used to instruct a computer to perform a task.
Official website |
---|
Execution method: | Compiled (machine code) |
---|---|
Garbage collected: | Yes |
Parameter passing methods: | By reference |
Type safety: | Safe |
Type compatibility: | Duck |
Type expression: | Implicit |
Type checking: | Dynamic |
Lang tag(s): | factor |
See Also: |
If you know Factor, please write code for some of the tasks not implemented in Factor.
Factor is a stack-based, concatenative, general-purpose programming language with a focus on practicality.
Initially developed by Slava Pestov, Factor began life in 2003 as a scripting language written for a game. The implementation was originally an interpreter written in Java, but has since gained an optimizing compiler and has been rewritten in Factor with a minimal C core. Read more about Factor's implementation history here. As of November 2018, Factor is still being developed by several contributors, with the latest public release in July 2018.
Factor is a stack language similar to, but of a higher level than, Forth. Factor is a concatenative language, meaning that rather than applying functions to arguments (applicative languages) to evaluate things, we compose functions to evaluate a single piece of data — the entire program up until that particular point. In Factor, the basic structure of data flow is function composition. That is, foo bar baz
is equivalent to baz(bar(foo()))
in an applicative language. This offers a nice left-to-right style of reading and data flow.
In Factor, we tend to name data flow operations rather than values. In an applicative language, you might write
var x = ...;
var y = foo(x);
var z = bar(x);
In Factor this is a data flow pattern called bi
.
[ foo ] [ bar ] bi
This says, "apply foo
to the object at the top of the data stack, and apply bar
to it as well." Rather than naming the values x, y, and z, we named the data flow pattern.
Factor comes with many practical features, including a REPL, a self-contained help browser, an object inspector, a debugger/code walker, a deployment tool, editor integration for most popular text editors and IDEs, and introspection capabilities useful for developers. Factor has a fully-featured library, including things such as an HTTP server/client, bindings to graphics libraries and databases, a C FFI, a cross-platform GUI framework, on down to niche things like polynomial arithmetic. Factor features an object system that takes inspiration from Common Lisp and Self.
Most code tends to be expressed naturally in a functional manner. Factor comes with combinators (higher-order functions) typically seen in functional languages, such as map
, filter
, reduce
, and many more. Although most things can be done efficiently without mutation, Factor doesn't shy away from it when it's useful. Mutating words end with exclamation points (by convention). Factor provides lexical and dynamic variables which can make writing imperative code more natural, or allows one to clean up code that performs a lot of stack shuffling.
One of Factor's greatest strengths is its ability to factor words into smaller words. Due to the nature of concatenative programming, this is typically a cut and paste job that can be done almost anywhere there is whitespace. Factor also has impressive metaprogramming capabilities. Since Factor is almost entirely written in Factor, there is full introspection support, including seamless access to Factor's parser, allowing one to define new syntax. Factor also offers Lisp-style macros, and in general, Factor code can be treated like a collection (homoiconicity).
Links[edit]
Subcategories
This category has the following 4 subcategories, out of 4 total.
Pages in category "Factor"
The following 556 pages are in this category, out of 556 total.
A
- A+B
- Abbreviations, automatic
- Abbreviations, easy
- Abbreviations, simple
- ABC Problem
- Abundant, deficient and perfect number classifications
- Accumulator factory
- Ackermann function
- Active object
- AKS test for primes
- Align columns
- Aliquot sequence classifications
- Almost prime
- Amb
- Amicable pairs
- Anagrams
- Anagrams/Deranged anagrams
- Animate a pendulum
- Animation
- Anonymous recursion
- Anti-primes
- Apply a callback to an array
- Arbitrary-precision integers (included)
- Arithmetic evaluation
- Arithmetic-geometric mean
- Arithmetic/Complex
- Arithmetic/Integer
- Arithmetic/Rational
- Array concatenation
- Array length
- Arrays
- Assertions
- Associative array/Creation
- Associative array/Iteration
- 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
B
- Babbage problem
- Balanced brackets
- Benford's law
- Bernoulli numbers
- Binary digits
- Binary search
- Binary strings
- Bitcoin/address validation
- Bitcoin/public point to address
- Bitmap
- Bitmap/Bresenham's line algorithm
- Bitmap/Bézier curves/Cubic
- Bitmap/Bézier curves/Quadratic
- Bitwise operations
- Boolean values
- Break OO privacy
- Brownian tree
- Bulls and cows
- Burrows–Wheeler transform
C
- Caesar cipher
- Calculating the value of e
- Call a foreign-language function
- Call a function
- Call an object method
- Cantor set
- Cartesian product of two or more lists
- Case-sensitivity of identifiers
- Catalan numbers
- Catalan numbers/Pascal's triangle
- Catamorphism
- Chaocipher
- Character codes
- Check output device is a terminal
- Check that file exists
- Chinese remainder theorem
- Circles of given radius through two points
- Classes
- Closures/Value capture
- Collections
- Colour bars/Display
- Combinations
- Comma quibbling
- Command-line arguments
- Comments
- Compare a list of strings
- Compile-time calculation
- Compound data type
- Concurrent computing
- Conditional structures
- Conjugate transpose
- Continued fraction
- Convert decimal number to rational
- Convert seconds to compound duration
- Copy a string
- Count in factors
- Count in octal
- Count occurrences of a substring
- Count the coins
- CRC-32
- Create a file
- Create a two-dimensional array at runtime
- CSV data manipulation
- CSV to HTML translation
- Cuban primes
- Cumulative standard deviation
- Currency
- Currying
- Cycle detection
D
- Date format
- Date manipulation
- Day of the week
- Decimal floating point number to binary
- Define a primitive data type
- Delete a file
- Department Numbers
- Detect division by zero
- Determine if a string is numeric
- Dice game probabilities
- Digital root
- Digital root/Multiplicative digital root
- Dinesman's multiple-dwelling problem
- Display a linear combination
- Distributed programming
- DNS query
- Documentation
- Dot product
- Dragon curve
- Dynamic variable names
E
- Echo server
- Egyptian division
- Egyptian fractions
- Element-wise operations
- Emirp primes
- Empty directory
- Empty program
- Empty string
- Enforced immutability
- Entropy
- Entropy/Narcissist
- Enumerations
- Environment variables
- Equilibrium index
- Ethiopian multiplication
- Euler's identity
- Evaluate binomial coefficients
- Even or odd
- Evolutionary algorithm
- Exceptions
- Exceptions/Catch an exception thrown in a nested call
- Executable library
- Execute a system command
- Exponentiation operator
- Exponentiation order
- Extend your language
- Extract file extension
- Extreme floating point values
F
- Factorial
- Factors of a Mersenne number
- Factors of an integer
- Farey sequence
- Fast Fourier transform
- 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 limit of recursion
- Find palindromic numbers in both binary and ternary bases
- Find the last Sunday of each month
- Find the missing permutation
- First-class functions
- First-class functions/Use numbers analogously
- Five weekends
- Fivenum
- FizzBuzz
- Flatten a list
- Floyd's triangle
- Fork
- Formatted numeric output
- Forward difference
- Four is magic
- Fractran
- Function composition
- Function definition
- Function frequency
- Fusc sequence
G
H
- Hailstone sequence
- Hamming numbers
- Happy numbers
- Harshad or Niven series
- Hash from two arrays
- Haversine formula
- Hello world/Graphical
- Hello world/Line printer
- Hello world/Newline omission
- Hello world/Standard error
- Hello world/Text
- Here document
- Heronian triangles
- Higher-order functions
- History variables
- Hofstadter Figure-Figure sequences
- Hofstadter Q sequence
- Horizontal sundial calculations
- Horner's rule for polynomial evaluation
- Host introspection
- Hostname
- HTTP
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 noise
- Include a file
- Increment a numerical string
- Infinity
- Inheritance/Multiple
- Inheritance/Single
- Input loop
- Input/Output for Pairs of Numbers
- Integer comparison
- Integer sequence
- Interactive programming
- Introspection
- Inverted index
- Inverted syntax
- Iterated digits squaring
K
L
- Largest int from concatenated ints
- Largest number divisible by its digits
- Last Friday of each month
- Law of cosines - triples
- Leap year
- Least common multiple
- Left factorials
- Leonardo numbers
- Letter frequency
- Levenshtein distance
- List comprehensions
- Literals/Floating point
- Literals/Integer
- Literals/String
- Logical operations
- Long multiplication
- Long primes
- Longest common subsequence
- 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/Increment loop index within loop body
- Loops/Infinite
- Loops/N plus one half
- Loops/Nested
- Loops/While
- Loops/with multiple ranges
- Loops/Wrong ranges
- Lucas-Lehmer test
- Luhn test of credit card numbers
M
- Mad Libs
- Magic 8-Ball
- Magic squares of odd order
- Mandelbrot set
- Map range
- Matrix multiplication
- Matrix transposition
- Matrix-exponentiation operator
- Maximum triangle path sum
- MD5
- Memory allocation
- Menu
- Metronome
- Middle three digits
- Mind boggling card trick
- Modular arithmetic
- Modular exponentiation
- Modular inverse
- Modulinos
- Monads/Maybe monad
- Monte Carlo methods
- Mouse position
- Move-to-front algorithm
- Multifactorial
- Multiline shebang
- Multiple distinct objects
- Multiplication tables
- Munchausen numbers
- Munching squares
- Mutual recursion
N
- N'th
- N-queens problem
- Named parameters
- Naming conventions
- Narcissistic decimal number
- Nested function
- Nested templated data
- Non-decimal radices/Convert
- Non-decimal radices/Input
- Non-decimal radices/Output
- Null object
- Number names
- Number reversal game
- Numerical and alphabetical suffixes
- Numerical integration
O
P
- Palindrome detection
- Pangram checker
- Parallel calculations
- Parsing/RPN calculator algorithm
- Partial function application
- Partition an integer X into N primes
- Pascal's triangle
- Pascal's triangle/Puzzle
- Penney's game
- Percolation/Mean run density
- Perfect numbers
- Perfect shuffle
- Perfect totient numbers
- Perlin noise
- Permutations
- Permutations/Derangements
- Pernicious numbers
- Phrase reversals
- Pick random element
- Playing cards
- Polymorphic copy
- Polymorphism
- Polynomial long division
- Population count
- Power set
- Price fraction
- Primality by trial division
- Prime conspiracy
- Prime decomposition
- Primorial numbers
- Priority queue
- Probabilistic choice
- Program name
- Proper divisors
- Pythagorean triples
R
- Random number generator (device)
- Random number generator (included)
- Random numbers
- Range expansion
- Range extraction
- Ray-casting algorithm
- Read a file character by character/UTF8
- Read a file line by line
- Read entire file
- Real constants and functions
- Reflection/Get source
- Reflection/List methods
- Reflection/List properties
- Regular expressions
- Remove duplicate elements
- Rename a file
- Rep-string
- Repeat
- Repeat a string
- Return multiple values
- Reverse a string
- Reverse words in a string
- RIPEMD-160
- Roman numerals/Decode
- Roman numerals/Encode
- Roots of a quadratic function
- Rosetta Code/Count examples
- Rot-13
- RPG Attributes Generator
- Run-length encoding
- Runtime evaluation
- Runtime evaluation/In an environment
S
- S-Expressions
- Safe primes and unsafe primes
- Sattolo cycle
- Search a list
- Search a list of records
- SEDOLs
- Self-describing numbers
- Semiprime
- Semordnilap
- Send an unknown method call
- Send email
- Sequence of non-squares
- Sequence of primorial primes
- Set
- Seven-sided dice from five-sided dice
- Sexy primes
- SHA-1
- SHA-256
- Shell one-liner
- Shoelace formula for polygonal area
- Short-circuit evaluation
- Show Ascii table
- Show the epoch
- Sierpinski triangle
- Sierpinski triangle/Graphical
- Sieve of Eratosthenes
- Simple windowed application
- Singleton
- Singly-linked list/Element definition
- Singly-linked list/Element insertion
- Singly-linked list/Traversal
- Sleep
- Smith numbers
- Sockets
- 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 numbers lexicographically
- Sort stability
- Sort three variables
- Sort using a custom comparator
- Sorting algorithms/Bead sort
- Sorting algorithms/Bogosort
- Sorting algorithms/Bubble sort
- Sorting algorithms/Gnome sort
- Sorting algorithms/Merge sort
- Sorting algorithms/Permutation sort
- Sorting algorithms/Quicksort
- Sorting algorithms/Sleep sort
- Sorting algorithms/Stooge sort
- Spelling of ordinal numbers
- Spinning rod animation/Text
- Split a character string based on change of character
- Square but not cube
- Square-free integers
- Stack
- Stack traces
- Statistics/Basic
- Stern-Brocot sequence
- 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 comments from a string
- Strip control codes and extended characters from a string
- Strip whitespace from a string/Top and tail
- Strong and weak primes
- Substring
- Substring/Top and tail
- Sum and product of an array
- Sum digits of an integer
- Sum multiples of 3 and 5
- Sum of a series
- Sum of squares
- Symmetric difference
- System time
T
- Take notes on the command line
- Temperature conversion
- Ternary logic
- Test a function
- Test integerness
- Text processing/Max licenses in use
- The Name Game
- The Twelve Days of Christmas
- Thue-Morse
- Time a function
- Tokenize a string
- Top rank per group
- Totient function
- Towers of Hanoi
- Trabb Pardo–Knuth algorithm
- Tree traversal
- Trigonometric functions
- Truncatable primes
- Truth table
- Two Sum
- Type detection