Posts

The Secret Life of Go: Maps

Image
  The Secret Life of Go: Maps # go # coding # programming # softwaredevelopment Chapter 5: Keys, Values, and the Art of Looking Things Up Friday morning arrived with clear skies. Ethan descended to the archive carrying the usual coffee tray and a small paper bag. Eleanor looked up from her desk. "What did you bring today?" "Black and white cookies. I figured we've covered enough territory this week to deserve them." She smiled and took one. "The optimist's cookie—never commit to just one flavor. Appropriate for today's topic." "Which is?" "Maps. Or as other languages call them: dictionaries, hash tables, associative arrays. The data structure for when you need to look things up." Eleanor opened her laptop and typed: package main import "fmt" func main () { var ages map [ string ] int fmt . Println ( ages ) } She ran it: map[] "This declares a map.  map[string]int  means: a map where the k...

The Secret Life of Go: Arrays and Slices

Image
  The Secret Life of Go: Arrays and Slices # go # coding # programming # softwaredevelopment Chapter 4: Collections and the Art of Growing Lists Thursday morning brought rain. Ethan arrived at the archive shaking water from his jacket, balancing a coffee tray and a small pastry box. Eleanor glanced up from her laptop. "Wet out there?" "November in New York." He set down the coffees and opened the box. "Rugelach today. Chocolate and cinnamon." "You're learning the neighborhood." She took one and bit into it. "What made you choose rugelach?" "The baker said they're good for thinking. Something about the layers." Eleanor smiled. "Layers. Perfect. Today we're talking about collections—how to store multiple pieces of data. And yes, there are layers to this story." She opened a new file. "Tell me, Ethan. If I asked you to store five numbers, how would you do it?" "Five variables?" "You ...