Live data from Hacker News

Underscore.go

tobyhede.github.io

21–30 of 62 posts

Re: Underscore.go

#22
What is the term for unpythonic in the Go community? This seems to be it. By the way it isn't using gofmt. https://github.com/tobyhede/underscore.go/blob/master/src/un...

It shows that the author knows how to code go, but I get the impression that go programmers are more picky about idiomatic code than even python programmers, so if the author wants to get into go development, the author should probably stop that and work on something more idiomatic.

Re: Underscore.go

#24

What is the term for unpythonic in the Go community? This seems to be it. By the way it isn't using gofmt. https://github.com/tobyhede/underscore.go/blob/master/src/un... It shows that the author knows how to code go, but I get the impression that go programmers are more picky about idiomatic code than even python programmers, so if the author wants to get into go development, the author should probably stop that and…

goop. just kidding, i made that up, but i hope it sticks

Re: Underscore.go

#25
post #5
post #4

Neat. I like that you can add your own type specific functions. I was interested in seeing the implementation of the Parallel Map, but on a quick browser through the source, could not find it. If you're interested in other works in the same space, I think think the the Gen library ( http://clipperhouse.github.io/gen/ ) goes a long way towards providing type-safe, idiomatic, Go code to achieve the same effects.

It doesn't appear that it is complete when compared to the listed functionality on the site.

Yes, but gen is more general for type-driven code generation. It’s implemented as pluggable ‘typewriters’, which anyone can create: https://github.com/clipperhouse/gen/blob/master/CHANGELOG.md

The default ‘genwriter’ package does LINQ/underscore stuff. If someone wanted to go further with it, they could create a new package (or extend that one).

Re: Underscore.go

#26
Oh hello. Library author here.

Underscore.go is a mostly WIP that I hadn't intended to go live on HN :)

The general feedback so far is __ is annoying, I thought it was cool and if people were annoyed they could fix it on import. But I might be quite wrong on this one.

The directory layout is going to change and I am working on a branch at the moment that splits the whole thing into a file per algorithm, which makes things much easier to work with.

Re: Underscore.go

#27

Using the function as the first argument and the iterable as the second, makes it easy to curry functions. A port of Ramda ( https://github.com/CrossEye/ramda ) would be better for this reason.

Thanks that's an interesting idea

Re: Underscore.go

#28
post #19

Underscore is not a perfect fit for JS, but it's close enough; if you like coding in the style Underscore promotes, Underscore.js makes Javscript programming simpler. Underscore seems like it would not at all be a good fit for Golang. Golang really wants you to just use a for-loop.

It seems that enough people are tired of such a verbose idiom in 2014 to merit a library like this.

I really dislike being that guy, but there's no reason why a language, today, shouldn't implement a decent map shorthand construction. For loops and unnecessary visual burden for a large variety of tasks and give no hint to the semantics of the code within a loop (is my loop doing a map, a transform, a reduction?).

Re: Underscore.go

#29
post #2

Underscore was chosen in JS presumably because it is a valid variable name that isn't used for anything. Underscore in Go actually means something, which is why this is actually double -underscore, which makes it even visually more confusing. The approach is interesting, but I'd really rather see a better name.

Yeah, that's the general feedback I've had. Happy to take suggestions.

"un" or "us" might be preferable?

Re: Underscore.go

#30

What is the term for unpythonic in the Go community? This seems to be it. By the way it isn't using gofmt. https://github.com/tobyhede/underscore.go/blob/master/src/un... It shows that the author knows how to code go, but I get the impression that go programmers are more picky about idiomatic code than even python programmers, so if the author wants to get into go development, the author should probably stop that and…

idiogomatic
Post reply on HN