Welcome to the egison wiki!
$ git clone https://github.com/egisatoshi/egison.git
#!/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/ |
-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), |
(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 |
(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"] |
FROM phusion/baseimage:latest | |
MAINTAINER Satoshi Egi | |
RUN apt-get update | |
RUN apt-get -y install libncurses-dev | |
RUN apt-get -y install haskell-platform | |
RUN cabal update | |
RUN cabal install egison | |
ENV PATH /root/.cabal/bin:$PATH |
(module $Main | |
{ | |
[String {string}] ; import only string | |
[$S [String {append concat}]] ; import only append and concat (with 'S.' as prefix) | |
[$S String] ; import all exported functions (with 'S.' as prefix) | |
} | |
{main} ; export main | |
) | |
(define $main |
require 'egison' | |
require 'prime' | |
include Egison | |
twin_primes = match_stream(Prime) { | |
with(List.(*_, _x, __("x + 2"), *_)) { | |
[x, x + 2] | |
} | |
} |
> (match-all (between 1 100) (set integer) [<cons (& ?(lte? 32 $) ?(lt? $ 64) $x) _> x]) | |
{32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63} | |
> (car (match-all (between 1 100) (set integer) [<cons (& ?(lte? 32 $) ?(lt? $ 64) $x) _> x])) | |
32 |