Warning: this is just me musing and soliciting stimulating opinions. None of this may happen.
There should be one — and preferably only one — obvious way to do it
-- Tim Peters
;; Prints a table of vars in an ns with name/line/added/macro flag/deprecated flag | |
(defn pr-vars [ns-sym] | |
(->> (ns-publics ns-sym) vals (map meta) (sort-by :name) | |
(map #(select-keys % [:name :line :added :macro :deprecated])) | |
(map #(merge {:added nil :macro false :deprecated false} %)) | |
clojure.pprint/print-table)) | |
(pr-vars 'clojure.string) | |
;; | :added | :macro | :deprecated | :name | :line | |
;; try this form-by-form at a REPL | |
(require '[clojure.spec.alpha :as s]) | |
;; create an inline DSL to describe the FizzBuzz world | |
(defmacro divides-by | |
[nm n] | |
`(s/def ~nm (s/and pos-int? #(zero? (mod % ~n))))) | |
;; specify FizzBuzz | |
(divides-by ::fizz 3) |
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.
How to use:
'use strict'; | |
const jsdom = require('jsdom'); | |
const makeKey = (attr) => { | |
return attr.split(/[-:]/).map((s, i) => { | |
return i === 0 ? s : s[0].toUpperCase() + s.slice(1); | |
}).join(''); | |
} |
If you were to give recommendations to your "little brother/sister" on things that they need to do to become a data scientist, what would those things be?
I think the "Data Science Venn Diagram" (http://drewconway.com/zia/2013/3/26/the-data-science-venn-diagram) is a great place to start. You need three things to be a good data scientist:
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
In React's terminology, there are five core types that are important to distinguish:
React Elements
This document is a collection of concepts and strategies to make large Elm projects modular and extensible.
We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp
. You will probably merge
a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state: