- [2..9] and [2..9]
- 小明(積)
- 小華(和)
4, 6, 8, 10, 12, 14, 16, 18,
import "phoenix_html" | |
import "bootstrap" | |
import "jquery" | |
import "toastr" | |
// ... |
syntax on | |
set encoding=utf-8 | |
set termencoding=utf-8 | |
set fileencoding=utf-8 | |
set fileencodings=ucs-bom,utf-8,big5,gb2312,latin1 | |
set ffs=unix,mac,dos | |
colorscheme pablo | |
set t_Co=256 |
defmodule RescueDemo do | |
def main do | |
data | |
|> wrapper_action | |
|> follow_up_function | |
end | |
def wrapper_action(data) do | |
try do | |
dangerous_action(data) |
{ | |
"description": "Left Command to Switch Input Source", | |
"manipulators": [ | |
{ | |
"conditions": [ | |
{ | |
"type": "input_source_if", | |
"input_sources": [ | |
{ | |
"language": "en" |
我們將安裝下列項目:
由於 macOS 及 linux 可以使用 asdf 這個語言版本管理器,所以我們將介紹用它來安裝 elixir 及 nodejs 的方式。而 Windows 則會使用 chocolatey 來安裝。
defmodule Food do | |
def reduce([], _), do: "😵" | |
def reduce(foods, f), do: Enum.reduce(foods, f) | |
def eat(_, "💀"), do: "💀" | |
def eat(stuff, _) do | |
if is_food(stuff), do: "💩", else: "💀" | |
end | |
def is_food(_), do: true # implement yourself |
nub' :: [Int] -> [Int] | |
nub' = foldr f [] where | |
f x xs | |
| x `elem` xs = xs | |
| otherwise = x:xs | |
-- without using `elem` | |
nub'' :: [Int] -> [Int] | |
nub'' = foldr f [] where | |
f x xs |
module Histogram where | |
import Data.List (unfoldr, foldl') | |
histogram :: [Int] -> String | |
histogram = addFootter . unlines . graph . tally where | |
addFootter s = s ++ "==========\n0123456789\n" | |
tally :: [Int] -> [(Int, Int)] | |
tally = foldl' accu ary where | |
ary = zip [0..9] (repeat 0) |
<!DOCTYPE> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Dom sample page</title> | |
<link rel="stylesheet" href="../css/main.css"/> | |
<style> | |
.found-element | |
{ | |
border: 2px solid #000000; |