text:
Integer mark into grade
Given a positive integer (0 and above, no maximum), convert it into a grade following these rules:
A = 100+
B = 90 - 99
C = 80 - 89
D = 70 - 79
E = 60 - 69
F = 59 and less.

This felt a little boring, so make the grade a + if it's 7,8 or 9 and a - if it's 0,1 or 2. Ignore this for the F and A cases.
An example:
Input:
65

Output:
E

Test cases:
0  -> F
20 -> F
65 -> E
72 -> D-
75 -> D
80 -> C-
99 -> B+
102 -> A
864 -> A

No trailing spaces. One newline after output is fine, but keep it consistent. Functions and full programs are both fine.
This is code golf, so shortest code wins. This was inspired by an Ask Ubuntu question, How to write a shell script to assign letter grades to numeric ranges?. The answers are in bash and python, so slightly spoilers.

Leaderboard:
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

var QUESTION_ID=49876;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),e.has_more?getAnswers():process()}})}function shouldHaveHeading(e){var a=!1,r=e.body_markdown.split("\n");try{a|=/^#/.test(e.body_markdown),a|=["-","="].indexOf(r[1][0])>-1,a&=LANGUAGE_REG.test(e.body_markdown)}catch(n){}return a}function shouldHaveScore(e){var a=!1;try{a|=SIZE_REG.test(e.body_markdown.split("\n")[0])}catch(r){}return a}function getAuthorName(e){return e.owner.display_name}function process(){answers=answers.filter(shouldHaveScore).filter(shouldHaveHeading),answers.sort(function(e,a){var r=+(e.body_markdown.split("\n")[0].match(SIZE_REG)||[1/0])[0],n=+(a.body_markdown.split("\n")[0].match(SIZE_REG)||[1/0])[0];return r-n});var e={},a=1,r=null,n=1;answers.forEach(function(s){var t=s.body_markdown.split("\n")[0],o=jQuery("#answer-template").html(),l=(t.match(NUMBER_REG)[0],(t.match(SIZE_REG)||[0])[0]),c=t.match(LANGUAGE_REG)[1],i=getAuthorName(s);l!=r&&(n=a),r=l,++a,o=o.replace("{{PLACE}}",n+".").replace("{{NAME}}",i).replace("{{LANGUAGE}}",c).replace("{{SIZE}}",l).replace("{{LINK}}",s.share_link),o=jQuery(o),jQuery("#answers").append(o),e[c]=e[c]||{lang:c,user:i,size:l,link:s.share_link}});var s=[];for(var t in e)e.hasOwnProperty(t)&&s.push(e[t]);s.sort(function(e,a){return e.lang>a.lang?1:e.lang<a.lang?-1:0});for(var o=0;o<s.length;++o){var l=jQuery("#language-template").html(),t=s[o];l=l.replace("{{LANGUAGE}}",t.lang).replace("{{NAME}}",t.user).replace("{{SIZE}}",t.size).replace("{{LINK}}",t.link),l=jQuery(l),jQuery("#languages").append(l)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",answers=[],page=1;getAnswers();var SIZE_REG=/\d+(?=[^\d&]*(?:<(?:s>[^&]*<\/s>|[^&]+>)[^\d&]*)*$)/,NUMBER_REG=/\d+/,LANGUAGE_REG=/^#*\s*([^,]+)/;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Wouldn't there be an A+ and A-? I don't see why we're ignoring them.

@ASCIIThenANSI makes it more interesting to have exceptions, and there is no maximum for the A, so no +

That classification board has a bug: the fish version is older and my answer is before it.

@IsmaelMiguel It was written when earliest post was not the default tie breaker yet (so it doesn't order ties at all). I'll try to fix it at some point though (probably not for this challenge, but at least the source on meta).

@MartinBüttner I was just pointing it out.

Python 2, 72 70 62 bytes
lambda n:"FA"[n>59:1+n/100]or chr(75-n/10)+"+-"[(n+3)%10/3::2]

This is an anonymous function that takes an int and returns the grade as a string.
(thanks to @MartinBüttner, @grc and @TheNumberOne for tips)

"EDCB"[n/10-6] -> chr(75-n/10)

What a clever way to select a character that might be empty!

CJam, 34 33 32 bytes
riAmd)4/"- +"=S-\Ae<5e>_~'L+o5%<

Okay, I've tried multiple approaches now and am unable to get this below 33, so here goes the explanation:
ri                                 e# Read the input and convert to integer
  Amd                              e# Take divmod of the input with 10. This leaves the
                                   e# number/10 and number%10 on stack
     )4/                           e# Increment the mod by 1 and integer divide by 4.
        "- +"=S-                   e# This converts 0,1,2 to 0 and 7,8,9 to 2. Pick - or +
                                   e# respectively and remove space in case of 3,4,5 and 6
                \Ae<5e>            e# To the divisor by 10 scope it to range of [5,10]
                       _~          e# Take a copy and do number * -1 - 1
                         'L+       e# Add it to char L. This gets us the required grade
                            o      e# Output the grade. This removes it from stack
                             5%    e# We now have scoped divisor on stack. Do mod with 5
                               <   e# Both 5 and 10 will return 0, in which case, we don't
                                   e# want the + or -. So we do a substr(0, 0).
                                   e# 5 represents F and 10, A. For others, it will do
                                   e# substr(0,X) where X > 0. Since the string is only
                                   e# 1 char long, it doesn't affect at all.

UPDATE: 1 byte saved thanks to a pointer by Dennis
Try it online here

What does the s do?

@Dennis converts char +/-/space to string for the last <

That shouldn't be necessary. Character String - pushes a string.

@Dennis Ah, you are right. I think for some previous version, the usage was different.

Retina, 43 + 15 = 58 bytes
...+
A
.[012]
$&-
.[789]
$&+
^9.
B
^8.
C
^7.
D
6.
E
\d.*
F

Retina is a regex language created by Martin Büttner, where the odd-numbered files are the regex to match with, and the even-numbered files are what to replace it with. Each line is a separate file, so I've added 15 bytes for each additional file.
Explanation
It starts by making anything with 3 or more digits an A. It adds a - if it is two-digit number ending with 0, 1, or 2, and + if it ends with 7, 8, or 9. The numbers are then mapped to their grade (e.g. a number starting with 9 is given a B). Any number left over is automatically an F. Unfortunately, ;` must be prepended to all but to the last regex to suppress intermediate output. Update: version 0.5.0 has intermediate output off by default, allowing me to save a few bytes.

Are you sure it doesn't output + and - for the F case?

@Tim It shouldn't, because \d.* matches and replaces the whole string, + included.

Ahh okay - I can see that now! :)

C, 99 bytes
I'm new here, I hope I'm following the rules.
char b[3];char*f(n){b[1]=0;n<60?*b=70:n>99?*b=65:(*b=75-n/10,b[1]=n%10<3?45:n%10>6?43:0);return b;}

This function takes the mark as a parameter and returns the grade as a NULL-terminated string.
Explanation
Added whitespace:
char b[3];

char *f(n) {
    b[1] = 0;
    n<60 ? *b = 70 :
    n>99 ? *b = 65 :
    (
        *b = 75 - n / 10,
        b[1] = n % 10 < 3 ? 45 : n % 10 > 6 ? 43 : 0
    );

    return b;
}

Global variables are automatically initialized to zero, so b is filled with NULLs. Since only the first two characters are ever touched, we only have to worry about putting a NULL in b[1] if the grade has only one character. This NULL is inserted at the very beginning of the function.
The n parameter is implicitly int. If the grade is less than 60, then it's set to 'F', if it's bigger than 99 it's set to 'A'.
In the other cases, the base grade is given by 'E' - (n - 60) / 10, which simplifies to 75 - n / 10. n % 10 gets the units digit of the mark. If it's less than 3 then a - is appended, if it's bigger than 6 a + is appended, otherwise b[1] is nulled (which it already was).
Test cases
#include <stdio.h>

char b[3];char*f(n){b[1]=0;n<60?*b=70:n>99?*b=65:(*b=75-n/10,b[1]=n%10<3?45:n%10>6?43:0);return b;}

int main() {
    printf("  0 -> %s\n", f(0));
    printf(" 20 -> %s\n", f(20));
    printf(" 65 -> %s\n", f(65));
    printf(" 72 -> %s\n", f(72));
    printf(" 75 -> %s\n", f(75));
    printf(" 80 -> %s\n", f(80));
    printf(" 99 -> %s\n", f(99));
    printf("102 -> %s\n", f(102));
    printf("864 -> %s\n", f(864));

    return 0;
}

Output:
  0 -> F
 20 -> F
 65 -> E
 72 -> D-
 75 -> D
 80 -> C-
 99 -> B+
102 -> A
864 -> A

Perfect :) Nothing wrong there.

difference between ur code and mine is one word "printf" that should save more than 3 byts in case ignored :)

Pyth, 33 bytes
+C-75K@S[/QTT5)1<-@"- +"/heQ4d%K5

Try it online: Demonstration or Test Suite
Explanation:
                                     implicit: Q = input
        [/QTT5)                      create the list [Q/10, 10, 5]
       S                             sort
      @        1                     take the element in the middle
     K                               store in K (this results in a number between 5 and 10)
  -75K                               75 - K
 C                                   char with ASCII-value ...
                  @"- +"/heQ4        "- +"[(Q%10 + 1) / 4]
                 -           d       remove spaces
                <             %K5    slice [:K%5]
+                                    add these two chars and print

><> (Fish), 78 71 bytes
iii0)?/:0({:'6'(@@+?/'{'01.
;$-o:'4'(?\'7'(?;'+'o
 ;o'A'\   \'-'o;o'F'\

Method:

We read the codepoints of first 3 characters x,y,z from the input. If a character is not present the value of its variable's will be -1 implicitly. (ord(c) will mark the codepoint of the character c)
If z > 0 (3 digit input) print A and exit.
If x < ord('6') or y < 0 (input < 60) print F and exit.
Print the character with codepoint 123 - x.
If y < ord('4') print-` and exit.
If y > ord('6') print+` and exit.
Exit.

C, 67 65
Surprisingly, this is quite close to the python solution.
f(i){printf(i<60?"F":i>99?"A":"%c%s",75-i/10,"-\0+"+(i%10+1)/4);}

But in order for this program, to come to such great shortness, sacrifices had to be made:

If an F or an A is printed printf doesn't even look at the
other arguments passed. This is a quite nasty hack.
If (i%10+1)/4 evaluates to 1 (no + or - should be appended to the grade), the %s formatter receives a pointer to a \0 byte, so nothing is printed. Also quite funny, because I didn't know that you could take the address of an indexed string literal. (e.g. &"string"[i]) (edit: "string"+i is even shorter! Thanks @nutki)

Here the output of the program for the numbers 57 to 102.
I made it a hexdump, so we can be sure no weird \0 bytes have been printed.
% seq 44 115 | xargs -n1 ./grade | xxd
0000000: 4646 4646 4646 4646 4646 4646 4646 4646  FFFFFFFFFFFFFFFF
0000010: 452d 452d 452d 4545 4545 452b 452b 452b  E-E-E-EEEEE+E+E+
0000020: 442d 442d 442d 4444 4444 442b 442b 442b  D-D-D-DDDDD+D+D+
0000030: 432d 432d 432d 4343 4343 432b 432b 432b  C-C-C-CCCCC+C+C+
0000040: 422d 422d 422d 4242 4242 422b 422b 422b  B-B-B-BBBBB+B+B+
0000050: 4141 4141 4141 4141 4141 4141 4141 4141  AAAAAAAAAAAAAAAA

The main method used:
main(c,v)char**v;{f(atoi(v[1]));}

&"string"[i] is unnecessary as it is equivalent to shorter "string"+i with which you can save 2 bytes.

i must be objective and upovote this :) congrats , u beated all C records

CJam, 41 39 37 34 bytes
This is way too long, but I don't think I'll be golfing it further for now.
qiAmd'K@Ae<5e>:X-X5%g@)4/"- +"=*S-

Test it here. Or run all test cases here.
Three bytes saved by Optimizer.
Explanation
(Slightly outdated)
qi                                    e# Read input and convert to integer.
  'K1$                                e# Push the character K, then copy the input.
      A/                              e# Divide by 10.
        Ae<5e>                        e# Clamp the result to the range 5..10.";
              -                       e# Subtract from K to get the grade.
               _'Am                   e# Duplicate get difference to A.
                   5%g                e# Check that its neither 0 (A) nor 5 (F).
                      @               e# Pull up the other copy of the input.
                       A%)4/          e# ((i % 10) + 1) / 4
                            "- +"=    e# Use that to select -, space, or +.
                                  *   e# Multiply it with the earlier boolean so that
                                      e# it vanishes for A and F.
                                   S- e# Remove the space if there is one.

GNU sed, 73 + 1 = 74 bytes
The + 1 is for the -r parameter.
s/^[1-5]?.$/F/
s/.{3,}/A/
s/[7-9]$/+/
s/[3-6]$//
s/[0-2]$/-/
y/9876/BCDE/

Python 2, 94 88 84 69 bytes
lambda g:g>99and'A'or[chr(75-g/10)+'-+'[g%10>2:1-(g%10>6)],'F'][g<60]

JavaScript (ES6), 66 bytes
Straight.

F=n=>n<60?'F':n>99?'A':'EDCB'[n/10-6|0]+(n%10>6?'+':n%10<3?'-':'')

// TEST (in Firefox)

for(i=0;i<111;i++)document.write(i+'='+F(i)+' ')

R, 107 105 99 bytes
Not a very good effort I'm afraid, but I will try and golf it more later.
cat(LETTERS[11-(r=min(max(scan(),59),100))%/%10],if(r>59&r<100)c('-','','+')[(r%%10+1)/4+1],sep='')

Edit Dropped a couple of ifs.  Fixed the case and an incorrect result for 100.  Now to get rid of the ifelses. Got rid of ifelses.

I think you want LETTERS rather than letters.

Perl, 66 62 bytes
This can probably be golfed more. Also a different way might be better.
$_=$_>99?A:$_<60?F:s/\d$/$&>6?"+":$&<3?"-":""/re;y/9876/BCDE/

+1 for -p
Run with:
echo 72 | perl -pE'$_=$_>99?A:$_<60?F:s/\d$/$&>6?"+":$&<3?"-":""/re;y/9876/BCDE/'

Why not use -p and drop the say?

@ThisSuitIsBlackNot thanks! Updated

Javascript (ES6), 78 79 bytes
This really isn't the smartest option, but I did what I could.
F=n=>'FEDCBA'[n[2]?5:n<60?0:n[0]-5]+(n[2]||n<60?'':'-+\n'[n[1]<3?0:n[1]>6?1:2])

Simply pass the grade as a string, and it will return it's grade letter.
The string part in very important.
You can check a testcase here:

console._RELAY_TO_DOC=true;

//non-es6 version:

function F(n){return 'FEDCBA'[n[2]?5:n<60?0:n[0]-5]+(n[2]||n<60?'':'-+\n'[n[1]<3?0:n[1]>6?1:2])}

var testcases=[0,20,65,72,75,77,80,90,99,100,102,180,1000],
    results={};

for(var i in testcases)
{
  results[testcases[i]]=F(testcases[i]+'');
}

console.log(results);

If the aditional space after the letter isn't allowed, I will happily remove it. It wasn't! This increased my code by 1 byte, but nothing (too) serious.

@Tim Fixed it. I hope it is enough. Quoting yourself: "One newline after output is fine, but keep it consistent.". I think that is consistent enough.

C#, 143 127 112 88 bytes
string g(int n){return n>=100?"A":n<=59?"F":(char)(75-n/10)+(n%10>6?"+":n%10<3?"-":"");}

I tried to be clever by doing ASCII number mods, but it seems I wasn't alone!
Thanks to Tim for advice on lists instead of ifs.
Thanks to DarcyThomas for pointing out I could use nested ternary operators.

Can you not cut down on the ifs using lists?

I'm not sure what you mean by using lists, could you explain a little?

In python I can do this: [item1,item2][condition]. If the condition is True it gives the 2nd item, if False the first.

Good idea! Added that.

I think you could use ternary if statements e.g., return <condition> ? <true result> : <false result> Note you can also nest them so return <condition> ? <true result> : <condition> ? <2nd true result> : < 2nd false result>

@DarcyThomas: Thanks for the tip, added your advice and managed to trim 24 bytes!

C, 102 bytes
int f(int h){int b,c;printf("%c%c",b?65:!c?70:75-h/10,!(b=h>99)*(c=h>59)*(((h%10<3)*45+(h%10>6)*43)));

}
Usage
#include <stdio.h>
int f(int );
int main(){
    int c;
    scanf("%d",&c);
    f(c);
}

You are missing the + and - part.

ah ok .... miss that

too long :( ....

Haskell, 78 bytes
The first line feels wasteful, costing 14 bytes, but I couldn't find a shorter version without it.
(#)=replicate
a="A":a
f=(!!)$60#"F"++[g:s|g<-"EDCB",s<-3#"-"++4#""++3#"+"]++a

Explanation
The operator # is a shorthand for creating n copies of its second argument. List a is an infinite list of Strings "A". Function f indexes into a list of all grades for n=0,1,... The list comprehension builds the "middle part" of this list (grades E to B); g is a single Char that is prepended to the String s (which may be empty).
Usage
ghci> map f [0,20,65,72,75,80,99,102,864]
["F","F","E","D-","D","C-","B+","A","A"]

dc, 52
[Anq]sa[Fnq]sf[q]sn16o?A~rd9<ad6>f20r-n1+4/d1=n45r-P

Output
$ for i in {0,20,65,72,75,80,99,102,864}; do printf "{%s -> %s} " $i $(dc -e '[Anq]sa[Fnq]sf[q]sn16o?A~rd9<ad6>f20r-n1+4/d1=n45r-P' <<< $i); done
{0 -> F} {20 -> F} {65 -> E} {72 -> D-} {75 -> D} {80 -> C-} {99 -> B+} {102 -> A} {864 -> A} $
$

TI-Basic, 79 74 76 Bytes
Input N
If N>99
105->N
sub("FFFFFFEDCBA",1+int(N.1),1
If Ans!="F
Ans+sub("---    +++",1+fPart(N.1),1
Ans

That does not work for numbers less than 10.

Nice catch, Tom, it was missing 1+

This also has (invisible) trailing spaces whenever there is no + or -.

TI-BASIC, 69 68 66 bytes
.1Ans
sub("F?E-E+D-D+C-C+B-B+A",1+2max(0,min(9,int(2Ans)-11)),int(e^(Ans<10 and Ans≥6 and iPart(2.2-5fPart(Ans

TI-BASIC is not good for string manipulation.
Input on the calculator homescreen, in the form of [number]:[program name].
Formatted:
.1Ans
sub(                      //Syntax for the substring command is sub(string, index, length)

    "F?E-E+D-D+C-C+B-B+A"                  //String that encodes possible grades

    ,1+2max(0,min(9,            ))         //Starts at "F" if input <60, "A" if >=100
                   int(2Ans)-11           //(Input-55)/5, so starts at "E" from 60 to 64,
                                          //second E from 65-69, D from 70 to 74, &c.

    ,int(e^(                                   //length 1 if false, 2 (includes +/-) if true
            Ans<10 and Ans≥6 and               //grade between 60 and 100
                                 iPart(               //1 if abs. val. of below >= 0.2
                                       2.2-5fPart(Ans  //2.2-.5(last digit)

This can probably be golfed further.

C#, 82 bytes
Func<int,string>g=s=>s>99?"A":s<60?"F":(char)(75-s/10)+(s%10<3?"-":s%10>6?"+":"");

Here's a fiddle with some test-cases.

JavaScript (ES6), 86 83 bytes
What's really eating up characters is the String.fromCharCode and the +/- condition... I strongly suspect there's a clever way to shorten at least one of them.
f=n=>n>99?'A':n<60?'F':String.fromCharCode(75.9-n/10|0)+(n%10<3?'-':n%10>6?'+':'');

If you want short code, String.fromCharCode is almost always useless. Use string indexing (see the other javascript answers)

Anyway, ~~(.1*-n+75.9) --> 75.9-n/10|0

@edc65 Thanks for the golfing advice! I'll keep string indexing in mind for the next occasion.

PHP5.5, 73 bytes
Once again, not the shortest one.
But it works!
<?=($n=$_GET[n])<59?F:($n>99?A:'BCDE'[$n[0]-6].'+-'[$n[1]<3?1:2*$n[1]<5])

I've classified it under PHP5.5 instead of just PHP since this uses syntax that is only valid for PHP5.5 and PHP5.6.
You can read about string and array dereferencing in the manual:
http://php.net/manual/en/migration55.new-features.php

Perl, 52
#!perl -p
$_=$_>99?A:$_<60?F:"$_"^"s";y/JK7890-6/BC+++\-\--/d

Ruby, 58 Bytes
Couldn't believe that there are no Ruby ones here.  On reflection it's fairly similar to some that are here already but anyway:
->x{x<60?'F':x>99?'A':(75-x/10).chr+'+-'[(x+3)%10/3].to_s}

Try it here

Excel, 100 bytes
=IF(A1<60,"F",IF(A1>99,"A",MID("EDCB",INT(A1/10)-5,1)&IF(MOD(A1,10)<3,"-",IF(MOD(A1,10)>6,"+",""))))


text:
Tips for golfing in Befunge 93
What general tips do you have for golfing in Befunge 93? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Befunge 93 (e.g. "remove comments" is not an answer). Please post one tip per answer.

There's already a Befunge 98 topic

As little white space as possible.
If you have a 10x5 (50) code, can you make it into a 6x8 (48):
some code
goes here
and it is
exactly 50
characters

goes to
put a bi
t of cod
e here a
nd count
all of 4
0 chars!

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Tips for golfing in LOLCODE
What general tips do you have for golfing in LOLCODE? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to LOLCODE. (e.g. "remove comments" is not an answer). Please post one tip per answer.

I had thought about posting this myself. It's actually not impossible to golf in LOLCODE.

Somewhat embarassingly, my second and third highest upvoted answers are in LOLCODE. So I will take this opportunity to share everything I know.

Define variables using the syntax variable R value rather than I HAS A variable ITZ value.
If you want to set a variable n equal to 1,
n R 1

is only 5 bytes, whereas
I HAS A n ITZ 1

is 15 bytes.

But then you lose the whole point of LOLCODE!

@Optimizer: To be fair, when is there ever a point to LOLCODE?

The point of LOLCODE is for the lols, of course.

@ace: Okay, you got me there.

lol

Wait, can't you only do that if the var is already defined?

@OldBunny2800 I think it depends on which interpreter you're using.

Using the lolcode.org language spec, it implies that <var> R <value> is only to change the value of a variable, similar to Javascript's var foo=bar vs foo=bar

@OldBunny2800 On this site we define languages by their implementations rather than their specifications. The R initialization and assignment works in LOLCoffee, the one available on http://repl.it.

AWSUM THX! I didn't know that.

In many cases it's shorter to read variable values from STDIN rather than defining a function. However, note that GIMMEH, which reads input from STDIN, always reads a YARN (i.e. string). But you can take advantage of LOLCODE's dynamic typing and add 0 to convert to a NUMBR.
For example,
GIMMEH n
n R SUM OF n AN 0
... (operations on n)

Defining n is 26 bytes, including newlines. Compare this to a user-defined function:
HOW DUZ I f YR n
    ... (operations on n)
IF U SAY SO

This requires 28 bytes.
Note that you could also multiply by 1 to convert to a NUMBR, but that requires 4 more bytes than the sum:
GIMMEH n
n R PRODUKT OF n AN 1

But n IS NOW A NUMBR is one byte shorter than n R SUM OF n AN 0

@LeakyNun Which implementation has that? I haven't seen it before.

In many LOLCODE implementations, such as the one on repl.it, HAI and KTHXBYE, which begin and end programs respectively, are unnecessary. In implementations in which they are necessary, the version number after HAI isn't necessary (e.g. HAI 1.2).
Similarly, the STDIO library is typically loaded by default, so CAN HAS STDIO? is also unnecessary.

When printing the value of a variable to STDOUT, consider the following:
VISIBLE variable

is much shorter than
VISIBLE ":{variable}"

Also, whenever a trailing newline is acceptable,
VISIBLE variable

which includes a trailing newline by default, is shorter than
VISIBLE variable!

which suppresses the newline.

Many operators have optional ANs in between them, as defined in the spec. For example:
SMOOSH "hello" AN ", world" MKAY

can be turned into this:
SMOOSH "hello" ", world" MKAY

Other operators that support this include BOTH, EITHER, WON, ALL, ANY, BOTH SAEM, and DIFFRINT. For some reason, the numerical operators don't allow you to remove the AN, though.
The spec also says, specifically for SMOOSH, that:

The line ending may safely implicitly close the SMOOSH operator without needing an MKAY.

Meaning this code should also be valid:
SMOOSH "hello" ", world"

However, the current version of lci doesn't seem to accept this behaviour :(

LOLCODE (surprisingly) doesn't actually need indentation, meaning you can turn this:
HOW IZ I FIB YR N
    I HAS A SML ITZ SMALLR OF N AN 1
    BOTH SAEM N AN SML
    O RLY?
        YA RLY
            FOUND YR 1
        NO WAI
            I HAS A FIRST ITZ I IZ FIB YR DIFF OF N AN 1 MKAY
            I HAS A SECOND ITZ I IZ FIB YR DIFF OF N AN 2 MKAY
            FOUND YR SUM OF FIRST AN SECOND
    OIC
IF U SAY SO

Into this:
HOW IZ I FIB YR N
I HAS A SML ITZ SMALLR OF N AN 1
BOTH SAEM N AN SML
O RLY?
YA RLY
FOUND YR 1
NO WAI
I HAS A FIRST ITZ I IZ FIB YR DIFF OF N AN 1 MKAY
I HAS A SECOND ITZ I IZ FIB YR DIFF OF N AN 2 MKAY
FOUND YR SUM OF FIRST AN SECOND
OIC
IF U SAY SO

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Multiply Pauli Matrices
The Pauli matrices are a set of 2x2 matrices which appear very commonly in quantum physics (no, you don't need to know any quantum physics for this challenge). If we include the identity in the set, the four matrices are:
 σ0 =      σ1 =      σ2 =      σ3 =
[1  0]    [0  1]    [0 -i]    [1  0]
[0  1]    [1  0]    [i  0]    [0 -1]

Multiplying two of these will always give another Pauli matrix, although it may be multiplied by one of the complex phases 1, i, -1, -i. For instance, σ1σ3 = -iσ2.
Your task is to multiply a number of Pauli matrices and return the resulting matrix and phase. Input will be given as a non-empty string of digits 0 to 3 representing the matrices σ0 to σ3. The output should be a string containing a single digit for the resulting matrix, optionally preceded by i, - or -i to indicate the phase (- is for -1).
You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest alternative), function return value or function (out) parameter.
You must not use any built-in (or 3rd-party) features related to Pauli matrices.
This is code golf, the shortest answer (in bytes) wins.
Test Cases
1 => 1
13 => -i2
000 => 0
123 => i0
03022 => 3
02132230 => -i3
1320130100032 => i2
311220321030322113103 => -2
0223202330203313021301011023230323 => -i0
1323130203022111323321112122313213130330103202032222223 => -1

I've added the [tag:abstract-algebra] tag because this is essentially asking for simplification of words in the generalised quaternion group.

Pyth, 47 bytes
I guess this is still golfable. But it beats CJam by a lot.
p.U&-=T*q3l{[0bZ)^_1%-Zb3xbZmvdz@+c"i - -i")khT

Try it online: Demonstration or Test Suite
Explanation
Determining the resulting matrix type is simply xoring all the numbers.
While multiplying 2 matrices A*B, the phase changes, if non of the matrices is σ0 and A != B.
                                                 implicit: T=10, z=input string
                            mvdz                 evaluate each char of the input
 .U                                              reduce: b=first value, for Y in mvdz[1:]
    -=T                                            T -= ...
        q3l{[0bZ)                                     (3 == len(set([0,b,Z])))
       *         ^_1%-Zb3                             * (-1)^((Z-b)%3)
   &                                               and
                         xbY                       update b by (b xor Y)
                                 +c"i - -i")k    the list ["i", "-", "-i", ""]
                                @            hT  take the element at index T+1 (modulo wrapping)
p                                                print phase and matrix

of course I have 44 if I use the same algorithm, which is essentially Sp300's.

Python 2, 108 89 87 86 bytes
x=y=0
for m in map(int,raw_input()):x+=m*y and(m-y)%3*3/2;y^=m
print"--i"[~x%4::2]+`y`

(Thanks to @grc and @xnor for the help)
Explanation
Let's split up the coefficient and the base matrix. If we focus on the base matrix only, we get this multiplication table (e.g. 13 is -i2, so we put 2):
  0123

0 0123
1 1032
2 2301
3 3210

which just happens to be the same thing as doing bitwise xor.
Now let's focus on the coefficients. If we let 0123 denote 1,i,-1,-i respectively, we get:
  0123

0 0000
1 0031
2 0103
3 0310

For this we first check if either number is 0 by doing m*y, taking care of the left column and top row. Adding in (m-y)%3 then gives:
  0123

0 0000
1 0021
2 0102
3 0210

which is close, except that we have 2 instead of 3. We account for this by performing *3/2.
For indexing, we notice that if we take the string "--i" and select every second character starting from indices 0123 we get "-i","-","i","".

Nice string slicing, I had forgotten about  this. I believe you can do 3-n%4 as ~n%4. I suspect you can express m*y and(m-y)%3*3/2 shorter in a magic string, but my first attempt 877449216>>2*m+8*y only tied. There's also a pretty algebraic formula,  that if Y=m^y, the expression is (m-y)*(y-Y)*(Y-m)/2, but that's long.

@xnor Oh ~, nice – the off-by-one was annoying me :/ I'm pretty sure m*y and(m-y)%3*3/2 can be shortened too, but I spent all night and didn't get anywhere... I'll come back to it if I have time. Maybe the fact that I have freedom mod 4 might help.

Retina, 77 bytes
I thought I'd use this opportunity to show off a new Retina feature: multi-stage loops. This should shorten many tasks considerably (especially conditional replacement).
ii
-
+`(.)\1|0

(.)-|(\d)(\d)
-$1$3$2
12
i3
23
i1
31
i2
)`(\d)i
i$1
^\D*$
$&0

Retina is my own regex-based programming language. The source code can be grouped into stages: each stage consists of two lines where the first contains the regex (and potentially some configuration) and the second line is the replacement string. The stages are then applied to STDIN in order and the final result is printed to STDOUT.
You can use the above directly as a source file with the -s command-line switch. However, I'm not counting the switch, because you can also just put each line in a separate file (then you lose 15 bytes for the newlines, but add +15 for the additional files).
Explanation
The new thing about this solution is the ) in the penultimate stage. This closes a multi-stage loop. There is no matching (, which means that the loop implicitly starts at the first stage. Hence, the first 7 stages are repeated until a full pass through all 7 of them stops changing the result. These 7 stages simply perform various transformations which gradually reduce the number of matrices in the string and combine phases. Once we reach the final result, none of the seven patterns matches any more and the loop ends. Afterwards, we append a 0 if there is no digit in the result yet (as the above stages simply drop all identities, including the result).
Here is what the individual stages do:
ii
-

Combines all pairs of i into - to reduce the phase characters.
+`(.)\1|0
<empty>

