Skip to content

Commit 594e85a

Browse files
committed
fix code
1 parent 1ff3ee2 commit 594e85a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

hs-src/Language/Egison/Types.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ data SymbolExpr =
433433
Symbol Id String [Index ScalarData]
434434
| Apply EgisonValue [ScalarData]
435435
| Quote ScalarData
436-
| FunctionData (Maybe EgisonValue) [EgisonValue] [EgisonValue] [Index ScalarData] -- fnname argnames arg indices
436+
| FunctionData (Maybe EgisonValue) [EgisonValue] [EgisonValue] [Index ScalarData] -- fnname argnames args indices
437437
deriving (Eq)
438438

439439
instance Eq PolyExpr where

sample/rosetta/best_shuffle.egi

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
(define $texts {"abba" "abracadabra" "seesaw" "elk" "grrrrrr" "up" "a" "aaaaa.....bbbbb" "Rosetta Code is a programming chrestomathy site."})
22

3-
(define $shufflingQuality
3+
(define $shufflingQuality
44
(lambda [$l1 $l2]
55
(sum (map2 (lambda [$x $y] (if (eq? x y) 1 0)) l1 l2))))
66

7-
(define $shuffle
8-
(lambda [$lst]
7+
(define $shuffle
8+
(lambda [$lst]
99
(match [lst (randomize lst)] [(list eq) (multiset eq)]
1010
{[[(loop $i [1 $n]
11-
<cons $x_i ...> <nil>)
11+
<cons $x_i ...> <nil>)
1212
(loop $i [1 n]
13-
(dfs <cons (& (|* !,x_i ,x_i) $y_i) ...>) <nil>)] (map 1#y_%1 (between 1 n))]})))
13+
(dfs <cons (& (|* !,x_i ,x_i) $y_i) ...>) <nil>)] (map 1#y_%1 (between 1 n))]})))
1414

1515
(define $main
1616
(lambda [$args]
1717
(each (compose show print)
18-
(map (lambda [$text]
19-
(let {[$new (shuffle text)]}
20-
(S.concat {(pack text) " " (pack new) " " (show (shufflingQuality text new))})))
21-
(map unpack texts)))))
18+
(map (lambda [$text]
19+
(let {[$new (shuffle text)]}
20+
(S.concat {(pack text) " " (pack new) " " (show (shufflingQuality text new))})))
21+
(map unpack texts)))))
2222

0 commit comments

Comments
 (0)