Live data from Hacker News

GoPlus – The Go+ language for data science

github.com

51–60 of 64 posts

Re: GoPlus – The Go+ language for data science

#51
post #44
post #25

Earlier quoted context omitted.

> I'm surprised comprehensions in particular haven't spread to more modern languages. I've come to dislike list comprehensions. Simple ones are ok but they do not handle incremental complexity well. Invariably it means code slowly becomes really unreadable as time goes by because nobody wants to rewrite the list comprehension when one more little tweak stuffed in there will do the job. I much prefer object-functional…

They're great until you find something like this in code: [x for y in z for x in zz if y in x] Then you begin to wonder how great they really are.

Also, most data scientists presumably have some advanced math background so it's akin to reading set-builder notation (albeit with listcomps the sets are sometimes nested). Your listcomp reads:

{x : y ∈ z, x ∈ zz | y ∈ x}

If you've read enough statistics/ML papers, this becomes second nature.

Re: GoPlus – The Go+ language for data science

#52
post #51
post #44

Earlier quoted context omitted.

They're great until you find something like this in code: [x for y in z for x in zz if y in x] Then you begin to wonder how great they really are.

Also, most data scientists presumably have some advanced math background so it's akin to reading set-builder notation (albeit with listcomps the sets are sometimes nested). Your listcomp reads: {x : y ∈ z, x ∈ zz | y ∈ x} If you've read enough statistics/ML papers, this becomes second nature.

> If you've read enough statistics/ML papers, this becomes second nature.

As someone who breathes that style of notation, there is excellent support in vim and emacs for custom display for readability. Conceal syntax in vim¹(builtin for rust/help/$few_others and external such as vim-cute-python²), and pretty-mode³ in emacs. I'm sure similar things exist in other editors too, but I don't use those ;)

You don't get the exact representation in your example with the things I've mentioned, but if you're used to a more "mathy"-style they really are quite nice. YM[and taste]MV.

1. http://vimdoc.sourceforge.net/htmldoc/syntax.html#conceal

2. https://github.com/ehamberg/vim-cute-python (moresymbols branch for er… more symbols)

3. https://github.com/akatov/pretty-mode

Re: GoPlus – The Go+ language for data science

#53

IMHO these conveniences should just be in the language. List comprehensions, dictionary comprehensions, and short-hand for literals are the kind of syntactic sugar that have almost no downsides, save you some RSI, and make code more readable. I'm surprised comprehensions in particular haven't spread to more modern languages.

I'm here to tell you that comprehension in this form is not everyone's thing. Scala's comprehension is more generic and it's actually monad binding. Comprehension as seen in python is only readable for simple computation, so you end up having to use map reduce sometime. That makes 2 ways to do the same thing and the "zen of python" a lie in this instance.

Re: GoPlus – The Go+ language for data science

#54

IMHO these conveniences should just be in the language. List comprehensions, dictionary comprehensions, and short-hand for literals are the kind of syntactic sugar that have almost no downsides, save you some RSI, and make code more readable. I'm surprised comprehensions in particular haven't spread to more modern languages.

Just no.

Re: GoPlus – The Go+ language for data science

#56
post #44

Earlier quoted context omitted.

They're great until you find something like this in code: [x for y in z for x in zz if y in x] Then you begin to wonder how great they really are.

To me that looks super easy to read. You just go left to right. for y in z: for x in zz: if y in x: yield x It’s extremely easy to sight read. If the lines become long, just split them up and it’s even more obvious. [x for y in z for x in zz if y in x] There’s nothing tricky about multiple loops and conditions in comprehensions in most languages that support them. Just go left to right and it mirrors outer to inner l…

Agree.

Re: GoPlus – The Go+ language for data science

#58
post #11
post #4

I'm not a Go user, but is the important idea here that it can be run from a scriptingish environment like Jupyter or something?

It's significant syntactic sugar that brings it closer to Python, but no notebook support from what I can see. Do any notebooks support a compiled language?

Go+ is planed to support jupyter and nteract.

Re: GoPlus – The Go+ language for data science

#59

I feel where they are trying to go with this, I wrote https://github.com/aunum/gold in Go because of all the nice parts of Go. This solves some of the pain points but is still fatally flawed as any other Go ML tool in that it can’t accelerate due to the Go C FFI. Until that issue is resolved Go simply won’t be broadly accepted in data science.

Would you please explain?

So due to how Go handles memory, it needs to do something called "trampoline", over to the C stack. This causes Go->C calls to have a substantial overhead 70-200ns/op. Most other languages that value is closer to 1ns. This means that every call to a GPU suffers from this latency.

This isn't too much of a problem if your doing all supervised learning with batch operations because the speedup of a GPU over a bigger operation outweighs the FFI latency.

However, it's a problem that doesn't appear to have a solution due to Go's memory management choices, and will hamper it ever being used for accelerated computing problems. This is one of the reasons Rust moved to using ownership rules.

You can read a bit more at https://dave.cheney.net/2016/01/18/cgo-is-not-go

Re: GoPlus – The Go+ language for data science

#60

I love the idea of main-less Go scripts for times where you just want to do something simple, fast. Neugram [1] aimed to make Go a better scripting tool, but unfortunately it seems the project is dead. Although Go+ says its focus is on data science, I think it could fill this niche too. By the way: does Go+ have shebang support? 1: https://github.com/neugram/ng

Go doesn't need to have shebang support, the kernel will provide that. But for the record it will work: frodo ~ $ cat t.go //opt/go/bin/go run $0 $@ ; exit package main import( "fmt" ) func main() { fmt.Printf("Hello, world\n" ); } frodo ~ $ ./t.go Hello, world Otherwise there are a bunch of go-interpreters out there, which can be used for adhoc scripting. I'm sure that in some circumstances they can be useful, but I…

I’m specifically asking about Go+ (not Go) “having” shebang support in that you can legally use the standard #! shebang. Yes, the kernel handles the shebang, but if the shebang target doesn’t ignore the line and errors then that’s where the problem lies.

The workarounds mentioned by you and the other commenter’s linked article are sub-optional in that they require a system-wide modification, require wrapper scripts, or are non-standard hacks.

Post reply on HN