g | x | w | all
Bytes Lang Time Link
037PowerShell Windows and Core250723T203832Zuser3141
nanGoogle Sheets250726T103247Zz..
318Bespoke250725T143018ZJosiah W
nanPython 3250723T063405Zm90
007Uiua250725T135328Znyxbird
038JavaScript ES6250723T065516ZArnauld
041Python 3250723T225336ZLucenapo
505Jelly250723T202317ZJonathan
027R250723T130605Zpajonk
nan05AB1E250723T130223ZKevin Cr
045JavaScript V8250723T045602ZSteve Be
007BQN250723T074609Zpanadest
013Charcoal250723T084138ZNeil
006APL Dyalog Extended250723T081639ZAdá
nanVyxal250723T043852Zlyxal

PowerShell (Windows and Core), 41 37 bytes

 param ($a,$b)!(diff $a $b)#-s 0-i -e
param($a,$b)!(diff $a $b -s 0 -i -e)#

Try it online!

Input expected as two character arrays.
diff is an alias for Compare-Object.

Anagram uses diff's default mode, which will only show differences. The negation of the result turns the result to a boolean ($true if $null, $false otherwise). The hash starts a comment to the end of the line.

Differ uses -SyncWindow 0 (which forces diff to compare at the exact positions, not over the complete arrays), -IncludeSame to show same characters at the same position, and -ExcludeDifferent to suppress differences.

