task_url stringlengths 30 116 | task_name stringlengths 2 86 | task_description stringlengths 0 14.4k | language_url stringlengths 2 53 | language_name stringlengths 1 52 | code stringlengths 0 61.9k |
|---|---|---|---|---|---|
http://rosettacode.org/wiki/Test_a_function | Test a function |
Task
Using a well-known testing-specific library/module/suite for your language, write some tests for your language's entry in Palindrome.
If your language does not have a testing specific library well known to the language's community then state this or omit the language.
| #Mathematica.2FWolfram_Language | Mathematica/Wolfram Language | myFun[x_] := Block[{y},y = x^2; Assert[y > 5]; Sin[y]]
On[Assert];myFun[1.0] |
http://rosettacode.org/wiki/Test_a_function | Test a function |
Task
Using a well-known testing-specific library/module/suite for your language, write some tests for your language's entry in Palindrome.
If your language does not have a testing specific library well known to the language's community then state this or omit the language.
| #NetRexx | NetRexx | /* NetRexx */
options replace format comments java crossref savelog symbols binary
import junit.framework.TestCase
import RCPalindrome
class RCTestAFunction public final extends TestCase
method setUp public
return
method tearDown public
return
method testIsPal public signals AssertionError
assertTru... |
http://rosettacode.org/wiki/The_Twelve_Days_of_Christmas | The Twelve Days of Christmas | Task
Write a program that outputs the lyrics of the Christmas carol The Twelve Days of Christmas.
The lyrics can be found here.
(You must reproduce the words in the correct order, but case, format, and punctuation are left to your discretion.)
Other tasks related to string operations:
Metrics
Array length
Stri... | #C.2B.2B | C++ | #include <iostream>
#include <array>
#include <string>
using namespace std;
int main()
{
const array<string, 12> days
{
"first",
"second",
"third",
"fourth",
"fifth",
"sixth",
"seventh",
"eighth",
"ninth",
"tenth",
"eleven... |
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #Julia | Julia |
julia> using Gtk
julia> screen_size()
(3840, 1080)
julia>
|
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #Kotlin | Kotlin | // version 1.1.2
/*
I needed to execute the terminal command: 'export COLUMNS LINES'
before running this program for it to work (returned 'null' sizes otherwise).
*/
fun main(args: Array<String>) {
val lines = System.getenv("LINES")
val columns = System.getenv("COLUMNS")
println("Lines = $line... |
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #Locomotive_Basic | Locomotive Basic | 4000 d5 push de
4001 e5 push hl
4002 cd 69 bb call &bb69
4005 ed 53 20 40 ld (&4020),de
4009 22 22 40 ld (&4022),hl
400c e1 pop hl
400d d1 pop de
400e c9 ret |
http://rosettacode.org/wiki/Terminal_control/Coloured_text | Terminal control/Coloured text | Task
Display a word in various colours on the terminal.
The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.
Optionally demonstrate:
How the system should determine if the terminal supports colour
Setting of the background colour
How to cause blinking or flashing (if ... | #ARM_Assembly | ARM Assembly |
/* ARM assembly Raspberry PI */
/* program colorText.s */
/* Constantes */
.equ STDOUT, 1 @ Linux output console
.equ EXIT, 1 @ Linux syscall
.equ WRITE, 4 @ Linux syscall
.equ BUFFERSIZE, 100
/* Initialized data ... |
http://rosettacode.org/wiki/Terminal_control/Cursor_movement | Terminal control/Cursor movement | Task
Demonstrate how to achieve movement of the terminal cursor:
how to move the cursor one position to the left
how to move the cursor one position to the right
how to move the cursor up one line (without affecting its horizontal position)
how to move the cursor down one line (without affecting its horizontal po... | #Axe | Axe | Output(X-1,Y)
Output(X+1,Y)
Output(X,Y-1)
Output(X,Y+1)
Output(0,Y)
Output(15,Y)
Output(0,0)
Output(15,7) |
http://rosettacode.org/wiki/Terminal_control/Cursor_movement | Terminal control/Cursor movement | Task
Demonstrate how to achieve movement of the terminal cursor:
how to move the cursor one position to the left
how to move the cursor one position to the right
how to move the cursor up one line (without affecting its horizontal position)
how to move the cursor down one line (without affecting its horizontal po... | #BaCon | BaCon | ' ANSI terminal cursor movement
' Default number of positions, if not specified, is 1.
' Left 1 position, blocks at first position
CURSOR BACK 1
' Right 1, blocks at end of line
CURSOR FORWARD 1
' Up 1, column uneffected, blocks at top
CURSOR UP 1
' Down 1, column uneffected, until scroll at bottom
CURSOR DOWN ... |
http://rosettacode.org/wiki/Terminal_control/Cursor_movement | Terminal control/Cursor movement | Task
Demonstrate how to achieve movement of the terminal cursor:
how to move the cursor one position to the left
how to move the cursor one position to the right
how to move the cursor up one line (without affecting its horizontal position)
how to move the cursor down one line (without affecting its horizontal po... | #BASIC | BASIC | 10 'move left
20 LOCATE , POS(0) - 1
30 'move right
40 LOCATE , POS(0) + 1
50 'move up
60 LOCATE CSRLIN - 1
70 'move down
80 LOCATE CSRLIN + 1
900 'beginning of line
100 LOCATE , 1
110 'end of line; requires previous knowledge of screen width -- typically 80
120 LOCATE , 80
130 'top left corner
140 LOCATE 1, 1
150 'bot... |
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Icon_and_Unicon | Icon and Unicon | procedure main()
writes(CUP(6,3), "Hello")
end
procedure CUP(i,j)
writes("\^[[",i,";",j,"H")
return
end |
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #J | J | 'Hello',~move 6 3 |
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Julia | Julia | const ESC = "\u001B"
gotoANSI(x, y) = print("$ESC[$(y);$(x)H")
gotoANSI(3, 6)
println("Hello")
|
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Kotlin | Kotlin | // version 1.1.2
fun main(args: Array<String>) {
print("\u001Bc") // clear screen first
println("\u001B[6;3HHello")
} |
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Lasso | Lasso | local(esc = decode_base64('Gw=='))
stdout( #esc + '[6;3HHello') |
http://rosettacode.org/wiki/Ternary_logic | Ternary logic |
This page uses content from Wikipedia. The original article was at Ternary logic. 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)
In logic, a three-valued logic (also trivalent, ternary, or trinary... | #Common_Lisp | Common Lisp | (defun tri-not (x) (- 1 x))
(defun tri-and (&rest x) (apply #'* x))
(defun tri-or (&rest x) (tri-not (apply #'* (mapcar #'tri-not x))))
(defun tri-eq (x y) (+ (tri-and x y) (tri-and (- 1 x) (- 1 y))))
(defun tri-imply (x y) (tri-or (tri-not x) y))
(defun tri-test (x) (< (random 1e0) x))
(defun tri-string (x) (if (= x... |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Picat | Picat | go =>
println("£"),
println(chr(163)),
println("太極拳"), % Tàijíquán
nl. |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #PicoLisp | PicoLisp | (prinl (char 26413) (char 24140)) # Sapporo |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #PL.2FI | PL/I | declare pound character (1) static initial ('9c'x);
put skip list (pound); |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #PureBasic | PureBasic | Print(Chr(163)) |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Python | Python | print u'\u00a3' |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #R | R | cat("£") |
http://rosettacode.org/wiki/Text_processing/1 | Text processing/1 | 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.
Often data is produced by one program, in the wrong format for later use by another program or person. In these situations another pr... | #D | D | void main(in string[] args) {
import std.stdio, std.conv, std.string;
const fileNames = (args.length == 1) ? ["readings.txt"] :
args[1 .. $];
int noData, noDataMax = -1;
string[] noDataMaxLine;
double fileTotal = 0.0;
int fileValues;
foreach... |
http://rosettacode.org/wiki/The_ISAAC_Cipher | The ISAAC Cipher | ISAAC is a cryptographically secure pseudo-random number generator (CSPRNG) and stream cipher. It was developed by Bob Jenkins from 1993 (http://burtleburtle.net/bob/rand/isaac.html) and placed in the Public Domain. ISAAC is fast - especially when optimised - and portable to most architectures in nearly all programming... | #Perl | Perl | use warnings;
use strict;
use Math::Random::ISAAC;
my $message = "a Top Secret secret";
my $key = "this is my secret key";
my $enc = xor_isaac($key, $message);
my $dec = xor_isaac($key, join "", pack "H*", $enc);
print "Message: $message\n";
print "Key : $key\n";
print "XOR : $enc\n";
print "XOR dcr: ", joi... |
http://rosettacode.org/wiki/Test_integerness | Test integerness | Mathematically,
the integers Z are included in the rational numbers Q,
which are included in the real numbers R,
which can be generalized to the complex numbers C.
This means that each of those larger sets, and the data types used to represent them, include some integers.
Task[edit]
Given a rational, real, or co... | #PowerShell | PowerShell |
function Test-Integer ($Number)
{
try
{
$Number = [System.Numerics.Complex]$Number
if (($Number.Real -eq [int]$Number.Real) -and ($Number.Imaginary -eq 0))
{
return $true
}
else
{
return $false
}
}
catch
{
Wr... |
http://rosettacode.org/wiki/Test_integerness | Test integerness | Mathematically,
the integers Z are included in the rational numbers Q,
which are included in the real numbers R,
which can be generalized to the complex numbers C.
This means that each of those larger sets, and the data types used to represent them, include some integers.
Task[edit]
Given a rational, real, or co... | #Python | Python | >>> def isint(f):
return complex(f).imag == 0 and complex(f).real.is_integer()
>>> [isint(f) for f in (1.0, 2, (3.0+0.0j), 4.1, (3+4j), (5.6+0j))]
[True, True, True, False, False, False]
>>> # Test cases
...
>>> isint(25.000000)
True
>>> isint(24.999999)
False
>>> isint(25.000100)
False
>>> isint(-2.1e120)
Tru... |
http://rosettacode.org/wiki/Text_processing/Max_licenses_in_use | Text processing/Max licenses in use | A company currently pays a fixed sum for the use of a particular licensed software package. In determining if it has a good deal it decides to calculate its maximum use of the software from its license management log file.
Assume the software's licensing daemon faithfully records a checkout event when a copy of the ... | #PureBasic | PureBasic | OpenConsole()
If ReadFile(0, OpenFileRequester("Text processing/3","mlijobs.txt","All files",1))
While Not Eof(0)
currline$=ReadString(0)
If StringField(currline$,2," ")="OUT"
counter+1
Else
counter-1
EndIf
If counter>max
max=counter
maxtime$=StringField(currline$,4,"... |
http://rosettacode.org/wiki/Test_a_function | Test a function |
Task
Using a well-known testing-specific library/module/suite for your language, write some tests for your language's entry in Palindrome.
If your language does not have a testing specific library well known to the language's community then state this or omit the language.
| #Nim | Nim | proc reversed(s: string): string =
result = newString(s.len)
for i, c in s:
result[s.high - i] = c
proc isPalindrome(s: string): bool =
s == reversed(s)
when isMainModule:
assert(isPalindrome(""))
assert(isPalindrome("a"))
assert(isPalindrome("aa"))
assert(not isPalindrome("baa"))
assert(isPalin... |
http://rosettacode.org/wiki/Test_a_function | Test a function |
Task
Using a well-known testing-specific library/module/suite for your language, write some tests for your language's entry in Palindrome.
If your language does not have a testing specific library well known to the language's community then state this or omit the language.
| #OCaml | OCaml | ocaml unix.cma -I +oUnit oUnit.cma palindrome.cmo palindrome_tests.ml
|
http://rosettacode.org/wiki/The_Twelve_Days_of_Christmas | The Twelve Days of Christmas | Task
Write a program that outputs the lyrics of the Christmas carol The Twelve Days of Christmas.
The lyrics can be found here.
(You must reproduce the words in the correct order, but case, format, and punctuation are left to your discretion.)
Other tasks related to string operations:
Metrics
Array length
Stri... | #Clojure | Clojure | (let
[numbers '(first second third fourth fifth sixth
seventh eighth ninth tenth eleventh twelfth)
gifts ["And a partridge in a pear tree", "Two turtle doves",
"Three French hens", "Four calling birds",
"Five gold rings", "Six geese a-layin... |
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #Mathematica.2FWolfram_Language | Mathematica/Wolfram Language | WIDTH=RunThrough["tput cols", ""];
HEIGHT=RunThrough["tput lines", ""]; |
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #Nim | Nim | import terminal
let (width, height) = terminalSize()
echo "Terminal width: ", width
echo "Terminal height: ", height |
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #OCaml | OCaml | $ ocaml unix.cma -I +ANSITerminal ANSITerminal.cma
# let width, height = ANSITerminal.size () ;;
val width : int = 126
val height : int = 47 |
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #Perl | Perl | use Term::Size;
($cols, $rows) = Term::Size::chars;
print "The terminal has $cols columns and $rows lines\n"; |
http://rosettacode.org/wiki/Terminal_control/Coloured_text | Terminal control/Coloured text | Task
Display a word in various colours on the terminal.
The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.
Optionally demonstrate:
How the system should determine if the terminal supports colour
Setting of the background colour
How to cause blinking or flashing (if ... | #Arturo | Arturo | str: "Hello World"
print color #red str
print color #green str
print color #blue str
print color #magenta str
print color #yellow str
print color #cyan str
print color #black str
print color #white str |
http://rosettacode.org/wiki/Terminal_control/Coloured_text | Terminal control/Coloured text | Task
Display a word in various colours on the terminal.
The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.
Optionally demonstrate:
How the system should determine if the terminal supports colour
Setting of the background colour
How to cause blinking or flashing (if ... | #AutoHotkey | AutoHotkey | DllCall( "AllocConsole" ) ; create a console if not launched from one
hConsole := DllCall( "GetStdHandle", int, STDOUT := -11 )
Loop 15
SetConsoleTextAttribute(hConsole, A_Index)
,WriteConsole(hConsole, "AutoHotkey`n")
MsgBox
SetConsoleTextAttribute(hConsole, Attributes){
return DllCall( "SetConsoleTextAttribut... |
http://rosettacode.org/wiki/Terminal_control/Cursor_movement | Terminal control/Cursor movement | Task
Demonstrate how to achieve movement of the terminal cursor:
how to move the cursor one position to the left
how to move the cursor one position to the right
how to move the cursor up one line (without affecting its horizontal position)
how to move the cursor down one line (without affecting its horizontal po... | #BBC_BASIC | BBC BASIC | VDU 8 : REM Move one position to the left
VDU 9 : REM Move one position to the right
VDU 11 : REM Move up one line
VDU 10 : REM Move down one line
VDU 13 : REM Move to the beginning of the line
VDU 30 : REM Move to the top left corner
VDU 23,16,16;0;0;0; : REM Dis... |
http://rosettacode.org/wiki/Terminal_control/Cursor_movement | Terminal control/Cursor movement | Task
Demonstrate how to achieve movement of the terminal cursor:
how to move the cursor one position to the left
how to move the cursor one position to the right
how to move the cursor up one line (without affecting its horizontal position)
how to move the cursor down one line (without affecting its horizontal po... | #Befunge | Befunge |
#include<conio.h>
#include<dos.h>
char *strings[] = {"The cursor will move one position to the left",
"The cursor will move one position to the right",
"The cursor will move vetically up one line",
"The cursor will move vertically down one line",
"The cursor will move to the beginning of... |
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Liberty_BASIC | Liberty BASIC | locate 3, 6
print "Hello"
|
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Logo | Logo | setcursor [2 5]
type "Hello |
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Mathematica.2FWolfram_Language | Mathematica/Wolfram Language | Run["tput cup 6 3"]
Print["Hello"] |
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Nim | Nim | import terminal
setCursorPos(3, 6)
echo "Hello" |
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #NS-HUBASIC | NS-HUBASIC | 10 LOCATE 3,6
20 PRINT "HELLO" |
http://rosettacode.org/wiki/Teacup_rim_text | Teacup rim text | On a set of coasters we have, there's a picture of a teacup. On the rim of the teacup the word TEA appears a number of times separated by bullet characters (•).
It occurred to me that if the bullet were removed and the words run together, you could start at any letter and still end up with a meaningful three... | #11l | 11l | F rotated(String s)
R s[1..]‘’s[0]
V s = Set(File(‘unixdict.txt’).read().rtrim("\n").split("\n"))
L !s.empty
L(=word) s // `=` is needed here because otherwise after `s.remove(word)` `word` becomes invalid
s.remove(word)
I word.len < 3
L.break
V w = word
L 0 .< word.len - 1
... |
http://rosettacode.org/wiki/Terminal_control/Clear_the_screen | Terminal control/Clear the screen | Task
Clear the terminal window.
| #11l | 11l | os:(‘clear’) |
http://rosettacode.org/wiki/Ternary_logic | Ternary logic |
This page uses content from Wikipedia. The original article was at Ternary logic. 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)
In logic, a three-valued logic (also trivalent, ternary, or trinary... | #D | D | import std.stdio;
struct Trit {
private enum Val : byte { F = -1, M, T }
private Val t;
alias t this;
static immutable Trit[3] vals = [{Val.F}, {Val.M}, {Val.T}];
static immutable F = Trit(Val.F); // Not necessary but handy.
static immutable M = Trit(Val.M);
static immutable T = Trit(Val.T... |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Racket | Racket |
#lang racket
(display "£")
|
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Raku | Raku | say '£';
say "\x[FFE1]";
say "\c[FULLWIDTH POUND SIGN]";
0xffe1.chr.say; |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #REXX | REXX | /*REXX program demonstrates displaying an extended character (glyph) to the terminal.*/
/* [↓] this SAY will display the £ glyph (if the term supports it).*/
say '£' /*this assumes the pound sign glyph is displayable on the terminal. */
/*this program can execute c... |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Ring | Ring |
# Project : Terminal control/Display an extended character
see "£"
|
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Ruby | Ruby | #encoding: UTF-8 #superfluous in Ruby > 1.9.3
puts "£" |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Scala | Scala | object ExtendedCharacter extends App {
println("£")
println("札幌")
} |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Seed7 | Seed7 | $ include "seed7_05.s7i";
include "console.s7i";
const proc: main is func
local
var text: console is STD_NULL;
begin
console := open(CONSOLE);
write(console, "£");
# Terminal windows often restore the previous
# content, when a program is terminated. Therefore
# the program waits until R... |
http://rosettacode.org/wiki/Text_processing/1 | Text processing/1 | 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.
Often data is produced by one program, in the wrong format for later use by another program or person. In these situations another pr... | #Eiffel | Eiffel |
class
APPLICATION
create
make
feature
make
-- Summary statistics for 'hash'.
local
reject, accept, reading_total: INTEGER
total, average, file_total: REAL
do
read_wordlist
across
hash as h
loop
io.put_string (h.key + "%T")
reject := 0
accept := 0
total := 0
acros... |
http://rosettacode.org/wiki/The_ISAAC_Cipher | The ISAAC Cipher | ISAAC is a cryptographically secure pseudo-random number generator (CSPRNG) and stream cipher. It was developed by Bob Jenkins from 1993 (http://burtleburtle.net/bob/rand/isaac.html) and placed in the Public Domain. ISAAC is fast - especially when optimised - and portable to most architectures in nearly all programming... | #Phix | Phix | --
-- demo\rosetta\ISAAC_Cipher.exw
--
with javascript_semantics
sequence randrsl = repeat(0,256)
integer randcnt
sequence mm
atom aa,bb,cc
function r32(object a)
if sequence(a) then
for i=1 to length(a) do
a[i] = r32(a[i])
end for
return a
end if
if a<0 then a+=#10000... |
http://rosettacode.org/wiki/Test_integerness | Test integerness | Mathematically,
the integers Z are included in the rational numbers Q,
which are included in the real numbers R,
which can be generalized to the complex numbers C.
This means that each of those larger sets, and the data types used to represent them, include some integers.
Task[edit]
Given a rational, real, or co... | #Quackery | Quackery | [ $ "bigrat.qky" loadfile ] now!
[ mod not ] is v-is-num ( n/d --> b )
[ 1+ dip [ proper rot drop ]
10 swap ** round v-is-num ] is approxint ( n/d n --> b ) |
http://rosettacode.org/wiki/Test_integerness | Test integerness | Mathematically,
the integers Z are included in the rational numbers Q,
which are included in the real numbers R,
which can be generalized to the complex numbers C.
This means that each of those larger sets, and the data types used to represent them, include some integers.
Task[edit]
Given a rational, real, or co... | #Racket | Racket | #lang racket
(require tests/eli-tester)
(test ;; known representations of integers:
;; - as exacts
(integer? -1) => #t
(integer? 0) => #t
(integer? 1) => #t
(integer? 1234879378539875943875937598379587539875498792424323432432343242423432432) => #t
(integer? -123487937853987594387593759837958753987549879242... |
http://rosettacode.org/wiki/Text_processing/Max_licenses_in_use | Text processing/Max licenses in use | A company currently pays a fixed sum for the use of a particular licensed software package. In determining if it has a good deal it decides to calculate its maximum use of the software from its license management log file.
Assume the software's licensing daemon faithfully records a checkout event when a copy of the ... | #Python | Python | out, max_out, max_times = 0, -1, []
for job in open('mlijobs.txt'):
out += 1 if "OUT" in job else -1
if out > max_out:
max_out, max_times = out, []
if out == max_out:
max_times.append(job.split()[3])
print("Maximum simultaneous license use is %i at the following times:" % max_out)
print(' ... |
http://rosettacode.org/wiki/Test_a_function | Test a function |
Task
Using a well-known testing-specific library/module/suite for your language, write some tests for your language's entry in Palindrome.
If your language does not have a testing specific library well known to the language's community then state this or omit the language.
| #Oforth | Oforth | test: [ "abcd" isPalindrome ]
test: ["abba" isPalindrome ]
test: [ "abcba" isPalindrome ] |
http://rosettacode.org/wiki/Test_a_function | Test a function |
Task
Using a well-known testing-specific library/module/suite for your language, write some tests for your language's entry in Palindrome.
If your language does not have a testing specific library well known to the language's community then state this or omit the language.
| #PARI.2FGP | PARI/GP | ? ispal("abc")
0
? ispal("aba")
1 |
http://rosettacode.org/wiki/The_Twelve_Days_of_Christmas | The Twelve Days of Christmas | Task
Write a program that outputs the lyrics of the Christmas carol The Twelve Days of Christmas.
The lyrics can be found here.
(You must reproduce the words in the correct order, but case, format, and punctuation are left to your discretion.)
Other tasks related to string operations:
Metrics
Array length
Stri... | #CLU | CLU | christmas = cluster is carol
rep = null
own ordinals: array[string] := array[string]$[
"first", "second", "third", "fourth", "fifth",
"sixth", "seventh", "eighth", "ninth", "tenth",
"eleventh", "twelfth"
]
own gifts: array[string] := array[string]$[
"A partridge in a ... |
http://rosettacode.org/wiki/The_Twelve_Days_of_Christmas | The Twelve Days of Christmas | Task
Write a program that outputs the lyrics of the Christmas carol The Twelve Days of Christmas.
The lyrics can be found here.
(You must reproduce the words in the correct order, but case, format, and punctuation are left to your discretion.)
Other tasks related to string operations:
Metrics
Array length
Stri... | #COBOL | COBOL | >>SOURCE FREE
PROGRAM-ID. twelve-days-of-christmas.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 gifts-area VALUE "partridge in a pear tree "
& "Two turtle doves "
& "Three french hens "
& "Four calling birds "
& "FIVE GOLDEN RINGS "
& "Six ... |
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #Phix | Phix | without js -- (video_config)
sequence vc = video_config()
printf(1,"Terminal buffer height is %d\n",vc[VC_LINES])
printf(1,"Terminal buffer width is %d\n",vc[VC_COLUMNS])
printf(1,"Terminal screen height is %d\n",vc[VC_SCRNLINES])
printf(1,"Terminal screen width is %d\n",vc[VC_SCRNCOLS])
|
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #PicoLisp | PicoLisp | (setq
Width (in '(tput cols) (read))
Height (in '(tput lines) (read)) ) |
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #PureBasic | PureBasic | Macro ConsoleHandle()
GetStdHandle_( #STD_OUTPUT_HANDLE )
EndMacro
Procedure ConsoleWidth()
Protected CBI.CONSOLE_SCREEN_BUFFER_INFO
Protected hConsole = ConsoleHandle()
GetConsoleScreenBufferInfo_( hConsole, @CBI )
ProcedureReturn CBI\srWindow\right - CBI\srWindow\left + 1
EndProcedure
Procedure ConsoleH... |
http://rosettacode.org/wiki/Terminal_control/Coloured_text | Terminal control/Coloured text | Task
Display a word in various colours on the terminal.
The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.
Optionally demonstrate:
How the system should determine if the terminal supports colour
Setting of the background colour
How to cause blinking or flashing (if ... | #BaCon | BaCon | ' ANSI terminal coloured text
COLOR FG TO BLACK
PRINT "a word"
COLOR FG TO RED
PRINT "a word"
COLOR FG TO GREEN
PRINT "a word"
' Other colours include YELLOW, BLUE, MAGENTA, CYAN, WHITE
' Second keyword can be BG for background colour control
' The COLOR command also accepts keywords of NORMAL, INTENSE, INVERSE, ... |
http://rosettacode.org/wiki/Terminal_control/Coloured_text | Terminal control/Coloured text | Task
Display a word in various colours on the terminal.
The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.
Optionally demonstrate:
How the system should determine if the terminal supports colour
Setting of the background colour
How to cause blinking or flashing (if ... | #BASIC | BASIC | FOR n = 1 TO 15
COLOR n
PRINT "Rosetta Code"
NEXT |
http://rosettacode.org/wiki/Terminal_control/Cursor_movement | Terminal control/Cursor movement | Task
Demonstrate how to achieve movement of the terminal cursor:
how to move the cursor one position to the left
how to move the cursor one position to the right
how to move the cursor up one line (without affecting its horizontal position)
how to move the cursor down one line (without affecting its horizontal po... | #C | C |
#include<conio.h>
#include<dos.h>
char *strings[] = {"The cursor will move one position to the left",
"The cursor will move one position to the right",
"The cursor will move vetically up one line",
"The cursor will move vertically down one line",
"The cursor will move to the beginning of... |
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #OCaml | OCaml | #load "unix.cma"
#directory "+ANSITerminal"
#load "ANSITerminal.cma"
module Trm = ANSITerminal
let () =
Trm.erase Trm.Screen;
Trm.set_cursor 3 6;
Trm.print_string [] "Hello";
;; |
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Pascal | Pascal |
program cursor_pos;
uses crt;
begin
gotoxy(6,3);
write('Hello');
end.
|
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Perl | Perl |
use Term::Cap;
my $t = Term::Cap->Tgetent;
print $t->Tgoto("cm", 2, 5); # 0-based
print "Hello";
|
http://rosettacode.org/wiki/Terminal_control/Cursor_positioning | Terminal control/Cursor positioning |
Task
Move the cursor to column 3, row 6, and display the word "Hello" (without the quotes), so that the letter H is in column 3 on row 6.
| #Phix | Phix | without js -- position
position(6,3)
puts(1,"Hello")
|
http://rosettacode.org/wiki/Teacup_rim_text | Teacup rim text | On a set of coasters we have, there's a picture of a teacup. On the rim of the teacup the word TEA appears a number of times separated by bullet characters (•).
It occurred to me that if the bullet were removed and the words run together, you could start at any letter and still end up with a meaningful three... | #Arturo | Arturo | wordset: map read.lines relative "unixdict.txt" => strip
rotateable?: function [w][
loop 1..dec size w 'i [
rotated: rotate w i
if or? [rotated = w][not? contains? wordset rotated] ->
return false
]
return true
]
results: new []
loop select wordset 'word [3 =< size word] 'wo... |
http://rosettacode.org/wiki/Teacup_rim_text | Teacup rim text | On a set of coasters we have, there's a picture of a teacup. On the rim of the teacup the word TEA appears a number of times separated by bullet characters (•).
It occurred to me that if the bullet were removed and the words run together, you could start at any letter and still end up with a meaningful three... | #AutoHotkey | AutoHotkey | Teacup_rim_text(wList){
oWord := [], oRes := [], n := 0
for i, w in StrSplit(wList, "`n", "`r")
if StrLen(w) >= 3
oWord[StrLen(w), w] := true
for l, obj in oWord
{
for w, bool in obj
{
loop % l
if oWord[l, rotate(w)]
{
... |
http://rosettacode.org/wiki/Terminal_control/Clear_the_screen | Terminal control/Clear the screen | Task
Clear the terminal window.
| #6502_Assembly | 6502 Assembly | tmpx -i clrscr.s -o bin/clrscr.prg
|
http://rosettacode.org/wiki/Terminal_control/Clear_the_screen | Terminal control/Clear the screen | Task
Clear the terminal window.
| #68000_Assembly | 68000 Assembly | JSR $C004C2 ;clear the FIX layer
JSR $C004C8 ;clear hardware sprites |
http://rosettacode.org/wiki/Terminal_control/Clear_the_screen | Terminal control/Clear the screen | Task
Clear the terminal window.
| #8080_Assembly | 8080 Assembly | putch: equ 2 ; CP/M 'putchar' syscall
bdos: equ 5 ; CP/M BDOS entry point
FF: equ 12 ; ASCII form feed
org 100h
mvi c,putch ; Print character (syscall goes in C register)
mvi e,FF ; Form feed (argument goes in E register)
jmp bdos ; Call CP/M BDOS and quit |
http://rosettacode.org/wiki/Ternary_logic | Ternary logic |
This page uses content from Wikipedia. The original article was at Ternary logic. 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)
In logic, a three-valued logic (also trivalent, ternary, or trinary... | #Delphi | Delphi | unit TrinaryLogic;
interface
//Define our own type for ternary logic.
//This is actually still a Boolean, but the compiler will use distinct RTTI information.
type
TriBool = type Boolean;
const
TTrue:TriBool = True;
TFalse:TriBool = False;
TMaybe:TriBool = TriBool(2);
function TVL_not(Value: Tri... |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Sidef | Sidef | say '£';
say "\x{FFE1}";
say "\N{FULLWIDTH POUND SIGN}";
say 0xffe1.chr; |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Tcl | Tcl | puts \u00a3 |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Verilog | Verilog | module main;
initial begin
$display("£");
end
endmodule |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Wren | Wren | System.print("£") |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #Xidel | Xidel | xidel -s -e 'parse-html("£ or £")'
£ or £ |
http://rosettacode.org/wiki/Terminal_control/Display_an_extended_character | Terminal control/Display an extended character | Task
Display an extended (non ASCII) character onto the terminal.
Specifically, display a £ (GBP currency sign).
| #XPL0 | XPL0 | code ChOut=8;
ChOut(0, $9C) \code for IBM PC's extended (OEM) character set
|
http://rosettacode.org/wiki/Text_processing/1 | Text processing/1 | 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.
Often data is produced by one program, in the wrong format for later use by another program or person. In these situations another pr... | #Erlang | Erlang |
-module( text_processing ).
-export( [file_contents/1, main/1] ).
-record( acc, {failed={"", 0, 0}, files=[], ok=0, total=0} ).
file_contents( Name ) ->
{ok, Binary} = file:read_file( Name ),
[line_contents(X) || X <- binary:split(Binary, <<"\r\n">>, [global]), X =/= <<>>].
main( Files ) ->
Acc = list... |
http://rosettacode.org/wiki/The_ISAAC_Cipher | The ISAAC Cipher | ISAAC is a cryptographically secure pseudo-random number generator (CSPRNG) and stream cipher. It was developed by Bob Jenkins from 1993 (http://burtleburtle.net/bob/rand/isaac.html) and placed in the Public Domain. ISAAC is fast - especially when optimised - and portable to most architectures in nearly all programming... | #PicoLisp | PicoLisp | (de add32 @
(mod32 (pass +)) )
(de mod32 (N)
(& N `(hex "FFFFFFFF")) )
(de isaac()
(let (Y 0 S (-13 6 -2 16 .))
(setq *CC (add32 *CC 1))
(setq *BB (add32 *BB *CC))
(for (I . X) *MM
(set (nth *MM I)
(setq Y
(add32
(get *MM (inc (% (>> ... |
http://rosettacode.org/wiki/Test_integerness | Test integerness | Mathematically,
the integers Z are included in the rational numbers Q,
which are included in the real numbers R,
which can be generalized to the complex numbers C.
This means that each of those larger sets, and the data types used to represent them, include some integers.
Task[edit]
Given a rational, real, or co... | #Raku | Raku | multi is-int ($n) { $n.narrow ~~ Int }
multi is-int ($n, :$tolerance!) {
abs($n.round - $n) <= $tolerance
}
multi is-int (Complex $n, :$tolerance!) {
is-int($n.re, :$tolerance) && abs($n.im) < $tolerance
}
# Testing:
for 25.000000, 24.999999, 25.000100, -2.1e120, -5e-2, Inf, NaN, 5.0+0.0i, 5-5i {
pr... |
http://rosettacode.org/wiki/Test_integerness | Test integerness | Mathematically,
the integers Z are included in the rational numbers Q,
which are included in the real numbers R,
which can be generalized to the complex numbers C.
This means that each of those larger sets, and the data types used to represent them, include some integers.
Task[edit]
Given a rational, real, or co... | #REXX | REXX | /* REXX ---------------------------------------------------------------
* 20.06.2014 Walter Pachl
* 22.06.2014 WP add complex numbers such as 13-12j etc.
* (using 13e-12 or so is not (yet) supported)
*--------------------------------------------------------------------*/
Call test_integer 3.14
Call test_integer 1.00000... |
http://rosettacode.org/wiki/Text_processing/Max_licenses_in_use | Text processing/Max licenses in use | A company currently pays a fixed sum for the use of a particular licensed software package. In determining if it has a good deal it decides to calculate its maximum use of the software from its license management log file.
Assume the software's licensing daemon faithfully records a checkout event when a copy of the ... | #R | R |
# Read in data, discard useless bits
dfr <- read.table("mlijobs.txt")
dfr <- dfr[,c(2,4)]
# Find most concurrent licences, and when
n.checked.out <- cumsum(ifelse(dfr$V2=="OUT", 1, -1))
times <- strptime(dfr$V4, "%Y/%m/%d_%H:%M:%S")
most.checked.out <- max(n.checked.out)
when.most.checked.out <- times[which(n.checked... |
http://rosettacode.org/wiki/Text_processing/Max_licenses_in_use | Text processing/Max licenses in use | A company currently pays a fixed sum for the use of a particular licensed software package. In determining if it has a good deal it decides to calculate its maximum use of the software from its license management log file.
Assume the software's licensing daemon faithfully records a checkout event when a copy of the ... | #Racket | Racket | #lang racket
;;; reads a licence file on standard input
;;; returns max licences used and list of times this occurred
(define (count-licences)
(let inner ((ln (read-line)) (in-use 0) (max-in-use 0) (times-list null))
(if (eof-object? ln)
(values max-in-use (reverse times-list))
(let ((mtch (regex... |
http://rosettacode.org/wiki/Test_a_function | Test a function |
Task
Using a well-known testing-specific library/module/suite for your language, write some tests for your language's entry in Palindrome.
If your language does not have a testing specific library well known to the language's community then state this or omit the language.
| #Pascal | Pascal | # ptest.t
use strict;
use warnings;
use Test;
my %tests;
BEGIN {
# plan tests before loading Palindrome.pm
%tests = (
'A man, a plan, a canal: Panama.' => 1,
'My dog has fleas' => 0,
"Madam, I'm Adam." => 1,
'1 on 1'... |
http://rosettacode.org/wiki/The_Twelve_Days_of_Christmas | The Twelve Days of Christmas | Task
Write a program that outputs the lyrics of the Christmas carol The Twelve Days of Christmas.
The lyrics can be found here.
(You must reproduce the words in the correct order, but case, format, and punctuation are left to your discretion.)
Other tasks related to string operations:
Metrics
Array length
Stri... | #Common_Lisp | Common Lisp | let
((gifts '("A partridge in a pear tree." "Two turtle doves, and"
"Three French hens," "Four calling birds,"
"Five gold rings," "Six geese a-laying,"
"Seven swans a-swimming," "Eight maids a-milking,"
"Nine ladies dancing," "Ten lords a-... |
http://rosettacode.org/wiki/The_Twelve_Days_of_Christmas | The Twelve Days of Christmas | Task
Write a program that outputs the lyrics of the Christmas carol The Twelve Days of Christmas.
The lyrics can be found here.
(You must reproduce the words in the correct order, but case, format, and punctuation are left to your discretion.)
Other tasks related to string operations:
Metrics
Array length
Stri... | #Cowgol | Cowgol | include "cowgol.coh";
var ordinals: [uint8][] := {
"first","second","third","fourth","fifth",
"sixth","seventh","eighth","ninth","tenth",
"eleventh","twelfth"
};
var gifts: [uint8][] := {
"Twelve drummers drumming",
"Eleven pipers piping",
"Ten lords a-leaping",
"Nine ladies dancing",
... |
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #Python | Python | import os
def get_windows_terminal():
from ctypes import windll, create_string_buffer
h = windll.kernel32.GetStdHandle(-12)
csbi = create_string_buffer(22)
res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
#return default size if actual size can't be determined
if not res: return 80,... |
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #Racket | Racket |
#lang racket
(require (planet neil/charterm:3:0))
(with-charterm
(charterm-screen-size))
|
http://rosettacode.org/wiki/Terminal_control/Dimensions | Terminal control/Dimensions | Determine the height and width of the terminal, and store this information into variables for subsequent use.
| #Raku | Raku | my $stty = qx[stty -a];
my $lines = $stty.match(/ 'rows ' <( \d+/);
my $cols = $stty.match(/ 'columns ' <( \d+/);
say "$lines $cols"; |
http://rosettacode.org/wiki/Terminal_control/Coloured_text | Terminal control/Coloured text | Task
Display a word in various colours on the terminal.
The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.
Optionally demonstrate:
How the system should determine if the terminal supports colour
Setting of the background colour
How to cause blinking or flashing (if ... | #BBC_BASIC | BBC BASIC | FOR col% = 0 TO 14
COLOUR col% : REM foreground
COLOUR 128+(15-col%) : REM background
PRINT "Rosetta Code"
NEXT |
http://rosettacode.org/wiki/Terminal_control/Coloured_text | Terminal control/Coloured text | Task
Display a word in various colours on the terminal.
The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.
Optionally demonstrate:
How the system should determine if the terminal supports colour
Setting of the background colour
How to cause blinking or flashing (if ... | #Befunge | Befunge | <v0"1Red"0"2Green"0"4Blue"0"5Magenta"0"6Cyan"0"3Yellow"00
,_:!#@_:"m3["39*,,,\,,"m4["39*,,,\"g"\->:#,_55+"m["39*,,, |
http://rosettacode.org/wiki/Terminal_control/Coloured_text | Terminal control/Coloured text | Task
Display a word in various colours on the terminal.
The system palette, or colours such as Red, Green, Blue, Magenta, Cyan, and Yellow can be used.
Optionally demonstrate:
How the system should determine if the terminal supports colour
Setting of the background colour
How to cause blinking or flashing (if ... | #C | C | #include <stdio.h>
void table(const char *title, const char *mode)
{
int f, b;
printf("\n\033[1m%s\033[m\n bg\t fg\n", title);
for (b = 40; b <= 107; b++) {
if (b == 48) b = 100;
printf("%3d\t\033[%s%dm", b, mode, b);
for (f = 30; f <= 97; f++) {
if (f == 38) f = 90;
printf("\033[%dm%3d ", f, f);
}
... |
http://rosettacode.org/wiki/Terminal_control/Cursor_movement | Terminal control/Cursor movement | Task
Demonstrate how to achieve movement of the terminal cursor:
how to move the cursor one position to the left
how to move the cursor one position to the right
how to move the cursor up one line (without affecting its horizontal position)
how to move the cursor down one line (without affecting its horizontal po... | #Common_Lisp | Common Lisp | (defun cursor-movement ()
(with-screen (scr :input-blocking t :input-echoing nil :cursor-visible t)
;; display the screen and wait for a keypress
(refresh scr) (get-char scr)
(move-direction scr :right) (refresh scr) (get-char scr)
(move-direction scr :left) (refresh scr) (get-char scr)
(move-di... |
Subsets and Splits
Rosetta Code COBOL Python Hard Tasks
Identifies and retrieves challenging tasks that exist in both COBOL and Python, revealing cross-language programming patterns and difficulty levels for comparative analysis.
Rosetta Code Task Comparisons
Identifies tasks common to both COBOL and Python languages that are described as having difficulty levels, revealing cross-language task similarities and providing useful comparative programming examples.
Select Specific Languages Codes
Retrieves specific programming language names and codes from training data, providing basic filtering but limited analytical value beyond identifying these particular languages.