Haskellやる
いちいちTokenizerやParserをライブラリを使わずに書くのはダルい。だからパーサジェネレータ(lex/yacc)を使ったりするものだが、Rustで書こうとするとパーサコンビネータである
github.com
が強いっぽい。nomを見てみたら何もわからん状態になったので影響を強く受けたっぽい
github.com
のtutorialから雰囲気でやってみようと思ったけどこれまた何もわからない。
なので、手元にすごいH本もあるしやってみようと思う。
Neovimに気持ち入門した
プログラミングを始めてからほとんどGUIエディタにしか触ったことがなかったしタイルマネージャを触り始めてからキーボードで全部アレコレしたいなという気持ちが強まったので試しにNeovimを突っ込んだ。
VSCodeにもVimのExtensionあったし気が向いたらそっちにも触ってみようかな、LSP周りをきっちり設定してTSでCDKを書けたらいいけど・・・。
とりあえずinit.vimを晒します
set number syntax on set fenc=utf-8 set nobackup set noswapfile set autoread set showcmd set cursorline set cursorcolumn set list listchars=tab:\▸\- set showmatch call plug#begin() Plug 'scrooloose/nerdtree' Plug '/usr/local/opt/fzf' Plug 'junegunn/fzf.vim' Plug 'jiangmiao/auto-pairs' Plug 'prabirshrestha/async.vim' Plug 'prabirshrestha/asyncomplete.vim' Plug 'prabirshrestha/asyncomplete-lsp.vim' Plug 'prabirshrestha/vim-lsp' Plug 'mattn/vim-lsp-settings' Plug 'ryanolsonx/vim-lsp-python' Plug 'thinca/vim-quickrun' Plug 'ajmwagar/vim-deus' call plug#end() if executable('pyls') au User lsp_setup call lsp#register_server({ \ 'name': 'pyls', \ 'cmd': {server_info->['pyls']}, \ 'whitelist': ['python'], \ }) endif noremap <Space> <Nop> let mapleader = "\<Space>" noremap <Leader>r :source ~/.config/nvim/init.vim<CR> noremap <Leader>w :w<CR> noremap <Leader>wq :wq<CR> noremap <Leader>a 0 noremap <Leader>e $ noremap <Leader>r <C-r> noremap <Leader>t :NERDTreeToggle<CR> inoremap <C-a> <ESC>0i inoremap <C-e> <ESC>$a nnoremap <BS> i<BS> inoremap <C-w> <ESC>wa inoremap <C-e> <ESC>ea inoremap <C-b> <ESC>ba inoremap <C-j> <ESC>ji inoremap <C-k> <ESC>ki set title set smartindent colors deus filetype indent on noremap s <Nop> noremap <Leader>ss :split<CR> noremap <Leader>sv :vsplit<CR> noremap <Leader>h <C-w>h noremap <Leader>j <C-w>j noremap <Leader>k <C-w>k noremap <Leader>l <C-w>l
プログラミング in OCaml 5th chapter 練習問題を解いた
練習問題 5.1
let downto1 n = if n < 1 then [] else let rec downto1' n = match n with | 1 -> [1] | n -> n :: downto1' (n - 1) in downto1' n;;
プログラミング in OCaml 4th chapter 練習問題を解いた
練習問題 4.1
let uncurry f (x, y) = f x y;;
練習問題 4.2
let rec repeat f n x = if n > 0 then repeat f (n - 1) (f x) else x;; let fib n = let (fibn, _) = repeat (fun (f, s) -> (s, f + s)) n (0, 1) in fibn;;
2020年の抱負
毎年雑に生きて雑に過ごしてる気がするのでそろそろ一年を計画的に生きてみたいなと思った
- 1回はする