text:
Stretching Words
Write a program or function that duplicates letters in a word, so that all the duplicated letters arranged from left to right in the word would form the input array.
For example:
input: chameleon, [c,a,l,n]
output: cchaamelleonn

Input

The starting word (e.g. chameleon)
An array of characters ([c,a,l,n]) or a string to represent an array (caln), or something similar
Input can be through function parameters, STDIN or language equivalents
All inputs will be lower-case letters (a-z)

Output

The changed word
If there are multiple solutions, any can be printed
input: banana [n,a]
possible outputs: bannaana, banannaa
                     |-|---------|-|--->[n,a]

You may assume that the input word (not necessarily the array) will have the letters in the array (in order)
You may also assume that the inputs have no consecutive letters which are the same (NOT apple, geek, green, glass, door...)

Examples
input: abcdefghij, [a,b,c]
output: aabbccdefghij

input: lizard, [i,a,r,d]
output: liizaarrdd

input: coconut, [c,o]
ouput: ccooconut or coccoonut or ccocoonut

input: onomatopoeia, [o,o,a,o,o]
output: oonoomaatoopooeia

input: onomatopoeia, [o,a,o]
output: oonomaatoopoeia or onoomaatoopoeia or oonomaatopooeia etc.

Shortest program wins!
Leaderboard (thanks to Martin Büttner for the snippet)

/* Configuration */

var QUESTION_ID = 51984; // Obtain this from the url
// It will be like http://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";

/* App */

var answers = [], page = 1;

