| Bytes | Lang | Time | Link |
|---|---|---|---|
| 031 | Raku Perl 6 rakudo | 250417T202315Z | xrs |
| 104 | Tcl | 180418T164723Z | sergiol |
| 043 | APLNARS | 250307T090834Z | Rosario |
| 007 | Uiua | 250307T004919Z | janMakos |
| 044 | AWK | 250306T141912Z | xrs |
| 032 | Zsh | 230217T060701Z | roblogic |
| 022 | GolfScript | 230117T162612Z | emirps |
| 008 | Japt v2.0a0 | 230118T075943Z | Shaggy |
| nan | 230117T202720Z | The Thon | |
| 005 | Vyxal | 230117T035606Z | lyxal |
| 035 | C# Visual C# Interactive Compiler | 181218T225103Z | dana |
| 106 | Swift | 190325T190658Z | onnoweb |
| 016 | Retina | 180418T073038Z | Kevin Cr |
| nan | C gcc Do=1<<*s%32 | 181219T082100Z | att |
| 004 | Brachylog | 190226T094153Z | Unrelate |
| 202 | MBASIC | 181221T161150Z | wooshiny |
| 032 | Powershell | 181219T060011Z | mazzy |
| 043 | Python 2 | 181218T234957Z | Triggern |
| 112 | C# .NET Core | 181218T232212Z | Gymhgy |
| 020 | Perl 5 p | 180503T015329Z | Xcali |
| 083 | C gcc | 180419T111642Z | Jonathan |
| 017 | Perl 5 with n M5.010 | 180626T151854Z | Sundar R |
| 029 | Julia 0.6 | 180626T150312Z | Sundar R |
| 102 | Visual Basic for Applications 32 bit | 180418T170241Z | dnep |
| 021 | Ruby | 180417T190447Z | Asone Tu |
| 137 | PHP | 180420T191030Z | Francisc |
| 082 | Excel VBA | 180420T163038Z | Taylor R |
| 022 | Perl 6 | 180418T211309Z | Phil H |
| 022 | APL Dyalog Unicode | 180417T191051Z | J. Sall& |
| 082 | C# | 180418T145234Z | Raymond |
| 012 | APL Dyalog Unicode | 180418T204556Z | Adá |
| 017 | Pyth | 180418T170722Z | hakr14 |
| 025 | JavaScript Node.js | 180417T183127Z | user7985 |
| 057 | Smalltalk | 180418T151455Z | Hans-Mar |
| 011 | Japt 2.0 | 180417T185524Z | Oliver |
| 046 | Python 3 | 180418T131901Z | musicman |
| 076 | Red | 180418T130438Z | Galen Iv |
| 009 | MATL | 180418T091005Z | Sanchise |
| 041 | R | 180417T191330Z | Giuseppe |
| 011 | CJam | 180418T083521Z | Esolangi |
| 039 | Java 8 | 180418T071226Z | Kevin Cr |
| 018 | K ngn/k | 180417T183248Z | ngn |
| 012 | Japt | 180418T074659Z | Etheryte |
| 048 | Python | 180417T191946Z | Scott No |
| 005 | 05AB1E | 180417T184135Z | Emigna |
| 056 | Python 2 | 180417T190245Z | Rod |
| 008 | Jelly | 180417T185546Z | Erik the |
| 091 | PowerShell | 180417T185117Z | AdmBorkB |
| 006 | Husk | 180417T184948Z | ბიმო |
Tcl, 104 bytes
proc I w {lmap c [split $w ""] {if [regexp -all -nocase $c $w]>1|![string is alp $c] {return 0}}
expr 1}
proc I w {lmap c [set L [split $w ""]] {if {[llength [lsearch -al -noc $L $c]]>1|![string is alp $c]} {return 0}}
expr 1}
Still too long for my taste!
APL(NARS), 43 chars
{0=≢⍵:1⋄≡∘∪⍨∊{⍵∊⎕A:⎕a[⎕A⍸⍵]⋄∼⍵∊⎕a:,⍨⍵⋄⍵}¨⍵}
1 means true, 0 means false. If array is void, return 1, else make input string lowercase and if there is some char not letter, duplicate it. Check if the result string has no duplicate. Test:
f←{0=≢⍵:1⋄≡∘∪⍨∊{⍵∊⎕A:⎕a[⎕A⍸⍵]⋄∼⍵∊⎕a:,⍨⍵⋄⍵}¨⍵}
f ''
1
f 'ab'
1
f 'aba'
0
f 'moOse'
0
f 'abc1'
0
Uiua, 7 bytes
/×⊂⊃±◰⌵
Explanation
⌵ # Capitalize the string
◰ # Get a mask of unique characters
± # Get a mask of alphabetic characters
⊂⊃ # Join the two lists
/× # Check if all are true (no dups or numbers)
Zsh, 32 bytes
c=${#${(uL)${(s::)1}}};((c<$#1))
Try it online!. Isogram/truthy returns 1, otherwise 0
Japt v2.0a0, 8 bytes
v
¶r\L â
v\n¶r\L â :Implicit input of string U
v :Lowercase
\n :Reassign to U
¶ :Is equal to?
r :Remove
\L : Regex /[^a-z]/gi
â :Deduplicate
Thunno, \$ 13 \log_{256}(96) \approx \$ 10.7 bytes
UDgAzsAqkZUJ=
Explanation
UDgAzsAqkZUJ= # Implicit input
UD # Convert to lowercase and duplicate
g k # Filter for characters which:
sAq # are in
Az # the lowercase alphabet
# (i.e. letters only)
ZU # Uniquify
J # Join by ""
= # Are they equal?
Vyxal, 5 bytes
⇩:ǍU=
Explained
⇩:ǍU=
⇩ # input to lowercase
: # dup
ǍU # remove non-letters and uniquify
= # are the top two stack items equal?
C# (Visual C# Interactive Compiler), 35 bytes
s=>s.ToDictionary(c=>c<65?c/0:c%32)
Tests for success by presence or absence of an exception.
When a character is a number, a divide-by-zero exception is thrown. Uppercase and lowercase letters normalized. A duplicate key exception will be thrown if the same character is used more than once.
Swift, 106 bytes
func j(s:String){var a:Set<Character>=[];for c in s{if c<"0"||c>"9"{a.insert(c)}};print(s.count==a.count)}
Retina, 16 bytes
Ci`(.).*\1|\d
^0
Returns 1 as Truthy and 0 as Falsey values.
Thanks @Neil for discovering and fixing a bug in my initial code.
Explanation:
C Check if the input matches part of the following regex:
i` Case insensitivity enabled
Check if part of the input matches either:
(.) A character `C`
.* followed by zero or more characters
\1 followed by the same character `C` again
| Or
\d A digit
^0 Invert Truthy/Falsey, basically replacing every 0 with a 1,
and every other value with a 1
C (gcc) -Do=1<<*s%32, 53+12 47+12 = 59 bytes
i;f(char*s){for(i=o;i&o&&*s/58;i^=o)s++;s=!*s;}
Uses the bits of i to store whether a letter has been encountered.
#define o 1<<*s%32 //byte corresponding to letter *s
i;f(char*s){
for(i=o; //mark first character
i&o&&*s/58; //until character duplicate (i&o) or end of string or number (*s/58)
i^=o) //toggle the character
s++; //step through string
s=!*s; //return
}
Brachylog, 4 bytes
ḷo⊆Ạ
The predicate will succeed if the input is an isogram and fail if it is not, outputting the lowercase Latin alphabet if it does succeed. Since Brachylog's ⊆ built-in predicate doesn't exactly match the ordinary relationship between a subset and superset, I had to spend a byte on sorting the lowercased input, but saved a byte on not having to explicitly check for duplicates in it. (If it didn't need to fail with numbers, we could just use ḷ≠.)
MBASIC, 202 bytes
1 DIM A(26):INPUT S$:FOR I=1 TO LEN(S$):P=ASC(MID$(S$,I,1))
2 IF P>96 THEN P=P-96
3 IF P>64 THEN P=P-64
4 IF P>26 THEN 7
5 A(P)=A(P)+1:NEXT:FOR I=1 TO 26:IF A(I)>1 THEN 7
6 NEXT:PRINT"true":END
7 PRINT"false"
It's ugly but it works. Merry Christmas!
Powershell, 32 bytes
param($s)$s-notmatch'\d|(.).*\1'
Python 2, 43 bytes
t=input().lower()
print len(set(t))==len(t)
Expects a quote-delimited string from STDIN as input.
Converts the input to lowercase to make comparisons case-insensitive, then compares the number of unique values to the total number of
C# (.NET Core), 112 bytes
Here's my (super long) take on this:
c=>{var k=c.ToLower().ToCharArray();return!Enumerable.SequenceEqual(k.Distinct(),k)|!c.Any(m=>char.IsDigit(m));}
It checks if the distinct version of the string is the same as the regular version, and if it is so, return false. Also return false if there is a digit in the string
C (gcc), 87 85 83 bytes
- Saved
twofour bytes thanks to ceilingcat.
f(s,p,b,P)char*s,*p;{for(b=s;*s;++s)for(p=b*=*s>64;b&&p<s;b=(*s^*p++)&95?b:0);s=b;}
Visual Basic for Applications (32 bit), 102 bytes
s=LCase(InputBox(u)):j=1:For i=1To Len(s):k=Mid(s,i,1):j=j*0^Instr(i+1,s,k)*(k Like"[a-z]"):Next:?j<>0
Used the fact that in VBA 0^x yields 1 if x is zero and 0 otherwise. Run in immediate (debug) window.
Edit: as pointed out by Taylor in the comments this only works in 32 bit installs of MS Office.
Ruby, 25 23 21 bytes
-2 bytes on both thanks to Giuseppe
->s{/(.).*\1|\d/i!~s}
-2 bytes thanks to Kirill L.
Ruby -n, 21 19 18 16 bytes
p !/(.).*\1|\d/i
PHP, 137 Bytes
Code, using ctype_alpha
function f($s){if(ctype_alpha($s)){echo(count(array_unique(count_chars
(strtolower($s))))>2)?0:1;}
else{echo(strlen($s))?0:1;}}
Explanation
(I am absolutely sure this can be shortened)
function f($s){
if(ctype_alpha($s)){ #ctype_alpha check if the string contains only letters
echo
(array_values(array_unique(count_chars(strtolower($s))))!=
[0,1])?0:1;
#count_chars, retuns an array with the times each letter is appear in the string
#array_unique, returns an array with only the unique values
#the array values will be [0,1] if no letter repeated
}else{
#here the empty string gets controlled, and if the string contained numbers
echo(strlen($s))?0:1;
}
}
Yes, i will try to reduce the bytes count :D
Excel VBA, 82 bytes
An Anonymous VBE immediate window function that takes input from range [A1] and outputs to the VBE immediate window.
[B1:B26]="=Len(A$1)-Len(Substitute(Lower(A$1),Char(Row()+95),""""))":?[Max(B:B)]<2
Perl 6, 22 bytes
{!(.uc~~/(.).*$0|\d/)}
No matches for some character then later the same character. Implicit function as a code block, match implicitly on $_, invert book with !. Added |\d (ta Adam) but also needed .uc~~, which needed parentheses...
Alternative with Bags, 23 bytes
{.uc.ords.Bag⊆65..97}
This one normalises case then makes a bag (set with incidence counts). Subset or equal only true if all members are members of the comparison Bag, and all incidence counts are less than or equal to those in the comparison Bag. So any repeats or digits would make the comparison false.
APL (Dyalog Unicode), 25 20 22 bytes
''≡'(.).*\1|\d'⎕S'&'⍠1
Returns 1 for true, else 0.
Saved 5 bytes thanks to @H.PWiz
Fixed, and saved another byte thanks to @Adám
How?
''≡'(.).*\1|\d'⎕S'&'⍠1 ⍝ Tacit fn
⍠1 ⍝ Ignore case
⎕S'&' ⍝ Search and return the match(es)
'(.).*\1|\d' ⍝ For this regex
''≡ ⍝ And compare to the empty string
C#, 82 bytes
bool f(string s)=>!!(s.GroupBy(c=>c).Any(c=>c.Count()>1|(!Char.IsLetter(c.Key))));
edit: added test for char
edit: using GroupBy to shorten it by 5 byte
APL (Dyalog Unicode), 12 bytes
Anonymous tacit function.
(∪≡~∘⎕D)819⌶
819⌶ lowercase
(…) apply the following tacit function on that:
~∘⎕D remove Digits from the argument
∪≡ are the unique elements of the argument identical to that?
Pyth, 17 bytes
.Am&!t/rz0d}dGrz0
Explanation:
.Am&!t/rz0d}dGrz0 # Code
m rz0 # Map the following over the lowercase input:
/rz0d # Count occurrences of d in lowercase input
t # minus 1
! # inverted (0 -> True)
& # and
}dG # d is in the lowercase alphabet
.A # Print whether all values are truthy
Python 3 translation:
z=input()
print(all(map(lambda d:not z.lower().count(d)-1and d in "abcdefghijklmnopqrstuvwxyz",z.lower())))
JavaScript (Node.js), 29 25 bytes
s=>!/(.).*\1|\d/i.test(s)
Thanks for the update on answer to @BMO , @l4m2 , @KevinCruijssen
-4 bytes thanks to @KevinCruijssen
Smalltalk, 57 bytes
Method to be defined in class String:
s^(self select:#isLetter)asUppercase asSet size=self size
This is most likely self-explanatory.
Red, 76 bytes
func[s][a: charset[#"a"-#"z"#"A"-#"Z"]parse s[any[copy c a ahead not to c]]]
MATL, 9 bytes
kt2Y2X&X=
k % Lowercase implicit input
t % Duplicate that
2Y2 % Push lowercase alphabet
X& % Intersection of alphabet and duplicate lowercase input
X= % Check for exact equality.
R, 41 bytes
!grepl("(.).*\\1|\\d",tolower(scan(,"")))
Regex approach. !grepl(regex,scan(,""),F) didn't work so I guess capturing doesn't match case-insensitively in R? I'm bad at regex in general, though, so I won't be surprised if I'm just doing it wrong...
R, 58 bytes
!anyDuplicated(c(el(strsplit(tolower(scan(,"")),"")),0:9))
Appends the digits 0:9 to the (lowercased) list of characters and tests if there are any duplicates.
CJam, 11 bytes
qelA,s+_L|=
Explanation
The basic idea is to append each digit then check for duplicates. Since the append ensures that each digit is already present once, any further presence of digits will be a duplicate, causing it to return false.
q e# read the input: | "MOoSE1"
el e# convert to lowercase: | "moose1"
A e# push 10: | "moose1" 10
, e# range [0,N): | "moose1" [0 1 2 3 4 5 6 7 8 9]
s e# string representation: | "moose1" "0123456789"
+ e# concatenate: | "moose10123456789"
_ e# duplicate: | "moose10123456789" "moose10123456789"
L| e# union with the empty list: | "moose10123456789" "mose1023456789"
e# (this gets rid of duplicates)
= e# Equal to original: | 0
Java 8, 61 39 bytes
s->!s.matches("(?i).*((.).*\\2|\\d).*")
Explanation:
s-> // Method with String parameter and boolean return-type
!s.matches("(?i).*((.).*\\2|\\d).*")
// Return whether the input does not match the regex
Regex explanation:
String#matches implicitly adds ^...$.
^(?i).*((.).*\2|\d).*$
(?i) Enable case insensitivity
^ .* Zero or more leading characters
( | ) Followed by either:
(.) Any character `C`
.* with zero or more characters in between
\2 followed by that same character `C` again
| Or:
\d Any digit
.*$ Followed by zero or more trailing characters
Japt, 12 bytes
;v
oC ‰ eUq
Explanation:
;v
; // Set alternative default vars, where C is the lowercase alphabet
v // Make the implicit input lowercase and reassign it
oC ‰ eUq
oC // Remove all items from the input that are not in the alphabet
‰ // Split into chars and select unique array items
eUq // Check if the result is equal to the input split into chars
Python 2/3, 36 52 48 bytes
lambda s:len(s)==len({*s.lower()}-{*str(56**7)})
I take advantage of the fact that set contains only unique elements. By invoking the __len__ method of each, I can determine whether s also contains only unique elements (ignoring case).
EDIT: Updated to satisfy the previously-overlooked requirement to return False for numeric inputs. The set of all digits is encoded as set(str(56**7)).
EDIT 2: Following this user suggestion, I now take advantage of unpacking the arguments to set comprehension. This formally breaks compatibility with Python 2.
05AB1E, 5 bytes
lDáÙQ
Explanation
l # convert input to lower-case
D # duplicate
á # keep only letters
Ù # remove duplicates
Q # compare for equality
Python 2, 57 56 bytes
x=input().lower()
print len(set(x)-set(`763**4`))/len(x)
First it turn then input into a set, removing the duplicates, then remove the digits (encoded in `763**4`), then check if the length is the same as the original input
PowerShell, 91 bytes
param($b)($a=[char[]]$b.ToUpper()|group|sort c*)[0].Count-eq$a[-1].count-and$b-notmatch'\d'
Naive solution, but I can't come up with a better algorithm. Takes input $b, converts it ToUppercase, casts it as a char-array. Pipes that array into Group-Object which constructs a object that has name/count pairs for each input letter. We then sort that based on the count and take the 0th one thereof. We check that its .Count is -equal to the .Count of the last [-1] pair. If so, then the counts are all equal, otherwise we have a different amount of letters.
We then -and that with checking whether the input -notmatches against \d to rule out any digits in the input. That Boolean result is left on the pipeline and output is implicit.
Husk, 6 bytes
§=f√ü_
Explanation
§=f√ü_ -- takes a string as argument, eg: "sAad2"
§ -- fork the argument..
f√ -- | filter out non-letters: "sad"
ü_ -- | deduplicate by lower-case: "sAd2"
= -- ..and compare: 0