Rebol3 Code Examples

A collection of programming tasks implemented in Rebol

1100 doorsControl flow 2100 prisonersGames 321 gameGames 424 gameGames 54-rings or 4-squares puzzleMisc 69 billion names of God the integerMath 7Abbreviations, automaticString 8Abbreviations, easyString 9Abbreviations, simpleString 10ABC correlationMath 11ABC problemMisc 12ABC wordsString 13Abelian sandpile modelControl flow 14Abelian sandpile model/IdentityMath 15Abundant odd numbersMath 16Achilles numbersMath 17Addition chainsMath 18Additive primesMath 19Air massMisc 20Almost primeMath 21Alternade wordsString 22AmbControl flow 23AnadromesString 24Anagram generatorString 25AnagramsString 26Anagrams/Deranged anagramsString 27Angle difference between two bearingsMath 28Angles (geometric), normalization and conversionMath 29Anti-primesMath 30Append numbers at same position in stringsString 31Approximate equalityMath 32Apéry's constantMath 33Archimedean spiralGraphics 34Arithmetic derivativeMath 35Arithmetic evaluationMath 36Attractive numbersMath 37Audio alarmI/O 38Audio frequency generatorI/O 39Audio overlap loopI/O 40Autogram checkerString 41Averages/ModeMath 42Babylonian spiralGraphics 43Bacon cipherCrypto / encoding 44Balanced bracketsString 45Barnsley FernGraphics 46Bell numbersMath 47Best shuffleData structures 48Bifid cipherCrypto / encoding 49Bilinear interpolationGraphics 50Bioinformatics/Sequence mutationMisc 51BiorhythmsMath 52Bitcoin address validationCrypto / encoding 53Bitmap/Flood fillGraphics 54Bitmap/HistogramGraphics 55Bitmap/Midpoint circle algorithmGraphics 56Bitmap/Read a PPM fileI/O 57Bitmap/Write a PPM fileI/O 58Bitwise IOI/O 59Bitwise operationsMath 60BoidsGraphics 61Box the compassMisc 62Brazilian numbersMath 63Brownian treeGraphics 64Bulls and cowsGames 65Bulls and cows playerGames 66Burrows–Wheeler transformCrypto / encoding 67Caesar cipherCrypto / encoding 68Calendar - for "REAL" programmersMisc 69Call an object methodControl flow 70Camel case and snake caseString 71Card shufflesGames 72Case-sensitivity of identifiersnone 73Catalan numbersMath 74Catalan numbers/Pascal's triangleMath 75Catamorphismnone 76Changeable wordsString 77Chinese remainder theoremMath 78Chinese zodiacMisc 79Color quantization (Median cut)Graphics 80Color quantization (Octree)Graphics 81Color wheelGraphics 82Colour bars/DisplayGraphics 83CombinationsData structures 84Combinations and permutationsMath 85Combinations with repetitionsData structures 86Command-line argumentsnone 87Compare length of two stringsString 88Conway's Game of LifeGames 89Count in octalMath 90Count the coins/0-1Math 91Create a two-dimensional array at runtimeData structures 92Create an HTML tableString 93CSV data manipulationI/O 94CSV to HTML translationI/O 95CurrencyMath 96CUSIPMath 97Damm algorithmMath 98Deal cards for FreeCellGames 99Death StarGraphics 100DeepcopyControl flow 101Digit fifth powersMath 102Digital rootMath 103Dijkstra's algorithmMath 104Discordian datenone 105Display a linear combinationMath 106Display an outline as a nested tableData structures 107DNS queryI/O 108Doomsday ruleMisc 109Dragon curveGraphics 110Draw a clock (CLI)Graphics 111Draw a cuboidGraphics 112Draw a pixelGraphics 113Draw a sphereGraphics 114Draw a torusGraphics 115Element-wise operationsMath 116Elementary cellular automatonControl flow 117EntropyMath 118Ethiopian multiplicationMath 119Euclidean rhythmMisc 120Euler methodMath 121Euler's constant 0.5772...Math 122Evolutionary algorithmMisc 123Exactly three adjacent 3 in listsData structures 124Execute Brain****Misc 125Extend your languageMisc 126Extensible prime generatorMath 127FASTA formatI/O 128Fibonacci sequenceMath 129File extension is in extensions listString 130File modification timeI/O 131Find common directory pathString 132Find first missing positiveData structures 133Find limit of recursionControl flow 134Find prime n such that reversed n is also primeMath 135Find squares n where n+1 is primeMath 136Find unimplemented tasksMisc 137Find words with alternating vowels and consonantsenone 138First-class functions/Use numbers analogouslyControl flow 139Five weekendsMisc 140Flipping bits gamenone 141Floyd's trianglenone 142Forest fireGraphics 143Four is magicMisc 144Four sides of squareControl flow 145Fractal treeGraphics 146Fraction reductionMath 147FractranMath 148Functional coverage treeData structures 149Gamma functionMath 150Gapful numbersMath 151Generate lower case ASCII alphabetString 152Generate random numbers without repeating a valueData structures 153Get system command outputI/O 154Go FishGames 155Gosper's hackMisc 156Gray codeMath 157Grayscale imageGraphics 158GreedGames 159GSTrans string conversionString 160Happy numbersMath 161Harriss SpiralGraphics 162Hash joinData structures 163Hello world/Standard errorI/O 164Hello world/Web servernone 165Here documentString 166Heronian trianglesMath 167Hex dumpData structures 168Huffman codingCrypto / encoding 169I before E except after CString 170IBANMath 171Image noiseGraphics 172Include a fileControl flow 173Increment loop index within loop bodyControl flow 174InfinityMath 175Integer overflowMath 176Integer sequenceMath 177IntrospectionControl flow 178Inverted indexData structures 179ISBN13 check digitMath 180Jacobsthal numbersMath 181JSON pointerString 182Julia setGraphics 183Knapsack problem/0-1Math 184Knapsack problem/BoundedMath 185Knapsack problem/ContinuousMath 186Knapsack problem/UnboundedMath 187Knight's tourGames 188Knuth shuffleData structures 189Kronecker productMath 190Kronecker product based fractalsMath 191Largest number divisible by its digitsMath 192Leap yearMisc 193Legendre prime counting functionMath 194Letter frequencyString 195Levenshtein distanceString 196Long multiplicationMath 197Long yearMath 198Longest common suffixString 199Longest string challengeString 200Look-and-say sequenceMath 201Loops/With multiple rangesControl flow 202Loops/Wrong rangesControl flow 203Lorenz attractornone 204Ludic numbersMath 205Luhn test of credit card numbersMath 206Lychrel numbersMath 207Lyndon wordString 208LZW compressionCrypto / encoding 209Mandelbrot setGraphics 210Markov chain text generatorString 211Mayan numeralsMisc 212Maze generationGraphics 213MD4Crypto / encoding 214Memory allocationMisc 215Minimum numbers of three listsData structures 216Minimum primesMath 217Morse codeCrypto / encoding 218MultitonMisc 219Munching squaresGraphics 220Möbius functionMath 221N'thString 222Named parametersMisc 223Naming conventionsMisc 224Natural sortingData structures 225Nautical bellMisc 226Neighbour primesMath 227Nested functionControl flow 228Nice primesMath 229Nim gameGames 230Number namesString 231Numbers divisible by their individual digits, but not by the product of their digitsMath 232Object serializationI/O 233Odd and square numbersMath 234Old lady swallowed a flyMisc 235Old Russian measure of lengthMath 236One-dimensional cellular automataControl flow 237Ordered wordsString 238Ormiston pairsMath 239Padovan n-step number sequencesMath 240Pairs with common factorsMath 241Palindrome datesMisc 242Palindrome detectionString 243Palindromic gapful numbersMath 244Palindromic primes in base 16Math 245Parsing/Shunting-yard algorithmData structures 246Partial function applicationMisc 247Pascal's triangleMath 248PentagramGraphics 249Periodic tableMisc 250Peripheral drift illusionGraphics 251Perlin noiseGraphics 252Permutation testMath 253PermutationsData structures 254Permutations with repetitionsData structures 255Permuted multiplesMath 256Phrase reversalsString 257Pick random elementMisc 258Pig the dice gameGames 259PiprimesMath 260Playing cardsGames 261Poker hand analyserGames 262Polynomial regressionMath 263PolyspiralGraphics 264Population countMath 265Prime conspiracyMath 266Priority queueData structures 267Probabilistic choiceMath 268Program nameMisc 269Pseudo-random numbers/Middle-square methodMath 270Pythagoras treeGraphics 271QuaternionMath 272Quickselect algorithmMath 273QuineMisc 274Random numbersMath 275Range expansionString 276Range extractionString 277Read a configuration fileI/O 278Read a file line by lineI/O 279Recaman's sequenceMath 280Reduced row echelon formMath 281Remove vowels from a stringString 282Rep-stringString 283RepeatMisc 284Return multiple valuesControl flow 285Reverse the gender of a stringString 286Reverse the order of lines in a text file while preserving the contents of each lineI/O 287RIPEMD-160Crypto / encoding 288Rock-paper-scissorsGames 289Roman numerals/DecodeMath 290Roman numerals/EncodeMath 291Rosetta Code/Rank languages by popularityMisc 292Rosetta_Code/Count_examplesMisc 293RPG attributes generatorGames 294Sattolo cycleData structures 295Search a list of recordsData structures 296Self-describing numbersMath 297SemordnilapString 298SEND + MORE = MONEYMisc 299Sequence of non-squaresMath 300Set puzzleGames 301Set, the card gameGames 302Seven-sided dice from five-sided diceGames 303SHA-256 Merkle treeCrypto / encoding 304Shift list elements to left by 3Data structures 305Short-circuit evaluationControl flow 306Show ASCII tableMisc 307Show the epochMisc 308Sierpinski arrowhead curveGraphics 309Sierpinski carpetGraphics 310Sierpinski curveGraphics 311Sierpinski pentagonGraphics 312Sierpinski square curvenone 313Sierpinski triangleGraphics 314Sierpinski triangle/GraphicalGraphics 315Sieve of EratosthenesMath 316Sieve of PritchardMath 317Sign of an integer (signum)none 318Simple turtle graphicsGraphics 319Sine waveI/O 320Sleeping Beauty problemMisc 321Smallest enclosing circle problemMath 322Smallest numbersMath 323Snake and ladderGames 324Soloway's recurring rainfallMath 325Solve a Hidato puzzleMisc 326Solve the no connection puzzleMisc 327Sort a list of object identifiersData structures 328Sort an outline at every levelData structures 329Sort disjoint sublistData structures 330Sort numbers lexicographicallyData structures 331Sort stabilityData structures 332Sort three variablesData structures 333Sort using a custom comparatorData structures 334Sorting algorithms/Bead sortData structures 335Sorting algorithms/BogosortData structures 336Sorting algorithms/Bubble sortData structures 337Sorting algorithms/Circle sortData structures 338Sorting algorithms/Cocktail sortData structures 339Sorting algorithms/Comb sortData structures 340Sorting algorithms/Counting sortData structures 341Sorting algorithms/Gnome sortData structures 342Sorting algorithms/Insertion sortData structures 343Sorting algorithms/Patience sortData structures 344Sorting algorithms/Permutation sortData structures 345Sorting algorithms/QuicksortData structures 346Sorting algorithms/Radix sortData structures 347Sorting algorithms/Selection sortData structures 348Sorting algorithms/Shell sortData structures 349Sorting algorithms/Stooge sortData structures 350Sorting algorithms/Strand sortData structures 351SoundexString 352Sparkline in unicodeString 353Speech synthesisI/O 354Spiral matrixMath 355Stack tracesMisc 356Statistics/BasicMath 357Statistics/Normal distributionMath 358Stem-and-leaf plotData structures 359Straddling checkerboardCrypto / encoding 360String comparisonString 361String matchingString 362String prependnone 363Strip a set of characters from a stringString 364Strip block commentsString 365Strip whitespace from a string/Top and tailString 366Sub-unit squaresMath 367Substitution cipherCrypto / encoding 368Substring/Top and tailString 369Sudan functionMath 370SudokuMisc 371Sum digits of an integerMath 372Sum of a seriesMath 373Sum of first n cubesnone 374Sum of squaresMath 375Sum to 100Math 376Summarize primesMath 377Summation of primesMath 378Sunflower fractalGraphics 379SuperellipseGraphics 380Taxicab numbersMath 381Teacup rim textString 382Temperature conversionMath 383Terminal control/Restricted width positional input/No wrappingI/O 384Ternary logicMath 385Test a functionControl flow 386Text betweenString 387The Name GameString 388The sieve of SundaramMath 389The Twelve Days of ChristmasMisc 390Three word locationData structures 391Thue-MorseMisc 392Time a functionI/O 393Tokenize a string with escapingString 394Top rank per groupData structures 395Topological sortData structures 396Transliterate English text using the Greek alphabetString 397Truncate a fileI/O 398Twelve statementsMisc 399Twin primesMath 400Two identical stringsnone 401Unicode stringsString 402Unicode variable namesMisc 403Unique charactersString 404Unique characters in each stringString 405Unix/lsI/O 406URL decodingI/O 407URL encodingI/O 408Useless instructionsControl flow 409Validate International Securities Identification NumberMath 410Variable declaration resetMisc 411VectorData structures 412Vector productsMath 413Vigenère cipherCrypto / encoding 414Voronoi diagramGraphics 415Walk a directory/Non-recursivelyI/O 416Walk a directory/RecursivelyI/O 417War card gameGames 418Water collected between towersMath 419Wave function collapseGraphics 420Word frequencyString 421Word wheelGames 422Word wrapString 423WordiffString 424Wordle comparisonGames 425Words from neighbour onesString 426Write entire fileI/O 427Write float arrays to a text fileI/O 428Write language name in 3D ASCIIGraphics 429XXXX redactedString 430Yin and yangnone 431Zeckendorf number representationMath 432Zig-zag matrixMath