% egison -T -e '(maclaurin-expansion (cos x) x)'
1
0
(/ (* -1 x^2) 2)
0
(/ x^4 24)
0
(/ (* -1 x^6) 720)
0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define $worriors | |
{["nagisa_misumi" "futari_ha" "black"] | |
["honoka_yukishiro" "futari_ha" "white"] | |
["hikari_kujo" "max_heart" "luminus"] | |
["saki_hyuga" "splash_star" "bloom"] | |
["mai_misho" "splash_star" "eaglette"] | |
["nozomi_yumehara" "yes" "dream"] | |
["rin_natsuki" "yes" "rouge"] | |
["urara_kasugano" "yes" "lemonade"] | |
["komachi_akimoto" "yes" "mint"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define $points | |
{[3 1] [4 5] [7 7] [8 1] [1 9] [3 8] [3 1]}) | |
(define $on-a-line? | |
(match-lambda [[integer integer] [integer integer] [integer integer]] | |
{[[[$x1 $y1] [$x2 $y2] [$x3 $y3]] | |
(eq? (abs (* (- y2 y1) (- x3 x1))) | |
(abs (* (- y3 y1) (- x2 x1))))]})) | |
; Enumerate triangles |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(echo_server). | |
-export([start/0,stop/1]). | |
-define(PORT, 12321). | |
start() -> | |
Options = [binary, {packet, raw}, {active, true}, {reuseaddr, true}], | |
case gen_tcp:listen(?PORT, Options) of | |
{ok, Listen} -> spawn(fun() -> acceptor_loop(Listen) end), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo rm -rf .cabal .ghc /Library/Egison | |
mkdir .ghc | |
cabal update | |
cp my-cabal/config .cabal/config | |
sudo cabal update | |
sudo cabal install egison egison-tutorial | |
sleep 3 | |
sudo rm -rf /Library/Egison/lib/ /Library/Egison/logs/ /Library/Egison/repo-cache/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat number | egison -F1s -s '(match-all-lambda (list string) [<cons <join _ <cons $x <cons $y <join $s <cons ,x <cons ,y $t>>>>>> _> [x y (take-while eq? (zip (unpack s) (unpack t)))]])' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Egison mode | |
(load-file "~/egison/elisp/egison-mode.el") | |
(autoload 'egison-mode "egison-mode" "Major mode for editing Egison code." t) | |
(setq auto-mode-alist | |
(cons `("\\.egi$" . egison-mode) auto-mode-alist)) | |
(load-file "~/elisp/xah-math-input/xah-math-input.el") | |
(global-set-key "\C-q" 'xah-math-input-change-to-symbol) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define $∇ | |
(lambda [$f $xs] | |
(generate-tensor | |
1#(∂/∂ f (nth %1 xs)) | |
{(length xs)}))) | |
(define $nabla ∇) | |
(define $taylor-expansion2 | |
(lambda [$f $xs $as] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; | |
;; Tensor | |
;; | |
[| x |] | |
;=> | |
x | |
(+ 1 [|1 2 3|]) | |
;=> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(filter (match-lambda (list something) | |
{[(& <snoc ,D _> | |
<join _ <cons ,B <join _ <cons ,C _>>>> | |
<snoc _ <snoc _ <nioj _ <snoc ,B _>>>> | |
<join _ <cons ,C <join _ <cons ,A _>>>>) | |
#t] | |
[_ #f]}) | |
(match-all {A B C D} (multiset something) | |
[<cons $a <cons $b <cons $c <cons $d <nil>>>>> {a b c d}])) |