Open in app
Home
Notifications
Lists
Stories

Write
Soheil HassasYeganeh
Soheil HassasYeganeh

Home

Aug 4, 2015

A script for an easy installation of go packages in hands-on tutorials

https://github.com/soheilhy/goget After presenting https://github.com/kandoo/beehive in a few hands-on tutorials, I am convinced that the main obstacle for new comers to Go (e.g., undergrad students who are proficient in Python) is actually installing the lastes version of Go and setting up the GOPATH. …

Golang

1 min read

A script for an easy installation of go packages in hands-on tutorials
A script for an easy installation of go packages in hands-on tutorials

Jul 30, 2015

Multiplexing Connections in Go

Serve different services on the same port using github.com/soheilhy/cmux! When your app exposes a REST endpoint, you are always lured to serve every other service via HTTP. If you build a distributed system, the first option for internal RPCs would be HTTP. If you build a client for your service…

Golang

2 min read


Jul 18, 2015

Python kwargs and Beyond in Golang

While working on Beehive’s API, I observed a pattern similar to @davecheney’s functional options: We have lots of configuration options that their values can be (a) set by the user, (b) overridden through command-line flags, or (c) set using a default constant value. In an effort to generalize that, I developed a library called args (https://github.com/soheilhy/args). Here is an example: The end-result is very similar to Python’s kwargs: Instead of writing Server(listen_on=80), we write Server(ListenOn(80)). Although you cannot pass an arbitrary parameter name as in Python, args is safer and, in my very biased opinion, looks a little bit more elegant.

Golang

1 min read


Jul 8, 2015

fn: Scala View in C++11

Simpler functional programming in C++11 — STL comes with an extensive set of tools for functional programming, ranging from std::remove_if() to std::transform() to std::accumulate(). For example, you can solve Euler Project’s Problem 1 in C++11, functional-style: #include <algorithm> #include <vector> #include <numeric> std::vector<int> v; // You can replace this with std::generate, but let's forget // about that in this example for…

Programming

2 min read


Jun 8, 2014

Fix your braces

Sleep tight, if you hack in programming languages that protect you from embarrassing optical illusions. In Python, indentation is the flow (and so is in Occam): if condition: fail fail Go, on the other hand, enforces blocks: if condition { fail fail } And so does Ruby, Pascal, Basic, and MATLAB. Haskell elegantly supports both: “If you leave off the braces and semicolons, then indentation becomes significant.”

1 min read

Soheil HassasYeganeh

Soheil HassasYeganeh

Following
  • Yonatan Zunger

    Yonatan Zunger

  • Ev Williams

    Ev Williams

  • Alon Halevy

    Alon Halevy

  • Medium

    Medium

  • Kris Gage

    Kris Gage

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Knowable