Live data from Hacker News

Ask HN: How to rediscover the joy of programming?

news.ycombinator.com

21–30 of 337 posts

Re: Ask HN: How to rediscover the joy of programming?

#22

Earlier quoted context omitted.

0.1 + 0.2 → 0.30000000000000004

That's not unique to JS. $ irb irb(main):001:0> 0.1 + 0.2 => 0.30000000000000004 irb(main):002:0> $ iex Erlang/OTP 22 [erts-10.6.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe] Interactive Elixir (1.10.2) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> 0.1 + 0.2 0.30000000000000004 iex(2)> $ python Python 2.7.17 (default, Dec 2 2019, 13:23:33) [GCC 4.2.1 Compatible Apple LLVM 11.0.0 (…

Interestingly, though, some languages get it right:

    northrup@Topaz:~/Desktop$ perl -de1
    
    Loading DB routines from perl5db.pl version 1.55
    Editor support available.
    
    Enter h or 'h h' for help, or 'man perldebug' for more help.
    
    main::(-e:1): 1
      DB say 0.1 + 0.2
    0.3
[…]

    northrup@Topaz:~$ csi
    CHICKEN
    (c) 2008-2019, The CHICKEN Team
    (c) 2000-2007, Felix L. Winkelmann
    Version 5.1.0 (rev 8e62f718)
    linux-unix-gnu-x86-64 [ 64bit dload ptables ]
    
    #;1> (+ 0.1 0.2)
    0.3
[…]

    northrup@Topaz:~$ sbcl
    This is SBCL 1.5.8, an implementation of ANSI Common Lisp.
    More information about SBCL is available at .
    
    SBCL is free software, provided as is, with absolutely no warranty.
    It is mostly in the public domain; some portions are provided under
    BSD-style licenses.  See the CREDITS and COPYING files in the
    distribution for more information.
    * (+ 0.1 0.2)
    0.3

Re: Ask HN: How to rediscover the joy of programming?

#23
post #2

Programming is 1,000 room hotel of which we live in only one. I recommend you study different programming paradigms because in them we can find really interesting approaches to solve problems. For me those have been: - functional programming (with Haskell) - logic programming (prolog) - Constraint Programming with the excellent Coursera class on minizinc. Those paradigms made programming fun again for me . PS: I also…

Besides trying out new languages and paradigms, I would also suggest programming things of a kind different from what OP's used to. For example, if they mainly do CRUD webapps at work, maybe they can start looking into creating games, a language, (programmed) music, screensavers, etc. Whatever they think is cool. It doesn't need to be big.

Re: Ask HN: How to rediscover the joy of programming?

#24
I have. When I started using Rust for some real project.

I picked up a C++ codebase for a DCC app plug-in from around 2011 and started porting it to C++17.

At that time I had already started learning Rust. Three months into the project the DCC host app changed API which meant major refactoring on top of porting.

I decided: screw it – let’s rewrite it in Rust (RIIR). It has been a most amazing experience.

I haven’t felt like this since I was 14 and started learning C and later (Turbo) C++, when I was 16.

The language and community are amazing. Lots of new material that is outside of my comfort zone. Steep learning curve but with the reward of this warm feeling of learning something new almost daily.

Highly suggested.

“Writing Rust code feels very wholesome”.

–John Carmack

I couldn’t have said it better.

Re: Ask HN: How to rediscover the joy of programming?

#26
post #7

Earlier quoted context omitted.

What was it about JavaScript that wanted you to leave programming? I'm just curious.

0.1 + 0.2 → 0.30000000000000004

That’s because you are running it on hardware implementing IEEE 754 floating point.

Re: Ask HN: How to rediscover the joy of programming?

#27

Earlier quoted context omitted.

That's not unique to JS. $ irb irb(main):001:0> 0.1 + 0.2 => 0.30000000000000004 irb(main):002:0> $ iex Erlang/OTP 22 [erts-10.6.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe] Interactive Elixir (1.10.2) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> 0.1 + 0.2 0.30000000000000004 iex(2)> $ python Python 2.7.17 (default, Dec 2 2019, 13:23:33) [GCC 4.2.1 Compatible Apple LLVM 11.0.0 (…

Interestingly, though, some languages get it right: northrup@Topaz:~/Desktop$ perl -de1 Loading DB routines from perl5db.pl version 1.55 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(-e:1): 1 DB say 0.1 + 0.2 0.3 […] northrup@Topaz:~$ csi CHICKEN (c) 2008-2019, The CHICKEN Team (c) 2000-2007, Felix L. Winkelmann Version 5.1.0 (rev 8e62f718) linux-unix-gnu-x86-64 [ 64bit…

Unless they're using an alternate exact representation for floats by default, that's just rounding them when printing.

Re: Ask HN: How to rediscover the joy of programming?

#28
Learn LISP/Scheme and lots of fundamental concepts you probably have a feel for, but in a far more profound way:

1. First watch the SICP series (https://www.youtube.com/watch?v=-J_xL4IGhJA&list=PLE18841CAB...)

2. Then work through the book (https://mitpress.mit.edu/sites/default/files/sicp/full-text/...)

If you really do the exercises (an hour here and an hour there), you can feel you brain getting wrapped around many core notions in very illuminating ways.

Re: Ask HN: How to rediscover the joy of programming?

#30

Earlier quoted context omitted.

That's not unique to JS. $ irb irb(main):001:0> 0.1 + 0.2 => 0.30000000000000004 irb(main):002:0> $ iex Erlang/OTP 22 [erts-10.6.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe] Interactive Elixir (1.10.2) - press Ctrl+C to exit (type h() ENTER for help) iex(1)> 0.1 + 0.2 0.30000000000000004 iex(2)> $ python Python 2.7.17 (default, Dec 2 2019, 13:23:33) [GCC 4.2.1 Compatible Apple LLVM 11.0.0 (…

Interestingly, though, some languages get it right: northrup@Topaz:~/Desktop$ perl -de1 Loading DB routines from perl5db.pl version 1.55 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(-e:1): 1 DB say 0.1 + 0.2 0.3 […] northrup@Topaz:~$ csi CHICKEN (c) 2008-2019, The CHICKEN Team (c) 2000-2007, Felix L. Winkelmann Version 5.1.0 (rev 8e62f718) linux-unix-gnu-x86-64 [ 64bit…

I don't think it's so much a matter of getting it right as much as it is about preferring the performance gain and ease of use of hardware-accelerated constant-space floating-point numbers. At least, that was probably the case when programming in something like C/C++. I don't imagine there's much point to it in ruby or python for example, other than that floating-point is standard by now.
Post reply on HN