We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Functional Programming
  3. Introduction
  4. Hello World N Times
  5. Discussions

Hello World N Times

Problem
Submissions
Leaderboard
Discussions

Sort 120 Discussions, By:

votes

Please Login in order to post a comment

  • rorick 3 years ago+ 0 comments

    Bad problem description for Clojure.

    Description states to copy template and fill blank: (fn[n]___________________________)

    But prepared caller part of solution is (hello_word_n_times n) and is not editable. It will not compile if one copies template and fills blanks. Temlate must be (defn hello_word_n_times [n]___________________________) or (def hello_word_n_times (fn[n]___________________________)).

    BTW, there's also a misspelling in calling part that cannot be edited: word instead of wor**l**d.

    I'm starting to suspect, that guys from Hackerrank do not really like Clojurists) Another surprise waiting Hackerrank student on his way of learning FP in Clojure is when his tested and submitted solution will fail with compile error. That's most likely because of version mismatch. Described environment is Clojure 1.9 and that is what anyone expects, but in reality it is ancient Clojure 1.6.

    17|
    Permalink
  • uvaprakashp 3 years ago+ 0 comments

    Scala version def f(n: Int) = println("Hello World\n" * n)

    10|
    Permalink
  • alsuga 4 years ago+ 0 comments

    Lang: Haskell
    I'm learning haskell, if someone have a suggestion or a correction please let me know

    hello_worlds 1 = putStrLn "Hello World"
    hello_worlds n = do
            putStrLn "Hello World" 
            hello_worlds (n - 1)
    
    main = do
       n <- readLn :: IO Int
       hello_worlds n
    
    10|
    Permalink
  • christopher_lil1 4 years ago+ 0 comments

    My version in Haskell:

    hello_worlds n = mapM_ putStrLn $ replicate n "Hello World"

    6|
    Permalink
  • xiang19950505 4 years ago+ 0 comments

    My version in Haskell:

    import Control.Monad (replicateM_)
    
    hello_worlds :: Int -> IO ()
    hello_worlds n = replicateM_ n $ putStrLn "Hello World"
    
    5|
    Permalink
Load more conversations

Need Help?


View top submissions
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature