Live data from Hacker News

Ask HN: What is the coding exercise you use to explore a new language?

news.ycombinator.com

31–40 of 73 posts

Re: Ask HN: What is the coding exercise you use to explore a new language?

#31
I usually pick one of the ideas on my low-stakes "side quest" list that I maintain. Something that I won't mind if it never gets finished, or if I have to trash it and start over because of what I learned while building it the first time, now that I know the language better. I'm currently working on a RISC-V cycle-level simulator in Rust.

While I'm picking up Rust, I really like the "rustlings" project that lets you exercise various parts of the language locally, instead of in a browser, so I can use the tools that I like. https://github.com/rust-lang/rustlings

Re: Ask HN: What is the coding exercise you use to explore a new language?

#32
I write up a "teaching-style" series on it.

To wit: https://littlegreenviper.com/series/swiftwater/

That series is almost abandoned, now, but it was instrumental, in my discovering how to write Swift.

This was one I wrote up, as I was exploring the SPM: https://littlegreenviper.com/series/spm/

Learning Bluetooth: https://littlegreenviper.com/series/bluetooth/

Writing a simple streaming server: https://littlegreenviper.com/series/streaming/

This was one that I wrote up, as I was learning CSS: https://littlegreenviper.com/series/stylist/

Re: Ask HN: What is the coding exercise you use to explore a new language?

#33
post #28

I commonly build a name generator based on travesties or Markov chains. I can write a simple version of it in a few minutes in a familiar language, but it exercises file IO, some simple data structures, string operations, and some randomization. Gives me a good first general idea of what it will be like to work with a new language.

That's very helpful, close to what I was envisioning. Thank you.

Sure.

It can also be fun, if your sense of humor responds to funny names, and if you choose the right inputs.

Re: Ask HN: What is the coding exercise you use to explore a new language?

#35
post #25

I port L0pht’s hphack.c to every language I’m learning. It covers sockets, string handling, and byte handling.

Great idea. Looks like a really interesting exercise. I may try it. Also wasn't aware of L0pht till now so good to know that history. Thank you.

Re: Ask HN: What is the coding exercise you use to explore a new language?

#36
Depends on what are you usually doing.

I write an L3 order book implementation, because I usually do quant trading.

Others might want to start with a simple REST webservice, a todo list, a CRUD application, solutions for Project Euler exercises, etc.

Re: Ask HN: What is the coding exercise you use to explore a new language?

#37
post #12

I write a bittorrent node. It goes over many topics I'm interested in: potrntially low-level networking, storage, bits and bytes fiddling, concurrency. The protocol is shockingly simple, and the end result is both easily testable and actually useful.

This seems interesting. Any resources you can recommend for understanding the protocol? And any examples of simple clients in various languages?

Re: Ask HN: What is the coding exercise you use to explore a new language?

#40
I generate an n-dimensional just intonation pitch lattice, based on my study of the work of Ben Johnston.

I like it because it’s kind of small, but tests several aspects of working in the language.

* the program needs support for several numeric types: integers, floats and rationals. * several basic math algorithms are needed, which will either test the std lib, how to use the package manager, or other language constructs as I pipeline implement them * how easy is it to write/run tests

Here’s one version in Rust, which links to clojure, cl versions. Want to try it with Julia next due to the built-in support for rationals.

https://github.com/jcpst/johnston

https://en.m.wikipedia.org/wiki/Lattice_(music)

Post reply on HN