Questions tagged [whitespace]

For challenges related to the processing and placement of whitespace characters (mainly, but not limited to spaces, tabs and line feeds), like challenges related to indentation. For challenges about the esoteric programming language Whitespace, use [whitespace-language] instead.

Filter by
Sorted by
Tagged with
52
votes
9answers
4k views

Unfolding the Hexagony source code

Introduction If you're not familiar with Hexagony, it's an esoteric language created by Martin Büttner. The thing is that this language accepts multiple forms for the program. The following programs ...
100
votes
25answers
15k views

Print a Negative of your Code

Consider a square of printable ASCII characters (code points 0x20 to 0x7E) for side length N, like the following (here, N = 6): ...
79
votes
44answers
7k views

Telescopic Parentheses

Consider a non-empty string of correctly balanced parentheses: (()(()())()((())))(()) We can imagine that each pair of parentheses represents a ring in a ...
55
votes
24answers
6k views

Significant Whitespace

We define whitespace to be any of the three characters, tab (0x09), newline (0x0A) or space (0x20). For this challenge, you're to write two programs or functions in the same programming language, ...
30
votes
46answers
3k views

Reversing of Words

Sona is in her house with her 10 year old daughter. She needs to go to school to bring back another child from school, as school is over at 2 pm. It's hot outside, so she wants to leave her younger ...
18
votes
15answers
2k views

Significant Whitespace: Robbers

This is part of a Cops and Robbers challenge. Go here for the cops' part. For the purpose of this challenge, we'll define whitespace as only linefeeds (0x0A) and spaces (0x20). Note that most ...
16
votes
23answers
2k views

Indent a string using given parentheses

Given the following input to the program: List of block start characters List of block end characters A string to format format the string with the blocks delimited by the two character sets ...
42
votes
5answers
2k views

My god, it's full of spaces!

Some people insist on using spaces for tabulation and indentation. For tabulation, that's indisputably wrong. By definition, tabulators must be used for tabulation. Even for indentation, tabulators ...
31
votes
5answers
1k views

Break tabs in half

Holy wars have been fought over spaces vs. tabs. (And of course spaces, being objectively superior, won.) —Alex A. Some people still refuse to accept that which is clearly supreme. You've just ...
51
votes
25answers
5k views

Significant Whitespace: Cops

For the purpose of this challenge, we'll define whitespace as only linefeeds (0x0A) and spaces (0x20). Note that most languages and regex flavours consider many other characters as whitespace as well, ...
48
votes
7answers
3k views

Avoiding Rivers

Background In typography, rivers are visual gaps in a block of text, which occur due to coincidental alignment of spaces. These are particularly annoying since your brain seems to pick them up more ...
32
votes
4answers
2k views

Code Explanation Formatter

Successful code golf submissions are, by nature, filled with crazy symbols all over the place. To make their submission easier to understand, many code-golfers choose to include an explanation of ...
10
votes
3answers
526 views

Expand tabs (implement expand(1))

Your task this time is to implement a variant of the POSIX expand(1) utility which expands tabs to spaces. Your program is to take a tabstop specification and then ...
22
votes
6answers
2k views

Mutual Negative Quines

This was inspired by Print a Negative of your Code and Golf a mutual quine. Consider a rectangle of characters, that meet the following restrictions: Consists solely of printable ASCII characters ...
18
votes
30answers
2k views

Remove common leading spaces

When coding in Python, sometimes you want a multiline string within a function, e.g. def f(): s = """\ Line 1 Line 2 Line 3""" (The backslash is ...
18
votes
46answers
3k views

Create a codeblock tool

When using Markup, like on the SE network, an indentation of four spaces before a line of text denotes it as part of a code block, as I hope you know. If you don't, here's an example (with ...
26
votes
15answers
3k views

Goodness, it's covered in tabs!

Space indentation users, unite! We must fight against all the lowly tab users! Your mission (should you choose to accept it) is to write a program or function that takes in two arguments: A string: ...
12
votes
7answers
1k views

C code indenter

Situation: You are a high school teacher, teaching your computing class how to write C programs. However, since it is just the beginning of the term, you haven't taught them about the importance of ...
6
votes
5answers
1k views

Remove Whitespace from a Java Program [closed]

In this challenge, you will be given the source code of a Java program. Your task is to write a function or full program that will remove the whitespace from this program. The whitespace-removed ...
24
votes
15answers
5k views

End the tabs versus space war

End the tabs versus space war So, there has been a great deal of debate of whether to use tabs or spaces to indent/format code. Can you help the university settle the dispute, by going to an ...
20
votes
10answers
2k views

Exploit “free whitespace”

Suppose a codegolf challenge doesn't count whitespace in the length of your program. Cheat this system by encoding your script into whitespace, and golf a script which decodes and executes embedded ...