Skip to content

Commit 2b98118

Browse files
committed
👾
1 parent 2d9c4ae commit 2b98118

File tree

12 files changed

+341
-123
lines changed

12 files changed

+341
-123
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
ghc: ['9.0.2', '9.6.7', '9.10.3', '9.12.2']
8+
ghc: ['9.6.7', '9.8.4', '9.10.3', '9.12.2']
99
steps:
1010
- uses: actions/checkout@v4
1111
- uses: haskell-actions/setup@v2

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Revision history for Nekomata
22

3-
## 0.8.1.0 -- Unreleased
3+
## 0.9.0.0 -- Unreleased
44

5+
* Updated some dependencies. Now GHC 9.6.7 or newer is required to build Nekomata. But GHC 9.14.1 is not supported yet due to a dependency issue.
56
* New particle: `\anyInt`.
67
* Fixed a bug in trimming spaces in the REPL.
78
* Some internal data types now derive `Show` instances for debugging.

Nekomata.cabal

Lines changed: 34 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,53 @@
1-
cabal-version: 3.0
2-
1+
cabal-version: 3.0
32
-- The cabal-version field refers to the version of the .cabal specification,
43
-- and can be different from the cabal-install (the tool) version and the
54
-- Cabal (the library) version you are using. As such, the Cabal (the library)
65
-- version used must be equal or greater than the version stated in this field.
76
-- Starting from the specification version 2.2, the cabal-version field must be
87
-- the first thing in the cabal file.
9-
108
-- Initial package description 'Nekomata' generated by
119
-- 'cabal init'. For further documentation, see:
1210
-- http://haskell.org/cabal/users-guide/
1311
--
1412
-- The name of the package.
15-
name: Nekomata
16-
13+
name: Nekomata
1714
-- The package version.
1815
-- See the Haskell package versioning policy (PVP) for standards
1916
-- guiding when and how versions should be incremented.
2017
-- https://pvp.haskell.org
2118
-- PVP summary: +-+------- breaking API changes
2219
-- | | +----- non-breaking API additions
2320
-- | | | +--- code changes with no API change
24-
version: 0.8.0.0
25-
21+
version: 0.8.0.0
2622
-- A short (one-line) description of the package.
2723
synopsis:
2824
An experimental non-determinstic concatenative golfing language
2925

3026
-- A longer description of the package.
3127
-- description:
32-
3328
-- The license under which the package is released.
34-
license: BSD-3-Clause
35-
29+
license: BSD-3-Clause
3630
-- The file containing the license text.
37-
license-file: LICENSE
38-
31+
license-file: LICENSE
3932
-- The package author(s).
40-
author: AlephAlpha
41-
33+
author: AlephAlpha
4234
-- An email address to which users can send suggestions, bug reports, and patches.
43-
maintainer: [email protected]
44-
35+
maintainer: [email protected]
4536
-- A copyright notice.
4637
-- copyright:
47-
category: Language
48-
build-type: Simple
49-
38+
category: Language
39+
build-type: Simple
5040
-- Extra doc files to be distributed with the package, such as a CHANGELOG or a README.
5141
extra-doc-files: CHANGELOG.md
5242

5343
-- Extra source files to be distributed with the package, such as examples, or a tutorial module.
5444
-- extra-source-files:
55-
5645
common warnings
5746
ghc-options: -Wall
5847

5948
library
6049
-- Import common warning flags.
61-
import: warnings
62-
50+
import: warnings
6351
-- Modules exported by the library.
6452
exposed-modules:
6553
Nekomata.Builtin
@@ -84,28 +72,24 @@ library
8472

8573
-- LANGUAGE extensions used by modules in this package.
8674
-- other-extensions:
87-
8875
-- Other library packages from which modules are imported.
8976
build-depends:
90-
, arithmoi ^>=0.13
91-
, base >=4.15 && <5
92-
, containers ^>=0.7
93-
, integer-roots ^>=1.0
94-
, parsec ^>=3.1
77+
arithmoi ^>=0.13,
78+
base >=4.15 && <5,
79+
containers ^>=0.8,
80+
integer-roots ^>=1.0,
81+
parsec ^>=3.1,
9582

9683
-- Directories containing source files.
97-
hs-source-dirs: src
98-
84+
hs-source-dirs: src
9985
-- Base language which the package is written in.
10086
default-language: Haskell2010
10187

