File tree Expand file tree Collapse file tree 4 files changed +39
-12
lines changed
compiled_starters/clojure/src/http_server
starter_templates/clojure/code/src/http_server Expand file tree Collapse file tree 4 files changed +39
-12
lines changed Original file line number Diff line number Diff line change 77
88(def port 4221 )
99
10+ (alter-var-root #'*out* (constantly *err*))
11+
1012(defn serve []
1113 (let [server-sock (ServerSocket. port)]
1214 (.setReuseAddress server-sock true )
1315 (.accept server-sock)
14- (println " accepted new connection" )))
16+ (binding [*out* (java.io.PrintWriter. System/out true )]
17+ (println " accepted new connection" ))))
1518
1619(defn -main [& args]
1720 ; ; You can use print statements as follows for debugging, they'll be visible when running tests.
18- (binding [*out* *err*]
19- (println " Logs from your program will appear here!" ))
21+ (println " Logs from your program will appear here!" )
22+
23+
24+ (alter-var-root #'*out* (constantly (java.io.PrintWriter. System/out true )))
25+
2026
2127 ; ; Uncomment this block to pass the first stage
2228 ; ;(serve)
29+
2330 )
Original file line number Diff line number Diff line change 77
88(def port 4221 )
99
10+ (alter-var-root #'*out* (constantly *err*))
11+
1012(defn serve []
1113 (let [server-sock (ServerSocket. port)]
1214 (.setReuseAddress server-sock true )
1315 (.accept server-sock)
14- (println " accepted new connection" )))
16+ (binding [*out* (java.io.PrintWriter. System/out true )]
17+ (println " accepted new connection" ))))
1518
1619(defn -main [& args]
17- (println " Logs from your program will appear here!" ))
20+
21+ (alter-var-root #'*out* (constantly (java.io.PrintWriter. System/out true )))
22+
1823
1924 (serve )
25+
2026 )
Original file line number Diff line number Diff line change 1- @@ -1,23 +1,20 @@
1+ @@ -1,30 +1,26 @@
22 (ns http-server.core
33 (:require
44 [clojure.java.io :as io])
88
99 (def port 4221)
1010
11+ (alter-var-root #'*out* (constantly *err*))
12+
1113 (defn serve []
1214 (let [server-sock (ServerSocket. port)]
1315 (.setReuseAddress server-sock true)
1416 (.accept server-sock)
15- (println "accepted new connection")))
17+ (binding [*out* (java.io.PrintWriter. System/out true)]
18+ (println "accepted new connection"))))
1619
1720 (defn -main [& args]
1821- ;; You can use print statements as follows for debugging, they'll be visible when running tests.
19- - (binding [*out* *err*]
20- (println "Logs from your program will appear here!"))
22+ - (println "Logs from your program will appear here!")
23+ -
24+
25+ (alter-var-root #'*out* (constantly (java.io.PrintWriter. System/out true)))
26+
2127
2228- ;; Uncomment this block to pass the first stage
2329- ;;(serve)
2430+ (serve)
31+
2532 )
Original file line number Diff line number Diff line change 77
88(def port 4221 )
99
10+ (alter-var-root #'*out* (constantly *err*))
11+
1012(defn serve []
1113 (let [server-sock (ServerSocket. port)]
1214 (.setReuseAddress server-sock true )
1315 (.accept server-sock)
14- (println " accepted new connection" )))
16+ (binding [*out* (java.io.PrintWriter. System/out true )]
17+ (println " accepted new connection" ))))
1518
1619(defn -main [& args]
1720 ; ; You can use print statements as follows for debugging, they'll be visible when running tests.
18- (binding [*out* *err*]
19- (println " Logs from your program will appear here!" ))
21+ (println " Logs from your program will appear here!" )
22+
23+
24+ (alter-var-root #'*out* (constantly (java.io.PrintWriter. System/out true )))
25+
2026
2127 ; ; Uncomment this block to pass the first stage
2228 ; ;(serve)
29+
2330 )
You can’t perform that action at this time.
0 commit comments