messages listlengths 2 2 |
|---|
[
{
"role": "user",
"content": "There are 100 doors in a row that are all initially closed.\n\nYou make 100 passes by the doors.\n\nThe first time through, visit every door and *toggle* the door (if the door is closed, open it; if it is open, close it).\n\nThe second time, only visit every 2nd door (door #2, ... |
[
{
"role": "user",
"content": "The Problem\n\n* 100 prisoners are individually numbered 1 to 100\n* A room having a cupboard of 100 opaque drawers numbered 1 to 100, that cannot be seen from outside.\n* Cards numbered 1 to 100 are placed randomly, one to a drawer, and the drawers all closed; at the start.\n*... |
[
{
"role": "user",
"content": "Task\n\nFind and show on this page the 10001st prime number."
},
{
"role": "assistant",
"content": "```\nsay (^∞).grep( &is-prime )[10000]\n\n```\n\nOutput:\n\n```\n104743\n```"
}
] |
[
{
"role": "user",
"content": "Task\n\nImplement the Fifteen Puzzle Game.\n\nThe **15-puzzle** is also known as:\n\n: : : * **Fifteen Puzzle**\n * **Gem Puzzle**\n * **Boss Puzzle**\n * **Game of Fifteen**\n * **Mystic Square**\n * **14-15 Puzz... |
[
{
"role": "user",
"content": "Your task is to write a program that finds a solution in the fewest moves possible single moves to a random Fifteen Puzzle Game. \nFor this task you will be using the following puzzle:\n\n```\n15 14 1 6\n 9 11 4 12\n 0 10 7 3\n13 8 5 2\n```\n\nSolution:\n\n```\n 1 2 ... |
[
{
"role": "user",
"content": "16 numbered pieces of the puzzle are placed out of order on a 4 X 4 grid. The correct order to win is to order the pieces\nas 1 through 16, read left to right, top to bottom:\n\n```\n 1 2 3 4\n 5 6 7 8\n 9 10 11 12\n 13 14 15 16\n\n```\n\nHow to Play: The aim is to get... |
[
{
"role": "user",
"content": "Task\n\nImplement a 2D sliding block puzzle game where blocks with numbers are combined to add their values.\n\nRules of the game\n: * The rules are that on each turn the player must choose a direction (up, down, left or right).\n * All tiles move as far as possible in t... |
[
{
"role": "user",
"content": "**21** is a two player game, the game is played by choosing\na number (**1**, **2**, or **3**) to be added to the *running total*.\n\nThe game is won by the player whose chosen number causes the *running total*\nto reach *exactly* **21**.\n\nThe *running total* starts at zero.\... |
[
{
"role": "user",
"content": "The 24 Game tests one's mental arithmetic.\n\nTask\n\nWrite a program that randomly chooses and displays four digits, each from 1 ──► 9 (inclusive) with repetitions allowed.\n\nThe program should prompt for the player to enter an arithmetic expression using *just* those, and *a... |
[
{
"role": "user",
"content": "task\n\nWrite a program that takes four digits, either from user input or by random generation, and computes arithmetic expressions following the rules of the 24 game.\n\nShow examples of solutions generated by the program.\n\nRelated task\n\n* Arithmetic Evaluator"
},
{
... |
[
{
"role": "user",
"content": "Task\n\nReplace **a, b, c, d, e, f,** and\n **g** with the decimal\ndigits LOW ───► HIGH\n \nsuch that the sum of the letters inside of each of the four large squares add up to\nthe same sum.\n\n```\n ╔══════════════╗ ╔══════════════╗\n ... |
[
{
"role": "user",
"content": "This task is a variation of the short story by Arthur C. Clarke.\n\n(Solvers should be aware of the consequences of completing this task.)\n\nIn detail, to specify what is meant by a “name”:\n\n: The integer 1 has 1 name “1”.\n: The integer 2 has 2 names “1+1”, an... |
[
{
"role": "user",
"content": "Task\n\nDisplay the complete lyrics for the song: **99 Bottles of Beer on the Wall**.\n\nThe beer song\n\nThe lyrics follow this form:\n\n> : : : 99 bottles of beer on the wall\n> : 99 bottles of beer\n> : Take one down, pass it around\n> :... |
[
{
"role": "user",
"content": "The A\\* search algorithm is an extension of Dijkstra's algorithm useful for finding the lowest cost path between two nodes (aka vertices) of a graph. The path may traverse any number of nodes connected by edges (aka arcs) with each edge having an associated cost. The algorithm... |
[
{
"role": "user",
"content": "**A+B** ─── a classic problem in programming contests, it's given so contestants can gain familiarity with the online judging system being used.\n\nTask\n\nGiven two integers, **A** and **B**.\n\nTheir sum needs to be calculated.\n\nInput data\n\nTwo integers are written ... |
[
{
"role": "user",
"content": "The use of abbreviations (also sometimes called synonyms, nicknames, AKAs, or aliases) can be an\n \neasy way to add flexibility when specifying or using commands, sub─commands, options, etc.\n\nIt would make a list of words easier to maintain (as words are added, chan... |
[
{
"role": "user",
"content": "This task is an easier (to code) variant of the Rosetta Code task: Abbreviations, simple.\n\nFor this task, the following *command table* will be used:\n\n```\n Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy\n COUnt COVerlay CURsor DELe... |
[
{
"role": "user",
"content": "The use of abbreviations (also sometimes called synonyms, nicknames, AKAs, or aliases) can be an\n \neasy way to add flexibility when specifying or using commands, sub─commands, options, etc.\n\nFor this task, the following *command table* will be used:\n\n```\n ad... |
[
{
"role": "user",
"content": "Taken from this video at the time stamp of 9:02\n\n**Task:**\n\nGet a string input and store it into a variable or something and compare the number of occurrences of the letters \"a\", \"b\" and \"c\".\nAll other characters MUST be ignored. If the \"a\"'s, \"b\"'s and \"c\"'s o... |
[
{
"role": "user",
"content": "Write a routine (function, subroutine, procedure, whatever it may be called in your language,) that when given a set of three letters, (a, b, c) for instance, will identify words that contain each of those letters, in differing amounts, and where each count differs from another... |
[
{
"role": "user",
"content": "You are given a collection of ABC blocks (maybe like the ones you had when you were a kid).\n\nThere are twenty blocks with two letters on each block.\n\nA complete alphabet is guaranteed amongst all sides of the blocks.\n\nThe sample collection of blocks:\n\n```\n (B O)\n (X... |
[
{
"role": "user",
"content": "Definition\n\nA word is an *ABC word* if the letters \"**a**\", \"**b**\" and \"**c**\" appear in the word in alphabetical order.\n\nIf any or all of these letters occur more than once in a word, then only the first occurrence of each letter should be used to determine... |
[
{
"role": "user",
"content": "| |\n| --- |\n| This page uses content from **Wikipedia**. The original article was at Abelian sandpile model. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) |... |
[
{
"role": "user",
"content": "Our sandpiles are based on a 3 by 3 rectangular grid giving nine areas that\ncontain a number from 0 to 3 inclusive. (The numbers are said to represent\ngrains of sand in each area of the sandpile).\n\nE.g. `s1` =\n\n```\n \n 1 2 0\n 2 1 1\n 0 1 3\n\n```\n\nand `s2`... |
[
{
"role": "user",
"content": "**Abstract type** is a type without instances or without definition.\n\nFor example in object-oriented programming using some languages, abstract types can be partial implementations of other types, which are to be derived there-from. An abstract type may provide implementation... |
[
{
"role": "user",
"content": "An Abundant number is a number **n** for which the *sum of divisors* **σ\n(\nn\n)\n>\n2\nn\n{\\displaystyle {\\displaystyle \\sigma (n)>2n}}**,\n \nor, equivalently, the *sum of proper divisors* (or aliquot sum) **s\n(\nn\n)\n>\nn\n{\\displaystyle {\\displays... |
[
{
"role": "user",
"content": "These define three classifications of positive integers based on their proper divisors.\n\nLet P(n) be the sum of the proper divisors of **n** where the proper divisors are all positive divisors of **n** other than **n** itself.\n\n```\n if P(n) < n t... |
[
{
"role": "user",
"content": "A problem posed by Paul Graham is that of creating a function that takes a single (numeric) argument and which returns another function that is an accumulator. The returned accumulator function in turn also takes a single numeric argument, and returns the sum of all the numeric... |
[
{
"role": "user",
"content": "| |\n| --- |\n| This page uses content from **Wikipedia**. The original article was at Achilles number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) |\n\nAn ... |
[
{
"role": "user",
"content": "The **Ackermann function** is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree.\n\nThe Ackermann function is usually defined as follows:\n\n: A\n ... |
[
{
"role": "user",
"content": "The task is to establish a connection to an Active Directory or Lightweight Directory Access Protocol server."
},
{
"role": "assistant",
"content": "(formerly Perl 6)\n\nUsing module LMDB - bindings to the openLDAP library. Requires an LDAP instance.\n\n```\nuse LMD... |
[
{
"role": "user",
"content": "Make sure you Connect to Active Directory"
},
{
"role": "assistant",
"content": "(formerly Perl 6)\n\n```\n# 20190718 Raku programming solution\n# https://github.com/perl6/doc/issues/2898\n# https://www.facebook.com/groups/perl6/permalink/2379873082279037/\n\n# Refe... |
[
{
"role": "user",
"content": "In object-oriented programming an object is active when its state depends on clock. Usually an active object encapsulates a task that updates the object's state. To the outer world the object looks like a normal object with methods that can be called from outside. Implementatio... |
[
{
"role": "user",
"content": "Demonstrate how to dynamically add variables to an object (a class instance) at runtime.\n\nThis is useful when the methods/variables of an instance are based on a data file that isn't available until runtime. Hal Fulton gives an example of creating an OO CSV parser at An Exerc... |
[
{
"role": "user",
"content": "An addition chain of length r for n is a sequence 1 = a(0) < a(1) < a(2) ... < a(r) = n , such as a(k) = a(i) + a(j) ( i < k and j < k , i may be = j) . Each member is the sum of two earlier members, not necessarily distincts.\n\nA Brauer chain for n is an addition chain where ... |
[
{
"role": "user",
"content": "| |\n| --- |\n| This page uses content from **Wikipedia**. The original article was at Addition-chain exponentiation. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on vari... |
[
{
"role": "user",
"content": "Definitions\n\nIn mathematics, **additive primes** are prime numbers for which the sum of their decimal digits are also primes.\n\nTask\n\nWrite a program to determine (and show here) all **additive primes** less than **500**.\n\nOptionally, show the **number** of additive prim... |
[
{
"role": "user",
"content": "Task\n\nDemonstrate how to get the address of a variable and how to set the address of a variable."
},
{
"role": "assistant",
"content": "(formerly Perl 6)\n\n```\nmy $x;\nsay $x.WHERE;\n\nmy $y := $x; # alias\nsay $y.WHERE; # same address as $x\n\nsay \"Same var... |
[
{
"role": "user",
"content": "Description\n\nThe ADFGVX cipher was a manually applied field cipher used by the German Army during World War I. It was broken in 1918 by the French cryptanalyst Georges Painvin.\n\nThe workings of the cipher are described in the Wikipedia article, linked to above, and so will ... |
[
{
"role": "user",
"content": "In astronomy **air mass** is a measure of the amount of atmosphere between the observer and the object being observed. It is a function of the *zenith angle* (the angle between the line of sight an vertical) and the altitude of the observer. It is defined as the integral of the... |
[
{
"role": "user",
"content": "The AKS algorithm for testing whether a number is prime is a polynomial-time algorithm based on an elementary theorem about Pascal triangles.\n\nThe theorem on which the test is based can be stated as follows:\n\n* a number \n\n p\n {\\displaystyle {\\displaystyle p}}\n ... |
[
{
"role": "user",
"content": "Some languages offer direct support for algebraic data types and pattern matching on them. While this of course can always be simulated with manual tagging and conditionals, it allows for terse code which is easy to read, and can represent the algorithm directly.\n\nTask\n\nAs ... |
[
{
"role": "user",
"content": "Given a text file of many lines, where fields within a line\nare delineated by a single 'dollar' character, write a program\nthat aligns each column of fields by ensuring that words in each\ncolumn are separated by at least one space.\nFurther, allow for each word in a column t... |
[
{
"role": "user",
"content": "An aliquot sequence of a positive integer K is defined recursively as the first member\nbeing K and subsequent members being the sum of the Proper divisors of the previous term.\n\n: * If the terms eventually reach 0 then the series for K is said to **terminate**.\n\n: Ther... |
[
{
"role": "user",
"content": "The Almkvist-Giullera formula for calculating \n\n1\n\nπ\n\n2\n{\\displaystyle {\\displaystyle {\\frac {1}{\\pi ^{2}}}}}\n is based on the Calabi-Yau\ndifferential equations of order 4 and 5, which were originally used to describe certain manifolds\nin string theory.\n\nThe f... |
[
{
"role": "user",
"content": "A k-Almost-prime is a natural number \n\nn\n{\\displaystyle {\\displaystyle n}}\n that is the product of \n\nk\n{\\displaystyle {\\displaystyle k}}\n (possibly identical) primes.\n\nExample\n\n1-almost-primes, where \n\nk\n=\n1\n{\\displaystyle {\\displaystyle k... |
[
{
"role": "user",
"content": "An alternade is a word whose alternating letters themselves form two words.\n\nExample\n\nThe word **lounge** contains the word **lug** (**l**o**u**n**g**e) and the word **one** (l**o**u**n**g**e**).\n\nFor a word to be an alternade, all its letters must be used.\n\nThe two wor... |
[
{
"role": "user",
"content": "Define and give an example of the Amb operator.\n\nThe Amb operator (short for \"ambiguous\") expresses nondeterminism. This doesn't refer to randomness (as in \"nondeterministic universe\") but is closely related to the term as it is used in automata theory (\"non-deterministi... |
[
{
"role": "user",
"content": "Two integers \n\nN\n{\\displaystyle {\\displaystyle N}}\n and \n\nM\n{\\displaystyle {\\displaystyle M}}\n are said to be amicable pairs if \n\nN\n≠\nM\n{\\displaystyle {\\displaystyle N\\neq M}}\n and the sum of the proper divisors of \n\nN\n{\\displaystyle {\\displaystyle N}}... |
[
{
"role": "user",
"content": "An anadrome is similar to a palindrome except, rather than spelling the *same* word or phrase when reversed, it spells a *different* word or phrase. An anadrome is a special case of an anagram.\n\n*Anadrome is a portmanteau of the words anagram and palindrome.*\n\nFor instance,... |
[
{
"role": "user",
"content": "There are already other tasks relating to *finding* **existing** anagrams. This one is about **creating** them.\n\nWrite a (set of) routine(s) that, when given a word list to work from, and word or phrase as a seed, generates anagrams of that word or phrase. Feel free to ignore... |
[
{
"role": "user",
"content": "When two or more words are composed of the same characters, but in a different order, they are called anagrams.\n\nTask\n\nUsing the word list at http://wiki.puzzlers.org/pub/wordlists/unixdict.txt,\n \nfind the sets of words that share the same characters that contain the m... |
[
{
"role": "user",
"content": "Two or more words are said to be anagrams if they have the same characters, but in a different order.\n\nBy analogy with derangements we define a *deranged anagram* as two words with the same characters, but in which the same character does *not* appear in the same position in ... |
[
{
"role": "user",
"content": "Anaprimes are prime numbers that are anagrams of each other, i.e. they use exactly the same digits with the same frequency but in a different order.\n\nAnaprimes are *very* common. To illustrate this, we will investigate the sizes of the equivalence classes defined by the \"is ... |
[
{
"role": "user",
"content": "Finding the angle between two bearings is often confusing.[1]\n\nTask\n\nFind the angle which is the result of the subtraction **b2 - b1**, where **b1** and **b2** are the bearings.\n\nInput bearings are expressed in the range **-180** to **+180** degrees.\n \nThe res... |
[
{
"role": "user",
"content": "This task is about the normalization and/or conversion of (geometric) angles using\nsome common scales.\n\nThe angular scales that will be used in this task are:\n\n: : * degree\n * gradian\n * mil\n * radian\n\nDefinitions\n\nThe angular scales used or... |
[
{
"role": "user",
"content": "Capture of the Oz version.\n\nOne good way of making an animation is by simulating a physical system and illustrating the variables in that system using a dynamically changing graphical display.\n\nThe classic such physical system is a simple gravity pendulum.\n\nTask\n\nCreate... |
[
{
"role": "user",
"content": "Task\n\nCreate and display five spinners.\nOne spinner in the middle and four spinners surrounding it.\nEach spinner is created by drawing radius lines around a center axis and then looping through the drawing to simulate a moving clock hand.\nWhen the loop is sped up, the illu... |
[
{
"role": "user",
"content": "**Animation** is integral to many parts of GUIs, including both the fancy effects when things change used in window managers, and of course games. The core of any animation system is a scheme for periodically changing the display while still remaining responsive to the user. ... |
[
{
"role": "user",
"content": "While implementing a recursive function, it often happens that we must resort to a separate *helper function* to handle the actual recursion.\n\nThis is usually the case when directly calling the current function would waste too many resources (stack space, execution time),... |
[
{
"role": "user",
"content": "The anti-primes\n(or highly composite numbers, sequence A002182 in the OEIS)\nare the natural numbers with more factors than any smaller than itself.\n\nTask\n\nGenerate and show here, the first twenty anti-primes.\n\nRelated tasks\n: * Factors of an integer\n * Sieve of E... |
[
{
"role": "user",
"content": "Many systems offer the ability to open a file for writing, such that any data written will be appended to the end of the file. Further, the file operations will always adjust the position pointer to guarantee the end of the file, even in a multitasking environment.\n\nThis feat... |
[
{
"role": "user",
"content": "Task\n\nGiven three lists:\n \nlist1 = [1,2,3,4,5,6,7,8,9]\n \nlist2 = [10,11,12,13,14,15,16,17,18]\n \nlist3 = [19,20,21,22,23,24,25,26,27]\n \nAt each index, turn the numbers into strings and concatenate them.\n \nThe result should be:\n \nlist = [11019,21120,31221,4132... |
[
{
"role": "user",
"content": "Task\n\nTake a combined set of elements and apply a function to each element."
},
{
"role": "assistant",
"content": "(formerly Perl 6)\n\n**Works with**: Rakudo version 2015.10-11\n\n```\nsub function { 2 * $^x + 3 };\nmy @array = 1 .. 5;\n\n# via map function\n.say... |
[
{
"role": "user",
"content": "Digital filters are used to apply a mathematical operation to a sampled signal. One of the common formulations is the \"direct form II transposed\" which can represent both infinite impulse response (IIR) and finite impulse response (FIR) filters, as well as being more numerica... |
[
{
"role": "user",
"content": "Sometimes, when testing whether the solution to a task (for example, here on Rosetta Code) is correct, the\ndifference in floating point calculations between different language implementations becomes significant.\n\nFor example, a difference between **32** bit and **64** bit f... |
[
{
"role": "user",
"content": "Apéry's constant is the sum of the reciprocals of the positive cubes.\n\nThat is, it is defined as the number \n\nζ\n(\n3\n)\n=\n\n∑\n\nk\n=\n1\n\n∞\n\n\n1\n\nk\n\n3\n,\n{\\displaystyle {\\displaystyle \\zeta (3)=\\sum \\_{k=1}^{\\infty }{\\frac {1}{k^{3}}},}}\n *where ζ is the... |
[
{
"role": "user",
"content": "Using the in-built capabilities of your language, calculate the integer value of:\n\n```\n \n \n \n \n \n \n \n 5\n \n \n 4\n \n \n ... |
[
{
"role": "user",
"content": "The Archimedean spiral is a spiral named after the Greek mathematician Archimedes.\n\nAn Archimedean spiral can be described by the equation:\n\n: r\n =\n a\n +\n b\n θ\n {\\displaystyle {\\displaystyle \\,r=a+b\\theta }}\n\nwith real numbers *a* and *b*.\n\... |
[
{
"role": "user",
"content": "Dynamically allocated objects take their memory from a heap.\n\nThe memory for an object is provided by an **allocator** which maintains the storage pool used for the heap.\n\nOften a call to allocator is denoted as\n\n```\nP := new T\n\n```\n\nwhere **T** is the type of an... |
[
{
"role": "user",
"content": "Arithmetic coding is a form of entropy encoding used in lossless data compression. Normally, a string of characters such as the words \"hello there\" is represented using a fixed number of bits per character, as in the ASCII code. When a string is converted to arithmetic encodi... |
[
{
"role": "user",
"content": "The **arithmetic derivative** of an integer (more specifically, the\n**Lagarias arithmetic derivative**) is a function defined for integers, based on prime\nfactorization, by analogy with the product rule for the derivative of a function that is\nused in mathematical analysis. ... |
[
{
"role": "user",
"content": "Create a program which parses and evaluates arithmetic expressions.\n\nRequirements\n\n* An abstract-syntax tree (AST) for the expression must be created from parsing the input.\n* The AST must be used in evaluation, also, so the input may not be directly evaluated (e.g. by cal... |
[
{
"role": "user",
"content": "Definition\n\nA positive integer **n** is an arithmetic number if the average of its positive divisors is also an integer.\n\nClearly all odd primes **p** must be arithmetic numbers because their only divisors are **1** and **p** whose sum is even and hence their average must b... |
[
{
"role": "user",
"content": "| |\n| --- |\n| This page uses content from **Wikipedia**. The original article was at Arithmetic-geometric mean. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance... |
[
{
"role": "user",
"content": "Almkvist Berndt 1988 begins with an investigation of why the agm is such an efficient algorithm, and proves that it converges quadratically. This is an efficient method to calculate \n\nπ\n{\\displaystyle {\\displaystyle \\pi }}\n.\n\nWith the same notations used in Arithmetic-... |
[
{
"role": "user",
"content": "A **complex number** is a number which can be written as:\n\na\n+\nb\n×\ni\n{\\displaystyle {\\displaystyle a+b\\times i}}\n(sometimes shown as:\n\nb\n+\na\n×\ni\n{\\displaystyle {\\displaystyle b+a\\times i}}\nwhere \n\na\n{\\displaystyle {\\displaystyle a}}\n and \n... |
[
{
"role": "user",
"content": "Task\n\nGet two integers from the user, and then (for those two integers), display their:\n\n: : : : * sum\n * difference\n * product\n * integer quotient\n * remainder\n * exponentiation (if... |
[
{
"role": "user",
"content": "Task\n\nCreate a reasonably complete implementation of rational arithmetic in the particular language using the idioms of the language.\n\nExample\n\nDefine a new type called **frac** with binary operator \"//\" of two integers that returns a **structure** made up of the numera... |
[
{
"role": "user",
"content": "Task\n\nShow how to concatenate two arrays in your language.\n\nIf this is as simple as `array1 + array2`, so be it."
},
{
"role": "assistant",
"content": "(formerly Perl 6)\n\n**Works with**: Rakudo version 2018.06\n\n```\nmy @array1 = 1, 2, 3;\nmy @array2 = 4, 5, ... |
[
{
"role": "user",
"content": "Task\n\nDetermine the number of elements in an array.\n\nAs an example use an array holding the strings 'apple' and 'orange'.\n\nOther tasks related to string operations:\n\nMetrics\n\n* Array length\n* String length\n* Copy a string\n* Empty string (assignment)\n\nCounting\n\... |
[
{
"role": "user",
"content": "This task is about arrays.\n\nFor hashes or associative arrays, please see Creating an Associative Array.\n\nFor a definition and in-depth discussion of what an array is, see Array.\n\nTask\n\nShow basic array syntax in your language.\n\nBasically, create an array, assign a val... |
[
{
"role": "user",
"content": "Generate and show all primes with strictly ascending decimal digits.\n\nAside: Try solving without peeking at existing solutions. I had a weird idea for generating\na prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial\nbut generating ... |
[
{
"role": "user",
"content": "Given the RFC 1035 message diagram from Section 4.1.1 (Header section format) as a string:\nhttp://www.ietf.org/rfc/rfc1035.txt\n\n```\n+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+\n| ID |\n+--+--+--+--+--+--+--+--+--+--+--+--+--+... |
[
{
"role": "user",
"content": "ASCII is the American Standard Code for Information Interchange. There are 128 ASCII characters of which the first 32 and the last are 'control characters'.\n\nTask\n\nShow how your language might treat control characters *en bloc* by using an enum, an enum like structure or ot... |
[
{
"role": "user",
"content": "This task has been flagged for clarification. Code on this page in its current state may be flagged incorrect once this task has been clarified. See this page's Talk page for discussion.\n\nThe main goal of Aspect Oriented Programming (AOP) is to keep all the code relating to a... |
[
{
"role": "user",
"content": "Assertions are a way of breaking out of code when there is an error or an unexpected input.\n\nSome languages throw exceptions and some treat it as a break point.\n\nTask\n\nShow an assertion in your language by asserting that an integer variable is equal to **42**."
},
{
... |
[
{
"role": "user",
"content": "According to Wikipedia; assertions can function as a form of documentation: they can describe the state the code expects to find before it runs (its preconditions), and the state the code expects to result in when it is finished running (postconditions); they can also s... |
[
{
"role": "user",
"content": "Task\n\nThe goal is to create an associative array (also known as a dictionary, map, or hash).\n\nRelated tasks:\n\n* Associative arrays/Iteration\n* Hash from two arrays\n\nSee also\n\n* Array\n* Associative array: Creation, Iteration\n* Collections\n* Compound data type\n* Do... |
[
{
"role": "user",
"content": "Show how to iterate over the key-value pairs of an associative array, and print each pair out.\n\nAlso show how to iterate just over the keys, or the values, if there is a separate way to do that in your language.\n\nSee also\n\n* Array\n* Associative array: Creation, Iteration... |
[
{
"role": "user",
"content": "Task\n\nDefine two associative arrays, where one represents the following \"base\" data:\n\n: : : : : | | |\n | --- | --- |\n | **Key** | **Value** |\n | \"name\" | \"Rocket Skates\" |\n | \... |
[
{
"role": "user",
"content": "Task\n\nDefine a data type consisting of a fixed number of 'buckets', each containing a nonnegative integer value, which supports operations to:\n\n1. get the current value of any bucket\n2. remove a specified amount from one specified bucket and add it to another, preserving t... |
[
{
"role": "user",
"content": "A number is an *attractive number* if the number of its prime factors (whether distinct or not) is also prime.\n\nExample\n\nThe number **20**, whose prime decomposition is **2 × 2 × 5**, is an *attractive number* because the number of its prime factors (**3**... |
[
{
"role": "user",
"content": "**AudioAlarm** is a program that asks the user to enter a certain number, representing a number of seconds. After the user enters the number, the program will ask the user to enter the name of an MP3 audio file (without the .mp3 file extension). The program will then display a ... |
[
{
"role": "user",
"content": "An audio frequency generator produces a continual audible monotone at a set frequency and level of volume.\nThere are controls to adjust the frequency and the volume up and down as desired.\nSome also have a selector to switch the waveform type between sine wave, square wave an... |
[
{
"role": "user",
"content": "**Audio Overlap Loop** is a program that produces an \"echo chamber\" effect by playing an audio file several times in an overlapping loop. A repetition level determines the number of times that the file is looped. For the purpose of this task, write a program that takes a para... |
[
{
"role": "user",
"content": "Definition\n\nAn **autogram** is a sentence that describes itself in the sense of providing an inventory of its own characters. An essential feature is the use of full cardinal number names such as \"one\", \"two\", etc., in recording character counts.\n\nAutograms are also cal... |
[
{
"role": "user",
"content": "Let `f` be a uniformly-randomly chosen mapping from the numbers 1..N to the numbers 1..N (note: not necessarily a permutation of 1..N; the mapping could produce a number in more than one way or not at all). At some point, the sequence `1, f(1), f(f(1))...` will contain a *repet... |
[
{
"role": "user",
"content": "Task\n\nWrite a program to find the mean (arithmetic average) of a numeric vector.\n\nIn case of a zero-length input, since the mean of an empty set of numbers is ill-defined, the program may choose to behave in any way it deems appropriate, though if the programming language h... |
[
{
"role": "user",
"content": "When calculating the average or mean of an angle one has to take into account how angles wrap around so that any angle in degrees plus any integer multiple of 360 degrees is a measure of the same angle.\n\nIf one wanted an average direction of the wind over two readings where t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.