10288
executable Nekomata
10389
-- Import common warning flags.
104-
import: warnings
105-
90+
import: warnings
10691
-- .hs or .lhs file containing the Main module.
107-
main-is: Main.hs
108-
92+
main-is: Main.hs
10993
-- Modules included in this executable, other than Main.
11094
other-modules:
11195
Doc
@@ -114,47 +98,38 @@ executable Nekomata
11498

11599
-- LANGUAGE extensions used by modules in this package.
116100
-- other-extensions:
117-
118101
-- Other library packages from which modules are imported.
119102
build-depends:
120-
, base >=4.15 && <5
121-
, bytestring ^>=0.12
122-
, containers ^>=0.7
123-
, haskeline ^>=0.8
124-
, Nekomata
125-
, optparse-applicative ^>=0.19
103+
Nekomata,
104+
base >=4.15 && <5,
105+
bytestring ^>=0.12,
106+
containers ^>=0.8,
107+
haskeline ^>=0.8,
108+
optparse-applicative ^>=0.19,
126109

127110
-- Directories containing source files.
128-
hs-source-dirs: app
129-
111+
hs-source-dirs: app
130112
-- Base language which the package is written in.
131113
default-language: Haskell2010
132114

133115
test-suite Nekomata-test
134116
-- Import common warning flags.
135-
import: warnings
136-
117+
import: warnings
137118
-- Base language which the package is written in.
138119
default-language: Haskell2010
139-
140120
-- Modules included in this executable, other than Main.
141-
other-modules: Eval
142-
121+
other-modules: Eval
143122
-- LANGUAGE extensions used by modules in this package.
144123
-- other-extensions:
145-
146124
-- The interface type and version of the test suite.
147-
type: exitcode-stdio-1.0
148-
125+
type: exitcode-stdio-1.0
149126
-- Directories containing source files.
150-
hs-source-dirs: test
151-
127+
hs-source-dirs: test
152128
-- The entrypoint to the test suite.
153-
main-is: Main.hs
154-
129+
main-is: Main.hs
155130
-- Test dependencies.
156131
build-depends:
157-
, base >=4.15 && <5
158-
, hspec ^>=2.11
159-
, Nekomata
160-
, unicode-data ^>=0.6
132+
Nekomata,
133+
base >=4.15 && <5,
134+
hspec ^>=2.11,
135+
unicode-data ^>=0.6,

analysis/Ideas.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
如果 CodePage 中的 256 个字符都用完了,可以考虑用像 05AB1E 那样,用 `.` 开头的字符来表示双字节的内置函数。现在的 CodePage 还没有用完,先不考虑这个问题,但 `.` 也先不要用掉。
1212

13-
LiberationMono 字体所支持的字符列举于[此文件](analysis/LiberationMonoGlyphs.txt),以供选取。
13+
LiberationMono 字体所支持的字符列举于[此文件](LiberationMonoGlyphs.txt),以供选取。
1414

1515
## 来自统计结果的想法
1616

