Intro to swarm coding

  • December 20, 2012 · 7:00 PM

Kevin Lynagh and I both want to start doing more swarm coding (collective, collaborative, interactive coding) as a way to build up our community, show others how to be effective with Clojure, explore the language, and build some cool projects!

Come join us, and bring a laptop (if you want)!
To warm up to coding as a group, we're going to start with the Coin Change Kata - http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata-1

We'll solve it first in a straight-forward and functional manner, implementing multiple approaches (greedy, off-by-X, ...) and then solve it again using core.logic's constraint system.

Join or login to comment.

  • Paul d.

    A new Clojerks meetup has been posted to continue swarming and working with Clojure. I'd love to see more people from the previous swarm make it - if the date and time doesn't work, let the group know. Thanks!

    January 14, 2013

  • Greg B.

    Thanks Paul for hosting such an interesting session. For my first Clojure program ever (below), I sketched out a recursive solution to the Kata problem in Haskell and then tried to translate pretty much directly to Clojure. (Granted - this doesn't exactly meet the problem spec, which called for a map over denominations. A final step could be added to translate to that form.)

    (defn maybeCons [x xs]
    (if (= xs nil) nil (cons x xs)))

    (defn best_of [left right]
    (cond (= right nil) left
    (= left nil) right
    (> (count right)(count left)) left
    true right))

    (defn kata [coins amt]
    (cond (= amt 0) []
    (empty? coins) nil
    (< amt (first coins)) (kata (drop 1 coins) amt)
    true (let [left (maybeCons (first coins)(kata coins (- amt (first coins))))
    right (kata (drop 1 coins) amt)]
    (best_of left right))))

    (print (kata '[masked]) 137))

    December 21, 2012

    • Paul d.

      In clojure, there's a function for that: (frequencies [[masked] 1]) => {25 5, 10 1, 1 2}

      January 3, 2013

    • Paul d.

      It's exactly the same function you're describing above, that you would do in Haskell. There's also a function called `apropos` that works like the Unix command, but for Clojure functions.

      January 3, 2013

  • Mitchell T.

    Interesting. I was somewhat shy but it was nice to follow along. I aspire to try typing.

    December 22, 2012

  • Howard M. Lewis S.

    It's been a while since I tried to code in a group, so it was a different experience. Sorry I had to rush out at the end.

    December 21, 2012

  • Paul d.

    Here is the git repo for the code swarm - https://github.com/clojure-pdx/c...­

    Thanks everyone for coming and participating. As more people get comfortable with Clojure, more people should be jumping on the keyboard :)

    December 21, 2012

  • Paul d.

    Great to see this on the calendar! Time and date works totally fine for me

    Thanks again to Simple for hosting!
    I also have exciting Clojure-meetup related news to share to kick the meeting off.

    December 11, 2012

Our Sponsors

  • Simple

    meeting space and funding

People in this
Meetup are also in:

You don't have to be an expert to start your own Meetup Group

Get started Learn more
Katie

I'm surprised by the level of growth I've seen since becoming an organizer, it's given me more confidence in my abilities.

Katie, started NYC ICO

Start your Meetup today

Act now and get 50% off.
Until February 1.

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy