aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-03-03 23:18:52 +0530
committerAndinus <andinus@nand.sh>2021-03-03 23:18:52 +0530
commit34dcef166e47d268e98973f609da470c59ed5f07 (patch)
treedd15d46051b5c41e731bcb53a331ed807ab69956
parent4c77f3376020ea13754b2f635ce07094cdc4a226 (diff)
downloadoctans-34dcef166e47d268e98973f609da470c59ed5f07.tar.gz
Change subroutine declaration style
From: sub t () {} To: sub t() {}
-rw-r--r--lib/Octans/CLI.rakumod6
-rw-r--r--lib/Octans/Neighbors.rakumod4
-rw-r--r--lib/Octans/Puzzle/Get.rakumod2
-rw-r--r--lib/Octans/RangeSearch.rakumod4
-rw-r--r--lib/Octans/WordSearch.rakumod4
5 files changed, 7 insertions, 13 deletions
diff --git a/lib/Octans/CLI.rakumod b/lib/Octans/CLI.rakumod
index 48477ef..0719dcd 100644
--- a/lib/Octans/CLI.rakumod
+++ b/lib/Octans/CLI.rakumod
@@ -2,9 +2,9 @@ use Octans::Puzzle;
use Octans::WordSearch;
use Octans::Puzzle::Get;
-proto MAIN (|) is export { unless so @*ARGS { say $*USAGE; exit }; {*} }
+proto MAIN(|) is export { unless so @*ARGS { say $*USAGE; exit }; {*} }
-multi sub MAIN (
+multi sub MAIN(
Str $path, #= path to the crossword (file or url)
Str :$dict = (%?RESOURCES<mwords/354984si.ngl> //
"/usr/share/dict/words").Str, #= dictionary file
@@ -68,6 +68,6 @@ multi sub MAIN (
}
-multi sub MAIN (
+multi sub MAIN(
Bool :$version #= print version
) { say "Octans v" ~ $?DISTRIBUTION.meta<version>; }
diff --git a/lib/Octans/Neighbors.rakumod b/lib/Octans/Neighbors.rakumod
index 0c90b0c..cc46a25 100644
--- a/lib/Octans/Neighbors.rakumod
+++ b/lib/Octans/Neighbors.rakumod
@@ -1,9 +1,7 @@
-unit module Octans::Neighbors;
-
# neighbors returns the neighbors of given index. Neighbors are cached
# in @neighbors array. This way we don't have to compute them
# everytime neighbors subroutine is called for the same position.
-sub neighbors (
+sub neighbors(
@puzzle, Int $y, Int $x --> List
) is export {
# @directions is holding a list of directions we can move in. It's
diff --git a/lib/Octans/Puzzle/Get.rakumod b/lib/Octans/Puzzle/Get.rakumod
index 1783796..f4094b2 100644
--- a/lib/Octans/Puzzle/Get.rakumod
+++ b/lib/Octans/Puzzle/Get.rakumod
@@ -2,7 +2,7 @@ use WWW;
use Octans::Puzzle;
# get-puzzle returns Puzzle.new() given input path.
-sub get-puzzle (
+sub get-puzzle(
Str $path
) is export {
my @grids;
diff --git a/lib/Octans/RangeSearch.rakumod b/lib/Octans/RangeSearch.rakumod
index e287d93..c6674a6 100644
--- a/lib/Octans/RangeSearch.rakumod
+++ b/lib/Octans/RangeSearch.rakumod
@@ -1,5 +1,3 @@
-unit module Octans::RangeSearch;
-
# range-starts-with returns a subset of given @dict list that start
# with $str. It should be faster than:
#
@@ -7,7 +5,7 @@ unit module Octans::RangeSearch;
#
# @dict should be a sorted list of words. It performs binary lookup on
# the list.
-sub range-starts-with (
+sub range-starts-with(
@dict, Str $str --> List
) is export {
# $lower, $upper hold the lower and upper index of the range
diff --git a/lib/Octans/WordSearch.rakumod b/lib/Octans/WordSearch.rakumod
index a1ed2c3..23487dc 100644
--- a/lib/Octans/WordSearch.rakumod
+++ b/lib/Octans/WordSearch.rakumod
@@ -1,12 +1,10 @@
-unit module Octans::WordSearch;
-
use Octans::Neighbors;
use Octans::RangeSearch;
# word-search walks the given grid & tries to find words in the
# dictionary. It walks in Depth-First manner (lookup Depth-First
# search).
-sub word-search (
+sub word-search(
# @dict holds the dictionary. @puzzle holds the puzzle.
@dict, @puzzle,