TXR
TXR is a new language implemented in C, running on POSIX platforms such as Linux, Mac OS X and Solaris as well as on Microsoft Windows. It is a dynamic, high level language originally intended for "data munging" tasks in Unix-like environments, particularly tasks requiring accurate, robust text scraping from loosely structured documents.
The Rosetta Code TXR solutions can be viewed in color, and all on one page with a convenient navigation pane here.
TXR started as a language for "reversing here-documents": evaluating a template of text containing variables, plus useful pattern matching directives, against some body of text and binding pieces of the text which matches variables. The variable bindings were output in POSIX shell variable assignment syntax, allowing for shell code like
eval $(txr
TXR was internally based, from the beginning, on a data model based on Lisp and eventually exposed a Lisp dialect that came to be known as TXR Lisp. TXR Lisp at first complemented the pattern extraction language, extending its power, but eventually became distinct. Programs can be written in TXR Lisp with no traces of the TXR pattern language, or vice versa.
TXR Lisp is an original dialect that contains many innovative features, which orchestrate together to express neat, compact solutions to everyday data processing problems. Programmers familiar with Common Lisp will be comfortable with TXR Lisp, and there is much to like for those who use Scheme, Racket or Clojure. TXR Lisp incorporates ideas from contemporary scripting languages also; a key motivation in many of its developments is the promotion of succinctness, which is something that often isn't associated with languages in the Lisp family.
Tasks
- 100 doors
- A+B
- ABC Problem
- Accumulator factory
- Ackermann function
- Align columns
- Amb
- Anonymous recursion
- Apply a callback to an array
- Arbitrary-precision integers (included)
- Arithmetic evaluation
- Arrays
- Associative array/Iteration
- Balanced brackets
- CSV data manipulation
- CSV to HTML translation
- Caesar cipher
- Call a foreign-language function
- Call a function in a shared library
- Classes
- Closures/Value capture
- Combinations
- Combinations with repetitions
- Comma quibbling
- Command-line arguments
- Comments
- Compound data type
- Conditional structures
- Count occurrences of a substring
- Currying
- Detect division by zero
- Determine if only one instance is running
- Empty string
- Environment variables
- Evaluate binomial coefficients
- Exceptions
- Exceptions/Catch an exception thrown in a nested call
- Extend your language
- Factorial
- Find limit of recursion
- First-class functions
- FizzBuzz
- Flatten a list
- Floyd's triangle
- Function definition
- Generic swap
- Globally replace text in several files
- Handle a signal
- Hash from two arrays
- Hash join
- Hello world/Graphical
- Hello world/Newline omission
- Here document
- Higher-order functions
- Host introspection
- Increment a numerical string
- Inheritance/Single
- JSON
- Keyboard input/Obtain a Y or N response
- Least common multiple
- Letter frequency
- Loop over multiple arrays simultaneously
- Luhn test of credit card numbers
- Man or boy test
- Mandelbrot set
- Maze generation
- Metaprogramming
- Modular exponentiation
- Multiline shebang
- Multisplit
- Mutual recursion
- Narcissist
- Old lady swallowed a fly
- Pangram checker
- Parsing/RPN to infix conversion
- Partial function application
- Pick random element
- Power set
- Prime decomposition
- Program name
- Quine
- Random number generator (included)
- Range expansion
- Range extraction
- Read a configuration file
- Read a specific line from a file
- Regular expressions
- Rename a file
- Return multiple values
- Reverse words in a string
- Rot-13
- Runtime evaluation/In an environment
- S-Expressions
- Scope modifiers
- Self-referential sequence
- Send email
- Set consolidation
- Shell one-liner
- Short-circuit evaluation
- Sleep
- Sockets
- Sort stability
- Soundex
- Special characters
- String matching
- Strip a set of characters from a string
- Strip control codes and extended characters from a string
- Strip whitespace from a string/Top and tail
- Sum of a series
- Synchronous concurrency
- Terminal control/Positional read
- Tokenize a string
- Top rank per group
- Twelve statements
- Unicode strings
- Update a configuration file
- Use another language to call a function
- Variable size/Get
- Variable size/Set
- Variable-length quantity
- Variables
- Vigenère cipher
- Walk a directory/Non-recursively
- Walk a directory/Recursively
- Web scraping
- Window creation
- Window creation/X11
- XML/Input
- Y combinator
- Yahoo! search interface