Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As someone who is currently "In Love With Python", I'm curious what other languages you recommend? I'm always looking to learn new stuff.


Depends on what you want to do.

Go is a fairly strong candidate for a straight up replacement for Python, but there will be a lot of newer things to learn with regards to using a compiled language without a repl, and the lack of traditional polymorphism.

Another good one is any kind of functional language, be it Haskell, Clojure, or OCaml. Learning how to think functionally will help your Python code quite a bit.

At some point in the future, Rust would be a good one to put on your list, but I don't believe that it is in a great place right now. It's getting better, but I don't feel that it's ready yet for production development. I think Mozilla can get away with it because they own the minds who are developing the language, and as such can hit the moving target which Rust currently is.


I'm not quite sure what I want to do, other than I don't want to do front-end development.

The other language I have any experience in is Delphi, which is a compiled language.

I have heard a lot of good things about Go, maybe I'll give that a shot.

I'd love to learn a functional language. I've looked at Haskell, and ouch. As someone with no formalized CS training, a lot of the type theory stuff goes right over my head. Is there a less crazy functional language you would recommend?

Yeah, I've looked a little at Rust, and it looks like it'll be interesting in a couple years.


> Is there a less crazy functional language you would recommend?

Clojure. It's a well supported and documented dialect of Lisp, which is a fundamentally functional language (though not purely functional), implemented on a platform that just about everyone has access to: the JVM.

The more you can minimize your use of the dot operator (which implicitly means minimizing your dependence on Java libraries), the more you'll learn about functional programming.


Alright, thanks. I'll give Clojure a shot at some point. I've played around with lisp a tiny bit in the context of reading SCIP, but that's about it.


You might want to look at Haskell again and not read too much into the type theory stuff at first, but learn how to use common monads, functors, etc.

Here's some code that might be convincing and understandable (correct me if I'm wrong!):

From a not quite yet ready to release everywhere web scraping library of mine in Haskell:

    main = runScraper $ do
        get "https://www.paypal.com/login"
    
        postToForm (Name "login_form") (Just creds) AllVisible
    
        get "https://www.paypal.com/myaccount/home"
    
        cursor <- liftM (fromMaybe (error "Couldn't get cursor")) getCurrentCursor
        liftIO . putStrLn $ "Your Paypal balance is: " <> getPaypalBalance cursor
    
      where creds =  [ ("login_email", "[email protected]") -- put your credentials here
                     , ("login_password", "password")]
An example of using lenses and imperative programming to create pong[0]:

    -- Update the paddles
    updatePaddles :: Float -> State Pong ()
    updatePaddles time = do
      p <- get
    
      let paddleMovement = time * paddleSpeed
          keyPressed key = p^.keys.contains (SpecialKey key)
    
      -- Update the player's paddle based on keys
      when (keyPressed KeyUp)   $ paddle1 += paddleMovement
      when (keyPressed KeyDown) $ paddle1 -= paddleMovement
    
      -- Calculate the optimal position
      let optimal = hitPos (p^.ballPos) (p^.ballSpeed)
          acc     = accuracy p
          target  = optimal * acc + (p^.ballPos._y) * (1 - acc)
          dist    = target - p^.paddle2
    
      -- Move the CPU's paddle towards this optimal position as needed
      when (abs dist > paddleHeight/3) $
        case compare dist 0 of
          GT -> paddle2 += paddleMovement
          LT -> paddle2 -= paddleMovement
          _  -> return ()
    
      -- Make sure both paddles don't leave the playing area
      paddle1 %= clamp (paddleHeight/2)
      paddle2 %= clamp (paddleHeight/2)
From "Program imperatively using Haskell lenses"[1]:

    battle :: StateT Game IO ()
    battle = do
        -- Charge!
        forM_ ["Take that!", "and that!", "and that!"] $ \taunt -> do
            lift $ putStrLn taunt
            strike
    
        -- The dragon awakes!
        fireBreath (Point 0.5 1.5)
        
        replicateM_ 3 $ do
            -- The better part of valor
            retreat
    
            -- Boss chases them
            zoom (boss.position) $ do
                x += 10
                y += 10




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: