J
https://gyazo.com/e0de0adbc49b5ce17b847f2dd3d5bc4e
J 言語
source code
標準 library
言語本體
資料
類似品
$ alias j='docker run -it -v "$(pwd):/mnt" --rm nesachirou/jlang'
學習
combinator rules
Monadicfx
Dyadicxfy
Leftx[y=x
Rightx]y=y
Monadic fork(fgh)x=(fx)g(hx)
Dyadic forkx(fgh)y=(xfy)g(xhy)
Monadic hook(fg)x=xf(gx)
Dyadic fookx(fg)y=xf(gy)
Monadic capped fork([:fg)x=f(gx)
Dyadic capped forkx([:fg)y=f(xgy)
Monadic noun fork(nfg)x=nf(gx)
Dyadic noun forkx(nfg)y=nf(xgy)
四則演算
code:j
NB. 足し算
1 + 2
+/ 1 2 3
NB. 引き算
2 - 1
NB. 掛け算
2 * 3
NB. 割り算
16 % 7 NB. 2.28571
NB. 剰餘
7 | 16 NB. 2
Average.
code:j
xs=.11 0 26 37 11 0 52
(+/%#)xs
(+/xs)%(#xs) NB. Monadic fork
code:j
(+/%#)11 0 26 37 11 0 52
Get random 100 alphanumeric charactors.
code:j
NB. 數字一覽
a.{~(48+i.10)
NB. 亂數百文字
(a.{~(48+i.10)){~]100?@$10
NB. 英數一覽
a.{~(48+i.10),(97+i.26),(65+i.26)
NB. 英數亂數文字列百文字
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'{~]100?@$62
(a.{~(48+i.10),(97+i.26),(65+i.26)){~]100?@$62
NB. ASCII印字可能非空白文字一覽
a.{~(33+i.94)
NB. ASCII印字可能非空白亂數文字列百文字
(a.{~(33+i.94)){~]100?@$94
Get random 24x4 alphanumeric charactors.
code:j
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'{~]4 24?@$62
(a.{~(48+i.10),(97+i.26),(65+i.26)){~]4 24?@$62
code:ruby
"まさわだ".chars.permutation.map{ |cs| cs.join("") } - "まさわだ" code:j
str=:'mswd'
((i.!#str)A.str)-.str
code:j
code:ruby
"masawada".chars.permutation.size - 1
code:j
(!#'masawada')-1
日時
code:j
6!:0 '' NB. 2020 7 21 8 22 13.8217
6!:0'' NB. 2020 7 21 8 22 13.8217
3 {. 6!:0 '' NB. 2020 7 21
todayno 3 {. 6!:0 '' NB. 80555
6!:0 'YYYY-MM-DD hh:mm:ss.sss' NB. 2020-07-21T08:22:13.822
isotimestamp 6!:0'' NB. 2020-07-21T08:22:13.822
require 'types/datetime'
(6!:0 '') tsPlus 9 0 0 NB. 2020 7 21 17 22 13.822
toDayNo 6!:0 '' NB. 80555.3
'YYYY-MM-DDThh:mm:sss' fmtDateTime toDayNo 6!:0 '' NB. 2020-07-21T08:22:14.644
'YYYY/M/D' fmtDate toDayNo 6!:0 '' NB. 2020/7/21
code:unixtime.j
Now=:6!:0''
<.5}Now+60*4}Now+60*3}Now+24*(todayno 3{.Now)-todayno 1970 1 1
NB. 1596966328
<.((tsrep 6!:0'')-tsrep 1970 1 1 0 0 0)%1000 NB. 1596967114
T=.1596967114
(todate (T%60*60*24)+todayno 1970 1 1),(24|<.T%60*60),(60|<.T%60),(60|T)
NB. 2020 8 9 9 58 34