Fork me on GitHub
#clojure-uk
<
2019-06-06
>
Olical08:06:34

What a beautiful day to sit inside with my back to the window 😬

guy09:06:04

morning!

maleghast09:06:52

Morning All πŸ™‚

dharrigan10:06:13

we do a lot of pythong programming here (for ML/AI stuff) so having that bridge to Clojure would be a nice way to get more adoption of clojure going

guy13:06:13

Heres a good puzzle

guy13:06:22

So now instead of solving it

guy13:06:25

just put in

guy13:06:31

and click run

guy13:06:32

and it gives you green/passes

guy13:06:58

Anyone know why that might be πŸ˜‚ ?

practicalli-john17:06:28

very weird, because normally you cant use defn in 4Clojure as it gives an error, you have to use fn instead

guy18:06:41

yes its quite strange hehe

dharrigan14:06:33

bug? On my repl I get an error if I plug in (= (defn 3) '(1 1 2))

guy14:06:58

Yes its defo a bug, i think its to do with 4clojure rather than clojure lang

guy14:06:12

I think it must be how they take the input string and do something with it

maleghast14:06:51

@dharrigan - That does__ look very interesting... We have a similar dynamic; Data Science Team is all Python...

dharrigan15:06:30

Collective wisdom time...

dharrigan15:06:40

Does anyone know of a very very simple command line http server that listens to any request (be it GET, POST, PUT, PATCH...) on any path, /foo, /foo/bar, /wibble/wobble/snarf and simply echos out the request to the command line? I don't need it to do anything else....

djtango15:06:29

does it have to be a local tool (i.e. postman-echo isn't what you're looking for)

dominicm18:06:02

I've used nc for this in the past

dominicm18:06:03

You're really just needing to pipe a 200 OK response into nc,

dominicm18:06:15

There's a few of these around on Google

alexlynham15:06:20

use ring & compojure? probably ten mins to get working

dharrigan15:06:00

nnnnaw, I want something where I don't have to think about it

dharrigan15:06:03

think of it like

dharrigan15:06:23

./i-accept-anything -p 8080

dharrigan15:06:53

my poor wee brain is tired from doing C, Clojure, Kotlin and work today

Ben Hammond16:06:11

you just want something that puts a server socket onto port 8080,accepts connections and dumps out all incoming trafffic, interpreting as UTF-8 string?

Ben Hammond16:06:12

(def f2 (future
           (with-open [ss (ServerSocket. 8084)]
             (mapv (fn [^Socket cs]
                       (try
                         (let [br (BufferedReader. (jio/reader (.getInputStream cs)))]
                           (loop [l "--connected---"]
                             (when l (println l)
                                     (recur (.readLine br)))))
                         (finally (.close cs))))
               (repeatedly 2 #(.accept ss))))))
sorta thing?

Ben Hammond16:06:38

I'm sure that can be polished alot

Ben Hammond16:06:13

I can point a webbrowser at

Ben Hammond16:06:20

and see stuff

dharrigan18:06:17

ben is my hero

😁 4
dharrigan18:06:13

yes, but it terminates after socket closes

dharrigan18:06:36

tiresome after a while πŸ™‚ There are examples where you can while it in a shell, but I really didn't want to think hard

dharrigan18:06:43

tired after a long day πŸ™‚

yogidevbear22:06:29

And goodnight πŸ˜„