Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
halgari
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
4 ms
·
1.
▲
by
halgari
14y ago
I've been programming professionally for about 8 years, and I'm self-taught. To be honest, I've found that my degree carrying co-workers fall way short in the basics. Perhaps it's just me, but my background in languages went something like
2.
▲
by
halgari
14y ago
+1, I've seen this idea before, and I think it's horrible. It's a ton of boilerplate crap that doesn't seem to solve any real-world problem.
3.
▲
by
halgari
14y ago
just use hash maps: http://www.youtube.com/watch?v=rI8tNMsozo0
4.
▲
by
halgari
14y ago
The problem with ClojureCLR is not the platform (that's 100% the same as Clojure on JVM) it's the tooling and lack of libs. So instead of using DataOutputStream, you have to use BinaryOutputStream. Clojure doesn't wrap much, so that means v
5.
▲
by
halgari
15y ago
We're taking the same approach as ClojureCLR and ClojureScript in clojure-py. As much as possible implement things exactly the way Clojure does.
6.
▲
by
halgari
15y ago
This is very correct. We compile Clojure code to Python bytecode. Clojure functions become python functions, clojure deftypes are Python classes, Clojure namespaces are Python modules. And yes, it runs perfectly well on PyPy. Actually it so
7.
▲
by
halgari
15y ago
Mostly because we have to have these collections inside the compiler. So it's a bit hard to write collections in a language that has no compiler. Chicken/egg issue..
8.
▲
by
halgari
15y ago
You can, but I think you'd run into the same issues mentioned here: http://clojure-py.blogspot.com/2012/02/ive-been-asked-many-t... Basically it reflection (aka dynamic dispatch) is a major performance killer if you don't implement a trac
9.
▲
by
halgari
15y ago
PyClojure (in the link) didn't actually take it to the extent we are. clojure-py goes so far as to implement all the standard collections in pure python. So [1 2 3] in clojure-py is a PersistentVector not a python list.
10.
▲
by
halgari
15y ago
Here's a blog post explaining the issues involved in a bit more detail: http://clojure-py.blogspot.com/
11.
▲
by
halgari
15y ago
I agree, if you're into Python, use python. However, I find things like macros, protocols, and multimethods drastically reduce the amount of coding that has to be done to accomplish a certain task. But I'm biased there ;-)
12.
▲
by
halgari
15y ago
Those numbers a re bit small to get a full view of the way the pypy jit works: user=> (time (reduce1 + (range 100000))) Elapsed time: 903.011083603 msecs 4999950000 user=> (time (reduce1 + (range 1000000))) Elapsed time:
13.
▲
by
halgari
15y ago
First of all, it should be mentioned, that this is not an abstraction layer. Clojure-py functions are actual Python functions (not classes as they are on the JVM). This means that the speed of clojure-py is almost exactly the same as python
14.
▲
by
halgari
15y ago
This is not true at all. PyPy implements a tracing jit that compiles specific loops for each set of types run through the interpreter. This means it is actually possible to have Python code that runs faster than C code in some rare cases:
15.
▲
by
halgari
15y ago
There's absolutely nothing stopping us from implementing atoms, refs, and agents on clojure-py. Sure, the GIL won't help at all, but PyPy is working hard to fix that.