aboutsummaryrefslogtreecommitdiff
path: root/challenge-026
diff options
context:
space:
mode:
authorchirvasitua <stuart-little@users.noreply.github.com>2021-01-11 20:25:09 -0500
committerchirvasitua <stuart-little@users.noreply.github.com>2021-01-11 20:25:09 -0500
commitd4bc6bb3f500d037ad5189ecd88b077976b14f32 (patch)
tree7198d73bd9755a9482a769b5b49037adf83d4a34 /challenge-026
parent017145744161d53f08c461310b43f242f36ff69b (diff)
downloadperlweeklychallenge-club-d4bc6bb3f500d037ad5189ecd88b077976b14f32.tar.gz
perlweeklychallenge-club-d4bc6bb3f500d037ad5189ecd88b077976b14f32.tar.bz2
perlweeklychallenge-club-d4bc6bb3f500d037ad5189ecd88b077976b14f32.zip
1st commit on 026_haskell
Diffstat (limited to 'challenge-026')
-rwxr-xr-xchallenge-026/stuart-little/haskell/ch-1.hs9
-rwxr-xr-xchallenge-026/stuart-little/haskell/ch-2.hs11
2 files changed, 20 insertions, 0 deletions
diff --git a/challenge-026/stuart-little/haskell/ch-1.hs b/challenge-026/stuart-little/haskell/ch-1.hs
new file mode 100755
index 0000000000..8c603cdb21
--- /dev/null
+++ b/challenge-026/stuart-little/haskell/ch-1.hs
@@ -0,0 +1,9 @@
+#!/usr/bin/env runghc
+
+-- run <script> <stones_string> <jewels_string>
+
+import System.Environment (getArgs,)
+
+main = do
+ (stones:jewels:_) <- getArgs
+ print $ length $ filter (flip elem stones) jewels
diff --git a/challenge-026/stuart-little/haskell/ch-2.hs b/challenge-026/stuart-little/haskell/ch-2.hs
new file mode 100755
index 0000000000..1f14fe583c
--- /dev/null
+++ b/challenge-026/stuart-little/haskell/ch-2.hs
@@ -0,0 +1,11 @@
+#!/usr/bin/env runghc
+
+-- run <script> <space-separated angles in degrees>
+
+import System.Environment (getArgs,)
+import Data.Angle
+import Data.Tuple.Extra ((&&&),)
+
+main = do
+ args <- getArgs
+ print $ degrees $ Radians (uncurry atan2 $ ((sum.(map sine)) &&& (sum.(map cosine))) $ map (\x -> Degrees (read x::Float)) args)