Edit: Updated the $null test for -4 bytes (d'oh)

Google Sheets, 104 + (0 * 1000) = 104

Anagram

+N("<>")+LET(s,SEQUENCE(LEN(A2)+0),0+SORT(AND(SORT(CODE(MID(A2,s+0,1)))=SORT(CODE(MID(B2,s+0,1))))))+(0)

Diff

=AND(SORT(LET(s,SEQUENCE(LEN(A2)),CODE(MID(A2,s+0,1))<>0+CODE(MID(B2,s+0,1)))))+0+N("+)SORT)()(SORT(")+0

Both expect the first string in A2 and the second string in B2.

enter image description here

Bespoke, 318 bytes

Anagram

With A.I:I presume anybody might do SO much,So easy
A.I composes artwork SO simply;I am stunned
And,If ever I~am getting WRITERS-block,it is sped up with A.I
whatever QUESTION(in topics I am studying)BECOMES SETTLED
Are you thrilled?Y~e e a h h h h
however,writing anagrams confuses it
what is with A.I?problem IS:no I

Expects the two inputs separated by ASCII 0 (NUL). Prints nothing if the two inputs are anagrams; prints Stack underflow. to STDERR if they're not.

While it reads the first input, it increments counters for each character on the heap (not including 0, the separator); while it reads the second input, it decrements those same counters. Then it loops through every Unicode codepoint (except 0, the separator) and checks whether the counts are 0; if a nonzero count is found, a Stack underflow. error is intentionally triggered.

Most of the score is taken up by the necessary commands in this program. Also, instead of looping from 1,114,112 down to 0, it's 1 fewer byte to loop from 11,111,111 down to 0...so apologies if this takes a super long time to run.

Differs

anagram message: could It be Done Somehow, say, By Computer?
Amateur Opinion: IT Isnt QUITE SO decisive
while Striking, I profess~An A.I Is NO playwright
what Is In token-prediction?
math~with grids which map a WORd to a Symbol (which buried LETTERS AWAY).
use A.Is; Study them thoroughly,
Even If It SEEMS Impressive.

Expects the two inputs separated by ASCII 0 (NUL). Prints nothing if the two inputs differ at each character; prints Invalid stack argument: 0 to STDERR if they don't.

First, it reads the first input onto the stack (including 0, the separator), and reverses the stack. Then, each character in the second input is compared to the top stack value (the corresponding character of the first input); if they are equal, an Invalid stack argument: 0 error is intentionally triggered.

Without the source restriction, this program would only be 136 bytes. The rest of the letters after the necessary ones (from playwright onward) form one long comment.


Yes, the two programs are indeed anagrams - and the anagram took quite a while to compose. (But to make it fit the "differs" rule, I cheated by changing the cases of letters and adding extraneous symbols.)

Python 3, 46 45 44 bytes

 lambda n,i,**zipfn:sorted(i) ==sorted(n) *1
lambda*d:1not in(s==e for*tr,s,e in zip(*d))

Try it online!

-1 thanks to emanresu A. -1 thanks to xnor.

Uiua, 7 bytes

≍∩⍆#/×≠
⍆/×≠#≍∩

Try it!
≍ match after ∩ both ⍆ sorted and ⍆ sort /× all ≠ not equal, respectively. The ⍆ sort in the second function is needed to offset the # comments starting positions.

JavaScript (ES6), 38 bytes

-2 thanks to @tata

Both functions expect (string1)(string2) and return 0 or 1. The strings are passed as arrays of characters.

Anagram

m=>r=>(r,e=a=>[1]+a.sort())^e(m)==e(r)

Differs

(e)=>(r)=>r.some((r,a)=>mt=r==e[+a])^1

Try it online!

Python 3, 41 bytes

 lambda a,l:sorted(a)==sorted(l)#.ipmn,f,
lambda o,e:all( map(str.find,o,e))#drst==

Try it online!

Jelly, 5 bytes + 0 = 5

Program 1 (verify anagrams of each other):

Œ!n§Ạ

A dyadic Link that produces 0 if the two are anagrams of each other or 1 if not.

Program 2 (verify respective characters all differ)

nẠŒ!§

A dyadic Link that produces [1] if all respective characters differ or [0] if not.

Try it online!

How?

Œ!n§Ạ - Link ("Program 1"): A; B     e.g. A = "abc"; B = "cab"
Œ!    - all permutations of {A}           ["abc",  "acb",  "bac",  "bca",  "cab",  "cba"  ]
  n   - not equals {B}? (vectorises)      [[1,1,1],[1,1,0],[1,0,1],[1,1,1],[0,0,0],[0,1,1]]
   §  - sums                              [3,      2,      2,      3,      0,      2      ]
    Ạ - all?                              0 ( => "abc" and "cab" are anagrams of each other)
nẠŒ!§ - Link ("Program 2"): A; B     e.g. A = "gfedcba"; B = "abcdefg"
n     - {A} not equals {B} (vectorises)   [1, 1, 1, 0, 1, 1, 1]
 Ạ    - all?                              0
  Œ!  - {implicit range} all permutations [[]]
    § - sums                              [0] ( => respective characters do NOT all differ)

R, 28 27 bytes

 \(x,y,`-`=sort)all(-x==-y)
\(x,y,`s`=--r==ot)all(x-y) 

Attempt This Online!

Takes input as vectors of character codes.

05AB1E, score: 8 (or 7) bytes + (0 * 1000) = 8

Inputs as a pair of character-lists.
Outputs 1 for truthy and 0 for falsey. †: Could be -1 byte by outputting 0/1 for program 1 and 1/0 for program 2, by replacing the _P with à, although I personally think both programs should have the same distinct truthy/falsy results.

Been trying for a while, but haven't found anything shorter, and even finding equal-bytes alternatives without q prove difficult.. :/

Explanation:

The base programs would be:

€{    # Sort each inner list of the (implicit) input-pair
  Ë   # Check that both values in the pair are now the same
      # (after which the result is output implicitly)

ø     # Zip/transpose the (implicit) input-pair of lists; swapping rows/columns
 €Ë   # Check for each inner pair if the two characters are the same
   _P # Check that all are falsey
      # (after which the result is output implicitly)

Because the Ë is on the same position in both programs, the no-op space was added.
In addition, the q is to stop the program, making everything after it no-ops.

JavaScript (V8), 45 bytes

(a,/*!>t*/b,m=e=>e.sort()+[],r=m(b))=>m(a)==r

a=>b=>!a.some((r,t)=>r==b[t]/*()(),,=mmer+*/)

Try it online! (improved with +[] and expecting arrayified strings, from Arnauld's solution)

Try it online!

JavaScript (V8), 56 bytes

(a,/*!>t[]*/b,m=e=>[...e].sort().join``,r=m(b))=>m(a)==r

a=>b=>![...a].some((r,t)=>r==b[t]/*()()``,,=.jmmnieor*/)

Try it online!

It's a bit unclear to me whether single-line comments (// ...)should be accepted for arrow-functions because they don't seem to be generally parsed as part of the function. I've erred on the side of caution and not used them.

BQN, 7 bytes

¬´⋄≡´∨¨
⋄¬∨´≡¨´

BQN online REPL

Thanks to @Adám for pointing out a bug.

Charcoal, 13 bytes

Anagram:

⬤θ⁼№θι№ηι¬⊙§κ

Try it online! Outputs a Charcoal boolean, i.e. - for anagram, nothing if not. Explanation:

 θ              First input
⬤               All characters satisfy
   №θι          Count in first input
  ⁼             Equals
      №ηι       Count in second input
                Implicitly print
         ¬⊙§κ   Unparseable (ignored)

Different:

¬⊙θ⁼ι§ηκ⬤№θ№ι

Try it online! Outputs a Charcoal boolean, i.e. - for all different, nothing if not. Explanation:

  θ             First input
 ⊙              Any character matches
    ι           Current character
   ⁼            Equals
     §ηκ        Matching character from second input
¬               Logical Not
                Implicitly print
        ⬤№θ№ι   Unparseable (ignored)

APL (Dyalog Extended), 6 bytes

Anagram←≡⍥∧⍝⍱=
Differs←⍱=⍝≡⍥∧

Try it online!

Anagram:  match  when  sorted (the rest is a comment)

Differs:  none = equal (the rest is a comment)

Vyxal, 6 + (0 * 1000) = 6

Program 1:

Þ⊍¬#=g

Try it Online!

Program 2:

=g#Þ⊍¬

Try it Online!

Takes both inputs as lists of characters. Program 2 returns 0 if all different, 1 otherwise.


Program 1 - Explained

Þ⊍¬#=g
Þ⊍      # Multiset symmetric difference
  ¬     # is empty?
   #=g  # comment to satisfy source requirements

Program 2 - Explained

=g#Þ⊍¬
=       # Check where letters are the same
 g      # Get the minimum of that (0 = all different, 1 = match)
  #Þ⊍¬ # Comment to satisfy source requirements