[Question]
  [
Write a function/program that accepts a string of lower/uppercase letters [A-Za-z] as input, that checks whether the occuring letters are unique and in alphabetical order (ignoring lower and uppercase) or not. The output must be truthy if they are unique and in alphabetical order and falsy if not.
Here some testcases
```
a                           true
abcdefGHIjklmnopqrSTUVWXyz  true     
aa                          false
puz                         true
puzz                        false
puzZ                        false
puZ                         true
PuZ                         true
pzu                         false
pzU                         false
abcdABCD                    false
dcba                        false
```
If you want, run your program on all words of a wordlist like [this one](http://www-01.sil.org/linguistics/wordlists/english/wordlist/wordsEn.txt) and and post some interesting ones =).
### Score
Lowest number of bytes wins.
  
[Answer]
# CJam, 8 bytes
```
lel_$_&=
```
[Here is a test harness](http://cjam.aditsu.net/#code=qN%2F%7B%0A%0Ael_%24_%26%3D%0A%0Ap%7D%2F&input=a%0AabcdefGHIjklmnopqrSTUVWXyz%0Aaa%0Apuz%0Apuzz%0ApuzZ%0ApuZ%0APuZ) for all examples in the challenge. This returns `0` or `1` (which are falsy and truthy, respectively, in CJam).
And [here](http://cjam.aditsu.net/#code=qN%2F%7B%0A%0Ael_%24_%26%3D%0A%0A%7D%2C%20N*) is a script to filter the word list in the question (takes a few seconds to run). You'll have to copy the word list into the input field manually, because it's too long for a permalink.
## Explanation
```
l        "Read input.";
 el      "Convert to lower case.";
   _$    "Get a copy and sort it.";
     _&  "Remove duplicates (by computing the set intersection with itself).";
       = "Check for equality with original (lower case) word.";
```
[Answer]
# Regex (any flavor), 55 bytes
Some people don't consider regex to be a programming language, but it's been used before, and it's not close to being the shortest.
```
^a?b?c?d?e?f?g?h?i?j?k?l?m?n?o?p?q?r?s?t?u?v?w?x?y?z?$
```
I've added one byte for the `i` (case-insensitive) flag. This is very straightforward and might be shorter to generate on the fly.
If regex alone are not allowed, you can use this 56-byte [Retina](https://github.com/mbuettner/retina) program suggested by Martin Büttner:
```
i`^a?b?c?d?e?f?g?h?i?j?k?l?m?n?o?p?q?r?s?t?u?v?w?x?y?z?$
```
Running this on the wordlist linked above yielded 10 6-letter words in alphabetical order.
> 
> ["abhors", "almost", "begins", "begirt", "bijoux", "biopsy", "chimps", "chinos", "chintz", "ghosty"]
> 
> 
> 
[Answer]
# Python 3, 44 bytes
```
*s,=input().lower()
print(sorted(set(s))==s)
```
A simple approach - check uniqueness, check sortedness.
[Answer]
# [><>](http://esolangs.org/wiki/Fish), ~~52~~ ~~42~~ 39 bytes
```
0>i:1+?v1n;
? )'`':/'@'v
0v?){:-<'`'/;n
```
This type of question is one of the few types that ><> is pretty comfortable with, since we only need to deal with one char at a time.
## Explanation
Don't get lost! There's a lot of wrapping here.
```
0            Push 0. We'll be mapping a-z to 1-26, so 0 will be smaller than everything
(loop)
i            Read a char of input
:1+? 1n;     If there's no more input, print 1
:'`')?       If the char is bigger than backtick...
  '`'          Push backtick  (which is one before 'a'), else...
  '@'          Push an @ sign (which is one before 'A')
-            Subtract, mapping a-z to 1-26
:{)?         If the new char is bigger than the previous char...
               Repeat from the beginning of the loop, else...
  0n;          Print 0
```
## Previous solution, 42 bytes
```
0i:1+?v1n;n0/\!
?)'`':/'@'v
? ){:-<'`'/ vv
```
The interesting thing is that, despite appearing to have the same functionality, the alternative
```
0i:1+?v1n;n0\/!
?)'`':/'@'v
? ){:-<'`'/ ^^
```
*(The change is in the arrows and mirrors on the far right)*
actually gives *incorrect* results, due to ><>'s interpreter using a Python defaultdict. What happens is that, by traversing through the empty space at the end of the second row, 0s are implicitly placed into the blank spaces when ><> tries to access the cell. This then messes with the `?` conditional trampoline at the beginning of the same row, as the newly placed 0s are skipped rather than the `v` at the end.
[Answer]
# Haskell, 52 Bytes
```
import Data.Char
and.(zipWith(>)=<<tail).map toLower
```
Usage: `(and.(zipWith(>)=<<tail).map toLower) "abcd"` which outputs `True`.
[Answer]
# C, 67 65 57 54 (52) characters
```
f(char*s){int c,d=0;for(;(c=*s++)&&(c&~32)>(d&~32);d=c);return!c;}
```
a little shorter:
```
f(char*s){int c,d=0;for(;(c=*s++)&&(c&~32)>d;d=c&~32);return!c;}
```
and even shorter:
```
f(char*s){int d=32;for(;(*s|32)>d;d=*s++|32);return!*s;}
```
Here's a little test: <http://ideone.com/ZHd0xl>
After the latest suggestions here are still two shorter versions:
```
// 54 bytes
f(char*s){int d=1;for(;(*s&=95)>d;d=*s++);return!*s;}
// 52, though not sure if valid because of global variable
d;f(char*s){d=1;for(;(*s&=95)>d;d=*s++);return!*s;}
```
Also this code relies on the fact, that in ASCII lowercase and uppercase only differ by the 5th bit (32) which I filter out. So this might not work with other encodings obviously.
EDIT: The latest version always sets the 5th bit as `|32` is shorter than `&~32`.
[Answer]
# Ruby, 33
```
->s{c=s.upcase.chars
c==c.sort|c}
```
Checks to see if the sorted unique characters are the same as all the characters.
[Answer]
## Javascript (ES5), 101
```
function i(s){b=0;l=''.a
s.toUpperCase().split('').forEach(function(c){if(c<=l)b=1
l=c})
return!b}
```
## Improved to 87 by edc95:
upvote his comment :)
```
function i(s){return!s.toUpperCase().split(l='').some(function(c){return(u=l,l=c)<=u})}
```
*Btw, the test cases currently in OP are fulfilled if a program is only checking uniqueness, disregarding order.*
---
I cant write comments yet, so I'll answer some remarks here:
**@edc65:** Thanks! I tried rewriting it using `some()`, but I couldn't get a shorter solution, because even though it looks like it would enable me to get rid of the superflous b variable, you need to type "return" twice (same with `reduce()`), and you can't just return the comparison's result directly, because the last character needs to be saved after the comparison with it.
**@edc65:** That's a nice use of the comma operator for 87! I edited it into my answer for more visibility.
[Answer]
# Haskell, 90 bytes
Supplies the function `f :: String -> Bool`
```
import Data.List
import Distribution.Simple.Utils
f l=g$lowercase l
g l=sort l==l&&l==nub l
```
Usage (assuming it is saved as golf.hs). `...` is used to replace `ghci`'s verbose loading messages.
```
$ ghci golf.hs
...
*Main> f "as"
...
True
*Main> f "aa"
False
```
If someone has a `lowercase` method shorter than `import Distribution.Simple.Utils` then please comment.
[Answer]
## Wolfram Mathematica, 49 37 bytes
```
f[x_]:=(l=Characters[ToLowerCase[x]];Union[l]==l)
```
P.S. Shorter solution by Martin Büttner:
```
Union[l=Characters@ToLowerCase@#]==l&
```
[Answer]
# J, 17 bytes
Checks if the lowercase sorted `/:~` string equals `-:` the lowercase nub `~.` string.
```
   (/:~-:~.)@tolower
   NB. testing with the example inputs
   ((/:~-:~.)@tolower) every (1$'a');'abcdefGHIjklmnopqrSTUVWXyz';'aa';'puz';'puzz';'puzZ';'puZ';'PuZ'
1 1 0 1 0 0 1 1
```
As in J a 1-charater long "string" represented as a regular string (with quotes) is just a character atom not a real string I formatted the input appropriately so all input would be real strings. (In the example above I used `1$'a'`.)
[Answer]
# MATLAB, ~~29~~ 27 bytes
Now for a one-liner which even makes sense outside of code-golf.
As an anonymous function (use as `o('yourstring')`)
```
o=@(s)all(diff(lower(s))>0)
```
I guess this function is pretty self-explanatory since it reads like a newspaper ad.
Previous version (29 bytes):
```
all(diff(lower(input('')))>0)
```
Input must be presented between `'` marks, e.g. `'Potato'`.
[Answer]
## Golang (65 bytes)
Go is not a golf friendly language, also, i suck at golf...
```
func a(s[]byte)(bool){return len(s)<2||s[0]|32<s[1]|32&&a(s[1:])}
```
Run it here: <http://play.golang.org/p/xXJX8GjDvr>
*edit 106->102*
*edit 102->96*
*edit 96->91*
*edit 91->87*
*edit 87->65*
I beat the java version, I can stop for today
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 3 bytes
```
ḷ⊆Ạ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pf/ahtw6Ompkcdy5VKikpTlfRqQMy0xJziVKXa04vK/z/csf1RV9vDXQv@/49WSlTSUUpMSk5JTXP38MzKzsnNyy8oLAoOCQ0Lj6isAkmCVBSUVkFIKBUFpkBkAJCMBQA "Brachylog – Try It Online")
The predicate succeeds if the input meets the requirements outlined and fails if it does not, printing `true.` or `false.` if run as a program.
```
       The input,
ḷ      lowercased,
 ⊆     is a not-necessarily-contiguous sub-list of
  Ạ    "abcdefghijklmnopqrstuvwxyz".
```
The first version I came up with, not explicitly referencing the alphabet:
# [Brachylog](https://github.com/JCumin/Brachylog), 4 bytes
```
ḷ≠.o
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pf/ahtw6Ompkcdy5VKikpTlfRqQMy0xJziVKXa04vK/z/csf1R5wK9/P//o5USlXSUEpOSU1LT3D08s7JzcvPyCwqLgkNCw8IjKqtAkiAVBaVVEBJKRYEpEBkAJGMB "Brachylog – Try It Online")
```
        The input,
ḷ       lowercased,
 ≠      in which every character is distinct,
  .     is the output variable,
   o    which sorted,
        is still the output variable.
```
[Answer]
# Pure Bash 4.x, 37
```
[[ ${1,,} =~ ^`printf %s? {a..z}`$ ]]
```
[Try it online!](https://tio.run/##VYxLC4JQFIT391ccxCBBpdYh0osKWkRlD6Po6D0XLVPzQWTUXzcVWjTwzWKGGQdTr3x4fkCQEPIe8IhBpZQy0DSQ5OV4Md9L5eEA8qurqm8wPnA6x4kfZgJaqQkv1PXifZbheCzrpS@g3ZZNw@goSg8yj8LmsBa5XgRZklOTUJDSfyXwFwmf8SikEhk6Licxmc4u1@AWRvE9Wa2tzXb3LBgii/OipjG7MpstKuIir7CabX8wHDHuOsi@ "Bash – Try It Online")
Input taken as a command-line parameter. As per standard shell semantics, exit code 0 means true (alphabetic) and exit code != 0 means false (not alphabetic).
The printf creates the regex as in [@hsl's solution](https://codegolf.stackexchange.com/a/47212/11259). The input string is expanded to lowercase and compared against the regex.
---
Previous answer:
### Bash + coreutils, 52
Straightforward solution:
```
a=`fold -1<<<${1,,}`
cmp -s <(sort -u<<<"$a")<<<"$a"
```
[Answer]
## J, 21 characters
This is too long. The argument must have rank `1`, i.e. it must be a string or vector.
```
*/@(<=~.;/:~)@tolower
```
* `tolower y` – `y` in lower case.
* `/:~ y` – `y` in lexical order.
* `~. y` – the nub of `y`, that is, `y` with duplicates removed.
* `x ; y` – `x` and `y` put into boxes and then concatenated.
* `< y` – `y` put into a box.
* `x = y` – `x` compared element-wise with `y`.
* `(< y) = (~. y) ; (/:~ y)` – a vector indicating if `y` is equal to its nub and itself sorted.
* `*/ y` – the product of the items of `y`, or its logical and if the items are booleans.
* `*/ (< y) = (~. y) ; (/:~ y)` – a boolean indicating the desired property for lowercase `y`.
[Answer]
# Julia, 44 bytes
```
s->(l=lowercase(s);l==join(sort(unique(l))))
```
This creates an anonymous function that takes a single argument `s`, converts it to lower case, and compares it to the unique sorted version of the string. It returns a boolean, i.e. `true` or `false`. If you want to test it out, assign it like `f=s->...` and then call `f("PuZ")`, etc.
[Answer]
# C# 6, 18 + ~~82~~ 76 = 94 bytes
Requires (18 bytes):
```
using System.Linq;
```
Code (76 bytes):
```
bool a(string s)=>(s=s.ToLower()).Distinct().OrderBy(x=>x).SequenceEqual(s);
```
C# 6 supports lambdas to define a function, which is useful for golfing.
Non-C# 6 version:
```
bool a(string s){return (s=s.ToLower()).Distinct().OrderBy(x=>x).SequenceEqual(s);}
```
Ungolfed code:
```
bool IsInAlphabeticalOrder(string s)
{
    s = s.ToLower();
    return s.Distinct()
            .OrderBy(x => x)
            .SequenceEqual(s);
}
```
[Answer]
# JavaScript (ES6) 54
Convert to uppercase, then to array and sort. If during sort two element are in the wrong order or equal, return 0 (falsy) else 1 (truthy)
**Edit** Shortened thx to @Optimizer (but still 2 more than the @Tamas solution implemented in ES6: `F=s=>[...s.toUpperCase()].every(c=>(u=l,l=c)>u,l='')`)
```
F=s=>[...s.toUpperCase(x=1)].sort((a,b)=>a<b?1:x=0)&&x
```
**Test** in Firefox / FireBug console
```
;['a','abcdefGHIjklmnopqrSTUVWXyz','aa','puz','puzz','puzZ','puZ','PuZ']
.map(w=>w+' '+F(w))
```
> 
> ["a 1", "abcdefGHIjklmnopqrSTUVWXyz 1", "aa 0", "puz 1", "puzz 0", "puzZ 0", "puZ 1", "PuZ 1"]
> 
> 
> 
[Answer]
# C (44 bytes)
`f(char*s){return(*s&=95)?f(s+1)>*s?*s:0:96;}`
Test it here: <http://ideone.com/q1LL3E>
Posting this because I can't comment yet, otherwise it would be a suggestion to improve the existing C answer because I completely stole the case-insensitive idea from the existing C answer.
Returns 0 if the string is not ordered, and a non-zero value if ordered.
[Answer]
## Java 8 - 90 89 87 85 chars
The idea here is to use a 'reduce' function that tracks the last char and "gives up" when it detects the sequence is not strictly ascending.
**golfed:**
```
int f(String s){return s.toLowerCase().chars().reduce(0,(v,c)->(v<0)?v:(c>v)?c:-1);}
```
**ungolfed:**
```
int f(String s){
    return s.toLowerCase()
            .chars()
            .reduce(0, (v,c) -> (v<0)? v : (c>v)?c:-1);
}
```
**example:**
```
System.out.println(new Quick().f("abc"));
System.out.println(new Quick().f("aa"));
System.out.println(new Quick().f("abcdefGHIjklmnopqrSTUVWXyz"));
System.out.println(new Quick().f("puZ"));
System.out.println(new Quick().f("Puz"));
System.out.println(new Quick().f("cba"));
```
**output:**
```
99
-1
122
122
122
-1
```
[Answer]
## VBA (161 bytes)
```
Function t(s As String)
t = 0
For i = 2 To Len(s)
a = Left(LCase(s), i)
    If Asc(Right(a, 1)) <= Asc(Right(a, 2)) Then Exit Function
Next
t = 1
End Function  
```
Compares ascii value with previous letter in lowercase, return 0 (false) when its value is smaller / equal and exit function
[Answer]
# Perl 6, 35 bytes
```
{my@c=.uc.comb;@c [[email protected]](/cdn-cgi/l/email-protection)}
```
This produces a callable block; if I could just assume that `$_` is already set to the desired word, I could delete the surrounding curly braces and lose two more bytes, but probably the only reasonable way to make that assumption would be to run it with `-n` and feed the word as standard input, which would add the two bytes right back.
[Answer]
# [R](https://www.r-project.org/), 37 bytes
```
all(diff(utf8ToInt(scan(,''))%%32)>0)
```
[Try it online!](https://tio.run/##K/qfZptWmpdckpmfp1Gho1CcnJiHENDT09Os0Kz@n5iTo5GSmZamUVqSZhGS75lXogFSqKGjrq6pqapqbKRpZ6D5v5YrTUMpMSk5JTXN3cMzKzsnNy@/oLAoOCQ0LDyiskpJEyRfUFoVBWGBVDo6Obsoaf4HAA "R – Try It Online")
Posting since this is substantially different and shorter than [Michal's R answer](https://codegolf.stackexchange.com/a/47272/86301).
Converts the letters to ASCII codepoints with `utf8ToInt`, then takes modulo 32 so that lower and upper letters are converted to the same numbers 1...26. Computes the pairwise differences, and checks that they are all positive.
[Answer]
# Perl, 27
@hsl's regexp dynamically build.
```
#!perl -p
$"="?";@x=a..z;$_=/^@x?$/i
```
Also we can do a reverse match: convert the input into a regexp: `PuZ` => `.*p.*u.*z.*` and then match this to a string of letters in alphabetical order. Result - also 27 characters.
```
#!perl -lp
$_=join(s//.*/g,a..z)=~lc
```
[Answer]
## k (6 bytes)
```
&/>':_
```
`&` returns true if both args are true
`/` modifies `&` to apply "over" a list, like a fold in functional languages
`>` greater than
`':` modifies `>` to apply "each-prior", so returns a vector of booleans stating which elements are greater than their predecessor
`_` makes it argument lower case
```
  _"puzZ"
"puzz"
  >':_"puzZ"
1110b
  &/>':_"puzZ"
0b
```
(`0b` means boolean false)
## q (13 bytes)
```
all(>':)lower
```
q is just syntactic sugar on k. `all` is defined as `&/`, and lower is `_`
[Answer]
# Python, 50 bytes
```
f=lambda x:sorted(set(x.lower()))==list(x.lower())
```
Try online here: <http://repl.it/c5Y/2>
[Answer]
# [Python 2](https://docs.python.org/2/), 43 bytes
```
lambda s:eval('"%s"'%'"<"'.join(s.lower()))
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUaHYKrUsMUdDXUm1WEldVV3JRkldLys/M0@jWC8nvzy1SENTU/N/QVFmXolGmoZSYlJySmqau4dnVnZObl5@QWFRcEhoWHhEZZWSpiYXQlkikPsfAA "Python 2 – Try It Online")
Puts `<` symbols between all the letters (converted to lowercase), and then `eval`s it. Python's chained comparison operators are perfectly happy to evaluate the whole thing as one big boolean expression.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 6 bytes
```
⇩¨=‡Us
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwi4oepwqg94oChVXMiLCIiLCJhXG5hYmNkZWZHSElqa2xtbm9wcXJTVFVWV1h5eiAgXG5hYVxucHV6XG5wdXp6XG5wdXpaXG5wdVpcblB1WiJd)
## Explained
```
⇩¨=‡Us
⇩¨=    # is the lowercase version of the input invariant under:
  ‡Us  # uniquify and sort? 
```
[Answer]
# [Prolog (SWI)](http://www.swi-prolog.org), 36 bytes
```
\S:-maplist(to_lower,S,L),sort(L,L).
```
[Try it online!](https://tio.run/##KyjKz8lP1y0uz/z/PybYSjc3sSAns7hEoyQ/Pie/PLVIJ1jHR1OnOL@oRMMHyNIDqkpITNDj4gJSSckpqWnuHp5Z2Tm5efkFhUXBIaFh4RGVVRD5glI4IwrCCIAxgFIIRTCxqlIYIxRhgaOTswuEl5KcBLMYSAMA "Prolog (SWI) – Try It Online")
Ungolfed:
```
\S :-
  maplist(to_lower, S, L), % convert each character code in S to lowercase, putting that in a list called L
  sort(L, L). % Does L sorted and uniquified equal L?
```
]