Skip to content

Commit 79dcb1e

Browse files
committed
Add "Clojure" lang
Closes #748
1 parent ee5f3c8 commit 79dcb1e

File tree

9 files changed

+45
-6
lines changed

9 files changed

+45
-6
lines changed

config/langs.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,23 @@ int main(int argc, char* argv[]) {
267267
// See: https://clang.llvm.org/cxx_status.html
268268
'''
269269

270+
[Clojure]
271+
size = '377 MiB'
272+
version = '1.11.1'
273+
website = 'https://clojure.org'
274+
example = '''
275+
; Printing
276+
(println "Hello, World!")
277+
278+
; Looping
279+
(dotimes [i 10]
280+
(println i))
281+
282+
; Accessing arguments
283+
(doseq [arg *command-line-args*]
284+
(println arg))
285+
'''
286+
270287
[COBOL]
271288
size = '4.48 MiB'
272289
version = 'GnuCOBOL 3.2.0'

docker/dev.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ RUN apk add --no-cache build-base curl git linux-headers tzdata \
99
COPY --from=codegolf/lang-swift ["/", "/langs/swift/rootfs/" ] # 548 MiB
1010
COPY --from=codegolf/lang-rust ["/", "/langs/rust/rootfs/" ] # 429 MiB
1111
COPY --from=codegolf/lang-haskell ["/", "/langs/haskell/rootfs/" ] # 405 MiB
12+
COPY --from=codegolf/lang-clojure ["/", "/langs/clojure/rootfs/" ] # 377 MiB
1213
COPY --from=codegolf/lang-go ["/", "/langs/go/rootfs/" ] # 334 MiB
1314
COPY --from=codegolf/lang-d ["/", "/langs/d/rootfs/" ] # 309 MiB
1415
COPY --from=codegolf/lang-julia ["/", "/langs/julia/rootfs/" ] # 302 MiB

docker/live.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ FROM scratch
2222
COPY --from=codegolf/lang-swift ["/", "/langs/swift/rootfs/" ] # 548 MiB
2323
COPY --from=codegolf/lang-rust ["/", "/langs/rust/rootfs/" ] # 429 MiB
2424
COPY --from=codegolf/lang-haskell ["/", "/langs/haskell/rootfs/" ] # 405 MiB
25+
COPY --from=codegolf/lang-clojure ["/", "/langs/clojure/rootfs/" ] # 377 MiB
2526
COPY --from=codegolf/lang-go ["/", "/langs/go/rootfs/" ] # 334 MiB
2627
COPY --from=codegolf/lang-d ["/", "/langs/d/rootfs/" ] # 309 MiB
2728
COPY --from=codegolf/lang-julia ["/", "/langs/julia/rootfs/" ] # 302 MiB

hole/play.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ func play(ctx context.Context, holeID, langID, code string, run *Run) error {
240240
cmd.Args = []string{"/usr/bin/brainfuck", "-c", code}
241241
case "c":
242242
cmd.Args = []string{"/usr/bin/tcc", "-run", "-"}
243+
case "clojure":
244+
cmd.Args = []string{"/usr/local/bin/clojure", "-M", "-"}
245+
cmd.Env = []string{"HOME=/root", "JAVA_HOME=/opt/java/openjdk", "PATH=/bin:/usr/bin"}
243246
case "crystal":
244247
cmd.Args = []string{"/usr/bin/crystal", "run", "--stdin-filename", "code.cr", "--"}
245248
cmd.Env = []string{"CRYSTAL_CACHE_DIR=/tmp", "PATH=/usr/bin:/bin"}

js/_codemirror.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { vim } from '@replit/codemirror-vim';
2020
import { assembly } from '@defasm/codemirror';
2121
import { brainfuck } from 'codemirror-lang-brainfuck';
2222
import { c, csharp, dart } from './vendor/codemirror-clike';
23+
import { clojure } from '@codemirror/legacy-modes/mode/clojure';
2324
import { cobol } from './vendor/codemirror-cobol';
2425
import { commonLisp } from '@codemirror/legacy-modes/mode/commonlisp';
2526
import { cpp } from '@codemirror/lang-cpp';
@@ -100,6 +101,7 @@ export const extensions = {
100101
'brainfuck': brainfuck(),
101102
'c': StreamLanguage.define(c),
102103
'c-sharp': StreamLanguage.define(csharp),
104+
'clojure': StreamLanguage.define(clojure),
103105
'cobol': StreamLanguage.define(cobol),
104106
'cpp': cpp(),
105107
'crystal': StreamLanguage.define(crystal),

langs/clojure/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM clojure:temurin-21-tools-deps-alpine as builder
2+
3+
RUN chown -R nobody: /root
4+
5+
FROM codegolf/lang-base
6+
7+
ENV JAVA_HOME /opt/java/openjdk
8+
9+
COPY --from=0 / /
10+
11+
ENTRYPOINT ["clojure"]
12+
13+
CMD ["-M", "-e", "(println (clojure-version))"]

latest-langs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ constant %paths = (
1111
'C#' => 'en.wikipedia.org/wiki/C_Sharp_(programming_language)',
1212
'C++' => 'en.wikipedia.org/wiki/Clang',
1313
'COBOL' => 'en.wikipedia.org/wiki/GnuCOBOL',
14+
'Clojure' => 'en.wikipedia.org/wiki/Clojure',
1415
'Crystal' => 'en.wikipedia.org/wiki/Crystal_(programming_language)',
1516
'D' => 'en.wikipedia.org/wiki/D_(programming_language)',
1617
'Dart' => 'en.wikipedia.org/wiki/Dart_(programming_language)',

sql/a-schema.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ CREATE TYPE keymap AS ENUM ('default', 'vim');
5959

6060
CREATE TYPE lang AS ENUM (
6161
'assembly', 'awk', 'bash', 'basic', 'berry', 'brainfuck', 'c', 'c-sharp',
62-
'cpp', 'cobol', 'crystal', 'd', 'dart', 'elixir', 'f-sharp', 'factor',
63-
'fish', 'forth', 'fortran', 'go', 'golfscript', 'haskell', 'hexagony',
64-
'j', 'janet', 'java', 'javascript', 'julia', 'k', 'lisp', 'lua', 'nim',
65-
'ocaml', 'pascal', 'perl', 'php', 'powershell', 'prolog', 'python', 'r',
66-
'raku', 'ruby', 'rust', 'sed', 'sql', 'swift', 'tcl', 'tex', 'v', 'viml',
67-
'wren', 'zig'
62+
'clojure', 'cpp', 'cobol', 'crystal', 'd', 'dart', 'elixir', 'f-sharp',
63+
'factor', 'fish', 'forth', 'fortran', 'go', 'golfscript', 'haskell',
64+
'hexagony', 'j', 'janet', 'java', 'javascript', 'julia', 'k', 'lisp',
65+
'lua', 'nim', 'ocaml', 'pascal', 'perl', 'php', 'powershell', 'prolog',
66+
'python', 'r', 'raku', 'ruby', 'rust', 'sed', 'sql', 'swift', 'tcl',
67+
'tex', 'v', 'viml', 'wren', 'zig'
6868
);
6969

7070
CREATE TYPE medal AS ENUM ('diamond', 'gold', 'silver', 'bronze');

svg/clojure.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)