Now if there are two consecutive identical characters left, it's either -- or two identical matrices. In either case, multiplying them gives the identity. But we don't need identities, so we just remove all of them, and the explicit identities (the 0s) as well. This stage is repeated in itself with + until the result stops changing. This ensures that things like 123321 get resolved completely, such that the next step can assume that all pairs of digits are distinct.
(.)-|(\d)(\d)
-$1$3$2

This is actually two separate transformations in one (for golfitude). Note that if the first alternative matches, $2 and $3 are empty, and if the second one matches $1 is empty. So this can be decomposed into these two steps:
(\d)(\d)
-$2$1

This just swaps all pairs of digits and adds a minus sign. Since we removed all 0s and all identical pairs, this will only match 12, 23, 31, 21, 32, 13. This step may seem weird, but it allows me to only check for half of these cases later on, because the ones I can't process then will be swapped here in the next iteration.
The other part of the above stage was:
(.)-
-$1

This gradually moves - signs all the way to the left (one position per iteration). I do this such that ultimately they are all next to each other and get resolved in the earlier step.
12
i3
23
i1
31
i2

These three stages now simply resolve the three pairs of products. As I said above, this will only catch half of the relevant cases, but the other half will be taken care of in the next iteration, after the previous step swapped all pairs.
)`(\d)i
i$1

This is the last stage of the loop. It's similar to the one that shifts - to the left, except for i. The main difference is that this one swaps i only with digits. If I used (.)i then in cases where I get a -i or i- the two would be swapped indefinitely and the program wouldn't terminate. So this only swaps them to the right of the - signs. This is sufficient - as long as all - and i appear together at some point, they can be resolved correctly.
^\D*$
$&0

The final step (outside of the loop). Remember that we always deleted all identities, so if the result is actually the identity (times a phase), then we won't have the required digit in the output any more, so we add it back.
As an example, here are all the intermediate forms of 0223202330203313021301011023230323 (skipping stages that don't perform any changes):
0223202330203313021301011023230323

321321312        # Remove identities
-23-31-12-132    # Swap all pairs
-23-31-i3-132    # Resolve 12
-i1-31-i3-132    # Resolve 23
-i1-i2-i3-132    # Resolve 31
-i-1i-2i-3-312   # Move - to the left and swap pairs
-i-1i-2i-3-3i3   # Resolve 12
-i-i1-i2-3-i33   # Move i to the left
-i-i1-i2-3-i     # Remove identities
--ii-1i-2-3i     # Move - to the left
--ii-i1-2-i3     # Move i to the left
----i1-2-i3      # Resolve ii
i1-2-i3          # Remove identities
i-1-2i3          # Move - to the left
i-1-i23          # Move i to the left
-i-1i-32         # Move - to the left and swap pairs
-i-i1-32         # Move i to the left
--ii-1-23        # Move - to the left and swap pairs
--ii-1-i1        # Resolve 23
----1-i1         # Resolve ii
1-i1             # Remove identities
-1i1             # Move - to the left
-i11             # Move i to the left
-i               # Remove identities. Now the loop can't change this any longer.
-i0              # Fix the result by adding in the 0.

CJam, 58 56 bytes
I am sure this can be golfed a lot, but here it goes:
L'i'-"-i"]q{+:G$i:XA<X{GiB%_2m8%!+m<XB%gX3%3-z*}?s}*\0=o

Try it online here or run the complete suite here


text:
Ways to arrange the integers 1 to 9 with operators so that the result is 100
Prelude:
This task is taken from Five Problems Every Software Engineer Should Be Able to Solve in Less Than an Hour, which I really recommend.
The task:

Write a program that outputs all possibilities to put + or - or
nothing between the numbers 1, 2, ..., 9 (in this order) such that the result is always 100.

Winning Criteria:
Shortest code in bytes wins.

Are spaces allowed between the numbers, like 1 2 3+4+5 rather than 123+4+5?

Pretty similar to http://codegolf.stackexchange.com/questions/3019/getting-an-answer-from-a-string-of-digits (this link allows for * & / and does not specify the target 100)

Perl 5.10.0 - 50 46 45B
say for grep{eval==100}glob join'{,+,-}',1..9

Usage: perl -M5.10.0 scratch.pl (I think I get the version for free)

A very nice solution; both concise and fairly readable even without much knowledge of Perl.

CJam, 43 40 bytes
"-"SL]8m*{A,2>.+1\+s}%{~]:+100=},N*S/'+*

Here is how it works:
"-"SL]                     e# This is an array containing -, space and empty character
                           e# This represents -, + and joints correspondingly
      8m*                  e# Get all cartesian products of these 3 strings of length 8
                           e# For instance, all cartesian products of length 2 are:
                           e# [["-" " "] ["-" "-"] ["-" ""] [" " " "] [" " "-"] [" " ""]
                           e# ["" " "] ["" "-"] ["" ""]]
         {          }%     e# Map these cartesian products over this loop
          A,2>             e# Get array [2, 3, 4, 5, 6, 7, 8, 9]
              .+           e# In-order concatenation of the above two arrays
                1\+s       e# Prepend 1 to the result from above and convert it to string
{        },                e# Now we have all possible strings of 1 to 9 with all possible
                           e# operators as well as joins (things like 567). Its time to
                           e# filter out what add up to 100
 ~                         e# Evaluate the string. This leaves some numbers on stack.
  ]:+                      e# Wrap those numbers in an array and take their sum
     100=                  e# Check if the sum is equal to 100
           N*              e# Join all filtered strings by newline
             S/'+*         e# We used space instead of +. So now we replace space with +

Try it online here

My shot at this:
Python 2, 93 bytes
def a(e,i):
 if i<=9:[a(e+x+`i`,i+1)for x in("+","-","")]
 elif eval(e)==100:print e
a("1",2)

You can use single space indents and also str(i) -> \i``. Also, you might want to mention that this is Python 2 specific :)

@Sp3000 Thanks!  I'm trying to improve my code golf skills and I'd never heard of the backtick thing.

One of the best code I have ever seen...

Mathematica, 93 92 bytes
Print/@Select[""<>ToString/@Range@9~Riffle~#&/@{"+","-",""}~Tuples~{8},ToExpression@#==100&]

Fairly straightforward: generates all possible strings using Tuples and then filters them.
For reference, I get:
1+2+3-4+5+6+78+9
1+2+34-5+67-8+9
1+23-4+5+6+78-9
1+23-4+56+7+8+9
12+3+4+5-6-7+89
12+3-4+5+67+8+9
12-3-4+5-6+7+89
123+4-5+67-89
123+45-67+8-9
123-4-5-6-7+8-9
123-45-67+89

Pyth, 26 bytes
fqvT100m+ssC,r1Td9^c3"+-"8

First, we generate all 8 element combinations of ["+", "-", ""]. c3"+-" chops "+-" into 3 rougly equal sied pieces, giving the appropriate list. ^c3"+-"8 gives the 8 element combinations.
Then, we greate the arithmetic sequences. C,r1Td zips together the operators with the numbers 1 through 8, which are then summed twice to give the string, and + ... 9 puts a 9 at the end.
Finally, fqvT100 filters for those expressions which evaluate to 100.

The update to the interpreter which allowed this code to work was this one, which was made about a day before this question was asked, so this code would have only worked on the command line compiler, not the online one, when the question was asked.
Demonstration.

JavaScript, 86 92
Head to head with the best. That must be an anomalous problem.
Edit -6 thx @nderscore

for(i=6562;k=--i;eval(o)-100||alert(o))for(j=o=1;j++<9;k=k/3|0)o+=k%3?' +-'[k%3]+j:[j]

Test in any browser console, it pops up just 11 times.
Or this snippet:

function out(x) { OUT.innerHTML = OUT.innerHTML + '\n' + x; }

// 6562 is 3 powered to 8 +1
for(i=6562;k=--i;eval(o)-100||out(o))
  for(j=o=1;j++<9;k=k/3|0)
    o+=k%3?' +-'[k%3]+j:[j]

Here's -6: for(i=6562;k=--i;eval(o)^100||alert(o))for(j=o=1;9>j++;k=k/3|0)o+=k%3?' +-'[k%3]+j:[j]

@nderscore thanks, some obvious changes against my sloppy golfing, but the last trick with the ternary is very clever

K, 61 50 bytes
t@&100=.:'t:{:[x>9;,y;,/_f[x+1]'(y,"+";y,"-";y),\:$x]}[2;"1"]

Tested with Kona.
The general approach is to recursively generate all the expressions and then filter out those which eval (.) to 100. This is reasonably competitive as written, but I think there's still room for improvement.
edit:
t@&100=.:'t:(,"1"){,/x,/:\:("+";"-";""),\:$y}/2+!8

Altering my approach a bit to be iterative rather than recursive, which removes the need for explicit base cases as well as saving me some brackets.

Python (176)
39 minutes and counting (for all problems that is)
from itertools import*
for i in product(('+','-',''),repeat=8):
 s=''.join(''.join(j)for j in chain(izip_longest(map(str,range(1,10)),i,fillvalue='')))
 if eval(s)==100:print s

This could probably be shorter, but this was my actual solution for this problem, just golfed down a bit.

APL(Dyalog Unicode), 54 50 48 bytes SBCS
↑b/⍨100=⍎¨b←{' '~⍨,(1↓⎕D),⍪⍵,' '}¨(,∘.,)⍣7⍨'-+ '

Try it on APLgolf!
A tradfn submission which uses strict right to left evaluation.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Rearranging a set of numbers into order
The Question
Given a set of 9 numbers, m[], which contains only numbers 1 through 9 in a random order, with no two numbers being the same, create a program in any language which rearranges the number to be in numerical order (1, 2, 3, etc. etc.) by only switching two numbers which are next to each other (ie. 1, 3, 2 → 1, 2, 3).
Rules

You may only modify the set by switching two numbers which are next to each other
The ending numbers (1 through 9 in order) should be contained in m[]
You can use any language you would like
The answer with the smallest amount of bytes wins

Edit:
Your code does not have to print the output, but the rearranged array must be in m[].

So basically a Bubble Sort algorithm ?

@Optimizer Correct

Do you have to print the intermediate steps?

Can you show more examples?

can we just return 1,2,3,4,5,6,7,8,9?

Should the output of the program be just the final sorted array ?

@user3502615 Should the program have any output? If so, what?

CJam, 15 bytes
q~A{{a+$~}*]}*p

How it works:
q~                     e# Read the CJam styled input array (For ex. [1 3 4 2 5 6 8 7 9])
  A{        }*         e# Run the loop 10 times. This is enough times for a 10 length
                       e# input array in a bubble sort
    {    }*            e# reduce
     a+$~              e# Rearrange the pair so that they are sorted
           ]           e# After each loop, wrap the numbers back into the array
              p        e# Print the array after the loops are done

Try it online here

Mathematica, 38 bytes
#//.{a___,b_,c_,d___}/;b>c:>{a,c,b,d}&

This is an unnamed function taking an array, which applies a replacement rule until the pattern cannot be found any more. The pattern is a list which has two consecutive elements b and c where b > c, and the rule says to swap the b and c but otherwise leave the array untouched.
There's a lot of syntactic sugar here, but the code is actually very readable if you know a bit of Mathematica:
# //. {a___,b_,c_,d___} /; b>c :> {a,c,b,d} &
^  ^     ^   ^          ^      ^            ^
|  |     |   |          |      |            |
|  |     |   | Declares an unnamed function |
|  |     |   |          |      |
| The function's argument      |
   |     |   |          |      |
   | Replace while possible... |
         |   |          |      |
         | Zero or more list elements.
             |          |      |
             | A single list element
                        |      |
                        | A condition for the pattern
                               |
                               | What to replace the pattern with

Python 3, 72 bytes
from random import*
while m!=sorted(m):p=randrange(8);m[p:p]=m.pop(p+1),

The bogosort (aka stupid sort) approach: swap neighbor elements randomly until the array will be sorted. Usually runs under a second.
2 bytes thanks to @xnor.

Python 2, 45
for i in range(8)*8:m[i:i+2]=sorted(m[i:i+2])

Cycles around the list, sorting consecutive pairs of elements. The index i cycles through 0,1,2,3,4,5,6,7 eight times, which guarantees all elements bubble through and the list is sorted.

Pyth, 13 - 15 bytes
Solution which performs the requested swapping, and produces no output:
#X=Qhf>FT.:Q2

Solution which performs the requested swapping, and prints out the intermediate state of the list at every step:
#QX=Qhf>FT.:Q2

Solution which performs the requested swapping, and prints out the final state of the list:
#X=Qhf>FT.:Q2;Q

Demonstration of the middle solution above.
The method of swapping adjacent values is taken from @Jakube's answer.
The program uses #, the loop until error statement, to swap an adjacent pair of misordered elements until no such pair exists, at which point h, the head function, throws an error, ending the program.

Outputting additional things which were not requested by the question is considered to be a standard loophole.

@Optimizer Actually, the OP doesn't mention output at all. It merely talks about modifying a set of numbers. Therefore, the same objection could be made about most of the answers here. I'll put a note about this in my answer.

You should instead ask the OP. I just asked. But I think its given and you are simply abusing the silence to make your program shorter :P

@Optimizer Updated my answer accordingly.

I vote for the first version, the set is sorted and no output is required. It's useful add an output just to verify that the program works, but that it's part of a test and not to be counted.

Retina, 95 93 bytes
Not particularly competitive (and probably still golfable), but here we go...
(.)1
1$1
([^1])2
2$1
([4-9])3
3$1
([5-9])4
4$1
([6-9])5
5$1
([7-9])6
6$1
(8|9)7
7$1
)`98
89
<empty>
<empty>

