Giter Site home page Giter Site logo

braces-be-gone's Introduction

Braces Be Gone

Get those pesky braces out of your face.

Example

The input file, Permuter.java:

public class Permuter
{
	private static void permute(int n, char[] a)
	{
		if (n == 0)
		{
			System.out.println(String.valueOf(a));
		}
		else
		{
			for (int i = 0; i <= n; i++)
			{
				permute(n-1, a);
				swap(a, n % 2 == 0 ? i : 0, n);
			}
		}
	}

	private static void swap(char[] a, int i, int j)
	{
		char saved = a[i];
		a[i] = a[j];
		a[j] = saved;
	}
}

Running BracesBeGone.hs Permuter.java prints:

public class Permuter                                          {
	private static void permute(int n, char[] a)           {
		if (n == 0)                                    {
			System.out.println(String.valueOf(a))  ;}
		else                                           {
			for (int i = 0; i <= n; i++)           {
				permute(n-1, a)                ;
				swap(a, n % 2 == 0 ? i : 0, n) ;}}}

	private static void swap(char[] a, int i, int j)       {
		char saved = a[i]                              ;
		a[i] = a[j]                                    ;
		a[j] = saved                                   ;}}

Usage

% BracesBeGone.hs --help
Braces Be Gone

Usage: BracesBeGone.hs [FILE] [-o|--output FILE] [--tab-width TABWIDTH]
                       [--min-line-width LINEWIDTH] [--brace-chars CHARS]

Available options:
  -h,--help                Show this help text
  FILE                     Input source FILE (default: stdin)
  -o,--output FILE         Write output to FILE (default: stdout)
  --tab-width TABWIDTH     Count tab characters as TABWIDTH spaces (default: 8)
  --min-line-width LINEWIDTH
                           Align braces at least to LINEWIDTH (default: 0)
  --brace-chars CHARS      Use CHARS as braces (default: "{};")

You'll need Haskell Stack to run this.

Contact

Olle Fredriksson - https://github.com/ollef

braces-be-gone's People

Contributors

ollef avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

braces-be-gone's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.