Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
新機能で知るEgison
Search
kotapiku
December 04, 2018
Programming
260
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
新機能で知るEgison
約1年の間に追加された主な機能についての紹介です.
kotapiku
December 04, 2018
Other Decks in Programming
See All in Programming
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
Jetpack Compose Mechanisms
skydoves
3
820
The Rails Doctrine Decade
koic
2
590
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
390
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
420
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
150
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
1.1k
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
2
630
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Scaling GitHub
holman
464
140k
ラッコキーワード サービス紹介資料
rakko
1
5.3M
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Speed Design
sergeychernyshev
33
2.2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
Raft: Consensus for Rubyists
vanstee
142
7.8k
Building AI with AI
inesmontani
PRO
1
1.3k
Designing for humans not robots
tammielis
254
26k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
550
Transcript
৽ػೳͰΔ&HJTPO Egison Workshop 2018 by @kotapiku
w ౦େཧͰ͢ w 7JN )BTLFMMOZBO w લ͘Β͍͔Βָఱٕज़ݚڀॴͰ &HJTPOόΠτΛ͍ͯ͠·͢ Twitter &
GitHub @kotapiku
ࠓ͢͜ͱ w ៉ྷͳ+VQZUFSग़ྗ w 'VODUJPO4ZNCPM w ͍͍͢ςϯιϧૢ࡞ w %'4ύλʔϯ w
༏ઌ͖03 w ৽ύʔαʔ࡞ͬͯ·͢ʂ
៉ྷͳ+VQZUFSग़ྗ
+VQZUFS/PUFCPPLͱ w 1ZUIPOͷରڥͱͯ͠։ൃ͞Ε͍ͯΔ w 1ZUIPOҎ֎ʹ+VMJB 3 3VCZͳͲ͑Δ w &HJTPOFHJTPO@LFSOFMΛೖΕΕ͑ΔΑ͏ʹ ͳΓ·͢
FHJTPO@LFSOFM IUUQTHJUIVCDPNFHJTPOFHJTPO@LFSOFM
None
.ΦϓγϣϯͰग़ྗΛΓସ͑Δ % egison -M asciimath > [| [| 1 0
0 |] [| 0 1 0 |] [| 0 0 1 |] |] #asciimath|((1, 0, 0), (0, 1, 0), (0, 0, 1))|# % egison -M latex > [| [| 1 0 0 |] [| 0 1 0 |] [| 0 0 1 |] |] #latex|\begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{pmatrix}|# % egison -M mathematica > [| [| 1 0 0 |] [| 0 1 0 |] [| 0 0 1 |] |] #mathematica|{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}|#
IUUQTHJUIVCDPNFHJTPOFHJTPOCMPCNBTUFS ITTSD-BOHVBHF&HJTPO.BUI0VUQVUIT w &HJTPOͷग़ྗจࣈྻΛύʔεˠมˠग़ྗ w ύʔαʔॻ͘ͷॳΊͯͰͨ͠ w XSJUFZPVSTFMGBTDIFNFJOIPVST ΛಡΜͰؤுͬͨ ࣮ʹ͍ͭͯ
'VODUJPO4ZNCPM
w ֶཧͰΑ͘G Y Z ΛGͱॻ͘ w &HJTPOͰ؆ܿʹࣜΛ͔͖͍ͨʂ
'VODUJPO4ZNCPM > (define $f (function [x y])) > f f
> (d/d f x) f|x > (d/d (d/d f x) y) f|x|y > (define $x (* r (cos θ))) > (define $y (* r (sin θ))) > (d/d f r) (+ (* f|x (cos θ)) (* f|y (sin θ))) G Y Z Λఆٛ ඍ͕៉ྷʹ͔͚·͢ ߹ؔͷඍͰ͖·͢
ඍͲ͏࣮ݱ͞Ε͍ͯΔ͔ (define $∂/∂ (lambda [$f *$x] (match f math-expr {
. . . [<func _ $argnames $args _> (sum (map2 (lambda[$s $r] (* (user-refs f {s}) (∂/∂ r x))) argnames args))] . . . }))) > (define $f (function [x y])) > (define $x (* r (cos θ))) > (define $y (* r (sin θ))) > (d/d f r) (+ (* f|x (cos θ)) (* f|y (sin θ))) BSHOBNFT\lYzlZz^ BSHT\ S DPTВ S TJOВ ^
͍͍͢ςϯιϧૢ࡞
Λ͍ͨ͠ Ͱʜ 'VODUJPO4ZNCPMࣗͷ໊લΛ࣋ͨͳ͚ΕͳΒͳ͍ ˠτοϓϨϕϧͰ͔͠ѻ͑ͳ͍ (define $g_i_j [| [| (function [x
y]) 0 0 |] [| 0 (function [x y]) 0 |] [| 0 0 (function [x y]) |] |]_i_j)
'VODUJPO4ZNCPM > (define $f (function [x y])) > f f
> (d/d f x) f|x > (d/d (d/d f x) y) f|x|y > (define $x (* r (cos θ))) > (define $y (* r (sin θ))) > (d/d f r) (+ (* f|x (cos θ)) (* f|y (sin θ))) ධՁͰͳ໊͘લΛग़ྗ͢Δ
(define $g11 (function [x y])) (define $g22 (function [x y]))
(define $g33 (function [x y])) (define $g_i_j [| [| g11 0 0 |] [| 0 g22 0 |] [| 0 0 g33 |] |]_i_j) (d/d g_i_j x) ͜ͷ··Ͱʜ w ֤ཁૉʹ͍ͭͯॻ͘ͷ͕໘ w H͕H@@ͳͷ͔Hddͳͷ͔͔Βͳ͍
͜͏ॻ͚ΔΑ͏ʹ͠·ͨ͠ > (define $g__ (generate-tensor ɹ(match-lambda [integer integer] ɹɹ{[[$n ,n]
(function [x y z])] [[_ _] 0]}) {3 3})) > g_i_j [| [| g_1_1 0 0 |] [| 0 g_2_2 0 |] [| 0 0 g_3_3 |] |]_i_j > (d/d g_i_j x) [| [| g_1_1|x 0 0 |] [| 0 g_2_2|x 0 |] [| 0 0 g_3_3|x |] |]_i_j ςϯιϧͷ໊લ ఴࣈͷ্Լ ໊લΛࣗಈͰ͚ͭͯ͘ΕΔ ඍͪΌΜͱදࣔ͞ΕΔ
w ςϯιϧΛlϵ@@@z lϵd@@zͷΑ͏ͳ໊લʹ ఆٛͰ͖Δ w 'VODUJPO4ZNCPMجຊτοϓϨϕϧͰѻ͏ ʜ EFpOFG GVODUJPOʜ ͳͲ
w ςϯιϧͷதͳΒ'VODUJPO4ZNCPMΛ͑Δ
%'4QBUUFSO
%'4QBUUFSO > (take 10 (match-all nats (set integer) [(dfs <cons
$m <cons $n <cons $l _>>>) [m n l]])) {[1 1 1] [1 1 2] [1 1 3] [1 1 4] [1 1 5] [1 1 6] [1 1 7] [1 1 8] [1 1 9] [1 1 10]} > (take 10 (match-all nats (set integer) [<cons $m (dfs <cons $n <cons $l _>>)> [m n l]])) {[1 1 1] [2 1 1] [3 1 1] [4 1 1] [5 1 1] [6 1 1] [7 1 1] [8 1 1] [9 1 1] [10 1 1]} > (take 10 (match-all nats (set integer) [(dfs <cons $m (bfs <cons $n <cons $l _>>)>) [m n l]])) {[1 1 1] [1 1 2] [1 2 1] [1 1 3] [1 2 2] [1 3 1] [1 1 4] [1 2 3] [1 3 2] [1 4 1]} > (take 10 (match-all nats (set integer) [(dfs <cons $m <cons $n (bfs <cons $l _>)>>) [m n l]])) {[1 1 1] [1 1 2] [1 1 3] [1 1 4] [1 1 5] [1 1 6] [1 1 7] [1 1 8] [1 1 9] [1 1 10]}
→ MState{[<cons $m <cons $n _>> nats (multiset integer)]} env
{} → MState{[$m 1 integer] [<cons $n _> {2 3 4 ...} (multiset integer)]} env {} MState{[$m 2 integer] [<cons $n _> {1 3 4 ...} (multiset integer)]} env {} … → MState{[$m 1 something] [<cons $n _> {2 3 4 ...} (multiset integer)]} env {} → MState{[<cons $n _> {2 3 4 ...} (multiset integer)]} env {[m 1]} → MState{[$n 2 integer] [_ {3 4 ...} (multiset integer)]} env {[m 1]} MState{[$n 3 integer] [_ {2 4 ...} (multiset integer)]} env {[m 1]} … → MState{[$n 2 something] [_ {3 4 ...} (multiset integer)]} env {[m 1]} → MState{[_ {3 4 ...} (multiset integer)]} env {[m 1] [n 2]} → MState{} env {[m 1] [n 2]} ύλʔϯϚονͷ༷ࢠ লུͯ͠ Ұͭͷ.4UBUFͷΈ ਐΊ͍ͯ·͢ (match-all nats (multiset integer) [<cons $m <cons $n _>> {m n}])
ύλʔϯϚονશମͷ༷ࢠ
શମΛ%'4͢Δͷ؆୯
͜ͷํ๏ͰҰ෦%'4ʹ͢Δͱμϝ
ղܾࡦ w ύλʔϯͷ൪্ʹEGTQBUUFSO͕དྷͨΒɼ ͦΕҎ߱൪Ҏ߱ͷ.4UBUFΛޙճ͠ʹ͢Δ w ޙճ͠ʹͨ͠.4UBUFΛύλʔϯ͝ͱʹूΊͯ Λ࡞Δ w ޙճ͠ʹͨͨͪ͠Λɼ͕ࠜਂ͍ॱʹॲཧ͢Δ
෦తʹ%'4͢Δͷ͕ՄೳʹͳΔ
༏ઌ͖03
0SEFSFE031BUUFSO > (match-all (between 1 9) (multiset integer) [<cons (&
(|* ,1 ,2 ,3) $x) <cons (& (|* ,4 ,5 ,6) $y) <cons (& (|* ,7 ,8 ,9) $z) _>>> {x y z}]) {{1 4 7} {1 4 8} {1 4 9} {1 5 7} {1 5 8} {1 5 9} {1 6 7} {1 6 8} {1 6 9} {2 4 7} {2 4 8} {2 4 9} {2 5 7} {2 5 8} {2 5 9} {2 6 7} {2 6 8} {2 6 9} {3 4 7} {3 4 8} {3 4 9} {3 5 7} {3 5 8} {3 5 9} {3 6 7} {3 6 8} {3 6 9}}
0SEFSFE031BUUFSOΛ͏ྫ w #FTUTIV⒐F SPTFUUBDPEF IUUQXXXSPTFUUBDPEFPSHXJLJ#FTU@TIV⒐F w จࣈྻ͕༩͑ΒΕɼͦͷจࣈྻΛฒସ͑ͯ ݩͷҐஔͱҟͳΔॴʹ͋ΔจࣈͷΛ࠷େԽ͢Δ w
FHUSFFˠFFUSHSSSˠSHSS
#FTUTIVGqFͷղྫ (define $shuffle-string (lambda [$s] (pack (shuffle (unpack s))))) (define
$shuffle (lambda [$lst] (match [lst (randomize lst)] [(list eq) (multiset eq)] {[[(loop $i [1 $n] <cons $x_i ...> <nil>) (loop $i [1 n] (dfs <cons (& (|* !,x_i ,x_i) $y_i) ...>) <nil>)] (map 1#y_%1 (between 1 n))]}))) (shuffle-string “tree”) ; “eetr” γϟοϑϧલͷจࣈ\YYYʜYO^ γϟοϑϧޙͷจࣈ\ZZZʜZO^
w c QBUQBU Λॲཧ͢Δͱ͖QBUΛ ޙճ͠ʹ͢Δˠύλʔϯ͝ͱʹ͕ͨ͘͞ΜͰ͖Δ w ਤඳ͘ͷେมͩͬͨͷͰ࣮ͨ͠ͱ͖ʹॻ͍͍ͯͨ ͷΛͦͷ··ࡌͤ·͢ ͍ͩͿదͰ͢ʣ ࣮ͷৄࡉ
None
৽ύʔαʔ࡞ͬͯ·͢ʂ
4͍ࣜͩͳ͋ʜಡΈͮΒ͍Α͏ʜ
(define $list (lambda [$a] (matcher {[<nil> [] {[{} {[]}] [_
{}]}] [<cons $ $> [a (list a)] {[{$x @$xs} {[x xs]}] [_ {}]}] [<snoc $ $> [a (list a)] {[{@$xs $x} {[x xs]}] [_ {}]}] [<join $ $> [(list a) (list a)] {[$tgt (match-all tgt (list a) [(loop $i [1 $n] <cons $xa_i ...> $rs) [(foldr (lambda [%i %r] {xa_i @r}) {} (between 1 n)) rs]])]}] [<nioj $ $> [(list a) (list a)] {[$tgt (match-all tgt (list a) [(loop $i [1 $n] <snoc $xa_i ...> $rs) [(foldr (lambda [%i %r] {@r xa_i}) {} (between 1 n)) rs]])]}] [,$val [] {[$tgt (if (eq? val tgt) {[]} {})]}] [$ [something] {[$tgt {tgt}]}] }))) Before
list(a) = matcher | <nil> as () -> | []
-> {()} | _ -> {} | <cons $ $> as (a, list(a)) -> | [$x, @$xs] -> {(x, xs)} | _ -> {} | <snoc $ $> as (a, list(a)) -> | [@$xs, $x] -> {(x, xs)} | _ -> {} | <join $ $> as (list(a), list(a)) -> | $tgt -> matchAll tgt as list(a) | loop($i, [1, $n], <cons $xa_i ...>, $rs) -> (foldr((%i %r -> [xa_i, @r]), [], 1..n), rs) | <nioj $ $> as (list(a), list(a)) -> | $tgt -> matchAll tgt as list(a) | loop($i, [1, $n], <snoc $xa_i ...>, $rs) -> (foldr((%i %r -> [@r, xa_i]), [], 1..n), rs) | $val as () -> | $tgt -> if val == tgt then {()} else {} | $ as (something) -> | $tgt -> {tgt} After
(define $twin-primes (match-all primes (list integer) [<join _ <cons $p
<cons ,(+ p 2) _>>> [p (+ p 2)]])) (take 10 twin-primes) twinPrimes = matchAll primes as list(integer) | _ <++> p <:> (p + 2) <:> _ -> [p, p + 2] take(10, twinPrimes) Before After
w IUUQTHJUIVCDPNFHJTPOFHJTPOCMPCNBTUFS ITTSD-BOHVBHF&HJTPO1BSTFS/PO4IT w ݩͷύʔαʔʹͳΒͬͯ1BSTFDͰॻ͍ͯ·͢ w ࠓͷͱ͜ΖFHJTPO/Ͱ͑·͢ w SFQMͩͱվߦͰ͙͢ࢮ͵ͷͰ͓ࢼ͠ͳΒϑΝΠϧͰ ࣮ߦ͍ͯͩ͘͠͞ʜ
w OPOTUFTUͷԼʹTBNQMF͕͍Ζ͍Ζ͋Γ·͢ ࣮ͷৄࡉ