In functional programming you often want to apply a function partly. A simple example is a function add
.
It would be nice if we could use add
like:
var res2 = add(1, 3); // => 4
var add10To = add(10);
var res = add10To(5); // => 15
module Main where | |
import Control.Monad | |
import Control.Monad.Free | |
import Prelude hiding (putChar, getChar) | |
import qualified System.IO as IO | |
import Test.QuickCheck | |
---------------------------------------------------------------- | |
-- Our DSL |
#!/usr/bin/env PYTHONIOENCODING=utf-8 python | |
# encoding: utf-8 | |
"""Git pre-commit hook which lints Python, JavaScript, SASS and CSS""" | |
from __future__ import absolute_import, print_function, unicode_literals | |
import os | |
import subprocess | |
import sys |
Functional programming gets a bad wrap about being too hard for mere mortals to comprehend. This is nonsense. The concepts are actually quite simple to grasp.
The jargon is the hardest part. A lot of that vocabulary comes from a specialized field of mathematical study called category theory (with a liberal sprinkling of type theory and abstract algebra). This sounds a lot scarier than it is. You can do this!
All examples using ES6 syntax. wrap (foo) => bar
means:
function wrap (foo) {
Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run". We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.
import java.util.Arrays; | |
public class HashCodeFunctions | |
{ | |
private final static short DEFAULT_PRIME_NUMBER = 31; | |
private HashCodeFunctions() | |
{ | |
throw new AssertionError("Could not be instantiated."); | |
} |
In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.
At the moment GraphQL allows 2 types of queries:
query
mutation
Reference implementation also adds the third type: subscription
. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.
해커랭크 사이트의 문제 중 하나 The Tree of Life 를 풀다가 나온 입력 처리입니다.
위의 문제는 이진 트리가 LISP의 S-expression 형식으로 입력됩니다.
이진 트리의 각 노드 값은 .
이나 X
이고,
브랜치는 괄호로 묶어 왼쪽/자신/오른쪽 순으로 표시됩니다.
예를 들어(X . (. X .))
는 아래와 같은 트리를 나타냅니다.
module ApiModel where | |
import Data.Time (ZonedTime(..), parseTimeM, defaultTimeLocale, iso8601DateFormat) | |
data ReservationRendition = ReservationRendition | |
{ rDate :: String | |
, rName :: String | |
, rEmail :: String | |
, rQuantity :: Int } | |
deriving (Eq, Show, Read) |