admin-announcements

Announcements from the Clojurians Admin Team (@U11BV7MTK @U077BEWNQ @U050TNB9F @U0ETXRFEW @U04V70XH6 @U8MJBRSR5 and others)
Josh Horwitz 2015-12-15T01:53:01.001812Z

I'm working my way through the clojure for the brave and true and as a Java developer it's just very hard to grasp the recursion and functional programming, very frustrating!

2015-12-15T02:15:35.001814Z

hey guys

monjohn 2015-12-15T02:41:18.001816Z

@joshua.d.horwitz: It's definitely a different way of thinking. Stick with it and it will eventually click.

Josh Horwitz 2015-12-15T02:47:51.001817Z

What’s the best way that you guys have learned? What’s the recommended books etc..

d-t-w 2015-12-15T03:05:19.001819Z

Hey @joshua.d.horwitz I worked with Java for about 15 years, have been purely Clojure the last 2. I found just coding it the best way to learn, rather than reading, but if you're not lucky enough to work on real-world Clojure projects I also find that if I ever need to work in Java these days I always have a REPL open - it's invaluable, anything you want to test in Java is readily available to you.

d-t-w 2015-12-15T03:05:45.001820Z

e.g. I wanted to check how messages being written to kafka were partitioned:

d-t-w 2015-12-15T03:05:49.001821Z

(pprint
  (let [partitioner (DefaultPartitioner. (VerifiableProperties.))]
    (map (fn [[key val]] [key (map first val)])
      (group-by second (map (fn [mta-host]
                              (let [k-part (.partition partitioner mta-host 3)]
                                [mta-host k-part]))
                         ["mta1101" "mta1102" "mta1103"
                          "mta1201" "mta1202" "mta1203"
                          "mta3101" "mta3102" "mta3103"
                          "mta3201" "mta3202" "mta3203"])))))
=> ([2 ("mta1101" "mta1203" "mta3102" "mta3201")]
    [0 ("mta1102" "mta1201" "mta3103" "mta3202")]
    [1 ("mta1103" "mta1202" "mta3101" "mta3203")])

seancorfield 2015-12-15T03:06:37.001822Z

@joshua.d.horwitz: I really liked The Joy of Clojure but it’s not recommended as an introductory book. I did some FP back in college before a career of C, C++, and lots of Java. I’d been doing recursion ever since I was doing assembler back in the 80’s tho’ so that probably helped :simple_smile:

seancorfield 2015-12-15T03:07:24.001824Z

As @d-t-w says, keep a REPL open and experiment a lot. Try out every piece of code you see. Try solving problems in the REPL using Clojure even if you’re going to use Java for the actual problem later.

seancorfield 2015-12-15T03:07:52.001825Z

You might like http://4clojure.com as a set of interactive puzzles with easy / medium / hard levels.

Josh Horwitz 2015-12-15T03:08:32.001826Z

Thanks @seancorfield and @d-t-w , I appreciate the help! I’m in the position where I’m wondering if I should just focus on learning Java as much as I can and all the frameworks, or to learn Clojure. I really like Clojure and the community.

seancorfield 2015-12-15T03:10:13.001827Z

I’m not sure I’d recommend Clojure as a learning experience if your goal is making a website for a nonprofit — there are definitely easier tools for building websites (esp. pure content-based sites) — but learning Clojure to become a better programmer overall is certainly reasonable.

Josh Horwitz 2015-12-15T03:12:09.001829Z

I was already learning Clojure, the website just came along out of nowhere so I thought it might be a good project to practice on.

monjohn 2015-12-15T03:19:00.001830Z

@joshua.d.horwitz: Another option would be to go through something this this, building a website and getting a feeling for Clojure along the way: http://www.amazon.com/Web-Development-Clojure-Build-Bulletproof/dp/1937785645

kyle_schmidt 2015-12-15T03:31:12.001831Z

^ highly recommend this book if you want to get your job done but it isn't for those wanting to learn the fundamentals.

Josh Horwitz 2015-12-15T03:40:26.001832Z

Really? Maybe I will check that out

Josh Horwitz 2015-12-15T03:43:24.001833Z

I do have that book, through my company we have a safari online account.

dave 2015-12-15T04:26:10.001834Z

@joshua.d.horwitz: http://learnyouahaskell.com/ was my introduction to functional programming. it's a great book not just for learning haskell, but it also does a great job of teaching functional programming concepts in an easy-to-understand way

dave 2015-12-15T04:26:23.001835Z

learning clojure after having read it was a breeze

Josh Horwitz 2015-12-15T04:37:48.001836Z

Thanks @dave , I have access to that book as well. Maybe I will try that first

ian 2015-12-15T08:00:49.001839Z

this has nothing to do with clojure, but holy cow does Go really upset me. I know I should just take some time to learn the basics, but I don't want to. I want to use a project written in Go but I can't even freaking figure out how to build it!

ian 2015-12-15T08:02:06.001840Z

why shouldn't I just be able to download a couple of .go files anywhere and just go build or something?

mostr 2015-12-15T08:24:50.001841Z

