Skip to content

Instantly share code, notes, and snippets.

View mariussoutier's full-sized avatar

Marius Soutier mariussoutier

View GitHub Profile
;; marius' solution to Compress a Sequence
;; https://4clojure.com/problem/30
#(map last (partition-by str %))
;; msoutier's solution to Drop Every Nth Item
;; https://4clojure.com/problem/41
(fn [coll n]
(keep-indexed #(if (not= 0 (mod (inc %1) n)) %2 nil) coll))
;; msoutier's solution to Duplicate a Sequence
;; https://4clojure.com/problem/32
#(interleave % %)
;; msoutier's solution to Pack a Sequence
;; https://4clojure.com/problem/31
partition-by identity
;; msoutier's solution to Replicate a Sequence
;; https://4clojure.com/problem/33
(fn [c n] (mapcat #(repeat n %) c))
;; msoutier's solution to Interpose a Seq
;; https://4clojure.com/problem/40
(fn [s c] (butlast (mapcat #(list %1 s) c)))
@mariussoutier
mariussoutier / core.clj
Created November 18, 2011 08:54
Conway's Game of Life in Clojure
;;; Conway's Game of Life
;;; Using a set of coordinates to provide a infinite world
;;;
;;; Moritz Ulrich <ulrich.moritz@googlemail.com>
;;; Cologne Clojure User Group
;;; November 17, 2011
(ns game-of-life.core
(:use [clojure.set :as set]))
@mariussoutier
mariussoutier / AkkaSpecification.scala
Last active August 29, 2015 14:00 — forked from cessationoftime/AkkaSpecification.scala
Test Akka from Specs2, versions as of Play 2.2.x
import org.specs2.mutable._
import org.specs2.specification._
import org.specs2.matcher._
import org.specs2.execute._
import org.specs2.control.Debug
import org.specs2.main.ArgumentsShortcuts
import akka.testkit.TestKitBase
import akka.actor.ActorSystem