File tree 5 files changed +52
-52
lines changed
compiled_starters/clojure/src
starter_templates/clojure/code/src
5 files changed +52
-52
lines changed Original file line number Diff line number Diff line change 5
5
; ; You can use print statements as follows for debugging, they'll be visible when running tests.
6
6
(println " Logs from your program will appear here!" )
7
7
; ; Uncomment this block to pass the first stage
8
- ; ; (try
9
- ; ; (let [server-socket (java.net.ServerSocket. 4221)]
10
- ; ; (doto server-socket
11
- ; ; (.setReuseAddress true)
12
- ; ; (.accept))
13
- ; ; (println "accepted new connection"))
14
- ; ; (catch java.io.IOException e
15
- ; ; (println (str "IOException: " (.getMessage e)))))
16
- )
8
+ ; ; (try
9
+ ; ; (with-open [server-socket (java.net.ServerSocket. 4221)]
10
+ ; ; (doto server-socket
11
+ ; ; (.setReuseAddress true)
12
+ ; ; (.accept))
13
+ ; ; (println "accepted new connection"))
14
+ ; ; (catch java.io.IOException e
15
+ ; ; (println (str "IOException: " (.getMessage e)))))
16
+ )
Original file line number Diff line number Diff line change 2
2
(:gen-class ))
3
3
4
4
(defn -main [& args]
5
- (try
6
- ( let [server-socket (java.net.ServerSocket. 4221 )]
7
- (doto server-socket
8
- (.setReuseAddress true )
9
- (.accept ))
10
- (println " accepted new connection" ))
11
- (catch java.io.IOException e
12
- (println (str " IOException: " (.getMessage e)))))
13
- )
5
+ (try
6
+ ( with-open [server-socket (java.net.ServerSocket. 4221 )]
7
+ (doto server-socket
8
+ (.setReuseAddress true )
9
+ (.accept ))
10
+ (println " accepted new connection" ))
11
+ (catch java.io.IOException e
12
+ (println (str " IOException: " (.getMessage e)))))
13
+ )
Original file line number Diff line number Diff line change 6
6
- ;; You can use print statements as follows for debugging, they'll be visible when running tests.
7
7
- (println "Logs from your program will appear here!")
8
8
- ;; Uncomment this block to pass the first stage
9
- - ;; (try
10
- - ;; (let [server-socket (java.net.ServerSocket. 4221)]
11
- - ;; (doto server-socket
12
- - ;; (.setReuseAddress true)
13
- - ;; (.accept))
14
- - ;; (println "accepted new connection"))
15
- - ;; (catch java.io.IOException e
16
- - ;; (println (str "IOException: " (.getMessage e)))))
17
- + (try
18
- + (let [server-socket (java.net.ServerSocket. 4221)]
19
- + (doto server-socket
20
- + (.setReuseAddress true)
21
- + (.accept))
22
- + (println "accepted new connection"))
23
- + (catch java.io.IOException e
24
- + (println (str "IOException: " (.getMessage e)))))
25
- )
9
+ - ;; (try
10
+ - ;; (with-open [server-socket (java.net.ServerSocket. 4221)]
11
+ - ;; (doto server-socket
12
+ - ;; (.setReuseAddress true)
13
+ - ;; (.accept))
14
+ - ;; (println "accepted new connection"))
15
+ - ;; (catch java.io.IOException e
16
+ - ;; (println (str "IOException: " (.getMessage e)))))
17
+ + (try
18
+ + (with-open [server-socket (java.net.ServerSocket. 4221)]
19
+ + (doto server-socket
20
+ + (.setReuseAddress true)
21
+ + (.accept))
22
+ + (println "accepted new connection"))
23
+ + (catch java.io.IOException e
24
+ + (println (str "IOException: " (.getMessage e)))))
25
+ )
26
26
\ No newline at end of file
Original file line number Diff line number Diff line change @@ -4,14 +4,14 @@ Study and uncomment the relevant code:
4
4
5
5
``` clojure
6
6
; ; Uncomment this block to pass the first stage
7
- (try
8
- ( let [server-socket (java.net.ServerSocket. 4221 )]
9
- (doto server-socket
10
- (.setReuseAddress true )
11
- (.accept ))
12
- (println " accepted new connection" ))
13
- (catch java.io.IOException e
14
- (println (str " IOException: " (.getMessage e)))))
7
+ (try
8
+ ( with-open [server-socket (java.net.ServerSocket. 4221 )]
9
+ (doto server-socket
10
+ (.setReuseAddress true )
11
+ (.accept ))
12
+ (println " accepted new connection" ))
13
+ (catch java.io.IOException e
14
+ (println (str " IOException: " (.getMessage e)))))
15
15
```
16
16
17
17
Push your changes to pass the first stage:
Original file line number Diff line number Diff line change 5
5
; ; You can use print statements as follows for debugging, they'll be visible when running tests.
6
6
(println " Logs from your program will appear here!" )
7
7
; ; Uncomment this block to pass the first stage
8
- ; ; (try
9
- ; ; (let [server-socket (java.net.ServerSocket. 4221)]
10
- ; ; (doto server-socket
11
- ; ; (.setReuseAddress true)
12
- ; ; (.accept))
13
- ; ; (println "accepted new connection"))
14
- ; ; (catch java.io.IOException e
15
- ; ; (println (str "IOException: " (.getMessage e)))))
16
- )
8
+ ; ; (try
9
+ ; ; (with-open [server-socket (java.net.ServerSocket. 4221)]
10
+ ; ; (doto server-socket
11
+ ; ; (.setReuseAddress true)
12
+ ; ; (.accept))
13
+ ; ; (println "accepted new connection"))
14
+ ; ; (catch java.io.IOException e
15
+ ; ; (println (str "IOException: " (.getMessage e)))))
16
+ )
You can’t perform that action at this time.
0 commit comments