diff options
| -rw-r--r-- | challenge-329/hvukman/f#/329_p1.fs | 9 | ||||
| -rw-r--r-- | challenge-329/hvukman/f#/329_p2.fs | 7 | ||||
| -rw-r--r-- | challenge-329/hvukman/lua/329_p1.lua | 17 | ||||
| -rw-r--r-- | challenge-329/hvukman/lua/329_p2.lua | 15 | ||||
| -rw-r--r-- | challenge-329/hvukman/picolisp/329_p1.l | 48 | ||||
| -rw-r--r-- | challenge-329/hvukman/picolisp/329_p2.l | 22 |
6 files changed, 118 insertions, 0 deletions
diff --git a/challenge-329/hvukman/f#/329_p1.fs b/challenge-329/hvukman/f#/329_p1.fs new file mode 100644 index 0000000000..e41216743b --- /dev/null +++ b/challenge-329/hvukman/f#/329_p1.fs @@ -0,0 +1,9 @@ +// Part 1 + +//with regex match and filter distinct + +let splitRuns s = Regex("\d+").Matches(s) |> Seq.cast<Match> |> Seq.map (fun m -> m.Value) |> Seq.toList |> Seq.distinct +printfn "%A" (splitRuns "go21od1lu5c7k") +printfn "%A" (splitRuns "the1weekly2challenge2") +printfn "%A" (splitRuns "4p3e2r1l") +printf "\n" diff --git a/challenge-329/hvukman/f#/329_p2.fs b/challenge-329/hvukman/f#/329_p2.fs new file mode 100644 index 0000000000..4eee0aff64 --- /dev/null +++ b/challenge-329/hvukman/f#/329_p2.fs @@ -0,0 +1,7 @@ +// Part 2 +let exists (x,y:String) = y.IndexOf(Char.ToUpper x:char) <> -1 && y.IndexOf(Char.ToLower x:char) <> -1 +String.iter (fun x -> if exists (x,"YaaAho") then printf "%c" x ) "YaaAho" +printf "\n" +String.iter (fun x -> if exists (x,"cC") then printf "%c" x ) "cC" +printf "\n" +String.iter (fun x -> if exists (x,"a") then printf "%c" x ) "a" diff --git a/challenge-329/hvukman/lua/329_p1.lua b/challenge-329/hvukman/lua/329_p1.lua new file mode 100644 index 0000000000..726c0d15b7 --- /dev/null +++ b/challenge-329/hvukman/lua/329_p1.lua @@ -0,0 +1,17 @@ + +function counting (X) +print("string: ", X) +local ints = {} +-- store values as keys which are unique +for word in string.gmatch(X, "%d+") do + ints[word]= true +end +-- print keys + for i,v in pairs(ints) do + print (i) + end + end + +counting("the1weekly2challenge2") +counting("go21od1lu5c7k") +counting("4p3e2r1l") diff --git a/challenge-329/hvukman/lua/329_p2.lua b/challenge-329/hvukman/lua/329_p2.lua new file mode 100644 index 0000000000..5cef522c4c --- /dev/null +++ b/challenge-329/hvukman/lua/329_p2.lua @@ -0,0 +1,15 @@ +function Nice (a) + print("string: ", a) + for i = 1, string.len(a) do + -- match upper and lower substring + if string.find(a,string.upper(string.sub(a, i, i))) ~= nil and + string.find(a,string.lower(string.sub(a, i, i))) ~= nil then + io.write(string.sub(a, i, i)) + end + end + print("") +end + +Nice("YaaAho") +Nice("cC") +Nice("A")
\ No newline at end of file diff --git a/challenge-329/hvukman/picolisp/329_p1.l b/challenge-329/hvukman/picolisp/329_p1.l new file mode 100644 index 0000000000..993bef44e6 --- /dev/null +++ b/challenge-329/hvukman/picolisp/329_p1.l @@ -0,0 +1,48 @@ + (setq inp "the1weekly2challenge2") + + (de fun (X) + (make + (for N (chop X) + + (if (format N) + (link N) + (link "") + ) + ) + ) + + ) + + # (load "perlpico/329_p1.l") + +(de do_it (X) + (make + (for N (size X) + (if (format (get X N)) + (let dummy + (link (make + (while (and (<= N (size X)) (format (get X N))) + (let new (get X N) + (prinl new) + (link new ) + (setq N (inc N)) + ) + ) + + #(setq N (inc N)) + #(prinl "dummy " dummy) + #(link dummy) + ) + ) + ) + ) + #(prinl (made)) + ) + ) +) + +(setq inp (fun inp)) +(do_it inp) + +(setq inp2 "go21od1lu5c7k") +(do_it (fun inp2)) diff --git a/challenge-329/hvukman/picolisp/329_p2.l b/challenge-329/hvukman/picolisp/329_p2.l new file mode 100644 index 0000000000..fc20c2a140 --- /dev/null +++ b/challenge-329/hvukman/picolisp/329_p2.l @@ -0,0 +1,22 @@ +(setq inp "YaaAho") + + + +(de do_it (X) + (pack (let str_list (chop X) + (make + (for N (chop X) + (if (and (member (uppc N) (chop X)) (member (lowc N) (chop X) ) ) + (link N ) + ) + ) + ) + ) + ) +) + +(prinl (do_it inp)) +(prinl (do_it "cC")) +(prinl (do_it "A")) + +# (load "perlpico/329_p2.l") |
