This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-08
Channels
- # admin-announcements (3)
- # arachne (1)
- # aws (2)
- # beginners (10)
- # boot (287)
- # cider (5)
- # clara (2)
- # cljs-dev (150)
- # cljsjs (2)
- # clojure (99)
- # clojure-austin (1)
- # clojure-brasil (1)
- # clojure-dev (13)
- # clojure-greece (55)
- # clojure-japan (1)
- # clojure-nl (2)
- # clojure-russia (24)
- # clojure-spec (184)
- # clojure-taiwan (1)
- # clojure-uk (45)
- # clojurescript (55)
- # clojurex (1)
- # cursive (20)
- # datascript (16)
- # datomic (1)
- # devcards (4)
- # events (10)
- # figwheel (1)
- # funcool (7)
- # hoplon (48)
- # immutant (1)
- # jobs (6)
- # lambdaisland (2)
- # lein-figwheel (19)
- # mount (36)
- # off-topic (37)
- # om (16)
- # om-next (17)
- # onyx (29)
- # planck (53)
- # proton (1)
- # pure-frame (1)
- # re-frame (40)
- # reagent (44)
- # remote-jobs (1)
- # ring (2)
- # robots (2)
- # rum (5)
- # slack-help (4)
- # spacemacs (27)
- # specter (82)
- # test-check (18)
- # test200 (1)
- # untangled (17)
Anyone here used http://hackerrank.com before?
I'm looking at their 30 day coding challenge stuff and wanted to submit all my solutions using Clojure
I'm looking at the first challenge which is a "Hello World" example
There is supposed to be a value passed in from the system (outside of my code) that I need to print out, but I can't figure out how to actually get that value that's supposedly being passed in
Says
; Enter your code here. Read input from STDIN. Print output to STDOUT
;
How would I do that? Sorry, new to this
this is the function that I’m mentioning https://github.com/clojure/clojure/blob/010864f8ed828f8d261807b7345f1a539c5b20df/src/clj/clojure/core.clj#L3668
Thanks
let me give that a try
Perfect
Thanks Seb :thumbsup:
(let [inputString (read-line)]
(println "Hello, World.")
(print inputString))
for this case in which you don’t need to hold the var (state), you could do something like
Seems obvious when you point it out 😉
I’ve to go out for a couple of hours, but feel free to ping me or DM if you hit any blockers, would be happy to help , I’ll try to answer later, when I’m back
Not sure if this was the best solution, but it worked for one of the FP challenges. Really enjoying the experience.
(fn[num lst]
(dotimes [i (count lst)]
(dotimes [j num]
(println (nth lst i)))))
Where num
was an iteration count and lst
was... a list of integers to print num
times
@yogidevbear: you could also generate the needed list and then print it all out