- Syntax
- Semantics
- Implementation
- Basics (tail-recursion, higher-order functions)
- See Haskell-basic
- Closure
- No free-variable
head [] --Head error | |
tail [] --Tail error | |
3 : 5 --Cons error | |
head (5 : (tail (1 : 2 : []))) --5 | |
tail (1 : 2 : 3 : []) -- [2,3] | |
tail (1 : []) -- [] | |
1 + 2 : 3 * 4 : 5 : 6 : [] --[3,12,5,6] | |
(2, 2) --(2, 2) | |
(1 + 2 : 3 * 4 : 5 : 6 : [], [], True, 0) --([3,12,5,6], [], True, 0) |
參與畢業生拯救計畫的大家!久等了!
您的會員帳號已進入審核,待一天後即可登入囉!歡迎加入 Dcard : )
請記得您的「自介」、「生日」與「照片」必須在登入後進行上傳填寫修正完整,否則將無法使用抽卡功能喔!
新加入成員必讀基本使用須知:
/** | |
* Converting snake_case to camelCase | |
* usage: node snakeToCamel.js <src> <dst> | |
* | |
* 2015/01/28 by SSARCandy | |
*/ | |
const fs = require('fs'); | |
function snakeToCamel(s) { |
const input = "251521 011805 1805010425 011404 01021205 2015 0415 020501212009062112 200809140719 0914 20080919 2315181204 011404 0106200518 251521 23011211 20081815210708 2008151905 0415151819 2015040125 251521 23091212 15141225 05220518 08012205 202315 03081509030519 12152205 1518 06050118 030815151905 12152205 011404 041514 20 05220518 120520 06050118 20211814 251521 01070109141920 25152118 16120125062112 0805011820 100913 030118180525"; | |
function decoder(str) { | |
return (str.length > 2) | |
? charMap(str.slice(0,2)) + decoder(str.slice(2)) | |
: charMap(str); | |
} | |
function charMap(str) { | |
return "abcdefghijklmnopqrstuvwxyz"[parseInt(str)-1]; |
#!/bin/bash | |
function show_gpu_user { | |
pid=$(pstree -sg $1 | grep -Eo 'bash\([0-9]*\)' | head -1 | grep -Eo '[0-9]*'); | |
docker ps -q | xargs docker inspect --format "{{.Name}} {{.State.Pid}}" | grep $pid | awk '{printf "%-24s", $1}'; | |
ps aux | grep $1 | grep -v grep | awk '{ for(i=1;i<=NF;i++) {if ( i >= 11 ) printf $i" "}; printf "\n" }'; | |
} | |
echo " "; |