Skip to content

Commit

Permalink
🛢️
Browse files Browse the repository at this point in the history
  • Loading branch information
AlephAlpha committed Sep 26, 2024
1 parent 07195fc commit 31045cc
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 41 deletions.
9 changes: 5 additions & 4 deletions Nekomata.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ library
-- Other library packages from which modules are imported.
build-depends:
, arithmoi ^>=0.13
, base >=4.15 && <5
, base >=4.15 && <5
, containers ^>=0.7
, integer-roots ^>=1.0
, parsec ^>=3.1
Expand Down Expand Up @@ -117,7 +117,7 @@ executable Nekomata

-- Other library packages from which modules are imported.
build-depends:
, base >=4.15 && <5
, base >=4.15 && <5
, bytestring ^>=0.12
, containers ^>=0.7
, haskeline ^>=0.8
Expand Down Expand Up @@ -154,6 +154,7 @@ test-suite Nekomata-test

-- Test dependencies.
build-depends:
, base >=4.15 && <5
, hspec ^>=2.11
, base >=4.15 && <5
, hspec ^>=2.11
, Nekomata
, unicode-data ^>=0.6
3 changes: 3 additions & 0 deletions analysis/corpus.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,6 @@ o$2ᵑ{Jĭᵃjᵈ↔,}=
ĕ∏Hᵗf
R~3DᵉlhÖ*ž
3D3UXᶜi3bᵖ≥
Ť?~q5Ƃ=
Ṗ@ᵐ~oũ
↔SĦaõ@
34 changes: 17 additions & 17 deletions analysis/freq_1gram.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{ : 83
$ : 56
= : 55
= : 56
: : 50
+ : 46
∑ : 39
ᵐ : 35
ᵐ : 36
→ : 33
R : 33
* : 32
Expand All @@ -13,68 +13,68 @@ x : 30
} : 28
- : 26
1 : 25
o : 25
j : 25
ᵉ : 24
o : 24
ç : 23
2 : 23
, : 22
↕ : 22
Ť : 22
3 : 21
Ť : 21
: 21
# : 20
ᵒ : 20
: 20
~ : 20
đ : 19
S : 18
ĭ : 18
u : 18
ᵖ : 18
~ : 18
S : 17
a : 18
p : 17
a : 17
l : 16
ĉ : 16
Ƃ : 15
Ɔ : 15
Z : 15
t : 15
Ɗ : 15
Ṁ : 15
Ð : 15
" : 14
Ƃ : 14
Ň : 14
∙ : 14
L : 14
ᶦ : 13
< : 13
q : 13
ᵃ : 13
≡ : 13
∫ : 13
ž : 13
; : 13
q : 12
½ : 12
ᶻ : 12
? : 12
Ë : 12
@ : 12
± : 12
∆ : 12
_ : 12
ʷ : 11
ũ : 11
ˡ : 11
Ţ : 11
Q : 11
r : 11
ᵑ : 11
? : 11
∏ : 11
J : 11
ũ : 10
E : 10
≥ : 10
ŋ : 10
c : 10
@ : 10
% : 10
ᶠ : 10
N : 10
Expand All @@ -100,6 +100,7 @@ H : 8
£ : 8
Ø : 8
ɗ : 8
Ħ : 8
¦ : 8
ƒ : 8
4 : 8
Expand All @@ -108,8 +109,8 @@ H : 8
ᴶ : 7
Ä : 7
/ : 7
Ħ : 7
Ĭ : 7
õ : 7
Ĉ : 7
ä : 7
Ř : 7
Expand All @@ -121,7 +122,6 @@ v : 7
Ď : 6
≤ : 6
ŧ : 6
õ : 6
ş : 6
µ : 6
Ŝ : 6
Expand All @@ -130,6 +130,7 @@ v : 7
D : 6
ĕ : 6
ṁ : 6
5 : 6
> : 6
Þ : 6
∩ : 6
Expand All @@ -151,7 +152,7 @@ s : 5
M : 5
8 : 5
√ : 5
5 : 5
: 5
U : 5
ᵋ : 5
A : 5
Expand All @@ -170,7 +171,6 @@ X : 4
6 : 4
ˣ : 4
ň : 4
Ṗ : 4
ʸ : 4
Ṃ : 3
ḟ : 3
Expand Down
19 changes: 16 additions & 3 deletions analysis/freq_2gram.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ cɗ : 2
ʳ× : 2
Y$ : 2
$Ĭ : 2
õ@ : 2
{1 : 2
%ŗ : 2
ŗ} : 2
Expand Down Expand Up @@ -140,6 +141,7 @@ E∑ : 2
o; : 2
;↔ : 2
ᵐh : 2
ᵐ~ : 2
*4 : 2
+→ : 2
Qƥ : 2
Expand Down Expand Up @@ -198,6 +200,7 @@ $y : 2
{i : 2
{Ť : 2
ç+ : 2
5Ƃ : 2
4* : 2
$2 : 2
2÷ : 2
Expand Down Expand Up @@ -353,7 +356,6 @@ cʳ : 1
ƊY : 1
Ĭɗ : 1
¬õ : 1
õ@ : 1
ˡ∑ : 1
ˡ½ : 1
$Z : 1
Expand Down Expand Up @@ -475,7 +477,6 @@ R∫ : 1
ä7 : 1
7+ : 1
+≥ : 1
ᵐ~ : 1
*5 : 1
5* : 1
4ŋ : 1
Expand Down Expand Up @@ -708,7 +709,6 @@ Uˡ : 1
Ťj : 1
ĭ: : 1
çç : 1
5Ƃ : 1
đ> : 1
:4 : 1
*Ð : 1
Expand Down Expand Up @@ -1453,3 +1453,16 @@ Xᶜ : 1
i3 : 1
bᵖ : 1
ᵖ≥ : 1
Ť? : 1
?~ : 1
~q : 1
q5 : 1
Ƃ= : 1
Ṗ@ : 1
@ᵐ : 1
~o : 1
oũ : 1
↔S : 1
SĦ : 1
Ħa : 1
aõ : 1
13 changes: 13 additions & 0 deletions analysis/freq_3gram.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1460,3 +1460,16 @@ Xᶜi : 1
i3b : 1
3bᵖ : 1
bᵖ≥ : 1
Ť?~ : 1
?~q : 1
~q5 : 1
q5Ƃ : 1
5Ƃ= : 1
Ṗ@ᵐ : 1
@ᵐ~ : 1
ᵐ~o : 1
~oũ : 1
↔SĦ : 1
SĦa : 1
Ħaõ : 1
aõ@ : 1
10 changes: 10 additions & 0 deletions analysis/freq_4gram.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1181,3 +1181,13 @@ Xᶜi3 : 1
ᶜi3b : 1
i3bᵖ : 1
3bᵖ≥ : 1
Ť?~q : 1
?~q5 : 1
~q5Ƃ : 1
q5Ƃ= : 1
Ṗ@ᵐ~ : 1
@ᵐ~o : 1
ᵐ~oũ : 1
↔SĦa : 1
SĦaõ : 1
Ħaõ@ : 1
7 changes: 7 additions & 0 deletions analysis/freq_5gram.txt
Original file line number Diff line number Diff line change
Expand Up @@ -925,3 +925,10 @@ UXᶜi3 : 1
Xᶜi3b : 1
ᶜi3bᵖ : 1
i3bᵖ≥ : 1
Ť?~q5 : 1
?~q5Ƃ : 1
~q5Ƃ= : 1
Ṗ@ᵐ~o : 1
@ᵐ~oũ : 1
↔SĦaõ : 1
SĦaõ@ : 1
2 changes: 1 addition & 1 deletion analysis/particles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ particle : with "{" / total
ʳ : 0 / 5
ˣ : 0 / 4
ᶾ : 0 / 1
ᵐ : 3 / 36
ᶻ : 1 / 12
ᵐ : 3 / 35
ᶜ : 1 / 9
ᵃ : 2 / 13
ᵋ : 1 / 5
Expand Down
2 changes: 2 additions & 0 deletions doc/Tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Nekomata is still in an early stage of development. The syntax and semantics of

For installing and using the interpreter, please see [Getting Started](GettingStarted.md).

For documentation of built-in functions and particles, please see [Builtins.md](Builtins.md).

## The Stack

Nekomata is a concatenative language. "Concatenative" is just a fancy word for "stack-based". In a concatenative language, the program is a sequence of instructions that operate on a stack.
Expand Down
35 changes: 19 additions & 16 deletions src/Nekomata/CodePage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,28 @@ import Data.Word (Word8)

{- | Nekomata's custom code page:
256 characters, each representing a single byte.
Unassigned characters are represented by '�'.
-}
codePage :: String
codePage =
"¡¢£¤¥¦§¬±×÷‼←→↔↕"
++ "¿∆∏∑∕∙√½∩∫≈≠≡µ≤≥"
++ " !\"#$%&'()*+,-./"
++ "0123456789:;<=>?"
++ "@ABCDEFGHIJKLMNO"
++ "PQRSTUVWXYZ[\\]^_"
++ "`abcdefghijklmno"
++ "pqrstuvwxyz{|}~\n"
++ "ᵃᶜᵈᵉᵋᶠʰᶦʲᴶᵏˡᵐᵚᵑᵒ"
++ "ᵖʳᵗʷˣʸᶻᶾ��������"
++ "ÄÅƂÇĈĎÐƊËḞĜĢĦĨĬĻ"
++ "ŁṀṂŇÖØƆƤṖŘŜŠŞŢŤŬ"
++ "ŽƵÞ�������������"
++ "äåƃƀçĉđḍɗēĕƒḟĝïĭ"
++ "įṁṃɱňŋṇõɔƥŗřşŧũů"
++ "žƶþ�������������"
concat
[ "¡¢£¤¥¦§¬±×÷‼←→↔↕"
, "¿∆∏∑∕∙√½∩∫≈≠≡µ≤≥"
, " !\"#$%&'()*+,-./"
, "0123456789:;<=>?"
, "@ABCDEFGHIJKLMNO"
, "PQRSTUVWXYZ[\\]^_"
, "`abcdefghijklmno"
, "pqrstuvwxyz{|}~\n"
, "ᵃᶜᵈᵉᵋᶠʰᶦʲᴶᵏˡᵐᵚᵑᵒ"
, "ᵖʳᵗʷˣʸᶻᶾ��������"
, "ÄÅƂÇĈĎÐƊËḞĜĢĦĨĬĻ"
, "ŁṀṂŇÖØƆƤṖŘŜŠŞŢŤŬ"
, "ŽƵÞ�������������"
, "äåƃƀçĉđḍɗēĕƒḟĝïĭ"
, "įṁṃɱňŋṇõɔƥŗřşŧũů"
, "žƶþ�������������"
]

-- | Convert a character to a number.
charToInt :: (Num a) => Char -> Maybe a
Expand Down
25 changes: 25 additions & 0 deletions test/Eval.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3845,3 +3845,28 @@ testEval = describe "Solutions to Code Golf Stack Exchange challenges" $ do
, ("54", first_ "27")
, ("1337", first_ "688")
]
describe "q275212: Stuck on Sokoban" $ do
specEval
"Ť?~q5Ƃ="
[ ("[[1,1,1,1,1],[1,1,1,1,1],[1,1,1,1,0],[1,1,1,1,0],[1,1,1,1,1]]", Check False)
, ("[[1,1,1],[0,1,1],[1,1,1]]", Check True)
, ("[[0,1,1],[1,1,1],[1,1,0]]", Check False)
, ("[[0,0,0,0],[0,1,0,1],[0,0,0,0]]", Check True)
, ("[[0,0,0,0],[0,1,0,0],[0,0,0,0]]", Check False)
, ("[[0,1]]", Check False)
, ("[[1,0,1,0]]", Check True)
, ("[[1,0,0,1]]", Check False)
]
describe "q275291: How many ways can you make change?" $ do
specEval
"Ṗ@ᵐ~oũ"
[ ("1 [\"\",\"cs\",\"2\",\"\",\"\",\"BJ\"]", all_ ["c", "s"])
, ("2 [\"\",\"cs\",\"2\",\"\",\"\",\"BJ\"]", all_ ["cc", "cs", "ss", "2"])
, ("3 [\"\",\"cs\",\"2\",\"\",\"\",\"BJ\"]", all_ ["ccc", "ccs", "css", "sss", "2c", "2s"])
, ("4 [\"\",\"cs\",\"2\",\"\",\"\",\"BJ\"]", all_ ["cccc", "cccs", "ccss", "csss", "ssss", "2cc", "2cs", "2ss", "22"])
, ("5 [\"\",\"cs\",\"2\",\"\",\"\",\"BJ\"]", all_ ["ccccc", "cccs", "ccss", "csss", "ssss", "2ccc", "2ccs", "2css", "2sss", "22c", "22s", "B", "J"])
]
describe "q275700: Reorder a string of length 2^n by permuting the n binary digits of every index" $ do
specEval
"↔SĦaõ@"
[("[1,2,0] [1,1,0,1,0,0,1,0]", all_ ["[1,0,0,1,1,1,0,0]"])]
Loading

0 comments on commit 31045cc

Please sign in to comment.