This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-14
Channels
- # beginners (19)
- # boot (11)
- # cider (59)
- # cljs-dev (292)
- # cljsrn (2)
- # clojure (121)
- # clojure-brasil (19)
- # clojure-canada (2)
- # clojure-france (2)
- # clojure-italy (57)
- # clojure-spec (54)
- # clojure-uk (20)
- # clojurescript (83)
- # core-async (20)
- # cursive (5)
- # datascript (2)
- # datomic (10)
- # duct (25)
- # editors (4)
- # emacs (2)
- # fulcro (5)
- # funcool (1)
- # graphql (2)
- # immutant (8)
- # java (1)
- # jobs (4)
- # jvm (1)
- # keechma (5)
- # luminus (10)
- # off-topic (113)
- # om (36)
- # onyx (11)
- # parinfer (55)
- # pedestal (7)
- # protorepl (28)
- # re-frame (25)
- # reagent (6)
- # ring-swagger (1)
- # shadow-cljs (113)
- # spacemacs (1)
- # specter (23)
- # unrepl (8)
- # yada (8)
i thought clojure interop with python would be really useful, I'm thinking something like clojurescript, but for python instead. anyone else think this is a good idea?
I bet @tbaldridge has some thoughts about that :)
I forget how many versions of that he’s done - at least a few if I remember correctly
pixie doesn’t do python interop though - it only uses a python vm
(I guess it can do python interop on a compiler level? not in the runtime)
but it's not updated
Hy has a similar syntax to Clojure: http://docs.hylang.org/en/stable/index.html
but it doesn't interop with python...?
if you mean pixie - it uses rpython to make a vm, but doesn’t have access to python at runtime
oh oops, it does!
yeah there's a lot of differences between python and clojure that makes it hard
I used to maintain clojure-py back in the day
i see.
it had a lot of problems though
is there one problem that you remember?
one of clojure's strengths is really the interop. every few days someone asks on r/clojure about clojure and data science
i think these questions would go away if there was a clojure that could interop with python
mutable closures, reference counting, reference counting that defults to borrowing (everything holds onto the head)
sort of like clojure for the CLR
i see
python is also rather slow, so if you want something liek clojure-py you need part of it to be in c
or make everyone use pypy
what about a clojure vm that knew how to consume the python wrappers of c and fortran stuff? (I ask, knowing nothing about how python ffi works or whether that question even makes any sense)
perhaps the real killer app for python in data science isn’t the wrapped libraries from c/fortran but the higher level stuff in python that consistently works together and builds on that - if so competing is going to be a lot more work
The other thing that makes this really hard is that it's hard to define what Clojure is.
Stuff like multi-arity functions don't exist in Python. So do we need to implement something like IFn and pay the cost of two dynamic dispatches on every function call?
What is even the core protocols needed by Clojure? CLJS and CLJ are really different in the protocol area, and some of the CLJS stuff is pretty JS specific.
so the few times I've looked into it I got bogged down in trying to figure out how to map Clojure semantics to Python
For example in Clojure falsey is nil and false. In Python it's: None, False, [] and 0.
would you be interested in working on this again if you had someone to help you? 😛
I bet you could get some traction with a docker image set up to run jvm clojure using blas and some good matrix and stats libs out of the box
i think javascript is different if it's falsey too
i'm glad i talked to you, you have so much experience!
@ackerleytng I'd be willing to give people pointers. But at this point if I'm going to write a language, there's other non-Clojure concepts I want to explore.
i see, ok!
Effect systems, fully immutable VMs, etc.
but then you'd have to reimplement numpy
That's basically what core.matrix is. And neanderthal already wraps this stuff in a very strong robust API. Generally, things in the data science front are starting to settle and accelerate. #data-science is the 'de facto place' to hang out for this.
@tbaldridge ok first question! how did you even start? by reading the clj/cljs implementation first?
pretty much, the stuff in clojure.lang is pretty simple. A good way to start is by looking at clojure/core.clj and seeing what stuff like conj calls, then dig into clojure.lang.RT, and that then takes you into all the other code.
Oh, that reminds me of something else that's a bit hard to implement:
No Clojure implementation out there has first-class Vars and protocols on the bottom.
CLJ has vars, but not protocols at the bottom
CLJS has protocols at the bottom, but not vars.
Python could have both, but that's a really nasty chicken-egg problem. To get vars you need hashmaps, and some other structures. To get that you need protocols. Protocols are stored in Vars....
I've played with fully self-hosted clojure a bunch of times and that's always been the biggest headache
@tbaldridge you don't actually need hashmaps tho, there's a few tricks you can play to defer hitting code paths where those would be needed, until they are defined
I found that a bigger headache than the circular dep between vars and protocol is the one between vars, namespaces and symbols
which makes me think -- I've heard RH say that if he was to redo the var/ns system he would make it significantly less reified
@alexmiller any ideas on ^ ?
I just want to get rid of Namespaces as mutable Java objects :)
Maybe, figuring that out would be step 1
Someone did a spike on immutable namespaces a few years ago iirc
But imagine that refer-clojure was just adding a pointer
oh I know - namespaces made of datoms
(kidding)
Maybe that’s what I’m remembering
Well if it’s indistinguishable from magic then it must be sufficiently advanced
@bronsa it blew my mind when I found out that F# kept all those "features"
one of the reasons I learned Clojure instead.
brb implementing OClojml
It's pretty much what you'd expect if you built Clojure on .NET and used OCaml as a base instead of lisp.
If Clojure didn't exist I'd probably be doing F# instead, I rather like it.
I like it but never liked the non windows environment for it although I hear it's better now
I love the contrapositive of Clark's third law: Any technology distinguishable from magic is insufficiently advanced.
F#'s tooling was pretty rough last I tried. It also ends up being pretty verbose at times.
I really like F# (what little I've used it). The providers stuff is awesome.
have you used opam? it’s a little clunky but at least it does switchable version isolations
I haven’t made a new OCaml project recently enough to try jbuilder