Skip to content

Instantly share code, notes, and snippets.

Fogus fogus

Block or report user

Report or block fogus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rich-already-answered-that.md

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats. The link points back at them.

Why no pattern matching?

If you are talking about the aspect of pattern matching that acts as a conditional based upon structure, I'm not a big fan. I feel about them the way I do about switch statements - they're brittle and

View lisp.pas
{+ PASCAL/Z COMPILER OPTIONS +}
{++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
{$C- <<< CONTROL-C KEYPRESS CHECKING OFF >>> }
{$F- <<< FLOATING POINT ERROR CHECKING OFF >>> }
{$M- <<< INTEGER MULT & DIVD ERROR CHECKING OFF >>> }
{++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
PROGRAM LISP {VERSION 1.7};
{
+ PROGRAM TITLE: THE ESSENCE OF A LISP INTERPRETER.
+ WRITTEN BY: W. TAYLOR AND L. COX
View email.clj
(defn valid-email? [email]
(let [pattern #"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"]
(and (string? email) (re-matches pattern email))))
View j.c
typedef char C;
typedef long I;
typedef struct a {
I t, r, d[3], p[2];
} *A;
#define P printf
#define R return
#define V1(f) A f(w)A w;
@fogus
fogus / dc_2017_biblio.md
Created Apr 24, 2017 — forked from BaseCase/dc_2017_biblio.md
List of resources recommended or mentioned by the speakers at Deconstruct 2017
View dc_2017_biblio.md

Deconstruct 2017 Bibliography

Here are all of the resources mentioned by Deconstruct 2017 speakers, along with who recommended what. Please post a comment if I missed something or have an error!

DC 2017 Speakers' Choice Gold Medalist

  • Seeing Like a State by James Scott

Books

  • Public Opinion by Walter Lippmann (Evan Czaplicki)
  • A Pattern Language by Christopher Alexander (Brian Marick)
  • Domain Driven Design by Eric Evans (Brian Marick)
View evented-reader.cljs
(ns unrepl.evented-reader)
(defprotocol Closeable
(close [_]))
(defprotocol Stream
(read! [stream])
(unread! [stream])
(on-more [stream f]
"f is a function of two arguments: stream and an array where to push values.
View blahblahblah.markdown

If you've looked into the relatively new Clojure library clojure.spec you might have come across something curious. Observe the use of core.spec/or:

(require '[clojure.spec :as s])
    
(s/def ::num (s/or :float float? 
                   :int   int? 
                   :ratio ratio?))
    
(s/conform (s/coll-of ::num) [0.25 1/2 1])
View full-map.edn
#{[:africa/east :africa/south]
[:africa/east :africa/west]
[:africa/east :asia/west]
[:africa/east :europe/south]
[:africa/south :africa/east]
[:africa/south :africa/west]
[:africa/south :australia/west]
[:africa/south :south-america/east]
[:africa/south :south-america/south]
[:africa/west :africa/east]
@fogus
fogus / set-game.clj
Created Jun 30, 2016 — forked from cgrand/set-game.clj
the SET game in clojure.spec
View set-game.clj
;; the SET game in clojure.spec
;; inspired by https://github.com/jgrodziski/set-game
(require '[clojure.spec :as s])
(s/def ::shape #{:oval :diamond :squiggle})
(s/def ::color #{:red :purple :green})
(s/def ::value #{1 2 3})
(s/def ::shading #{:solid :striped :outline})
(s/def ::card (s/keys :req [::shape ::color ::value ::shading]))
View comics-favorite-100.txt
From Hell
Transmetropolitan
Jimmy Corrigan, the Smartest Kid on Earth
Cerebus
Strangers in Paradise
Swamp Thing (Moore)
Metabarons
Lone Wolf and Cub
Sandman
Love and Rockets
You can’t perform that action at this time.