@@ -24,10 +24,9 @@ LiberationMono 字体所支持的字符列举于[此文件](analysis/LiberationM
2424
* `1` 排到第十四,是最常见的常量。
2525
* `ç``\cons0`)能排到第十八。这个完全出乎我的意料,因为很多别的 golfing 语言中根本没有这个操作。它的作用是给列表加一个 0,通常是配合 `\head``\last``\minimum``\maximum` 等函数使用,来处理空列表的特殊情况。需要看一看其它语言是怎么处理空列表的。
2626
* 与 non-deterministic 机制有关的操作,除了 `=``\eq`)没有一个排到前二十。排最高的是第二十四的 `a``\allValues`)。
27-
* 在两个字符的组合中,排前六的分别是 `ᶦ{``ᵖ{``ʷ{``ˡ{``ᶠ{``ᵑ{`。也许可以像 Vyxal 等语言一样,让这些助词自动开启 block,省去一个 `{`。不过另外一些助词通常只修饰单个 built-in,自动开启 block 反而会额外需要一个 `}`。尤其是 ``````,两种用法都很常见,不好取舍。详见 [`analysis/particles.txt`](particles.txt),以及下文的[关于助词](#关于助词)
27+
* 在两个字符的组合中,排前六的分别是 `ᶦ{``ᵖ{``ʷ{``ˡ{``ᶠ{``ᵑ{`。也许可以像 Vyxal 等语言一样,让这些助词自动开启 block,省去一个 `{`。不过另外一些助词通常只修饰单个 built-in,自动开启 block 反而会额外需要一个 `}`。尤其是 ``````,两种用法都很常见,不好取舍。详见 [`particles.txt`](particles.txt),以及下文的[关于助词](#关于助词)
2828
* `{$` 在两个字符的组合中排第六,`{:` 排第八。这两个组合没有特别的意义,只是因为 `\dup``\swap` 是最常用的两个操作,因此它们的组合也很常用。
2929
* `Ťđ` 在两个字符的组合中也排九,和 `{:``Jᵐ``ᵐ{` 并列。这个组合是将二维列表转置,然后进行 unpair 操作。看起来确实比较常用。先等更多的解答出现再决定是否增加这个 built-in。
30-
* `Ňᵖ{` 在三个字符的组合中排第一,也许值得为它增加一个助词。
3130
* 统计结果与其它语言的差异,除了考虑到语言本身的特点之外,还要考虑到语言的使用者的偏好。目前 Nekomata 的使用者基本上只有我自己,解答的也主要是我感兴趣的题目类型,string 相关的题目较少,ascii-art 更是完全没有。
3231

3332
随着已有解答的增多,增加新的内置函数时,很难再把已有的解答都看一遍,看看是否能用新的内置函数来改进。因此,这一统计结果不再代表最优的方案,但仍有一定的参考价值。
@@ -211,6 +210,10 @@ LiberationMono 字体所支持的字符列举于[此文件](analysis/LiberationM
211210

212211
更多情况还需进一步考虑。这是比较大的改动,需要仔细斟酌。也许还有其它更好的方案。以后再说。
213212

213+
## 语法糖
214+
215+
可以考虑引入 `²``³` 两个字符,表示把其后的两个和三个内建函数复合在一起。比如说 `²\add\mul` 相当于 `{ \add \mul }`。这样在一些情况下可以省去一些大括号。从已有的解答来看,能用到 `³` 的地方还挺多,`²` 反而用得不多。`⁴` 就不考虑了。
216+
214217
## 文档
215218

216219
目前的文档还很不完善。需要增加更多的例子,以及更详细的说明。

analysis/corpus.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ sNP
7575
ᵐ*Ŝ
7676
Ṁ←ɔõhĦ+
7777
~Ɗƶ
78+
Ɗ;ᵃɗ+%a∑
7879
ᵒ%ᵐ∏¬x∙
7980
ᶠ{$~¦}∑
8081
Ňᵉĝᵈ,L
@@ -102,6 +103,7 @@ uᵐhů
102103
8*→√
103104
R∫ē
104105
Ṁä7+≥
106+
105107
ᵐ~
106108
*5*4ŋ≈√
107109
ᵒ+→Ö
@@ -141,6 +143,7 @@ xq§LaĦ*
141143
Þ½
142144
Sđ*aŢṂ
143145
S:đ∩z¿ᵐj
146+
OŜ$ĈÅ
144147
qŤqŤ=
145148
;$N,
146149
xŘ↔
@@ -178,11 +181,14 @@ oĉ~z
178181
ƒz
179182
Ħ±
180183
ᵉᵑ{ˣ∙ɔᵈç}T
184+
ŝᵃƊᵖy,ƆZɔ↕ɗ=
181185
ᵐĈ
182186
ˡ¦
183187
Ṁ→ᵒÇ∏ƃ
184188
ʷ{į1?-ň
185189
O:Ŝ≡$Ðål
190+
ᵒM→
191+
R:~M
186192
8ᵚ~ᵖ{≈←ň‼į=
187193
0*2R+ŋ↕ũ+ň8<
188194
ox=
@@ -254,6 +260,7 @@ qŁ:∙=
254260
ᴷ{*$Bu$L
255261
ᴷ{$Bçu#=
256262
qCᵉL↔≤a*$h→L
263+
Oᵖ{ŜË
257264
→ᵉ_rÇ∫µA
258265
ƤƊQůɗ
259266
¢SQ↕ɗQao
@@ -397,6 +404,7 @@ Z4ʷ¦→8¦
397404
J:ᵐ↔=ṩ
398405
Äᵐ{įŋ∫}∫Ẑᵚ≥
399406
Ňᵗ{ƂJŁ≡
407+
ᵃS↕ÐŤ
400408
p↔:CĨ→0I→T↔aj
401409
ƒƶ4L
402410
"Hᶜ"∏
@@ -413,3 +421,5 @@ $ŧ∑ᵖ{ŧ∑'d/=
413421
u$ᵐĨ→
414422
ƊˣṀ→b
415423
↕:∆Zƶ¿
424+
xbᶦ∆haxF/
425+
x$y~O$L

0 commit comments

Comments
 (0)