function answersUrl(index) {
  return "http://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      if (data.has_more) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SIZE_REG = /\d+(?=[^\d&]*(?:<(?:s>[^&]*<\/s>|[^&]+>)[^\d&]*)*$)/;
var NUMBER_REG = /\d+/;
var LANGUAGE_REG = /^#*\s*([^,]+)/;

function shouldHaveHeading(a) {
  var pass = false;
  var lines = a.body_markdown.split("\n");
  try {
    pass |= /^#/.test(a.body_markdown);
    pass |= ["-", "="]
              .indexOf(lines[1][0]) > -1;
    pass &= LANGUAGE_REG.test(a.body_markdown);
  } catch (ex) {}
  return pass;
}

function shouldHaveScore(a) {
  var pass = false;
  try {
    pass |= SIZE_REG.test(a.body_markdown.split("\n")[0]);
  } catch (ex) {}
  return pass;
}

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  answers = answers.filter(shouldHaveScore)
                   .filter(shouldHaveHeading);
  answers.sort(function (a, b) {
    var aB = +(a.body_markdown.split("\n")[0].match(SIZE_REG) || [Infinity])[0],
        bB = +(b.body_markdown.split("\n")[0].match(SIZE_REG) || [Infinity])[0];
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  answers.forEach(function (a) {
    var headline = a.body_markdown.split("\n")[0];
    //console.log(a);
    var answer = jQuery("#answer-template").html();
    var num = headline.match(NUMBER_REG)[0];
    var size = (headline.match(SIZE_REG)||[0])[0];
    var language = headline.match(LANGUAGE_REG)[1];
    var user = getAuthorName(a);
    if (size != lastSize)
      lastPlace = place;
    lastSize = size;
    ++place;
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", user)
                   .replace("{{LANGUAGE}}", language)
                   .replace("{{SIZE}}", size)
                   .replace("{{LINK}}", a.share_link);
    answer = jQuery(answer)
    jQuery("#answers").append(answer);

    languages[language] = languages[language] || {lang: language, user: user, size: size, link: a.share_link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang > b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 50%;
  float: left;
}

#language-list {
  padding: 10px;
  width: 50%px;
  float: left;
}

table thead {
  font-weight: bold;
}

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

@AlexA. only one instance because otherwise the array formed by the duplicate letters would be [c,o,c,o], rather than [c,o].

Yeah sorry, reading it again that's obvious. Thanks.

Seeing this got quite a lot of answers, and many in the same languages, would you be interested in adding the leaderboard snippet? If so, I'm happy to edit it in and amend the answers that don't use the required header format.

@MartinBüttner I forgot about that! Added. I had to change #answer-list and #language-list width to 50% to avoid overlapping columns in your snippet.

@StretchManiac That's because some of the answers contain links in their headers which they shouldn't. I'll fix them.

"You may also assume that the inputs have no consecutive letters which are the same (NOT apple, geek, green, glass, door...)" both inputs or just the first one? There's an example with "ooaoo" as second input and my code breaks in this case.

Clarification (see my bash+sed answer): Is it illegal for banana, na => baannana?  I believed that "You may assume that all inputs will have the letters in the array (in order)" is meant to permit, but not require, answers to process both lists sequentially, but @manatwork interpreted it differently.

Is there a maximum length on either piece of input?

@aragaer that is only the first input, not the array, I'll clarify that.

@TobySpeight that sentence was meant to merely state that the input possible, for example there would be no banana ,[t,x]. In your example, the duplicated letters would form [a,n], not [n,a]. I'll clarify that in the question.

I'm still not completely sure - is banana, na => baannana allowed?  Or am I only allowed bannaana, bannanaa or banannaa for that input?

@TobySpeight No. That is not allowed (your first sentence).

Pyth, 14 bytes
s+L&@d<Q1.(QZz

Demonstration.
Input style:
banana
["b","a","n","a"]

Explanation:
s+L&@d<Q1.(Q0z
                  Implicit: z = input(); Q = eval(input())
 +L          z    Map (lambda d) over z, adding the result to each character.
    @d<Q1         Intersection of d with Q[:1], up to the first element of Q.
   &              Logical and - if the first arg is truthy, evaluate and
                  return the second arg, otherwise return first arg.
         .(Q0     Q.pop(0)
                  The addition will either be the empty string, for the empty
                  intersection, or the character that was Q[0] otherwise.

s                 Concatenate and print.

Brainfuck, 46 45 (63 with printable characters in input)
Compatible with Alex Pankratov's bff (brainfuck interpreter used on SPOJ and ideone) and Thomas Cort's BFI (used on Anarchy Golf).
The printable version takes the array first as a string, followed by a tab, followed by the starting string with no trailing newline.
Demonstration on ideone.
-[+>,---------]
<[++++++++<]
<,+
[
  -.
  [>+>-<<-]
  >>
  [
    <[>+<-]
  ]
  <[.[-]]
  ,+
]

We can save some bytes by using \x00 as a separator instead of tab:
,[>,]
<[<]
<,+
[
  -.
  [>+>-<<-]
  >>
  [
    <[>+<-]
  ]
  <[.[-]]
  ,+
]

That feeling when BF is shorter than my Python code.. :(

I usually don't care for Brainfuck, but this is awesome!

This is beautiful.

CJam, 15 bytes
rr{_C#)/(C@s}fC

Try it online.
How it works
rr              e# Read two whitespace-separated tokens from STDIN.
  {         }fC e# For each character C in the second string.
   _            e#   Duplicate the first string.
    C#          e#   Compute the index of the character in the string.
      )/        e#   Add 1 and split the string in slice of that size.
        (       e#   Shift out the first slice.
         C      e#   Push the character.
          @     e#   Rotate the remainder of the string in top of the stack.
           s    e#   Stringify (concatenate the slices).

It's a battle of the CJams! You and Sp both have 15 byte CJam answers, and 15 is currently the shortest. :)

@AlexA. Just wait for Pyth. You just wait...

Sounds like you'd better learn Pyth. ;)

C, 62 bytes
f(char*s,char*c){while(*s-*c||putchar(*c++),*s)putchar(*s++);}

Well, this is surprisingly competetive.
We define a function f(char*, char*) that takes the string as its first input and the array of characters to duplicate as its second input.
Some testing code:
int main (int argc, char** argv) {
    f("onomatopeia", "oao");
    return 0;
}

Which prints:
oonomaatoopeia

Try it online!
If it is acceptable to submit a macro rather than a function, the following #define g(s,c) is just 58 bytes, but requires s and c to be actual pointers:
#define g(s,c)while(*s-*c||putchar(*c++),*s)putchar(*s++);

Thanks for making me look up the comma operator. That's useful!

Suggest write(1,c++,*s==*c) instead of *s-*c||putchar(*c++)

CJam, 15 bytes
rr{:X/(XX+@X*}/

An alternative CJam approach. Try it online
Explanation
For each character in the second string, we do two things.

Split the current suffix of the string by the character, e.g. "beeper" "e"  ->  ["b" "" "p" "r"]
Uncons the first string in the array, insert two of the character, then rejoin the rest of the array with the character, e.g. "b" "ee" "eper". The last string is the new suffix.

Retina, 33 bytes
More information about Retina.
+`(?=(.))(((.)(?<!\4.))+\n)\1
$1$2

This expects the two strings on STDIN, separated by a newline.
For counting purposes, each line goes into a separate file, \n should be replaced with an actual newline character (0x0A). If you actually want to test this, it's more convenient to put this in a single file where \n remains as it is and then invoke Retina with the -s option before passing the file.
Explanation
(Outdated... I managed to get rid of the marker... I'll update this later.)
Each pair of lines is a regex substitution (first line the pattern, second line the substitution).
^
#

This puts a # as a marker at the start of the input string.
+`#(.*?(.))(.*\n)\2
$1$2#$3

This finds the first letter in the input (after the marker) corresponding to the next letter to be duplicated, duplicates that letter, moves the marker behind it, and drops the first character of the second string. The +` at the front tells Retina to do this repeatedly until the string stops changing (in this case, because the second string is empty and all required letters have been duplicated).
#
<empty>

Finally, we clean up the string by dropping the marker.

I figured that retina would have a nice solution, and I was right, because you found one. Also, when I first skimmed your description, I read the end as "we clean up the string by dropping the mic."

@mbomb007 I was hoping to get rid of the "mic" by only duplicating individual letters that don't have any duplicates after them, but I can't do it in less than 33 bytes. (There's a broken 28 byte version in the revision history.)

@mbomb007 FYI, I did manage to remove the marker now, but the byte count is still the same. This still looks golfable though.

As an aside, I just realized that Retina doesn't have a page on https://esolangs.org

@mbomb007 Yes, I'm aware. I'll probably add one after I've implemented a few of the more important outstanding features.

Python, 61
def f(s,l):b=s[:1]==l[:1];return s and-~b*s[0]+f(s[1:],l[b:])

A greedy recursive solution. Saves to b whether the first letter of the string s is the first letter of the string l of letters to double. If so, take one of that letter and prepend it to the recursive call with the rest of s, removing the first element from l. If not b, do the same but don't double the letter and don't remove from l.
The code checks s[:1]==l[:1] rather than s[0]==l[0] to avoid an index-out-of-bounds error when s or l is empty.

Prolog, 95 83 79 56 bytes
d([A|S],H):-put(A),H=[A|T],put(A),d(S,T);d(S,H).
d(_,_).

Example:
d(`chameleon`,`caln`).

returns
cchaamelleonn

Edit: Saved 4 bytes thanks to Oliphaunt
Edit2: Saved 20 bytes using the deprecated put/1 SWI-Prolog predicate instead of writef. Saved one byte replacing the recursion end predicate d([],_). to d(_,_).. Won't work if the ordering of the two definitions of d is swapped though, but we don't care about that in golfed code. Saved another 2 bytes removing the parenthesis around H=[A|T],put(A),d(S,T)

I'm not really sure why this got downvoted. Maybe add some explanation to your code?

You can save four bytes by unifying implicitly: H=[A|T]. Also, why not make it a little more readable by replacing the spaces with newlines?

@Oliphaunt Thanks for the suggestion, I didn't see this slight optimization after I originally modified my code to use the H=[A|T] clause.

Python 2, 83 74 72 65 Bytes
No real special tricks here. x is the string, y is the array of characters that are duplicated. To clarify if this doesn't copy properly, the first indentation level is a space, the next is a tab.
Edit 1: Saved 9 bytes by using string manipulation instead of pop().
Edit 2: Saved 2 bytes by using -~ to increment g by 1.
Edit 3: Saved 7 bytes by using y[:1] trick, thanks to xnor for this!
def f(x,y,s=''):
 for c in x:g=y[:1]==c;s+=c*-~g;y=y[g:]
 print s

Check it out here.
Properly formatted and explained:
def f(x,y,s=''):           # Defining a function that takes our input,
                           # plus holds a variable we'll append to.
  for c in x:              # For every character in 'x', do the following:
    g = y[:1] == c         # Get the first element from the second string, will
                           # return an empty string if there's nothing left.
                           # Thanks to xnor for this trick!
    s += c * -~g           # Since int(g) would either evaluate to 0 or 1, we
                           # use the -~ method of incrementing g to multiply
                           # the character by 1 or 2 and append it to 's'
    y = y[g:]              # Again, since int(g) would either evaluate to 0
                           # or 1, use that to cut the first value off y, or
                           # keep it if the characters didn't match.
  print s                  # Print the string 's' we've been appending to.

"You may assume that all inputs will have the letters in the array (in order)." That should save you quite a few bytes.

You can get the first element from a possibly-empty string as y[:1].

I now realize that you can't save as many as I thought because of how you're doing it with y=y[g:], so "quite a few" is quite an exaggeration.

@Vioz- I was thinking y[:1]==c. Does that work?

@xnor Yes, it does if I take the letters that need replacing instead. Thanks!

Excel VBA, 110 bytes
This is my first entry to CodeGolf so I hope this is ok.
You enter the input word in A1 and then the letters to be replaced in B1 and the resulting word is displayed in a message box.
w = Cells(1, 1)
l = Cells(2, 1)
For i = 1 To Len(w)
x = Left(w, 1)
R = R + x
If InStr(l, x) > 0 Then
R = R + x
End If
w = Right(w, Len(w) - 1)
Next
MsgBox R

If VBA isn't indentation-sensitive, you could get rid of all of the indents and save a few bytes. I think you can also get rid of all of the spaces after commas and around operators. Ought to save you a few bytes.

@QPaysTaxes Thanks for your edit. I pressed rollback just to see what it would do. Not sure if that made you lose points or something for your edit?

Nope, I still have the +2, though I did get confused for a bit. You might want to roll back again; at least according to three highish-rep people, it was a good edit.

@QPaysTaxes I agree I liked the edit. Think I just rolledbacked one too many times.

I can't tell. Mobile doesn't exactly display things nicely. Ultimately, though, what matters is the code, not the formatting.

Javascript, 47 bytes
(a,b)=>a.replace(/./g,d=>b[0]!=d?d:d+b.shift())

Taking advantage of some ES6 features.

Does this work correctly for onomatopoeia, oao?

@AlexA. Outputs: "oonoomaatoopooeiaa". Ah, I understand. Will fix

Fixed, I think. Added a lot of characters :(

Instead of b.indexOf(d)==0, try ~b.search(d)

@IsmaelMiguel search is only applicable on strings. Had to change b to an array

It would be shorter to use replace instead of converting to an array and mappning: (a,b)=>a.replace(/./g,d=>!b.indexOf(d)?d+b.splice(0,1):d).

@NinjaBearMonkey That's a great idea, thanks

@edc65 splice modifies b in place, which is why I'm using it. If I just used a zero index, it would only replace the first character. Maybe I'm misunderstanding you comment...

Pyth, 18 17 bytes
sm?+d.(QZqd&QhQdz

Live demo.
Saved 1 byte thanks to @Jakube.
Explanation:
                z  Read the first line of input.
 m                 For each character in that line
  ?      qd&QhQ    If (?) the first char of the stretch list (`&QhQ`)
                   and the current character are equal,
   +d.(QZ          Then double the current character and pop an element off
                   the stretch list.
               d   Otherwise, just return the same character.
s                  Join all the characters together.

Original version:
jkm?+d.(QZqd&QhQdz

Live demo for original.

Haskell, 42 bytes
(a:b)#e@(c:d)|a==c=a:a:b#d|1<2=a:b#e
a#_=a

Usage example:
*Main> "coconut" # "co"
"ccooconut"
*Main> "lizard" # "iard"
"liizaarrdd"
*Main> "onomatopoeia" # "ooaoo"
"oonoomaatoopooeia"

How it works:
If one string is empty, the result is the first string. Else: if the first characters of the strings match, take it two times and append a recursive call with the tails of the strings. If the characters don't match, take the first character of the first string and append a recursive call with the tail of the first string and the same second string.

Pyth, 16 bytes
u|pH<GJxGH>GJwz

Try it online: Demonstration
This is quite hacky. Stack-based languages might have an advantage here.
Explanation
                   implicit: z = 1st input line, w = 2nd
u             wz   reduce, start with G = z
                   for each H in w, update G to:
        xGH          index of H in G
       h             +1
      J              store in J
    <GJ              substring: G[:J] (everything before index J)
  pH                 print substring then H (without newlines)
 |                   afterwards (actually or, but p always returns 0)
           >GJ       substring: G[J:] (everything from index J to end)
                     update G with ^
                   afterwards implicitly print the remainder G

@isaacg Help? There must be something shorter...

And more elegant ;-)

Got it in 14 - 1 less than CJam is the best place to be.

JavaScript ES6, 47 bytes
(w,s)=>w.replace(/./g,c=>c==s[0]?c+s.shift():c)

Assumes s is an array ["c","a","l","n"]

><> (Fish), 68 34 Bytes
ri&:o&:&=\
l&io& /!?/
?!;20.\l!\

You can run it at http://fishlanguage.com/playground inputting the string as the initial stack (with " marks, i.e. "chameleon") and the array of extra letters as the input stack (no " marks i.e. caln).
Don't forget to press the Give button to seed the input stack.
r       reverses the stack
i&      reads in the first input, and stores it in the register
:o      copies the top of the stack, and outputs the top of the stack
&:&     puts register value on stack, copies it, then puts top stack into register
=       checks if the top two values are equal, if yes push 1, else push 0
?       if top value is non-zero, execute next instruction
!       skips the following instruction (unless it was skipped by the previous ?)

If yes, then we proceed on the same line
&o      puts register value on stack, and outputs it
i&      reads in the first input, and stores it in the register
l       puts length of stack on stack, then proceed to lowest line

If no, we go directly to the last line
l       As above.
?!;     If zero value (from length), then end execution
20.     Push 2 and 0 onto stack, then pop top two values, and go to that position (2,0) (i.e. next instruction is at (3,0))

EDIT: Halved it! :)

REGXY, 24 bytes
Uses REGXY, a regex substitution based language. Input is assumed to be the starting word and the array, space separated (e.g. "chameleon caln").
/(.)(.* )\1| /\1\1\2/
//

The program works by matching a character in the first string with the first character after a space. If this matches, the character is repeated in the substitution and the character in the array is removed (well, not appended back into the string). Processing moves on to the second line, which is just a pointer back to the first line, which causes processing to repeat on the result of the previous substitution. Eventually, there will be no characters after the space, at which point the second branch of the alternation will match, removing the trailing space from the result. The regex will then fail to match, processing is completed and the result is returned.
If it helps, the iterative steps of execution are as follows:
chameleon caln
cchameleon aln
cchaameleon ln
cchaameleonn n
cchaameleonn  (with trailing space)
cchaameleonn

The program compiles and executes correctly with the sample interpreter in the link above, but the solution is perhaps a bit cheeky as it relies on an assumption in the vagueness of the language specification. The spec states that the first token on each line (before the /) acts as a label, but the assumption is that a null label-pointer will point back to the first command in the file with a null label (or in other words, that 'null' is a valid label). A less cheeky solution would be:
a/(.)(.* )\1| /\1\1\2/
b//a

Which amounts to 27 bytes

Japt -m, 10 7 bytes
iVvUèVÎ

Try it
iVvUèVÎ     :Implicit map of each character U in the first input (the string)
i           :Prepend
 V          :  The second input (the array)
  v         :  Remove this many elements from the start ...
   Uè       :    Count the occurrences in U of
     VÎ     :    The first element of V

Ruby, 52 47 bytes
Solution:
f=->(s,a){s.chars.map{|c|c==a[0]?a.shift*2:c}.join}
Example:
p f.call('banana', ['n','a']) # => "bannaana"
Explanation:
Proc form of a method which takes a string as the first argument, and an array of characters as the second argument.  Maps a block onto an array of the characters in the string argument, which checks each character against first element of the comparison array, and if there is a match, removes the first element of the comparison array, and doubles it.

update
f=->s,a{s.chars.map{|c|c==a[0]?a.shift*2:c}*''}

You can skip the parentheses around the parameters s,a. And *'' is equivalent to .join. That's 5 bytes saved, but I still beat you by one (for now) :D

R, 119
Based on @Alex's answer, this one is a couple of bytes shorter:
function(s,a){message(unlist(lapply(strsplit(s,"")[[1]],function(x){if(length(a)&x==a[1]){a<<-a[-1];c(x,x)}else x})))}

Ungolfed:
function(s, a) {
  message(                             # Prints to output
    unlist(                            # Flattens list to vector
      lapply(                          # R's version of map
        strsplit(s,"")[[1]],           # Split vector to characters
        function (x) {
          if (length(a) & x == a[1]) { # If there are still elements in a
                                       # and there's a match
            a <<- a[-1]                # Modify a
            c(x, x)                    # And return the repeated character
          } else x                     # Otherwise just return it
        }
      )
    )
  )
}

Perl, 73 62 59 56
Entirely new approach yields much better results. Still, I bet it can be shorter.
Call as f('coconut', ['c','o']).
sub f{($s,$a)=@_;$s=~s/(.*?)($_)/\U$1$2$2/ for@$a;lc$s}

For each character in the array, find the first occurrence and duplicate it, and turn everything up to it to uppercase. Then return the entire string, converted to lowercase.
EDIT: shaved a couple of more characters by getting rid of shift and pop.

The previous version:
sub f{join '',map{shift @{$_[0]}if s/($_[0][0])/$1$1/;$_}split //,shift}

The new version doesn't respect the character order anymore. (BTW, “The foreach keyword is actually a synonym for the for keyword, so you can use either.” – Foreach Loops.)

@manatwork That should do it. And thanks for the for hint. It's actually shorter now.

rs, 39 bytes
More information about rs.
There's already a Retina answer, but I think this one uses a slightly different approach. They were also created separately: when I began working on this one, that answer hadn't been posted.
Besides, this one is 6 bytes longer anyway. :)
#
+#(\S)(\S*) ((\1)|(\S))/\1\4#\2 \5
#/

Live demo and test suite.

I really like that debug switch in your interpreter.

Python 2, 77
def f(x,y,b=''):
 for i in x:
    try:
     if i==y[0]:i=y.pop(0)*2
    except:0
    b+=i
 print b

Call as:
f('onomatopoeia',['o','a','o'])

I may have got the byte count horribly wrong... Uses a mixture of spaces and tabs.

JavaScript ES6, 72 bytes
(s,a,i=0,b=[...s])=>a.map(l=>b.splice(i=b.indexOf(l,i+2),0,l))&&b.join``

This is an anonymous function that takes 2 parameters: the starting word as a string and the characters to stretch as an array. Ungolfed code that uses ES5 and test UI below.

f=function(s,a){
  i=0
  b=s.split('')
  a.map(function(l){
    i=b.indexOf(l,i+2)
    b.splice(i,0,l)
  })
  return b.join('')
}

run=function(){document.getElementById('output').innerHTML=f(document.getElementById('s').value,document.getElementById('a').value.split(''))};document.getElementById('run').onclick=run;run()
Starting word: <input type="text" id="s" value="onomatopoeia" />

Leters to duplicate: <input type="text" id="a" value="oao"/>

<button id="run">Run</button>
Output: <output id="output"></output>

R, 136 128 122 bytes
function(s,a){p=strsplit(s,"")[[1]];for(i in 1:nchar(s))if(length(a)&&(x=p[i])==a[1]){p[i]=paste0(x,x);a=a[-1]};message(p)}

This creates an unnamed function that accepts a string and a character vector as input and prints a string to STDOUT. To call it, give it a name.
Ungolfed + explanation:
f <- function(s, a) {
    # Split s into letters
    p <- strsplit(s, "")[[1]]

    # Loop over the letters of s
    for (i in 1:nchar(s)) {

        # If a isn't empty and the current letter is the first in a
        if (length(a) > 0 && p[i] == a[1]) {

            # Replace the letter with itself duplicated
            p[i] <- paste0(p[i], p[i])

            # Remove the first element from a
            a <- a[-1]
        }
    }

    # Combine p back into a string and print it
    message(p)
}

Examples:
> f("coconut", c("c","o"))
ccooconut

> f("onomatopoeia", c("o","a","o"))
oonomaatoopoeia

Saved 8 bytes thanks to MickeyT and another 3 thanks to jja!

You could use cat(p,sep='') to output straight to STDOUT for a couple

@MickyT: Didn't think of that! Thanks, edited. :)

Actually, message(p) is shorter.

@jja: I didn't know about message, that's awesome! Thanks! Edited to use your suggestion.

Bash+sed, 51
sed "`sed 's/./s!^[^&]*&!\U\&&!;/g'<<<$1`s/.*/\L&/"

Input from stdin; characters to be doubled as a single argument:
$ echo chameleon | strtech caln
cchaamelleonn

This works by constructing a sed program from $2 and then executing it against $1.  The sed program replaces the first occurrence of each replacement letter with two copies of its uppercase version, and downcases the whole lot at the end.  For the example above, the generated sed program is
s!^[^c]*c!\U&C!;s!^[^a]*a!\U&A!;s!^[^l]*l!\U&L!;s!^[^n]*n!\U&N!;s/.*/\L&/

pretty-printed:
# if only sed had non-greedy matching...
s!^[^c]*c!\U&C!
s!^[^a]*a!\U&A!
s!^[^l]*l!\U&L!
s!^[^n]*n!\U&N!
s/.*/\L&/

I use the uppercase to mark characters processed so far; this avoids re-doubling characters that have already been doubled, or applying a doubling earlier than the previous one.
Earlier version, before clarification that order of replacement list is significant (44 chars):
sed "`sed 's/./s!&!\U&&!;/g'<<<$1`s/.*/\L&/"

Incorrect. strtech na <<< banana outputs “baannana”, but first an occurrence on “n” should be doubled, only after that an occurrence of “a”.

In that case, I've misunderstood the question; it wasn't explicit that the ordering meant that prior letters should not be doubled, simply that you would be able to find a subsequent one to double.  I'll have a think about an alternative that satisfies this new requirement.

No problem, neither I got it right the first time. I suggest to delete your answer while thinking (you can undelete any time later), to avoid the chance to get downvoted.

@manatwork: I've asked the questioner for clarification, and provided an alternative answer that satisfies that reading of the rules (but it cost me 7 chars to do so)

JavaScript, 92 characters
function f(s,c){r="";for(i=0;i<s.length;i++){r+=s[i];if(c.indexOf(s[i])>-1)r+=s[i]}return r}

Unobfuscated version:
function stretch(str, chars) {
    var ret = "";
    for(var i = 0; i < str.length; i++) {
        ret += str[i];
        if(chars.indexOf(str[i]) > -1) {
            ret += str[i];
        }
    }
    return ret;
}

Perl, 51 bytes
$s=<>;$s=~s=^.*$_=$_=,$,.=$&for split"",<>;print$,;

Input is provided via STDIN. First input is the starting word (e.g. chameleon), second input is the letters as a single string (e.g. caln).
The above is just an obfuscated (read "prettier") way of doing the following:
$word = <>;
for $letter(split "", <>) {
   $word =~ s/^.*$letter/$letter/;
   $result .= $&;
}
print $result;

As we go through each letter, we replace from the start of the word up to the letter in the source word with just the new letter, and append the match (stored in $&) to our result. Since the match includes the letter and then gets replaced with the letter, each letter ends up appearing twice.
Because STDIN appends a new line character to both of our inputs, we're guaranteed to capture the remnants of the full word on the last match, i.e. the new line character.

Perl 5 + -0p, 26 bytes
1while s;(.)(.+
)\1;$1$1$2
Try it online!

K (ngn/k), 41 21 bytes
-20 bytes by adapting my answer here
{x@&y{y_x,1+y~:*x}/x}

Try it online!

y{...}/x set up a reduction seeded with y (the characters to repeat), run over the characters in x (the full string). confusingly, within the function itself, x and y are flipped. this ends up returning a boolean array with 2s in the positions containing the desired matches and 1s everywhere else

1+y~:*x compare the first character to search for (*x) to the current character being iterated over (y), updating y with the result of 0 or 1. then add one to this; this represents the number of copies of the current character to end up returning. note that as soon as we have matched all the search characters, no more matches will be identified (since a character will never ~ (match) a 1 or 2)
x, append this result to the list of characters to search for (essentially overloading the reduction to end up returning the desired output)
y_ if there was a match, drop the first character (if there wasn't a match, this is a no-op). this allows us to search for the next search character in the next iteration of the reduction

x@& return the correct number of copies of each character

Vyxal s, 9 bytes
£ƛ¥h=[&Ḣd

Try it Online!
£ƛ¥h=[&Ḣd
£         # Put the first input in the register
 ƛ        # Map over the second input:
  ¥h=[    #  Is the current character equal to the first character of the register?
      &Ḣd #  If so, remove the first character of the register and double the current character
          #  (implicit) else, return the current character unchanged
          # s flag smashes this list into a string

Python, 53 92 bytes
Found my solution to be the same length in both Python 2 and 3.
EDIT: Man, fixing that case when doing multiple replaces of the same letter (while still using the same method) took a bit of work.
Python 2:
Try it here
def f(s,t):
 for c in t:s=s.replace(c,'%',1)
 print s.replace('%','%s')%tuple(x*2for x in t)

Python 3:
s,*t=input()
for c in t:s=s.replace(c,'%',1)
print(s.replace('%','%s')%tuple(x*2for x in t))

Lua, 76 78 76 75 58 53 bytes
New, completely reworked solution with help from wieselkatze and SquidDev! come on guys, we can beat brainfuck :P
function f(a,b)print((a:gsub("["..b.."]","%1%1")))end

Explanation coming tommorow. Try it here.

Original solution:
Saved 2 bytes thanks to @kirbyfan64sos!
Lua is a pretty terrible language to golf in, so I think I did pretty good for this one.
function f(x,y)for i=1,#x do g=y:sub(i,i)x=x:gsub(g,g..g,1)end print(x)end

Code explanation, along with ungolfed version:
function f(x,y) --Define a function that takes the arguements x and y (x is the string to stretch, y is how to stretch it)
  for i=1,#x do --A basic for loop going up to the length of x
    g=y:sub(i,i) -- Define g as y's "i"th letter
    x=x:gsub(g,g..g,1) --Redefine x as x with all letter "g"s having an appended g after them, with a replace limit of 1.
  end
  print(x)
end

Try it here. (Outdated code but same concept, just less golfed, will update tommorow)

Added on two bytes because I had to fix glitch where it would replace all letter defined in the array with their duplicates.

I think you can remove the newlines after function f(x,y) and after print(x), saving you two bytes.

Mathematica, 66 bytes
""<>Fold[Most@#~Join~StringSplit[Last@#,#2->#2<>#2,2]&,{"",#},#2]&

Example:
In[1]:= f = ""<>Fold[Most@#~Join~StringSplit[Last@#,#2->#2<>#2,2]&,{"",#},#2]&

In[2]:= f["banana", {"n", "a"}]

Out[2]= "bannaana"

Ruby, 46 bytes
f=->s,a{a.map{|c|y,s=s.split(c,2);y+c*2}*''+s}

For each character c in the array a, divide the string s in two halves on the first occurrence of c. Add two copies of the c to the first half, and continue with the other half of s. Join it all together and add the remainder of s :)
Examples:
f["coconut", %w(c o)]
=> "ccooconut"
f["banana", %w(b a a)]
=> "bbaanaana"

C, 57
Inspired by BrainSteel's answer:
f(char*s,char*c){while(*c-putchar(*s++)||putchar(*c++));}

This uses the result of putchar to determine whether we've hit one of the replacement list, and if so, advance one through the replacement list, outputting as we go.
If we don't consume all the replacements, we'll go off the end of the input string, but luckily the rules guarantee we wont.  :-)
Test harness:
int main(int argc, char* argv[]) {
    f(argv[1], argv[2]);
    return 0;
}

This code assumes no double letters in the replacement list. I don't think that's an assumption you are allowed to make, as the 4th test case has double letters. That is what drove me away from this approach :(

@BrainSteel - I've withdrawn the answer that makes the assumption "no double letters in the replacement list", and edited this to a new answer.  I can no longer avoid 2xputchar, but I save a few chars by using their results.

C#, 116 bytes
Indented for clarity:
string F(string s,string c){
    int i;
    return c==""
        ?s
        :s.Remove(i=s.IndexOf(c[0]))+c[0]+F(s.Substring(i),c.Substring(1));
}

SM83/Z80 machine language, 14 bytes
Takes input 1 in de, input 2 in hl, output to bc.
1A 13 02 03 B7 C8 BE 20
F7 02 03 23 18 F2

stretch:
 ld a,(de)                  // 1A       load input 1 char
 inc de                     // 13       and increment
 ld (bc),a                  // 02       store it
 inc bc                     // 03       and increment
 or a                       // B7       test for 0
 ret z                      // C8       return if so
 cp (hl)                    // BE       test against input 2 char
 jr nz,stretch              // 20 F7    if not same, continue
 ld (bc),a                  // 02       if same, store again
 inc bc                     // 03       and increment again
 inc hl                     // 23       also increment input 2 char
 jr stretch                 // 18 F2    loop back

The register pressure is extreme on this one. There's just enough room for three pointers and a character without pushing things to memory. It's impossible to do it this efficiently without putting the second input into hl.

PHP, 145 Bytes
  <?php
$a=str_split($argv[1]);
$b=str_split($argv[2]);
foreach($a as $x){
if($x==$b[0])
{
    $w[] = $x . $x;
    array_shift($b);
}
else $w[] = $x;
}
echo implode($w);

Link to compact version
Definitely not the shortest answer, but no one else has done PHP yet so why not!
Takes the word as the first argument, and a string representing the characters to be duplicated for the second argument.
I'm still new to golfing, so let me know if you see anything I could improve.
Thanks!

05AB1E, 9 bytes
vy?¬yQić?

Pretty similar to my 05AB1E answer for two related challenges: Speed of Lobsters and Backronymiser.
Try it online or verify all test cases.
Explanation:
v        # Loop over the characters `y` of the first (implicit) input-string:
 y?      #  Print this character
 ¬       #  Push the first letter of the list
         #  (which will be the second implicit input-list in the first iteration)
  yQi    #  If it's equal to the current character `y`:
     ć   #   Extract the head of the list
      ?  #   Pop and print it as well


text:
Rocket Bots KOTH
Rocket Bots
The year is 3024. People have become too scarce a resource to risk in war, so combat has shifted to the robots. Your task is to construct a bot like no other, who's rockets will rain destruction down on your foes and shoot down all incoming threats.
Gameplay
Bots
Gameplay takes place on a 10x15 grid. Your bot is located off the bottom edge, and has three slots at spots 6,7 and 8 of the grid. Your opponent is located at the top of the grid, with three slots directly opposite yours.
Rockets
From any of these slots, you can fire a rocket, assuming the slot has not been destroyed. A rocket consists of a list of directions that is given to it when created, and once fired these directions cannot be changed. Each turn, the rocket will consume the top of the list, and move in that direction. Rockets move simultaneously. If two rockets end in the same tile, they will both explode. If a rocket runs out of commands, it will explode. If a rocket runs out of fuel, after 100 moves, it will explode. When a rocket explodes, it will remain in that tile for 5 turns, causing any other rockets that move there to explode as well.
Note:  Because of the simultaneous movement, two rockets can pass each other without exploding, as long as they do not both end a turn in the same tile.
Goal
The goal of each match is to destroy your opponents slots while keeping yours alive. A rocket can be fired from any live slot you have, and is given a path designated by you before it is fired. You fire a rocket every second turn, meaning rockets will move twice before you can fire another one. A duel lasts for 200 turns, or until one bots slots are all destroyed.
Scoring
At the end of the match, you get one point for each live slot you have, and one point for each opponents slot you destroyed. This means it is a zero-sum game, and 6 points will be awarded each match.
A round robin will be run so that each bot faces each other bot once. If any bots use RNGs, then each matchup will be 1000 duels instead.
Implementation
Code for the competition can be found here: https://github.com/Cain93/RocketBots
Each submission should extend the Bot class. You must override the fireRocket method. This method receives a grid array of Rockets, Rocket[][], that represents the gameboard. You are always located at the bottom of the grid, with slots at spots [-1][6], [-1][7], [-1][8]. On the grid, unoccupied spots will be represented with null. If a rocket exists in a tile, you can identify who it belongs to by accessing the dis field. "^" is your rocket, and "v" is your opponents.
You must return a LinkedList of Integers that gives the instructions for your rocket. To move up, use 0. To move up and right, use 1, just right, use 2, etc all the way to 7 for up and left. The rocket will move in the order you push Integers. For example, the following code will make the rocket move upwards a few turns, zig-zag a few turns and then detonate.
LinkedList<Integer> moves = new LinkedList<Integer>();

moves.push(0);
moves.push(0);
moves.push(0);
moves.push(1);
moves.push(7);
moves.push(1);
moves.push(7);

To change which slot to fire the rocket from, change the curSlot field. 0 is your leftmost slot, and 2 is your rightmost. To check if a slot is destroyed, use getSlot(int slotNumber).
If a rocket ends a turn on a slot, that slot will be destroyed. You do not need to manually detonate the rocket.
Note: Rockets spawn at the location of the slot fired from, but will move once before collisions are evaluated. So if you fire a rocket from slot 0, and the first move is right (2), then you will destroy your own middle slot. However, up and right (1) is a safe move.
If you want to name your bot, override the name() method.
Bots will be re-built for each duel, so any static variables will be reset.
Good Luck!
May your rockets fly true and your opponents be nothing but smoldering scraps of metal.
Hint:

 Purposefully detonating rockets to create explosions is an easier way to defend than trying to shoot down opponents rockets.

Example Bot
package bots;

import java.util.LinkedList;

import mechanics.*;

public class SimpleBot extends Bot {

    public String name(){
        return "Simple";
    }

    public LinkedList<Integer> fireRocket(Rocket[][] g){

        LinkedList<Integer> l = new LinkedList<Integer>();
        for(int i = 0; i < 12; i++){
            l.push(0);
        }
        return l;
    }

}

Scores
Scores from 6-24
Simple: 900
Zigzagoon: 3654
Wall-E: 3606
Tortoise: 2248
3 Shot: 2334
HatTrickBot: 4287
Sniper: 2973
SideShooter: 2491
Terminator: 4835
StraightShot: 3378
Defender: 4570
MoreDakka: 4324

Fixed so order does not matter, if any bots use RNG's then I will increase the running to 1000 times per matchup

Is there a way to check if an opponent slot is destroyed? getSlot(int) is only for our slots, right?

@Katenkyo Right now, there is no way to check opponents slots. Would this be valuable, do you thnk?

@Cain It could be interesting, to be able to not launch any rocket to a destroyed slot :3

There is a bug in the code: If you are player 1 and use slot 0, the rocket spawns at x:6. However, if you are player 2 and use slot 0, the rocket spawns at x:8. Could you either fix this or provide a method to determine on which side the bot is located?

@Manu it's not a bug, you're looking to the board from your side, so the left slots are relative

I'm so sorry, fixed that bug already, I just forgot to push it!

@Cain cool, thank you! :)

Defender
Defender uses a new type of defense: The rockets are patrolling in front of the slots. This gives a huge advantage, since rockets live for 100 turns instead of 5 turns (like explosions).
package bots;

import java.util.LinkedList;
import mechanics.*;

public class Defender extends Bot {
    int turn = 0;

    @Override
    public String name() {
        return "Defender";
    }

    @Override
    public LinkedList<Integer> fireRocket(Rocket[][] grid) {
        LinkedList<Integer> command = new LinkedList<Integer>();
        for (int i = 0; i < 3; i++) {
            if ((grid[0][6+i] == null || grid[0][6+i].getDis().equals("v")) && (grid[1][6+i] == null || grid[1][6+i].getDis().equals("v")) && getSlot(i)) {
                curSlot = i;
                command.push(0);
                for (int j = 0; j < 50; j++) {
                    command.push(0);
                    command.push(4);
                }
                break;
            }
        }

        if (command.isEmpty()) {
            if ((grid[0][9] == null || grid[0][9].getDis().equals("v")) && (grid[0][10] == null || grid[0][10].getDis().equals("v")) && (grid[1][10] == null || grid[1][10].getDis().equals("v")) && getSlot(2)) {
                curSlot = 2;
                command.push(1);
                command.push(1);
                command.push(4);
                for (int i = 0; i < 50; i++) {
                    command.push(6);
                    command.push(2);
                }
            } else if ((grid[0][5] == null || grid[0][5].getDis().equals("v")) && (grid[0][4] == null || grid[0][4].getDis().equals("v")) && (grid[1][4] == null || grid[1][4].getDis().equals("v")) && getSlot(0)) {
                curSlot = 0;
                command.push(7);
                command.push(7);
                command.push(4);
                for (int i = 0; i < 50; i++) {
                    command.push(2);
                    command.push(6);
                }
            }

        }

        if (command.isEmpty()) {
            if (turn % 2 == 0 && getSlot(0)){
                curSlot = 0;
                command.push(7);
                command.push(7);
                for (int i = 0; i < 7; i++) {
                    command.push(0);
                }
                command.push(2);
                for (int i = 0; i < 2; i++) {
                    if (Math.random() < 0.2) command.push(2);
                }
                command.push(1);
            } else {
                curSlot = 2;
                command.push(1);
                command.push(1);
                for (int i = 0; i < 7; i++) {
                    command.push(0);
                }
                command.push(6);
                for (int i = 0; i < 2; i++) {
                    if (Math.random() < 0.5) command.push(6);
                }
                command.push(7);
            }
        }

        turn++;
        return command;
    }
}

Wow +1 . Awesome bot. But as you say, fails to play good when the bot is on the other side.

Pretty flawless play, congratualtions

Zigzagoon
The outer slots go (slightly) wide, then head forward and come back in toward the enemy slots. The middle slot shoots a zigzag pattern up the middle.
Every other round (3 turns), it goes into defense mode and just explodes some rockets near my own slots. Attack mode rockets then go around them. Nothing too fancy, just something to get the contest up and running.
package bots;import java.util.*;import mechanics.*;

public class Zigzagoon extends Bot{
    String[] evenMoves = {"7000000001","0170710170","1000000007"};
    String[] oddMoves = {"0","00","0"};
    boolean even = true;
    public String name(){return "Zigzagoon";}

    public LinkedList<Integer> fireRocket(Rocket[][] g){
        curSlot = (curSlot+1)%3;
        if(curSlot<1)even=!even;
        String[] moves = even?evenMoves:oddMoves;
        LinkedList<Integer> command = new LinkedList<Integer>();
        for(int i=0;i<moves[curSlot].length();i++)
            command.push(moves[curSlot].charAt(i)-'0');
        return command;
    }
}

Fixed, most of the difference came from which whether even started as true or false. Bots now rebuild before each match.

Ah, that makes sense. I didn't even think of variables not resetting. Thanks :)

Terminator
I'm proud to present Terminator !!!
Each rocket move far left/right from the middle and return on a enemy slot. Every two turns, a defense rocket is launched straight and explode near slot to protect it.
package bots;

import java.util.LinkedList;
import mechanics.Bot;
import mechanics.Rocket;

public class Terminator extends Bot {

    int n = 0;
    String[] moves = {"000", "0111107777", "00", "0077700111", "00", "0777701111"};

    public String name() {
        return "Terminator";
    }

    @Override
    public LinkedList<Integer> fireRocket(Rocket[][] g) {
        curSlot = (n+1) % 3;

        LinkedList<Integer> commands = loadCommands(moves[n % moves.length]);
        n++;

        return commands;
    }

    protected LinkedList<Integer> loadCommands(String commands) {
        LinkedList<Integer> linkedList = new LinkedList<Integer>();

        for (int i = 0; i < commands.length(); i++) {
            linkedList.push(commands.charAt(i) - 48);
        }

        return linkedList;
    }

}

HatTrickBot
I had DoubleTapBot for CodeBot 3, who was hitting twice on a turn, here comes HatTrickBot : Hitting all the 3 spots at the same time !
It is always possible to prevent a rocket to hit if you know where it will fall.
But I don't think there's many bot that will be able to protect their slots against a 3 rocket attack.
By the way, yes, it's horrible to see such elseif with repeated switch. I could have created a var to switch on with unique values for each combination of the status of slots and the turnConter. But it would be harder to read (I would have to keep the meaning of the values in a comment... boring !) :)
package bots;
import java.util.LinkedList;
import mechanics.*;
/*
 * HatTrickBot always tries to destroy all the enemy slots at once
 * In order to achieve this, each slot needs extrem concentration and coordination
 * It explain why they need some turns to re-synchronized the rockets after one of them dies.
 */
public class HatTrickBot extends Bot
{
    // Default moves are at [0]
    // moves at [1] are used when there's only 2 slots remaining
    // moves  [2-4] are here for when there's only 1 slot remaining
    // it panicks, and can't establish how to fire to do a hat trick.
    // So he will just spamm every ennemy position, one at a time
    String[] rightSlot = {  "770002000020",
                            "0000000001",
                            "0000000000",
                            "0000000001",
                            "0000000011"};
    String[] midSlot   = {  "0000000000",
                            "11000060000",
                            "0000000000",
                            "0000000010",
                            "0000000700"};
    String[] leftSlot  = {  "11000060007",
                            "777702000020",
                            "0000000000",
                            "0000007000",
                            "0000077000"};
    int turnCounter=-1;
    public String name(){return "HatTrickBot";}
    public LinkedList<Integer> fireRocket(Rocket[][] g)
    {
        turnCounter=(turnCounter+1)%3;
        String[][] moves = {rightSlot,midSlot,leftSlot};
        LinkedList<Integer> ll = new LinkedList<Integer>();
        boolean slotL=getSlot(0),slotM=getSlot(1),slotR=getSlot(2);
        int movePoint=0;
        if(slotL&&slotM&&slotR)
        {
            switch(turnCounter)
            {
            case 0: curSlot=0;
                break;
            case 1: curSlot=2;
                break;
            case 2: curSlot=1;
                break;
                default:break;
            }
            movePoint=0;

        }
        else if(!slotM&&slotL&&slotR)
        {
            switch(turnCounter)
            {
            case 0: curSlot=0;
                    movePoint=0;
                break;
            case 1: curSlot=2;
                    movePoint=0;
                break;
            case 2: curSlot=0;
                    movePoint=1;
                break;
                default:break;
            }
        }
        else if(!slotL&&slotM&&slotR)
        {
            switch(turnCounter)
            {
            case 0: curSlot=0;
                    movePoint=0;
                break;
            case 1: curSlot=1;
                    movePoint=1;
                break;
            case 2: curSlot=0;
                    movePoint=1;
                break;
                default:break;
            }
        }
        else if(!slotR&&slotM&&slotL)
        {

            switch(turnCounter)
            {
            case 0: curSlot=2;
                    movePoint=1;
                break;
            case 1: curSlot=1;
                    movePoint=1;
                break;
            case 2: curSlot=1;
                    movePoint=0;
                break;
                default:break;
            }
        }
        else
        {
            if(slotR)curSlot=0;
            if(slotM)curSlot=1;
            if(slotL)curSlot=2;
            movePoint = 2+turnCounter;
        }
        for(int i=0;i<moves[curSlot][movePoint].length();i++)
            ll.push(Integer.parseInt(moves[curSlot][movePoint].charAt(i)+""));
        return ll;
    }
}

Rockets only fire every other turn, so this doesn't make a full Hat Trick hit. Still extremely effective though

@Cain Ho, sad that it's every 2 turns :/. Anyway, I'll see the result of the first round then modify to do a real HatTrick if I think it can improve it :)

Rockets move twice between every time fireRocket() is called. So right now, they are all offset from each other by a turn still. You can use the test file in the controller to see a visual representation of the match.

@Cain I was at work when I wrote those bots, so I based them only on the specs :)

Wow, I'm impressed you managed to write that without any testing then, congrats. I updated the specs to make it more clear

@Cain Haha, thanks for the congrats ! But it's all thanks to the specs, they were clear up to that point :).

SideShooter
First shoots via the first ( rightmost ) turret in one of two different ways. Then, it shoots via the last ( leftmost ) turret in one of two different ways. Then it makes a "wall" with the second ( middle ) turret by exploding rockets in front of each turret. This process is repeated.
If the game lasts for more than 30 turns, SideShooter grows bored and changes in a small way. Instead of making a "wall" with the second ( middle ) turret, it shoots straight. The rest of the turrets behave the same way.
import java.util.LinkedList;

public class SideShooter extends Bot {

    int[] launcher = new int[]{1, 3, 2, 2, 2};
    String[] right = {"1100000077", "100000007"};
    String[] left  = {"7700000011", "700000001"};
    int position = -1;
    int turns = 0;

    public String name(){
        return "SideShooter";
    }

    public LinkedList<Integer> fireRocket(Rocket[][] g){
      LinkedList<Integer> directions = new LinkedList<Integer>();

      if(getSlot(0) || getSlot(1) || getSlot(2))
          do{
              position = (position + 1) % 5;
              curSlot = launcher[position] - 1;
          }while(!getSlot(curSlot));

      if(position == 0)
      {
          String shoot = left[((int) (Math.random() * left.length))];
          for(int i=0; i < shoot.length(); i++)
              directions.push(shoot.charAt(i)-'0');
      }else if(position == 1)
      {
          String shoot = right[((int) (Math.random() * right.length))];
          for(int i=0; i < shoot.length(); i++)
              directions.push(shoot.charAt(i)-'0');
      }else
      {
          if(turns < 30)
          {
            if(position == 2 )
                directions.push(0);
            else if(position == 3)
                directions.push(1);
            else if(position == 4)
                directions.push(7);
          }else
              for(int i=0; i < 10; i++)
                  directions.push(0);
      }
      turns ++;
      return directions;
    }

}

the do...while statement do an infinite loop...

@guy777 , No it isn't. It loops until it find a not-broken turret.

ok ! the two first time i launch the code with all bots, SideShooter and other bot (i don't know which) can't finish the game !!!

Some games are unfinishable. The controller should have a turn limit.

When all turrets are down and SideShooter plays in second, your bot do an infinite loop in the do...while because !getSlot(curSlot) always return true. Your should put a test before entering the while loop.

@guy777 , Ok. So, will int temp = position;       do{           position = (position + 1) % 5;           if(temp == position)               break;             curSlot = launcher[position] - 1;       }while(!getSlot(curSlot)); prevent it? (PS: I'm a bit busy now. You can edit my answers to correct the mistake)

just put if(getSlot(0) || getSlot(1) || getSlot(2)) before do. I edit your answer

@CoolGuy I voted to approve his edit. Make sure to review/test it yourself.

Sniper
Sniper first blocks its two sides and then starts shooting straight.
import java.util.LinkedList;

public class Sniper extends Bot {

    int[] launcher = new int[]{1, 3, 1, 2, 3};
    String[] moves = {"7", "1", "0000000000", "0000000000", "0000000000"};
    int position = -1, move = 0;

    public String name(){
        return "Sniper";
    }

    public LinkedList<Integer> fireRocket(Rocket[][] g){
        LinkedList<Integer> directions = new LinkedList<Integer>();

        if(getSlot(0) || getSlot(1) || getSlot(2))
        do{
            position = (position + 1) % launcher.length;
            curSlot = launcher[position] - 1;
        }while(!getSlot(curSlot));

        for(int i=0; i < moves[move].length(); i++)
            directions.push(moves[move].charAt(i)-'0');

        move = (move + 1) % moves.length;

        return directions;
    }

}

See the comments on SideShooter, same issue here.

Tortoise
If I protect all my bases, I have 3 points. Bases can only be attacked from 5 locations if I get the grid well. Rocket lasts 5 turn on the field...
This bot uses all of this to match its goal : surviving with at least 50% of the points in the pocket. It shoots 3 rockets, then cover itself
package bots;

import java.util.LinkedList;

public class Tortoise extends Bot
{
    int turnCounter=-1;
    boolean attacked=false;
    int[] moves={7,0,0,0,1};
    public String name(){return "Tortoise";}
    public LinkedList<Integer> fireRocket(Rocket[][] g)
    {
         LinkedList<Integer> rocket = new LinkedList<Integer>();
         turnCounter++;
         if(!attacked)
         {
             curSlot=turnCounter;
             for(int i=0;i<11;i++)
                 rocket.push(0);
             if(turnCounter==2)
                 attacked=true;
             return rocket;
         }
         turnCounter%=5;
         switch(turnCounter)
         {
         case 0:
         case 1:curSlot=0;break;
         case 2:curSlot=1;break;
         case 3:
         case 4:curSlot=2;break;
            default:break;
         }
         rocket.push(moves[turnCounter]);
         return rocket;
    }
}

Rockets only fire every other turn, so you can really only maintain 2 and a half walls

@Cain Oh, So i'll modify it to have a real shelter :)

Three Shot
We got some weird shots flying. No true defense, but the pattern is such that it will be hard to get a shot past this bizarre hail of missiles. (or that is the idea. it most likely will not work.)
package bots;import java.util.*;import mechanics.*;

public class ThreeShot extends Bot{
    public String name(){state = 0;return "3 Shot";}
    private int state;

    public LinkedList<Integer> fireRocket(Rocket[][] g){
        LinkedList<Integer> command = new LinkedList<Integer>();
        if(state < 2){
           state++;
           return fireLeft();
        }
        if(state < 4){
           state++;
           return fireCenter();
        }
        state=(state+1)%6;
        return fireRight();
    }
    LinkedList<Integer> fireCenter(){
        LinkedList<Integer> command = new LinkedList<Integer>();
        curSlot = 1;
        while(command.size()<90){
            command.push(1);
            command.push(7);
            command.push(6);
            command.push(1);
        }
        return command;
    }
    LinkedList<Integer> fireRight(){
        LinkedList<Integer> command = new LinkedList<Integer>();
        curSlot = 2;
        command.push(1);
        for(int i=0;i<8;i++){
            command.push(0);
        }
        command.push(7);
        return command;
    }
    LinkedList<Integer> fireLeft(){
        LinkedList<Integer> command = new LinkedList<Integer>();
        curSlot = 0;
        command.push(7);
        for(int i=0;i<8;i++){
            command.push(6);
            command.push(1);
        }
        command.push(1);
        return command;
    }
}

Note

MoreDakka
MoreDakka shoots in five directions without a stop (until turrets gets wrecked by other missiles).
import java.util.LinkedList;

public class MoreDakka extends Bot
{
    String[] moves={"70000000001", "0000000000", "0000000000", "0000000000", "1000000007"};
    int[] launcher = new int[]{0, 0, 1, 2, 2};
    int position = -1;

    public String name(){
        return "MoreDakka";
    }

    public LinkedList<Integer> fireRocket(Rocket[][] g)
    {
         LinkedList<Integer> directions = new LinkedList<Integer>();

         if(getSlot(0) || getSlot(1) || getSlot(2))
            do{
                position = (position + 1) % launcher.length;
                curSlot = launcher[position];
            }while(!getSlot(curSlot));

         for(int i=0; i < moves[position].length(); i++)
            directions.push(moves[position].charAt(i)-'0');

         return directions;
    }
}

StraightShot
Just fire right at them.
package bots;import java.util.*;import mechanics.*;

public class StraightShot extends Bot{
    public String name(){return "StraightShot";}

    public LinkedList<Integer> fireRocket(Rocket[][] g){
        LinkedList<Integer> command = new LinkedList<Integer>();
        curSlot = (curSlot+1)%3;
        for(int i=0;i<100;i++)
            command.push(0);
        return command;
    }
}

In case you weren't aware, this is basically the same as WaveBot, one of the example bots included with the controller.

@Geobits I had no idea that example bots existed.

My bad for not putting the Sample Bots somewhere easier to see. I'm just gonna delete WaveBot and let this entry stand

Here's my own entry
WallE
Shoots some offset rockets, and builds walls on his edges and center.
After 100 turns, starts targeting the middle slot.
package bots;

import java.util.LinkedList;
import java.util.Random;

import mechanics.*;

public class WallE extends Bot {

    int turn = 2;

    public String name(){
        return "Wall-E";
    }

    public LinkedList<Integer> fireRocket(Rocket[][] g){
        turn++;
        LinkedList<Integer> moves = new LinkedList<Integer>();
        curSlot = 1;
        switch(turn%4){
        case 0:
            //Check the right wall
            if(getSlot(2)){
                curSlot = 2;
                moves.push(1);
                return moves;
            }
        case 1:
            //Check the left wall
            if(getSlot(0)){
                curSlot = 0;
                moves.push(7);
                return moves;
            }
        case 2:
            //Check the center wall
            if(getSlot(1)){
                curSlot = 1;
                moves.push(0);
                return moves;
            }
            break;
        default:
            //Fire a sneaky rocket
            Random rand = new Random();
            int direction = rand.nextInt(2);
            int back = 0;
            if(direction == 0 && getSlot(2)){ direction = 1; back = 7; curSlot = 2;}
            else{ direction = 7; back = 1; curSlot = 0; }
            moves.push(0);
            moves.push(direction);
            moves.push(direction);
            for(int i = 0; i < 5; i++){
                moves.push(0);
            }

            //Go for the center after turn 100
            if(turn > 104){
                moves.pop();
                moves.push(back);
            }
            moves.push(back);
            moves.push(back);

        }

        return moves;

    }

}

source: Stack Exchange

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

sort: votes


text:
Implement a FuzzyFinder
Inspired by this link I found on Reddit.
A FuzzyFinder is a feature of many text editors. As you start to type a file path S, the FuzzyFinder kicks in and shows you all files in the current directory containing the string you entered, sorted by the position of S in the file.
Your task is to implement a fuzzy finder. It should be program or function that takes (via stdin, function argument, or command line) a string S and a list of strings L, formatted however you wish, and returns or prints the result of running the fuzzy finder. The search should be case-sensitive. Results where S is in the same position in multiple strings may be sorted however you wish.
Example:
Input: mig, [imig, mig, migd, do, Mig]
Output:
    [mig, migd, imig]
OR
    [migd, mig, imig]

This is code golf, so the shortest solution wins.

Can we assume all input is in lowercase, or should we fuzzy match for upper case as well?

@Vioz- No; the search must be case-sensitive. I updated the question and the example.

Pyth, 9 bytes
oxNzf}zTQ

Try it online: Demonstration
Explanation:
            implicit: z = input string, Q = input list
    f   Q   filter Q for elements T, which satisfy:
     }zT      z is substring of T
o           order the remaining strings N by:
 xNz          the index of z in N

This was the exact same Pyth program as I had during my testing. :)

CJam, 18 15 bytes
{1$#)}q~2$,@$p;

Try it online in the CJam interpreter.
I/O
Input:
"mig" ["imig" "mig" "migd" "do" "Mig"]

Output:
["mig" "migd" "imig"]

How it works
      q~        e# Read and evaluate the input from STDIN.
                e# Pushes a needle and an array of haystacks.
{    }          e# Define a code block:
 1$             e#   Copy the needle.
   #            e#   Compute the index of the needle in the haystack.
    )           e#   Add 1 to the index.
        2$      e# Copy the block.
          ,     e# Filter: Keep only haystacks for which the code block
                e#         pushed a non-zero value.
           @    e# Rotate the block on top of the stack.
            $   e# Sort: Arrange the haystacks according to the values
                e#       pushed by the code block.
             p  e# Print the filtered and sorted haystacks.
              ; e# Discard the needle.

Python 2, 65
def f(s,l):g=lambda x:x.find(s)+1;print sorted(filter(g,l),key=g)

The expression x.find(s) returns the position of the first occurrence of s in x, giving -1 for no match. We add 1 to the result to that no-match corresponds to 0, letting us filter them out. We then sort by the match position, which is unaffected by shifting by 1.

GolfScript, 13 bytes
~{?)}+\1$,\$`

This is one of those rare occasions where GolfScript can beat CJam, by using block concatenation and taking a few liberties with the input which can be formatted however you wish.
Try it online in Web GolfScript.
I/O
Input
["imig" "mig" "migd" "do" "Mig"] {"mig"}

Output
["migd" "mig" "imig"]

How it works
~             # Evaluate the input from STDIN.
              # Pushes an array of haystacks and a needle in a block.
 {?)}         # Push a code block that computes an index and increments it.
     +        # Concatenate that block with the needle block.
      \1$     # Swap the block with the arrays of haystacks and copy the block.
         ,    # Filter: Keep only haystacks for which the code block
              #         pushed a non-zero value.
          \   # Swap the array of haystacks with the code block.
           $  # Sort: Arrange the haystacks according to the values
              #       pushed by the code block.
            ` # Inspect: Format the array for pretty printing.

JavaScript ES6, 68 bytes
(s,l,f=j=>j.indexOf(s))=>l.filter(w=>~f(w)).sort((a,b)=>f(a)>f(b))

This is an anonymous function that takes parameters s (file path string) and l (array of strings). The Stack Snippet below contains ungolfed code converted to ES5 so more people can test it easily. (If you have Firefox, you can use edc65's prettier test suite found in his answer.)

f=function(s,l){
  g=function(j){
    return j.search(s)
  }

  return l.filter(function(w){
    return ~g(w)
  }).sort(function(a,b){
    return g(a)>g(b)
  })
}

id=document.getElementById;run=function(){document.getElementById('output').innerHTML=f(document.getElementById('s').value,document.getElementById('l').value.split(', ')).join(', ')};document.getElementById('run').onclick=run;run()
File path: <input type="text" id="s" value="mig" />

Files: <input type="text" id="l" value="imig, mig, migd, do, Mig" />

<button id="run">Run</button>

Output: <output id="output"></output>

Wow! silly me losing time preparing a test suite!

[Hold] Pyth, 24 Bytes
JwKcwdVlK=G.)KI}JGaYG))Y

Try is here
I'm pretty new at Code Golfing/Pyth so I'm not sure it's optimal, but I'm working on it!
Update: I don't think I'm actually sorting correctly, and I can't seem to get it to work. I know that o is order-by, and I need to sort by position of S so I am using .:GlJ in order to find all the substrings of the length of S for the current element G and then x in order to find the index of the first occurrence of S, but I can't seem to set lambda correctly.

Check out z and Q. Using them gives you immediately 18 bytes. And you can remove the l in VlK => 17 bytes (link)

Btw, your code doesn't work. Try the test case: imig mig migd do Mig imig

I have a working 9 bytes solution. If you want any help in Pyth, join the chat.

Oh, cool! I'll try to figure out how you did it tonight. Thanks for all the help! (Gonna need to earn 1 more reputation point before I can even chat :P)

@Changming Gave you the point. :)

Python 2, 69 68 66 Bytes
I just created a function which takes s as the string to match in a list of strings n
Edit 1: Thanks to Jakube for golfing off a byte.
lambda s,n:sorted([x for x in n if s in x],key=lambda x:x.find(s))

Check it out here.

JavaScript (ES6), 68
That's almost the same of @NBM answer (even if it's not copied), so I don't expect upvotes. Enjoy the snippet anyway
A function with a string and a string array arguments, return a string array. Filter then sort.
Test runnign the snippet below (being EcmaScript 6, Firefox only)

f=(s,l,i=t=>t.indexOf(s))=>l.filter(t=>~i(t)).sort((t,u)=>i(t)-i(u))

$(function(){
  $("#S,#L").on("keyup",
   function() {
     $('#O').val(f(S.value,L.value.split('\n')).join('\n'))
   } );
  $("#S").trigger('keyup');
})
#S,#L,#O { width: 400px }
#L,#O { height: 100px }

Input String
<input id=S value='mig'>

Input List
<textarea id=L>
imig
mig
migd
do
Mig
</textarea>

Output List
<textarea id=O readonly></textarea>

Haskell, 129 116
116 (Thanks to Franky):
import Data.List
h s=map snd.sort.map(\x->((head[c|c<-[0..length x],isPrefixOf s(drop c x)]),x)).filter(isInfixOf s)

129:
import Data.List
f s n=map snd(sort(map(\x->((head [c|c<-[0..length x],isPrefixOf s(drop c x)]),x))(filter(\x->isInfixOf s x)n)))

Well, it's pretty long, maybe I'll find how to short it up a bit...

shave off 13: h s=map snd.sort.map(\x->((head[c|c<-[0..length x],isPrefixOf s(drop c x)]),x)).filter(isInfixOf s)

ORACLE, 60
Does this count?
select * from t where a like '%mig%' order by instr(a,'mig')

It could count, but it would need to be an Oracle procedure that takes the data as arguments.

Whether it counts or not, I think it's cool. The first code golf solution ever that I really understand. Great work!

@ThomasWeller Thanks! These code golfers can certainly be very bright but sometimes KISS is all you need!

Vyxal r, 7 6 bytes
-1 byte because I is big dumb and forgot about multi-byte lambda thingies.
‡⁰e~Fṡ

Try it Online!
Explanation:
        # Implicit input - List of strings
‡       # Define lambda:
 ⁰      #   Get last input - Search string
  e     #   Regex span - Returns empty list for no match
   ~F   # Filter list by lambda without popping lambda
     ṡ  # Sort filtered list by lambda
        # Implicit output

@DLosc I guess I missed that when I was reading the challenge. Thanks for pointing it out. I actually like this answer better. It's not as short, but it's a lot more clever, imo.

Ruby, 63
p=->(w,l){l.find_all{|x|x[w]}.sort{|a,b|a.index(w)-b.index(w)}}

Run
irb(main):022:0> p["mig", ["imig", "mig", "migd", "do", "Mig"]]
=> ["migd", "mig", "imig"]

Notes

First find all matching words with find_all
Sort by index position of word to be searched.

Edit (by daneiro)
Ruby, 49
p=->w,l{l.select{|x|x[w]}.sort_by{|e|e.index(w)}}

Same thing in 49 characters: p=->w,l{l.select{|x|x[w]}.sort_by{|e|e.index(w)}}

@daniero Please post it as your answer. I will upvote !

Nah, that's ok really :) My version is just an improvement of yours, I think they are too similar to be separate answers. select is an alias for find_all, and sort and sort_by  are basically the same things in slightly different wrappings. I'll upvote you instead, for thinking of the same solution as me ;)

Pip, 15 bytes
14 bytes of code, +1 for -p flag.
Yq_@?ySKyN_FIg

Takes the list as command-line args and the string from stdin. Try it online!
Explanation
Yq              Yank a line of stdin into y
           FIg  Filter array of cmdline args by this function:
        yN_       Count occurrences of y in arg
      SK        Sort the resulting list using this key function:
  _@?y            Index of y in arg
                Print the Pip representation of the list (implicit, -p flag)

Japt, 7 bytes
føV ñbV

Try it
føV ñbV     :Implicit input of array U and string V
f           :Filter U by
 øV         :  Contains V?
    ñ       :Sort by
     bV     :  First index of V

Racket 46 bytes
(for/list((i l)#:when(string-contains? i s))i)

Usage:
(define (f s l)
 (for/list((i l)#:when(string-contains? i s))i))

Testing:
(f "mig" '["imig" "mig" "migd" "do" "Mig"])

Output:
'("imig" "mig" "migd")

Groovy, 32 bytes
{a,b->a.findAll{it.contains(b)}}

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:
Best place for learning GolfScript?
It looks like a fun language, but the official site is down and the EsoLangs page doesn't explain it quite well and looks like it's missing stuff. Is there anywhere that the language is documented?

Try https://web.archive.org/web/20150325040649/http://www.golfscript.com/golfscript/

We welcome questions for tips on golfing, but I'm not sure if tips on learning a golfing language (rather than golfing it down) are on topic. They'd certainly be useful, so I've raised a meta question to see how the community feels about this.

@MitchSchwartz Sweet! Works great!

Feel free to join us in chat; there are plenty of helpful people that would be willing to assist you in real-time if you have any other more specific questions. :)

@trichoplax I wasn't quite sure where to put it, this seemed like the best place.

@Phase At this point I don't think we're really sure where you should put it either, but regardless, welcome to PPCG and I wish you luck in learning GolfScript!

@AlexA. Thanks! I can't wait to get some birdies! I'll grab my 7 iron.

@Doorknob I'll be sure to ask all my questions there!

@MitchSchwartz Post as answer?

the site is now back up

A cached copy of the offical site is available on the Internet Archive's Way Back Machine.

the site is now back up

GolfScript is a nice language, but, as you already said, the official webpage is down. While I don't claim to know the future, this probably means that no bugs will be fixed and no new features will be implemented. In fact, the latest version of the Ruby interpreter was released in 2013.
GolfScript also has a few annoying quirks (e.g., no character type), is very slow and bound to lose in contests where you'd need to use commands such as base or print, which are simply too long for a golfing language.
Where am I going with this? Learn CJam instead!
CJam is inspired by GolfScript, so almost everything you can do in GolfScript, you can do in CJam as well.
But:

It's easier to use.
It's more powerful.
It's faster.
It's shorter.
It has a client-side online interpreter.
Its developer is active on this very site.
It's released under the MIT license.
It's supported by several members of this community by submitting bug reports/feature requests, golfing tips and third party documentation.

I don't think "Don't learn GolfScript" is a good answer for somebody expressing an interest to learn GolfScript.

@MitchSchwartz: I disagree. It might not be the answer the OP was expecting, but I still think it's good advice.

@Dennis I agree with your disagree, I'll be sure to learn CJam!

Aren't some GolfScript answers still shorter than the CJam equivalents?

Also, the SourceForge repo shows the latest commit 2 months ago.

@kirbyfan64sos: It's true, a GolfScript answer can be one or two bytes shorter than its CJam counterpart. But it's much more common to find a CJam answer that is 50% shorter. Regarding SF, as far as I know, the official interpreter was never hosted there.

@Dennis Ack, you're right about SF. I feel smart. :/

the site is now back up


text:
Tips for golfing in TI-BASIC
What general tips do you have for golfing in TI-BASIC for the TI-83/84+ series calculators? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to TI-BASIC (e.g. "remove comments" is not an answer).
Please post one tip per answer.

Please always include which version you are refering to!

Your calculator is pretty smart at inferring the end of lines for you, and thus you can omit quite a few characters.
:Disp "HELLO WORLD    //is the same as...
:Disp "HELLO WORLD"

For( loops have a syntax like this - For(variable, start, end, increment), but you can omit the increment and it will use 1:
:For(A,1,5     //is the same as...
:For(A,1,5,1)

and you can omit ending parentheses (at the end of lines) across the board:
:Output(1,1,A
:int(A
:round(A
etc.

Tested on my TI-84 Silver Edition calculator
If you think this is more than one idea (inferring endings) then I'll split them up

....this is just wrong

Also, try to rewrite code so you use the least number of closing parentheses. On only the last expression of every line, you get the parentheses for free, so move the most nested statements to the end. That is, not(iPart(B))+(A=5 can be (A=5)+not(iPart(B.

This applies for everything that needs closing, not just parentheses (namely {lists}, "strings" and [[matrices]]). Expressions will automatically be closed when you reach a newline, colon (a stand-in for the newline; doesn't apply to strings, though, as they can contain colons) or the variable assignment arrow (→, typed with the STO▶` button). Such a weird feature of the language.

Use Ans
If you will only use an expression in the next line, don't store it to a variable! The special Ans variable is a one-byte token that stores the value of the last expression evaluated. Thus:
Xsin(A)->R
Disp R+tanh(R

can be
Xsin(A)
Disp Ans+tanh(Ans

saving two bytes.

Use a lookup table encoded in floating-point numbers
A slightly advanced tip:
Small lookup tables are useful for code golf: it's very often that we need a function that maps, for example, 0 to 1, 1 to 2, 2 to 1, and everything else to 0. However, TI-BASIC arrays are not suited for this purpose: for one thing, they're one-based, and for another, a value cannot be extracted until the array is stored in Ans or a list variable.
In my answer here, I store a small lookup table in a magic constant in base 11. Simply list the values you want to use,
{0,-1,5,-1,-1,2,9,-1,8,6}

convert to a useful form
{1,0,6,0,0,3,10,0,9,7}

write in your desired base (base 11)
.106003A097

and convert to base 10
-1+int(11fPart(11^Ans.0954191904

The shortest array approach is 8 bytes longer!
{1,0,6,0,0,3,10,0,9,7}-1:Ans(X+1

TI-BASIC only stores floats to 14 decimal digits, so you can store up to 44ish bits but only 14 decimal digits.
This technique can often be improved further by using brute-force search to find a magic constant rather than base-N encoding. I'm still in the process of golfing the answer above, but the lengendary TI-BASIC golfer Weregoose used this method to generate the differences between numbers coprime with 30 (that is, a repeating list of 6, 4, 2, 4, 2, 4, 6, 2 ) on the wiki/forum TI-BASIC Developer with this snippet:
2+2iPart(3fPart(576e^(fPart(I/8

The magic constant 576 was found using Mathematica, but if you don't own a copy use a script in your favorite language.

Skip unnecessary variable initialization
Current consensus is to allow all code to be run on a fresh interpreter. We can take advantage of this—all uninitialized real variables start at 0 in TI-BASIC, and Xmin starts as the possibly useful value -10. So if you ever need to take a running total in a program that doesn't take input from Ans, or you really need a -10 in one less byte, this tip can help you.

Xmax is 10 and Ymin and Ymax behave similarly, right? Also there are some other graph parameters that have some other values, I think.

Put repeated expressions equation variables.
EX:
Remainder(randInt(1,9),1
Remainder(randInt(1,9),5
Remainder(randInt(1,9),10

Can be:
"randInt(1,9→u
Remainder(u,1
Remainder(u,5
Remainder(u,10

Note: it is hard to find a good use for this, but that does not mean you should forget equation variables :P
Source: http://tibasicdev.wikidot.com/selfmodify
-c4ooo from Omnimaga

In this example, you could save more by adding n to the first expression, along with the Remainder( function.

Smaller list generation
If you need a list {1,2,...,N}, where N is, say, 42, the obvious way to create it is
seq(X,X,1,42.

However, one byte smaller than that is a neat hack using the binomcdf( (cumulative binomial distribution) command.
cumSum(binomcdf(41,0

This only works when N is a constant, because the savings comes from replacing N-1 with its value in the code.
There are two cases that allow even shorter code.
If you already have a list L1 of dimension N:
cumSum(1 or L1

If you don't care about order:
randIntNoRep(1,N     ;random permutation of numbers from 1 to N

Guaranteed to be one byte smaller (and stupidly slower) than seq(X,X,1,N even when N isn't constant is cumSum(1 or rand(N.

Eliminate End statements for If blocks at the end of a program
Saves two bytes: one for the End and one for the linebreak. It also allows you to use the implied Disp on the last line, often saving an additional byte.
[code]
If A>5
Then
Output(1,1,Ans²+Ans+A
Disp 3ln(A
End
//end of program

Can be:
[code]
If A>5
Then
Output(1,1,Ans²+Ans+A
3ln(A
//end of program

It should be noted that this tip doesn't work for loop blocks.  +1 for the good tip though

Know your idioms
Here are some snippets I commonly use in code golf:

Convert to truth-value (0/1): not(not(Ans, or Ans and 1. Which one to use depends on the parentheses needed.
Add one to a truth-value: int(e^(Ans. Saves an open-paren over 1+(Ans. Very useful, because TI-BASIC has one-based arrays.
Map {0,1} to {1,-1}: cos(πAns. Saves one byte over 1-2Ans.

Sign function of a number: tanh(ᴇ9Ans
Round towards positive infinity: -int(-Ans
Number of digits in a positive integer: 1+int(log(Ans
Complex number to list {Re,Im}: imag(Ans{i,1

Convert string to list: seq(inString("...",sub(Ans,X,1)),X,1,length(Ans (where ... is the search string)
Chop off first element of a list: ΔList(cumSum(Ans
Chop off last element of a list: ΔList(cumSum(Ans)-Ans
Check if all elements of list L1 are unique: SortA(L1:min(ΔList(L1
Search for the number X in a list (returns first occurrence): 1+sum(not(cumSum(Ans=X
Mode of a list when a single mode exists, and the list has at most 10 elements: (ugly, but short): median(Ans,10^(seq(sum(Ans=Ans(X)),X,1,dim(Ans

I really don't understand why the tanh(ᴇ9Ans one works.

@SuperJedi224 Well, tanh(0 is zero, and the limits to infinity on the left and right are -1 and 1. It gets exponentially close to those values, so past +-17 or so it's within rounding error of +-1. If the absolute values are greater than 17ish already, we just use tanh( alone.

If you find yourself using
0→G ;or any other variable
;other lines of code

Then, you could use (to save a byte):
DelVar G;other lines of code

This is because when you delete a variable (G), it becomes its default value, in this case, 0. Then, you could put another line after the DelVar statement, without a newline. Be careful when putting crucial control statements directly after a DelVar statement.
(Tested on TI-84)

This is rarely useful; variables are initialized to 0 by default, and you can zero Y by doing a ZStandard.

@ThomasKwa It's been useful to me on many instances, esp. when a reset is required partway through execution.

In code golf? When? If you show me the program I think I'll be able to optimize out the DelVar.

@ThomasKwa Not xode golf per se, rather, programming on low disk space (TI-83). I don-t have the program right now. I'll get back to you on that.

After a few minutes of thought, I can think of a couple of scenarios when DelVar can possibly be shortest, like after single-line If statements.

Which list variables to use?
When using lists, avoid the default lists L₁ through L₆ in favor of named lists with one-letter names: ᶫA through ᶫZ (where ᶫ is the little L).
Either one costs two bytes to reference (though L₁ is a single token, it is a two-byte token) but when storing values in a list, you can drop the ᶫ symbol, saving a byte:
{1,2,3,4,5→ᶫA

can be
{1,2,3,4,5→A

The calculator checks the data type of the expression when deciding where the result is stored.
Similarly, Input A or Prompt A will store to ᶫA if the user enters a list instead of a number.
Several other commands can be used without the ᶫ, though most of them are rarely used in golfing. For example, Matr►list( allows the ᶫ to be removed in its third, fourth, and higher arguments.
The general rule is that, if the command takes a list variable name and not a list expression, and if there is no alternative syntax that could put a different kind of variable there, then the command might work with the ᶫ left off.
This doesn't work with modifying a single entry of a list: 1→ᶫA(3 cannot be changed to 1→A(3.
Of course, the best list variable to use is always Ans.

Wait, what? "Input A" stores to ᶫA if the user enters a list." That means that many of my programs are pretty easy to break. Then it's good that I don't have that many Input programs anyway, I mostly have either small tools with no error checking or complete games that use GetKey instead of Input.

If you are really keen on user-proofing your programs against this, you can always store a random value to A and check if it has changed after Input A.

Know your variable assignment costs
If you use a B-byte expression N times, should you assign it to a variable?
Ans costs 1+N bytes to use (one for the linebreak and one for each time it's used, so use Ans when (B-1)*(N-1)>2. There can be only one Ans per line, so try all values for Ans that might be useful.
Real variables (e.g. X) cost 3+N bytes, so use them when (B-1)*(N-1)>4.
List variables cost 3+2N bytes, so use them when (B-2)*(N-1)>5.
Equation variables are the least useful: they need 4+2N bytes. Use them when (B-2)*(N-1)>6.
Min. bytes in an expression to save
 N \ var. | Ans | Real | List | Eqn
------------------------------------
 2           4     5      8      9
 3           3     4      5      6
 4           2     3      4      5

When a function evaluates to a list, store it to a list rather than an equation variable like u; this saves one byte.
Keep in mind that the presence or absence of close parentheses can often cause storing expressions to be advantageous if they're rearranged.
Now I'll contradict myself and say that one should write code on one line as much as possible. Why? Usually when there's a long repeated expression on a line, it can be simplified.

int(rand over randInt(
X+int(Yrand is equal to or fewer bytes than randInt(X,Y as randInt is a 2 byte token.  Some potential benefits:
X+ can be left out when lower bound is 0, saving two bytes
X+ is necessary before randInt( anyway in certain situations, for example random from a step function like {2,5,8,11}
X+int(Yrand(N can be used just as randInt(X,Y,N to generate a list of N random numbers
Graphscreen initialization
To use functions like Line( easily with pixel coordinates it's necessary to initialize the graphscreen axes to square pixels and remove axes:
AxesOff
84→Xmin
72→Ymax
ZInteger

Clamp
min(U,max(L,N

Where N is the number or algorithm and U and L are upper and lower bounds
Is N in List
max(N={X,Y,Z

More List math
L1*L2→L3

instead of

for(A,1,dim(L1
L1(A)*L2(A→L3(A
End

This also works for things like this:
not(L1
L1 and L2

Output
Disp and Text( can both be chained, so Disp A,B will Display A then B on separate lines and Text(28,40,A,B will print A next to B on one line
If you only need to display a single thing at the end of a program you can drop the Disp command, the final line acts as an implicit Disp
Tech from the optimal movement loop
A lot of these optimizations are part of the tech used to move a character around the screen in the fewest bytes
http://tibasicdev.wikidot.com/movement
Token Size Lists
http://tibasicdev.wikidot.com/tokens
For help scoring