Skip to main content

Log: 202101

· 5 min read

Achivement

  • "りあクト! TypeScript で始めるつらくない React 開発(第 3.1 版)【I. 言語・環境編】"

  • "りあクト! TypeScript で始めるつらくない React 開発(第 3.1 版)【II. React 基礎編】"

  • "りあクト! TypeScript で始めるつらくない React 開発(第 3.1 版)【III. React 応用編】" / 大岡 由佳

  • "体系的に学ぶ 安全な Web アプリケーションの作り方(第 2 版)" / 徳丸 浩

  • AtCoder Problems / BC4B / Hard 100 (2 nd)

  • "Programming in Haskell (2nd Edition)" / Grahm Hutton

りあクト!

Original: https://github.com/oukayuka/Riakuto-StartingReact-ja3.1
https://github.com/e5pe0n/rea-ct

  • very nice book
  • Learned history of front end
  • Learned grammer of JavaScript and TypeScript
  • Learned tools for JavaScript and TypeScript
    • nodenv
    • node
    • yarn
    • create-react-app
    • tslint
    • stylelint
    • pritter
  • Learned modern style of implementation in React
    • FC, Hooks, Redux, React Query, Suspense, Concurrent

体系的に学ぶ 安全な Web アプリケーションの作り方

  • Good
    • well organized
  • Bad
    • too monotonous
    • tools used in this book are old
      • PHP, Perl
  • Learned basic valnerabilities and attacks, and measures against them

Programming in Haskell

About this book

  • Many examples of implementation
  • Detail of procedure to make recursive functions step by step

About Haskell

  • プログラムを読むことが式展開と同じ
    • 構文解析機みたい,シンタクティック
  • 命令型に比べて考えるべき場所が少ない
    • 命令型
      • それぞれの変数の値,値の変わるタイミングに注意する必要がある
        • 配列のインデックスとそこの値とか
    • 宣言型
      • 演繹的
      • 式展開なのでとっ散らからない
        • 再帰関数を理解しやすい
      • less bugs

e.g. insertion sort in Haskell

insert :: Ord a => a -> [a] -> [a]
insert x [] = [x]
insert x (y:ys)
| x <= y = x:y:ys
| otherwise = y:insert x ys

isort :: Ord a => [a] -> [a]
isort [] = []
isort (x:xs) = insert x (isort xs)


isort [3, 2, 1, 4]
= insert 3 (insert 2 (insert 1 (insert 4 [])))
= insert 3 (insert 2 (insert 1 [4]))
= insert 3 (insert 2 [1, 4])
= insert 3 [1, 2, 4]
= [1, 2, 3, 4]
  • クイックソートに感動
qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort (x:xs) = qsort smaller ++ [x] ++ qsort larger
where
smaller = [a | a <- xs, a <= x]
larger = [b | b <- xs, b > x]
  • It's better to read curried functions without replacement with lambda expressions if you understood a notation of curried functions is syntactic sugar of lambda expressions
    • consider the syntax of curried functions is default to define functions with multi args so you can get a partial applied function from any multi args function
add :: Int -> Int -> Int
add x y = x + y

-- means

add :: Int -> (Int -> Int)
add = \x -> (\y -> x + y)
  • Type declarations and Data declarations are similar with ones of TypeScript
-- Haskell
data Bool = False | True
// TypeScript
type Bool = true | false
  • Applicative and Monad
    • Applicative is too complex to understand it and to use it without considering
    • I feel that Monad is useful a bit, but I cannot found how to use Applicative
  • Reasoning
    • induction is used to reason about recursive types or recursive functions
    • we can confirm if the logic of a function is correct

e.g.

replicate :: Int -> a -> [a]
replicate 0 _ = []
replicate n x = x : replicate (n - 1) x
-- Base case:
length (replicate 0 x)
= { applying replicate }
length []
= { applying length }
0

-- Inductive case:
length (replicate (n + 1) x)
= { applying replicate }
length (x : replicate n x)
= { applying length }
1 + length (replicate n x)
= { induction hypothesis }
1 + n
= { commutativity of + }
n + 1

Music

  • In Flames
  • Sithu Aye