Skip to content

Commit 827599e

Browse files
committed
Add Lisp
1 parent 0c554a9 commit 827599e

File tree

12 files changed

+46
-30
lines changed

12 files changed

+46
-30
lines changed

assets/hole.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ button:hover {
8989
#tabs {
9090
clear: both;
9191
display: grid;
92-
grid-gap: 6px;
93-
grid-template-columns: repeat(8, 1fr);
92+
grid-template-columns: repeat(9, 1fr);
9493
position: relative;
9594
-moz-user-select: none;
9695
-ms-user-select: none;
@@ -127,6 +126,7 @@ button:hover {
127126

128127
#tabs a[href="#bash"] { background-image: svg(bash#fff) }
129128
#tabs a[href="#javascript"] { background-image: svg(javascript#fff) }
129+
#tabs a[href="#lisp"] { background-image: svg(lisp#fff) }
130130
#tabs a[href="#lua"] { background-image: svg(lua#fff) }
131131
#tabs a[href="#perl"] { background-image: svg(perl#fff) }
132132
#tabs a[href="#perl6"] { background-image: svg(perl6#fff) }

assets/hole.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ onload = function() {
1818
let activeEditor;
1919
let editors = [];
2020

21-
for (let lang of ['bash', 'javascript', 'lua', 'perl', 'perl6', 'php', 'python', 'ruby']) {
21+
for (let lang of ['bash', 'javascript', 'lisp', 'lua', 'perl', 'perl6', 'php', 'python', 'ruby']) {
2222
let editor = CodeMirror(main, {
2323
lineNumbers: true,
2424
lineWrapping: true,
@@ -48,7 +48,7 @@ onload = function() {
4848

4949
( onhashchange = function() {
5050
// Kick 'em to Perl 6 if we don't know the chosen language.
51-
if (!/^#(?:bash|javascript|lua|perl6?|php|python|ruby)$/.exec(location.hash))
51+
if (!/^#(?:bash|javascript|lisp|lua|perl6?|php|python|ruby)$/.exec(location.hash))
5252
location.hash = 'perl6';
5353

5454
let lang = location.hash.slice(1);

assets/includes/lisp.svg

Lines changed: 1 addition & 0 deletions
Loading

assets/stats.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ onload = function() {
3232
new Chart(canvases[1].getContext('2d'), {
3333
type: 'pie',
3434
data: {
35-
labels: ['Bash', 'JavaScript', 'Lua', 'Perl', 'Perl 6', 'PHP', 'Python', 'Ruby'],
35+
labels: ['Bash', 'JavaScript', 'Lisp', 'Lua', 'Perl', 'Perl 6', 'PHP', 'Python', 'Ruby'],
3636
datasets: [{
3737
data: JSON.parse(canvases[1].dataset.data),
3838
backgroundColor: [

assets/user.css

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ tr {
9999
width: 220px;
100100
}
101101

102-
#matrix tr:first-child th:nth-child(2) { background-image: svg(bash#222) }
103-
#matrix tr:first-child th:nth-child(3) { background-image: svg(javascript#222) }
104-
#matrix tr:first-child th:nth-child(4) { background-image: svg(lua#222) }
105-
#matrix tr:first-child th:nth-child(5) { background-image: svg(perl#222) }
106-
#matrix tr:first-child th:nth-child(6) { background-image: svg(perl6#222) }
107-
#matrix tr:first-child th:nth-child(7) { background-image: svg(php#222) }
108-
#matrix tr:first-child th:nth-child(8) { background-image: svg(python#222) }
109-
#matrix tr:first-child th:nth-child(9) { background-image: svg(ruby#222) }
102+
#matrix tr:first-child th:nth-child(2) { background-image: svg(bash#222) }
103+
#matrix tr:first-child th:nth-child(3) { background-image: svg(javascript#222) }
104+
#matrix tr:first-child th:nth-child(4) { background-image: svg(lisp#222) }
105+
#matrix tr:first-child th:nth-child(5) { background-image: svg(lua#222) }
106+
#matrix tr:first-child th:nth-child(6) { background-image: svg(perl#222) }
107+
#matrix tr:first-child th:nth-child(7) { background-image: svg(perl6#222) }
108+
#matrix tr:first-child th:nth-child(8) { background-image: svg(php#222) }
109+
#matrix tr:first-child th:nth-child(9) { background-image: svg(python#222) }
110+
#matrix tr:first-child th:nth-child(10) { background-image: svg(ruby#222) }

build-langs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ docker pull alpine:edge
44

55
cd containers
66

7-
for name in Bash JavaScript Lua Perl Perl\ 6 PHP Python Ruby; do
7+
for name in Bash JavaScript Lisp Lua Perl Perl\ 6 PHP Python Ruby; do
88
lang=${name,,} # lowercase
99
lang=${lang// /} # trim space
1010

@@ -22,6 +22,7 @@ for name in Bash JavaScript Lua Perl Perl\ 6 PHP Python Ruby; do
2222
ver=${ver//$'\n'/ }
2323
ver=${ver%.}
2424
ver=${ver% Copyright (C) 1994-2017 Lua.org, PUC-Rio}
25+
ver=${ver/ (built on*/}
2526

2627
html+="<tr><th>$name<td>$ver"
2728

containers/lisp/.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

containers/lisp/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM alpine:edge
2+
3+
RUN apk add --no-cache curl gcc make musl-dev
4+
5+
RUN curl -L http://downloads.sourceforge.net/sourceforge/clisp/clisp-2.49.tar.bz2 | tar xjf -
6+
7+
RUN cd clisp-2.49/src \
8+
&& sed -i '/asm\/page\.h/d' unix.d \
9+
&& ../configure --ignore-absence-of-libsigsegv --prefix=/usr \
10+
&& ./makemake --prefix=/usr > Makefile \
11+
&& make \
12+
&& make install
13+
14+
FROM scratch
15+
16+
COPY --from=0 /lib/ld-musl-x86_64.so.1 /lib/
17+
COPY --from=0 /usr/bin/clisp /usr/bin/lisp
18+
COPY --from=0 /usr/lib/clisp-2.49 /usr/lib/clisp-2.49
19+
20+
ENTRYPOINT ["lisp", "--version"]

routes/hole.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ func hole(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
148148
">" + preambles[hole] + "<button>Run</button><div id=tabs>" +
149149
"<a href=#bash><div>Bash</div><div>not tried</div></a>" +
150150
"<a href=#javascript><div>JS</div><div>not tried</div></a>" +
151+
"<a href=#lisp><div>Lisp</div><div>not tried</div></a>" +
151152
"<a href=#lua><div>Lua</div><div>not tried</div></a>" +
152153
"<a href=#perl><div>Perl</div><div>not tried</div></a>" +
153154
"<a href=#perl6><div>Perl 6</div><div>not tried</div></a>" +

routes/scores.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ var holeMap = map[string]string{
4343
var langMap = map[string]string{
4444
"bash": "Bash",
4545
"javascript": "JavaScipt",
46+
"lisp": "Lisp",
4647
"lua": "Lua",
4748
"perl": "Perl",
4849
"perl6": "Perl 6",
@@ -81,17 +82,6 @@ var holes = [][]string{
8182
{"𝑒", "𝑒"},
8283
}
8384

84-
var validLangs = map[string]bool{
85-
"bash": true,
86-
"javascript": true,
87-
"lua": true,
88-
"perl": true,
89-
"perl6": true,
90-
"php": true,
91-
"python": true,
92-
"ruby": true,
93-
}
94-
9585
func scores(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
9686
var hole string
9787
var langs []string
@@ -124,14 +114,14 @@ func scores(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
124114
seen := map[string]bool{}
125115

126116
for _, lang := range langs {
127-
if validLangs[lang] && !seen[lang] {
117+
if _, ok := langMap[lang]; ok && !seen[lang] {
128118
url += "/" + lang
129119
seen[lang] = true
130120
}
131121
}
132122

133123
// No point in listing EVERY lang.
134-
if len(seen) == len(validLangs) {
124+
if len(seen) == len(langMap) {
135125
url = "/scores"
136126

137127
if hole != "" {
@@ -169,6 +159,7 @@ func scores(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
169159
for _, v := range [][]string{
170160
{"bash", "Bash"},
171161
{"javascript", "JavaScript"},
162+
{"lisp", "Lisp"},
172163
{"lua", "Lua"},
173164
{"perl", "Perl"},
174165
{"perl6", "Perl 6"},

0 commit comments

Comments
 (0)