Sandbox: Difference between revisions

From Rosetta Code
Content added Content deleted
m (#ask gets an intro.)
Line 17: Line 17:
* http://semantic-mediawiki.org/wiki/Help:Result_formats
* http://semantic-mediawiki.org/wiki/Help:Result_formats


{{Category:Maintenance}}
{{#ask: [[Category:Maintenance]]
{{#ask: [[Category:Maintenance]]
| intro=These pages need the maintenance!!!
| format=category
| format=category
| limit=20
| limit=20

Revision as of 22:21, 24 August 2011

Which mu is the correct mu?

Can you use a data URL?

Text [data:text/html,Hello%20World No.]

What if you transclude a category?

Follow the articles and subcategories for items requiring maintenance. -- Okay, the member list doesn't show up. No good.

Using the Semantic MediaWiki (SMW)

These pages need the maintenance!!!

TITLE

code

pre test

Programming Task
This is a programming task. It lays out a problem which Rosetta Code users are encouraged to solve, using languages they know.

Code examples should be formatted along the lines of one of the existing prototypes.
<reddit programming/>
Test
Another line
Yet another line, this time one which clearly is much longer than the width of the browser window, at least assuming normal screen dimensions and font settings, and assuming the browser window is not wider than the screen (which would be impractical anyway).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Testing new language tags

Z80

<lang z80>

some random instructions
 ld a, 80h
 ld b, 9Ah
 add a, b
 adc a, a
 rst 0 ; reboot :-)

</lang>

Whitespace

<lang whitespace> This may not be a meaningful whitespace

 program,

but it's just a highlighting test anyway. </lang>

AviSynth

<lang avisynth> AviSource("D:\clip.avi") ConvertToYUY2() PixieDust(5) </lang>

POV-Ray

<lang povray>

  1. declare factorial = function(C) { prod(i, 1, C, i) }
  2. declare A = factorial(5);

sphere{0,A} // a sphere </lang>

Text

<lang text> Is this actually a programming language, or really just plain text? </lang>

What happens if a language doesn't exist?

<lang somelanguagethatdoesnotexist> some code more code;

  • a b -> c /// &a1 ->>> 778

(Probably this is an obfuscated language :-)) </lang>

Whitespace test with unicode ZERO WIDTH NO-BREAK SPACE character (U+FEFF)

<lang whitespace>



</lang> testing

Impl needed

Tcl pages: 987

Tcl/Omit pages: 7

Programming tasks: 1,271

Property query test

If I understand the ask syntax correctly, this should turn up a list of all programming languages: 0815, 11l, 1C, 360 Assembly, 4D, 4DOS Batch, 6502 Assembly, 6800 Assembly, 68000 Assembly, 8 1/2, 80386 Assembly, 8051 Assembly, 8080 Assembly, 8086 Assembly, 8th, A+, AArch64 Assembly, ABAP, ABC, ACL2, AHDL, ALGOL, ALGOL 60, ALGOL 68, ALGOL W, ALGOL-M, AMPL, ANSI BASIC, ANT, ANTLR, APL, ARM Assembly, ASIC, ASP, ASP.Net, ATS, AWK, Acornsoft Lisp, Action!, ActionScript, Acurity Architect, Ada, Agda, Agda2, Agena, Aikido, Aime, Algae, Alice ML, Alore... further results

Or maybe it works this way: 0815, 11l, 1C, 360 Assembly, 4D, 4DOS Batch, 6502 Assembly, 6800 Assembly, 68000 Assembly, 8 1/2, 80386 Assembly, 8051 Assembly, 8080 Assembly, 8086 Assembly, 8th, A+, AArch64 Assembly, ABAP, ABC, ACL2, AHDL, ALGOL, ALGOL 60, ALGOL 68, ALGOL W, ALGOL-M, AMPL, ANSI BASIC, ANT, ANTLR, APL, ARM Assembly, ASIC, ASP, ASP.Net, ATS, AWK, Acornsoft Lisp, Action!, ActionScript, Acurity Architect, Ada, Agda, Agda2, Agena, Aikido, Aime, Algae, Alice ML, Alore... further results

Maybe this way: Nor does this.

Maybe this way: "$BLOCK--.REX", $BLOCK.REX, $ERR.HEL, $ERR.REX, $MORSE.HEL, $MORSE.REX, $SPELL.HEL, $SPELL.REX, $SUDOKU.HEL, $T.HEL, $T.REX, -RF-, 0cred, 100 doors, 100 prisoners, 10001th prime, 10Print, 15 puzzle game, 15 puzzle game in 3D, 15 puzzle solver, 16 puzzle game, 16 puzzle game/autohotkey, 2048, 21 game, 24 game, 24 game/Solve, 3d turtle graphics, 4-rings or 4-squares puzzle, 4-rings or 4-squares puzzle/X86 Assembly, 4tH, 7Basic, 8080 PL/M Compiler, 9 billion names of God the integer, 99 Bottles of Beer/Basic, 99 bottles of beer, A Zebrahead, A* search algorithm, A+B, A13x, ABC problem, ABC words, ADFGVX cipher, ADW Modula-2, ADub, AJFarmar, AKS test for primes, ALGOL 68 Genie, ALGOL 68R, ALGOL 68RS, ALGOL 68S... further results

This gives a lot of stuff I dont want, but not what I want. Maybe the following works: No.

Maybe this: Again nothing.

This should turn up all languages and libraries which provide Graphics: AWT, FLTK, FLTK4d, GTK, JavaFX, JavaFX, Kivy, MINOS, Swing, Tk, XUL::Gui

This should turn up anything which does not provide Graphics: Ayrch, Binary Lambda Calculus, C++, Emacs Lisp, Go, JavaFX, JavaFX, Slope, Swing, TclX, Ultimate++, Unlambda, V (Vlang)

as I learned now, it instead turns up anything which provides something other than Graphics.

This should turn up anything which provides first class functions: Binary Lambda Calculus, Emacs Lisp, Go, Slope, Unlambda, V (Vlang)

And this should be the intersection of the previous two sets: Binary Lambda Calculus, Emacs Lisp, Go, Slope, Unlambda, V (Vlang)

This should turn up anything that provides or allows Graphics: AWT, Ayrch, C++, FLTK, FLTK4d, GTK, JavaFX, JavaFX, Kivy, MINOS, Swing, Tk, Ultimate++, XUL::Gui

This should turn up anything implemented in a language that provides graphics: Nothing!?

Does "implemented in language" work? Let's see everything implemented in Unlambda: 99 bottles of beer, Comments, Empty program, Function composition, Hello world/Text, Loops/Infinite, Program termination, Quine, Reverse a string, Rot-13, Sierpinski triangle

This should turn up anything implemented in a language that allows graphics: 100 doors, 100 prisoners, 10001th prime, 15 puzzle game, 15 puzzle solver, 2048, 21 game, 24 game, 24 game/Solve, 4-rings or 4-squares puzzle, 9 billion names of God the integer, 99 bottles of beer, A* search algorithm, A+B, ABC problem, ABC words, ADFGVX cipher, AKS test for primes, ASCII art diagram converter, AVL tree, Abbreviations, automatic, Abbreviations, easy, Abbreviations, simple, Abelian sandpile model, Abelian sandpile model/Identity, Abstract type, Abundant odd numbers, Abundant, deficient and perfect number classifications, Accumulator factory, Achilles numbers, Ackermann function, Active object, Addition chains, Additive primes, Address of a variable, Algebraic data types, Align columns, Aliquot sequence classifications, Almkvist-Giullera formula for pi, Almost prime, Alternade words, Amb, Amicable pairs, Anadromes, Anagrams, Anagrams/Deranged anagrams, Anaprimes, Angle difference between two bearings, Angles (geometric), normalization and conversion, Animate a pendulum... further results

This might turn up anything which has a "provides" property: Or it might not. :-)

What about this: AWT, Ayrch, Binary Lambda Calculus, C++, Emacs Lisp, FLTK, FLTK4d, GTK, Go, JavaFX, JavaFX, Kivy, MINOS, Slope, Swing, TclX, Tk, Ultimate++, Unlambda, V (Vlang), XUL::Gui

Is Classes implemented in C++? 1 (1 = yes, 0 = no).

Is Classes implemented in Unlambda? 0 (1 = yes, 0 = no).

The following assumes a (currently non-existent) template "ignore" which takes an argument and ignores it. With that template, if the task Mutex is implemented in C++, nothing would be printed, otherwise a nested ask is executed, which just lists all requirements of Mutex (assuming I've got everything right): Template:Ignore

And now the same with Unlambda instead of C++ (there's of course no Unlambda implementation):

 Requires
MutexCapability:Concurrency

The same without the "Requires" text:

  
MutexCapability:Concurrency

Memoization

Memoization is a method used to reduce function calls in recursive functions or other functions that are called very frequently. The basic idea behind memoizing is to store results for new sets of inputs (typically in a key-value style) so that the function will not have to re-compute those results later.

Functions which can be memoized are ones that give the same answer for a set of inputs each time those inputs are used. Fibonacci number functions are often memoized to reduce their call trees and calculation times over time. The basic operation of a memoized function would look something like this:

function a with inputs
   if inputs have been seen before
      return a stored answer from when they were seen
   else
      compute the answer for inputs
      store that (inputs, answer) pair
      return that answer
end function

Some programs may negate the condition in the "if" and swap the operations.

The overall benefit is that a function frequently called with the same set of inputs can save time by remembering the answer after computing it once -- sacrificing memory for computation time. In systems where memory (or storage depending on the implementation of storing old results) comes at a premium, memoization is not a good option. As long as memory is available and input sets are used repeatedly, memoization can save lots of computation time.

For tasks that use/can benefit from/(whatever) memoization, see Category:Memoization

[[Encyclopedia]][[Category:Memoization]]

Category:Memoization

The main page for this category is Memoization.

Memoization is a method used to reduce function calls in recursive functions or other functions that are called very frequently. The basic idea behind memoizing is to store results for new sets of inputs (typically in a key-value style) so that the function will not have to re-compute those results later.

For more information, see Memoization.