Skip to content

Instantly share code, notes, and snippets.

View vinayvinay's full-sized avatar

Vinay Patel vinayvinay

View GitHub Profile
package main
import (
"fmt"
"log"
"net/http"
"html/template"
"github.com/gorilla/sessions"
@vinayvinay
vinayvinay / 4clojure-solutions.clj
Created May 14, 2011 09:09
sharing my first steps to picking-up clojure using 4clojure.com
;;; 25
(= (filter #(= (mod % 2) 1) #{1 2 3 4 5}) '(1 3 5))
(= (filter #(= (mod % 2) 1) [4 2 1 6]) '(1))
(= (filter #(= (mod % 2) 1) [2 2 4 6]) '())
(= (filter #(= (mod % 2) 1) [1 1 1 3]) '(1 1 1 3))
;;; 24
(= (reduce (fn [x y] (+ x y)) [1 2 3]) 6)
(= (reduce (fn [x y] (+ x y)) (list 0 -2 5 5)) 8)
(= (reduce (fn [x y] (+ x y)) #{4 2 1}) 7)