Where <empty> should be an empty line.
Since all numbers are single digits, this just expects a string with all 9 digits as the input and will print 123456789 after successfully sorting it. Each stage performs a single swap and the )1` indicates that all but the last stage should be repeated until the result stops changing.
The empty stage at the end is necessary, because otherwise we would get intermediate results every time the 98 stage is processed.
Here are all the intermediate results (whenever it changes) for an example run:
451629387
451269387
451263987
451263978
415263978
412563978
412536978
412536798
412536789
142536789
124536789
124356789
123456789

(I obtained this by adding the : option to each stage, and got rid of consecutive duplicates manually.)

Pyth, 17 bytes
uXGhaf>FT.:G2]Z)Q

Switching items in a list is really expensive in Pyth. So here's a fun solution, that stretches the rules a little bit. It's probably not valid.
Try it online: Pyth Compiler/Executor
Explanation
First of all, the time complexity of my code is O(n^3). But this is not the interesting part. The question doesn't say anything about the complexity.
The critical part is, how I switch two elements in the list. Let's say I want to switch the elements m[3] and m[4]. I don't care about the indices 3 and 4 at all. I simply create a second list, that replaces every element equal to m[3] with the number m[4] and every number equal to m[4] with the value m[3]. Since the list doesn't contain duplicates, this simulates switching these two values. If there were duplicates, like in the input [1, 3, 2, 2], the output would be [1, 2, 3, 3]. And if you give the input [1, 2, 1], it would end in an infinite loop. I don't explicitly create the second list, it's just part of Pyth's implementation of the translate-method. If you print out the current lists (see here), it give the correct values, which you would expect.
                   implicit: Q = input list
u               Q  set G = Q, update G as long with the following statements,
                   until it stops changing:
         .:G2         all pairs (G[i],G[i+1])
     f>FT             filter for pairs T, where T[0] > T[1]
    a        ]Z       add to this list of pairs [0]
                      (ensures that the filtered list is always non-empty)
   h                  take the first element
 XG            )      translate G by this pair (switches the values T[0] with T[1])
                   print implicitly at the end

JavaScript (ES6) 56
A recursive function that rearranges the given list in place.
F=l=>l.some((v,i)=>v>l[++i]&&[l[i-1]=l[i],l[i]=v])&&F(l)

Notes

In JS, for any numeric value v : v > undefined == false, v < undefined == false. So going outside the array bounds is not a problem if we use the right comparison
When the array at last is sorted, the function inside 'some' return false and recursion ends
The value returned in case of a swap is a 2 element array, and its value is always 'truthy'. That works even when one or more array elements are 0
In fact the function works with any numeric input, not only single and not repeated digits. Did not found a way to take advantage from this OP constraint.

Test using snippet (in Firefox) - the snippet version output the current list values at each step.

F=l=>(log('L='+l), l.some((v,i)=>v>l[++i]&&[l[i-1]=l[i],l[i]=v])&&F(l))

function log(x) {
   L.innerHTML = L.innerHTML +x+'\n'
}

function go() {
  l = I.value.split(/\D+/g).map(x=>x|0)
  F(l)
  O.innerHTML = '' + l
}

go()
Unsorted: <input id=I value="2 8 4 7 5 3 9 1 6"><button onclick="go()">-></button>

Sorted:

Operations log:

Javascript (ES6), 66 61 53 bytes
Thanks to the new rule, I can reduce even further :)

f=x=>x.map((a,i)=>a<(b=x[--i])&&f(x,x[i]=a,x[i+1]=b))

// Snippet demo: (Firefox only)
f(z=prompt().split(/\D+/).map(x=>+x))
alert(z.join(', '));

Commented
f=x=> // recursive function f
    x.map( // map function to array
        (a, i)=> // a = current value, i = current index
            a < (b = x[--i]) && // poll value of previous index, compare less than
                                // comparison always false at first index as undefined will always be less
                f(x, x[i] = a, x[i + 1] = b) // if true, swap values and call f
    )

C, 183
main(c,d,s){int a[10];for(c=0;c<10;c++)scanf("%d", &a[c]);for (c=0;c<10;c++){for(d=0;d<10-c-1;d++){if(a[d]>a[d+1]){s=a[d];a[d]=a[d+1];a[d+1]=s;}}}for(c=0;c<10;c++)printf("%d", a[c]);}

It's not golfed yet, other than variable names.

127 bytes

Haskell, 59 bytes
s e(h:t)=min e h:max e h:t
f l=iterate(init.foldr s[9])l!!9

The function s puts an element e in front or at the second place of a list depending on if it's less or greater than the first element of the list. Folding s into the input list lets the smallest element bubble to the front. I'm folding into a list containing a single 9 which I immediately remove afterwards with init, so that I don't have to check for empty lists in s. iterate repeats the folding process forever creating a list of intermediate results. The final result is the 9th element of this list.

Perl, 68 bytes
{for(0..7){if($m[$_]>$m[$_+1]){splice@m,$_,2,$m[$_+1],$m[$_];redo}}}

Ungolfed code
 {                                             # Block runs once unless redo is called

     for (0..7) {                                 # Loop index is in $_

         if ($m[$_] > $m[$_+1]) {                 # Check if swap needed

             splice @m, $_, 2, $m[$_+1], $m[$_];  # Replace a two element slice of
                                                  # the array with those
                                                  # two elements reversed

             redo                                 # Restart the block over
         }
     }
}


text:
Maximum Concatenated Product
We are given a list of integers p1, ..., pk (not necessarily distinct) where each has a value between 1 and 9, inclusive. Using each of the p1, ..., pk exactly once, we can form concatenations of digits, to achieve a new list of numbers; we then output the product of this new list. The goal is to maximize this product by choosing the best concatenations of digits.
For example, we are given the list: 2 3 2 (separated by spaces). We can form the following concatenations:

2 3 2 (product of these concatenations is 12)
23 2 (product is 46)
32 2 (product is 64)
22 3 (product is 66)

Since the largest product that we can form of concatenations is 66, we output that.
Rules:

There must be at least one multiplication (i.e., you cannot just concatenate all of the digits and output that).
You cannot use any other operators other than multiplication, or insert parentheses, etc.
Assume that the list of integers given is separated by spaces, and all integers have values between 1 and 9.

Shortest code (in bytes) wins!
Test cases:
Input: 1 2 3; Output: 63 (i.e., 21*3)
Input: 2 5 9; Output: 468 (52*9)
Input: 1 2 3 4; Output: 1312 (41*32)

Should we write a whole program or a function taking input parameters and returning the result is also fine?

@randomra Yes, that's fine.

For each pair of numbers a,b, the product a* b.is less than the simple concatenation ab (= a*10^(digits of b)+b). So just 1 product (as it's mandatory). Add this: http://codegolf.stackexchange.com/q/49854/21348

CJam, 32 28 23 12 bytes
0le!f{~*}:e>

Try it online in the CJam interpreter.
Thanks to @user23013 for helping me save 16 whole bytes!
Idea
Permuting the characters in the input string divides it into integers (groups of consecutive digits) separated by spaces. By pushing a zero and then evaluating the permuted input string, we push two or more integers. Multiplying the topmost two will result either in the product of the input divided into exactly two integers or some suboptimal value.
Code
 le!         e# Push all possible character permutations of the input.
0   f{  }    e# For each permutation:
             e#   Push 0, then the permuted string.
      ~      e#   Evaluate the string. Pushes one or more integers.
       *     e#   Multiply the two topmost integers.
         :e> e# Retrieve the greatest integer in the array.

l2%_,,1>\e!m*{~S+m<~*}%$W=.

l2%S+e!{0\~*}%$W=.

CJam, 36 35 bytes
q~]_,([SL]m*{s},\e!\m*{z[s~]:*}%$W=

Pretty straight forward. Iterates over all possible combinations and sorts them by product. Then outputs the largest. All this, keeping in mind that at least 1 multiplication should be present.
Will add explanation soon.
Try it online here

JavaScript (ES6) 125
Edit I think @oberon got it right : "each new digit must be concatenated to the smallest number"
I'll not change this answer stealing his idea. Implementation in ES6 would be 70 bytes (sign changed in comparison to compare as number and not strings)

f=l=>l.split(' ').sort().reverse().map(d=>-a>-b?a+=d:b+=d,a=b='')||a*b

My solution

f=l=>(i=>{for(r=0;a=b='',k=--i;r<a*b?r=a*b:0)for(v of l)k&1?a+=v:b+=v,k/=2})(1<<~-(l=l.split(' ').sort().reverse()).length)|r

As I said in comments, for each pair of numbers a,b, the product a*b is less than the simple concatenation ab (=a*10^(digits of b)+b). So it's better to avoid products and prefer concatenation, but as at least 1 product is requested, we have to build 2 numbers and multiply them.
I try all possible grouping of digits, building a pair of numbers to multiply. Each number is obviosuly built taking digits in decreasing order.
For instance, with a list of 4 numbers, [1 2 3 4] - try:

4 * 321
43 * 21
42 * 31
41 * 32
432 * 1
431 * 2
421 * 3

The max of these value is the result we need.
The groupings can be enumerated looping on a bitmap of 4 bits, with min value 0001 and max value 0111 (that is 1<<(4 -1) - 1)
Not so golfed
f=l=>{
  l = l.split(' '); // string to array
  l.sort().reverse(); // decreasing order
  m = 1 << (l.length-1); starting value fro loop
  r = 0
  // loop from m-1 down to 1
  for(i=m; --i; )
  {
    a = b = '';
    k = i;
    for(v of l) // divide the digits base on bits of i
    {
      k & 1 ? a+=v : b+=v;
      k /= 2;
    }
    if (r (i=>{for(r=0;a=b='',k=--i;r<a*b?r=a*b:0)for(v of l)k&1?a+=v:b+=v,k/=2})(1<<~-(l=l.split(' ').sort().reverse()).length)|r

t=l=>(i=>{for(x=r='';a=b='',k=--i;r<a*b?(r=a*b,x=' = '+a+'x'+b):0)for(v of l)k&1?a+=v:b+=v,k/=2})
(1<<~-(l=l.split(' ').sort().reverse()).length)|| x

function go()
{
  R.value = f(I.value) // TEST AS IS
   + t(I.value) // Some more info
}

test=['1 2 3 4','1 2 3','2 5 9','8 9 8']

test.forEach(t => O.innerHTML = O.innerHTML + (t + ' -> ' + f(t)) + '\n')
Type your list: <input id=I><button onclick='go()'>-></button><input readonly id=R>

Python 3, 111 bytes
It's probably much more golfable.
I like its running time, though (O(n log n), is it?).
l=sorted(map(int,input().split()),reverse=1);m=[0,0]
for x in l:i=m[0]>m[1];m[i]=m[i]*10+x
print(m[0]*m[1])

Ungolfed with explanation.
# edc65 has already explained that the optimal solution can be found applying a single
# multiplication. thus, given that
#     (10x + d)y > (10y + d)x
# where x, y are the two numbers and d is the next digit to insert, it follows that
#     y > x
# and thus each new digit must be concatenated to the smallest number. obviously, digits
# should be added in descending order.
l = sorted(map(int, input().split()), reverse=1)
m = [0,0]
for x in l:
    i = m[0] > m[1]
    m[i] = m[i]*10 + x
print(m[0] * m[1])

R, 164
function(n){l=length(n);a=sort(n,T);i=1;while(a[i]==a[i+1]&&i<l-2)i=i+2;a[c(i,i+1)]=a[c(i+1,i)];eval(parse(t=paste0(c(a[1:l%%2==1],"*",a[1:l%%2==0]),collapse='')))}

As a method I'm unsure if this is robust.  With the cases that I have tested it appears to work each time.  I tried testing it against optimizers solution and it appears to be OK against that as well.  I'm more than prepared to be proven wrong :)  There's room for golfing, but I was hoping to get some feedback on the method first.
The general process is :

Sort the list in descending order
Swap the first odd/even pair that differ
Concatenate the even and odd items of the list
Evaluate the product of the two results

Expanded out with some comments
function(n){
    l=length(n);
    a=sort(n,T);    # sort descending order
    # Determine which pair to swap
    i=1;
    while(a[i]==a[i+1]&&i<l-2)i=i+2;
    a[c(i,i+1)]=a[c(i+1,i)];  # swap pair
    # concatenate the even and odd indices items around a * and evaluate
    eval(parse(t=paste0(c(a[1:l%%2==1],"*",a[1:l%%2==0]),collapse='')))
}

And some test runs (implemented as a function called g)
> g(c(1,2,3))
[1] 63
> g(c(2,5,9))
[1] 468
> g(c(1,2,3,4))
[1] 1312
> g(c(1,2,3,5,5,5))
[1] 293132
> g(c(1,5,7,7,9,9))
[1] 946725
> g(c(1,7,8,9,9,9))
[1] 978117
> g(c(7,8,9,9,9))  #Test case provided edc65 to randomra
[1] 97713

Pyth, 25 bytes
eSsmm*ss<dkss>dkr1ld.pcz)

I loop over every permutation of the input. Then because every optimal combination consists of two integers I merely split it at every possible position, and multiply the concatenated splits. I then sort and get the last element.

Jelly, 12 bytes
Œ!ŒṖ€Ṗ€ẎḌP€Ṁ

Try it online!
ಠ_ಠ Tied with CJam. Takes input as a list of values, +2 bytes to input as space-separated
How it works
Œ!ŒṖ€Ṗ€ẎḌP€Ṁ - Main link. Takes a list L on the left
Œ!           - Permutations of L
  ŒṖ€        - Partitions of each
     Ṗ€      - Remove the last one from each
       Ẏ     - Join into one list
        Ḍ    - Convert from digits to numbers
         P€  - Product of each
           Ṁ - Maximum

Stax, 8 bytes
ä;ªÜé▐ßó

Run and debug it
Uncompressed is 9 bytes, still beating CJam(with the same method).
Explanation
|T{Ze*m|M
|T        permutations of input
  {   m   mapped to:
   Z      tuck a zero under the string
    e     evaluate the string
     *    multiply the top two elements
       |M get the maximum of the mapped list


text:
2-dimensional hue graph of array
The Question
Given a two dimensional array, o[][], create a 2-dimensional graph such that o[xCoordinate][yCoordinate] is the hue of the point at (xCoordinate, yCoordinate), and the value and saturation are always 100. Let the hue go from -50 to 50, where -50 and 50 are 0 and 100 respectively.
Rules

You may use any language you wish
Lowest bytes wins
Include seperate byte amount for points taken off from extra

Extra
If you want extra points (or, less actually) you can include a snippit of code in the same language such that o[x][y] is equal to sin x · cos y, in less than 25 bytes more than your original snippit. Extra points removes 10 bytes from your score.
Example Language: 89 [79] (Extra: 113)

Fixed it, I meant "100"

On what scale? 0 to 100? (Same for the Hue. Does it go from 0 to 2 pi? From 0 to 360? From 0 to 1? From 0 to 100?)

The hue goes from -50 to 50, where -50 and 50 are 0 and 100 respectively.

What do you mean by "where -50 and 50 are 0 and 100 respectively"? Are they -50 and 50 or are they 0 and 100? The scale of value and saturation is also still not mentioned in the challenge.

Value and saturation stay at 100, so only color is affected. Also, say the output of sin x * cos x is 0, this would make the hue 50. If the output was -50, the hue would be 0, and if the output was 50, the hue would be 100.

When saying "equal to sin x · cos x", are you referring to the x in o[x][y] (or in Mathematica, o[[x, y]])?

sorry, i mean sin x * cos y

Mathematica: 68
Graphics@Raster@Reverse[List@@Hue[#/100]~ColorConvert~"RGB"&/@#&/@o]

Still figuring out the extra.

What does Mathematica not have a function for?

@Loovjo I've yet to be able to get it to make me a sandwich.