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