Sort by

recency

|

171 Discussions

|

  • + 0 comments

    OCaml: let rec printHWn (n : int) : _ = match n with | 0 -> () | _ -> let _ = print_string "Hello World\n" in printHWn (n - 1)

    let () = let n = read_int() in printHWn n

  • + 0 comments

    Nice work! You've captured functional well by using sequences instead of traditional loops. The Seq.iter is a clean and efficient approach. This mindset in software development emphasizes immutability and higher-order functions, which are core strengths of F# over imperative paradigms like TS and C#. Keep exploring!

  • + 0 comments

    Scala

    def f(n: Int): Unit = {
      if (n > 0) {
        println("Hello World")
        f(n - 1)      
      }
    }
    
  • + 1 comment

    I'm learning F# coming from TS and C#

    what about this 2 liner? IHMO the beauty of thinking functional is not thinking about for loops but in term of sequences

    open System
    
    let n = Console.ReadLine() |> int
    seq { 1 .. n } |> Seq.iter (fun _ -> Console.WriteLine("Hello World") )
    
  • + 0 comments

    Carbon steel flanges serve as important connectors in industries by joining pipes, valves, and equipment. These flanges are primarily made from carbon steel, which is a cost-effective material with good strength and durability, making it a common choice for linking pipes in industrial systems.