Any Cursive users around? Trying to force myself to stick to structural editing as much as possible (still being Clojure beginner), I know I can wrap stuff in parens just by selecting it and hitting (, but what if I want to do the opposite? E.g. I have fiddled with parens and ended up with sth like this (((str “Hello “ “World”))). How can I get rid of these redundant form parens (I have “standard” Cursive keybindings over MacOSX 10.5+ set)?

cjmurphy 2015-12-15T08:26:16.001842Z

I just highlight then use the delete key. Quite a hassle really and I'm sure that's not the right way.

sveri 2015-12-15T08:27:01.001843Z

@cjmurphy: @mostr I do it the same way, using cursive for almost over a year already 😄

cjmurphy 2015-12-15T08:27:08.001844Z

I have a feeling we are supposed to think in a 'parenedit' way, but I could be completely wrong, prolly am.

mostr 2015-12-15T08:27:51.001845Z

I feel like hacking Cursive way by just using “Delete” :simple_smile: But looks like it’s way to go from what you say :simple_smile:

cjmurphy 2015-12-15T08:28:06.001846Z

We s/be in #C0744GXCJ by the way...

mostr 2015-12-15T08:29:12.001847Z

oh, 🤦 haven’t checked if channel existed before posting, joining.

dnolen 2015-12-15T12:26:22.001854Z

@mostr: there’s a command for that, “Raise"

dnolen 2015-12-15T12:27:38.001855Z

if ^ is the cursor (^(foo 1 2)) Raise -> (foo 1 2)

mostr 2015-12-15T12:27:42.001856Z

thanks, will check it too. We got “Splice” working (on #C0744GXCJ) in this particular case (I mean remove redundant parens pair)

mostr 2015-12-15T12:28:02.001857Z

will give it a try

mostr 2015-12-15T12:30:15.001858Z

yeah, this is IT, looks like it’s also special case for “Splice” too, thanks!

dnolen 2015-12-15T12:38:25.001859Z

things I find essential - Raise, Splice, Split, and Sexpr aware Kill

2015-12-15T17:50:03.001866Z

I thought splice would be used for something like that

jaen 2015-12-15T18:08:07.001867Z

For me splice also seems more natural than raise to achieve this.

2015-12-15T19:37:20.001869Z

I just finally remembered to support Clojars on bountysource: https://salt.bountysource.com/teams/clojars In case anyone else was meaning to and needed a reminder. :simple_smile:

👍 1
2015-12-15T19:40:56.001871Z

I hate to think of what would happen if there was a sustained Clojars outage. Many thanks to tcrawley for all of his work, and, of course, xeqi, too.

2015-12-15T19:43:38.001873Z

thanks bridget!

🤘 2
sveri 2015-12-15T22:21:11.001876Z

Hi, anybody knows a clojure library for websockets? I tried gniazdo, but this seems to break my project with classpath issues. Sente seems to be only able to open a client on cljs side.

jaen 2015-12-15T22:23:29.001877Z

@sveri: how would you want to do a server on the client side though?

sveri 2015-12-15T22:25:24.001878Z

@jaen i want to connect to a websocket on server side. So from server to server.

jaen 2015-12-15T22:26:46.001879Z

Ah, I must have misunderstood you. Yeah, unfortunately sente doesn't have a client.

jaen 2015-12-15T22:26:54.001880Z

Aleph seems to have a client thought https://github.com/ztellman/aleph#websockets

sveri 2015-12-15T22:35:28.001883Z

Thanks... I will look at it tomorrow.

shinych 2015-12-15T22:46:15.001884Z

@jaen https://github.com/jarohen/chord

jaen 2015-12-15T22:48:47.001886Z

Yes, I'm aware of this library, but that doesn't answer @sveri's use-case, does it?

sveri 2015-12-15T22:56:34.001888Z

@jaen @shinych at least in the readme i cannot find an example.

jeff 2015-12-15T22:56:59.001889Z

no, the client side of chord uses the browser APIs

jeff 2015-12-15T22:57:09.001890Z

server to server websockets don’t really make sense

jeff 2015-12-15T22:57:13.001891Z

just use a regular socket

👍 1
jeff 2015-12-15T23:00:18.001892Z

http-kit has client and server APIs, but not client-side websockets. That would most likely be a substantial amount of work, although if you needed this for some reason you could probably do it.

sveri 2015-12-15T23:06:54.001893Z

@jeff what do you mean exactly with "just a socket"? What i want is to connect to a websocket endpoint from clojure side. Which "socket" implementation should i use for that?

jeff 2015-12-15T23:08:17.001894Z

ah, an external websocket service.

jeff 2015-12-15T23:08:25.001895Z

I don’t know of any clojure clients

jeff 2015-12-15T23:09:17.001898Z

if you have control of both client and server, than I meant a plain TCP socket

sveri 2015-12-15T23:10:15.001899Z

Ah... Now i get what you mean. No, i don't have control, only an external endpoint.

danielcompton 2015-12-15T23:46:31.001900Z

@sveri: you could copy the wrapper parts of gniazdo into your own projects, or use the jetty Java library directly