halgari

๐Ÿ“… Joined in 2012

๐Ÿ”ผ 45 Karma

โœ๏ธ 15 posts

๐ŸŒ€
15 total posts
Stories0
Comments15
Ask HN0
Show HN0
Jobs0
Polls0

(Replying to PARENT post)

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 this: GW-BASIC -> QBASIC -> ASM -> C -> C++ -> PHP -> JS --> Python -> Erlang -> Ruby -> C# -> Clojure. So for me, programming in C meant that I had to understand linked lists and sort algorithms.

I've sat in in interviews before and asked candidates (with degrees and experience) the difference between a dictionary, a hash-set and a list, and I just get blank stares.

So no, I think it's more about the desire to learn. If you have a true interest in Software Engineering, you'll teach these basics to yourself. If not, then not even college will help you.

๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

+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.
๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

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 very little code written for one VM runs on the other. Plus you don't have lein, which is a bit problem tooling-wise

๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

We're taking the same approach as ClojureCLR and ClojureScript in clojure-py. As much as possible implement things exactly the way Clojure does.
๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

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 sometimes runs a bit better. CPython segfaults with bad bytecode sequences (unbalanced stacks). PyPy actually throws an error so you can fix the code.
๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

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..
๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

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 tracing jit.

๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

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.
๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

Here's a blog post explaining the issues involved in a bit more detail: http://clojure-py.blogspot.com/
๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

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 ;-)
๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

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: 777.748823166 msecs
  499999500000
  user=> (time (reduce1 + (range 10000000)))
  Elapsed time: 8764.57095146 msecs
  49999995000000
  user=>

  Clojure via hotspot:
  user=> (time (reduce + (range 100000)))
  "Elapsed time: 174.768593 msecs"
  4999950000
  user=> (time (reduce + (range 1000000)))
  "Elapsed time: 267.60421 msecs"
  499999500000
  user=> (time (reduce + (range 10000000)))
  "Elapsed time: 1131.77367 msecs"
  49999995000000
  user=>
But yes, we still have some room for improvement.
๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

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 code.

Secondly, there is some benifit to not having to worry about static typing in a dynamic language. Anyone want to explain how to read a binary file in Clojure? Here's a hint, it takes the use of FileInputStream, DataInputStream. In clojure-py it's as simple as (py/open "foo.bin" "r").

And thirdly, why are we writing a dynamic language on a static VM? Fast Clojure code on the JVM these days takes little hints. You have to tag parameters with ^Integer and ^Double to kick the compiler type inference into gear. None of this is required on a dynamic VM. In fact, it's completely pointless.

๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

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: http://morepypy.blogspot.com/2011/07/realtime-image-processi...
๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0

(Replying to PARENT post)

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.
๐Ÿ‘คhalgari๐Ÿ•‘13y๐Ÿ”ผ0๐Ÿ—จ๏ธ0