- Types are declared with
:
and not::
, and the consing operator conversely is::
instead of:
- No
where
clauses, onlylet/in
- The standard style is different, check http://elm-lang.org/docs/style-guide for reference
- Multiline strings are a thing with
"""
- Haskell's
data
corresponds totype
in Elm, and also, Haskell'stype
corresponds to Elm'stype alias
($)
is(<|)
, but you don't use it all that much – Elm people like the flipped operator(|>)
which lets you build something that reads like a pipeline- Related: Backticks will likely die soon in favour of functions that have an argument order that lends itself to pipelining with
(|>)
- Also,
(.)
is(<<)
, and a flipped version(>>)
exists, but I don't see it used that much either (>>=)
is not an available operator and would not be polymorphic (no typeclasses, see below), and is instead commonly namedSomeType.andThen
– e.g.Maybe.andThen : Maybe a -> (a -> Maybe b) -> Maybe b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mouse(_, me, when, claim){ | |
when('fox is out', () => { | |
claim(me, 'wish', 'labelled', 'squeak') | |
claim(me, 'wish', 'outlined', 'red') | |
}) | |
} | |
function fox(_, me, when, claim){ | |
claim('fox is out') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Part I: The Magic | |
// The crux of this are two methods: pushStackTokens and readStackTokens | |
// They form the primitives for manipulating the Javascript VM's call stack | |
// pushStackTokens allows us to inject information (tokens) into the call stack | |
// readStackTokens allows us to retrieve all the stack tokens in the | |
// current call stack. | |
function pushStackTokens(tokens, fn, ...args){ | |
tokens.forEach(tok => console.assert(/^\w+$/.test(tok), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; In response to blog post: | |
;; https://medium.com/@kasperpeulen/10-features-from-various-modern-languages-that-i-would-like-to-see-in-any-programming-language-f2a4a8ee6727 | |
;; Run with lumo | |
;; https://github.com/anmonteiro/lumo | |
;; | |
;; # npm install -g lumo-cljs | |
;; lumo clojurescript-feature-examples.cljs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "https://jsonfeed.org/version/1", | |
"title": {{ .Site.Title | jsonify }}, | |
"home_page_url": {{ .Permalink | jsonify }}, | |
{{ with .OutputFormats.Get "json" -}} | |
"feed_url": {{ .Permalink | jsonify }}, | |
{{- end }} | |
{{ if (.Site.Params.author) or (.Site.Params.author_url) -}} | |
"author": { | |
{{ if .Site.Params.author -}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.purush.hadoop.giscup.script; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStreamWriter; | |
import java.io.PrintWriter; | |
public class Main { | |
private static int totalchars = 0, offset = 0; | |
private static InputStream stream; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def send_text_message(phone_number, message) do | |
ExTwilio.Api.create(ExTwilio.Message, | |
[to: phone_number, | |
from: Application.get_env(:ex_twilio, :send_number), | |
body: message]) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Called if a parameter is missing and | |
* the default value is evaluated. | |
*/ | |
function mandatory() { | |
throw new Error('Missing parameter'); | |
} | |
function foo(mustBeProvided = mandatory()) { | |
return mustBeProvided; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $primary: get-color('cyan', '500'); | |
@function get-color($color-hue, $color-shade: '500') { | |
$color: map-get(map-get($colors, $color-hue), $color-shade); | |
@if $color { | |
@return $color; | |
} @else { @error '=> ERROR'; } | |
} | |
$colors: ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="../tsd/tsd.d.ts" /> | |
import mongoose = require('mongoose'); | |
import passport = require('passport'); | |
interface IUser extends mongoose.Document { | |
provider: string; | |
id: string; | |
authorId: string; | |
displayName: string; |