aysylu / loom

Graph library for Clojure. Mailing list https://groups.google.com/forum/#!forum/loom-clj
http://aysy.lu/loom/
887 stars 108 forks source link

clojurescript support #45

Closed fluke777 closed 7 years ago

fluke777 commented 10 years ago

f720bf1d0eb2b786938b8b62d0452a1d17f72170 laid the groundwork.

Now, the following namespaces need to be ported to Clojurescript:

Also, we'll need to add:

----------------------------ORIGINAL POST BELOW------------------------------------------- Hey

is there a plan on supporting clojurescript?

Recently I heard about the project called cljx which is a simple preprocessor for different host platforms for clojure. I went ahead and created a branch here https://github.com/fluke777/loom/tree/cljx . It does include the layer of cljx. The test seem to be passing as the were if you run

lein do clean, cljx once, test

I did not do any work on clojurescript support per se but I think this is a prerequisite. If this would be interesting for others I could give it a try. I am not a cljx nor clojurescript master but yeah why not.

aysylu commented 9 years ago

Hey,

Yes, I'd be happy to see Loom support Clojurescript. There has been some interest in the past, but no progress made. I'm looking for a project that can utilize Loom in Clojurescript. Do you have a use case?

Also, I think when adding cljx support we should go for the following structure:

src/loom/common
src/loom/clj  ; for Clojure specific functionality, Java interop etc
src/loom/cljx ; for Clojurescript specific implementation
nez commented 9 years ago

@aysylu an use case: Comportex ( https://github.com/nupic-community/comportex ) had to copy paste clojure.algo.graph to be able to use it in clojurescript. If loom supported cljx, comportex would be able to use loom instead of having the copy pasted clojure.algo.graph.

Also, I suppose there would be use for front-end plotting and transformation of graphs.

danielcompton commented 9 years ago

Clojure 1.7's reader conditionals would probably be better than using cljx, once 1.7 is released.

aysylu commented 9 years ago

Good idea. I created #60 to track progress.

aysylu commented 9 years ago

f720bf1d0eb2b786938b8b62d0452a1d17f72170 laid the groundwork.

Now, the following namespaces need to be ported to Clojurescript:

Also, we'll need to add:

danielcompton commented 9 years ago

@aysylu if you wanted to add that todo list to this issue's description then it'll show up with pretty formatting in GitHub issues.

turbopape commented 8 years ago

Hi guys, Thank you for this useful library. I use it in a project which I intend to port to ClojureScript. I see the loom.XYZ namespaces coming with cljc extenstions now, but still can't manage to compile loom/requiring libaries in Clojurescript. Using the released lib [0.5.4] from Clojars, cljsbuild complaints about not finding loom/alg.cljc - I think this is not what's packaged in the current release on Clojars, or did I get something wrong? Thank you, Rafik

aysylu commented 8 years ago

Hi @turbopape,

you're correct, the problem is that .cljc and the support for Clojurescript was not part of the [0.5.4] release. It'll be available in the next release, which I'm hoping to cut this weekend. I'll update this thread when it becomes available.

Cheers, Aysylu

turbopape commented 8 years ago

Thank you @aysylu, very cool!

Envoyé de mon iPhone

Le 8 avr. 2016 à 03:47, Aysylu Greenberg notifications@github.com a écrit :

Hi @turbopape,

you're correct, the problem is that .cljc and the support for Clojurescript was not part of the [0.5.4] release. It'll be available in the next release, which I'm hoping to cut this weekend. I'll update this thread when it becomes available.

Cheers, Aysylu

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

turbopape commented 8 years ago

Hey @aysylu ,

Any chance to work on cljc's ?

Thank you !

aysylu commented 8 years ago

Hey @turbopape, loom version 0.6.0 with latest updates is now released: https://clojars.org/aysylu/loom/versions/0.6.0. Thanks for your patience!

turbopape commented 8 years ago

Hey @aysylu ,

Thank you !

I'll try porting milestones during this week-end :)

Cheers!

turbopape commented 8 years ago

Hi @aysylu ,

When attempting to compile my project for clojruescript I get the following error: clojure.lang.ExceptionInfo: failed compiling file:target/_out/loom/alg_generic.cljc {:file #object[java.io.File 0x7b4b2dcd "target/_out/loom/alg_generic.cljc"]} ... The reason for this stack seems to be :

Caused by: clojure.lang.ExceptionInfo: No such namespace: java.util.Arrays, could not locate java/util/Arrays.cljs, java/util/Arrays.cljc, or Closure namespace "java.util.Arrays" in file target/_out/loom/Alg_generic.cljc {:tag :cljs/analysis-error}

I think some refactoring may have to be done in order to get javascript working ... Thank you,

aysylu commented 8 years ago

@turbopape: I think it's because the alg-generic namespace still needs to be ported to Clojurescript. Is this something you'd like to contribute? (the list of namespaces that still need to be ported is in the first post of this thread)

turbopape commented 8 years ago

Hi Aysylu,

Yeah, definitely, would give it a shot during the week-end,

Cheers,

Rafik

2016-04-26 14:47 GMT+01:00 Aysylu Greenberg notifications@github.com:

@turbopape https://github.com/turbopape: I think it's because the alg-generic namespace still needs to be ported to Clojurescript. Is this something you'd like to contribute?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/aysylu/loom/issues/45#issuecomment-214750586

cemerick commented 8 years ago

It looks like the trail has gone cold on making loom available in ClojureScript. Unless someone has commits ready for a PR waiting in the wings, I'll try to nail this down tonight.

turbopape commented 8 years ago

This is the thread that explains the macro and extend-type stuff : #76 Cheers !

turbopape commented 8 years ago

You'll find it daunting, as it uses protocol extension mechanisms only available in Clojure, I tried (and someone else did) rewriting using nasty macros, but I abandoned as It was not clean at all.

In my opinion, the implementations shall be rewritten to avoid extend-type (or the other one, I forgot ...)

Good luck any ways !

Cheers,

Rafik

2016-10-20 21:54 GMT+01:00 Chas Emerick notifications@github.com:

It looks like the trail has gone cold on making loom available in ClojureScript. Unless someone has commits ready for a PR waiting in the wings, I'll try to nail this down tonight.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aysylu/loom/issues/45#issuecomment-255225392, or mute the thread https://github.com/notifications/unsubscribe-auth/ACpoH8QH-XD0NE5t05cWVn9gZ1t9pqyfks5q19UTgaJpZM4C1i6D .

cemerick commented 8 years ago

@turbopape Take a look at my PR, #91, and especially the notes (and maybe impl, if you're interested) in the loom.cljs namespace.

turbopape commented 8 years ago

Ah great!

For futures, I used a lib named promesa, that wraps promises in js, pretty much close semantics ...

Le 25 oct. 2016 19:35, "Chas Emerick" notifications@github.com a écrit :

@turbopape https://github.com/turbopape Take a look at my PR, #91 https://github.com/aysylu/loom/pull/91, and especially the notes (and maybe impl, if you're interested) in the loom.cljs namespace.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aysylu/loom/issues/45#issuecomment-256131148, or mute the thread https://github.com/notifications/unsubscribe-auth/ACpoHydbbXlvWI5sQ7FadpOFseHzNlK-ks5q3kvtgaJpZM4C1i6D .

cemerick commented 8 years ago

Yeah, there's a bunch of options there. Since promises were used in only one algorithm function, I decided it'd be better to punt on it for now. It can be addressed later on if there's demand.

turbopape commented 8 years ago

Yes, besides, it is used like to get some state back when it's ready in some ever running loop. I think this can be rethought in a more loop/recurrish way.

2016-10-25 19:55 GMT+01:00 Chas Emerick notifications@github.com:

Yeah, there's a bunch of options there. Since promises were used in only one algorithm function, I decided it'd be better to punt on it for now. It can be addressed later on if there's demand.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aysylu/loom/issues/45#issuecomment-256139924, or mute the thread https://github.com/notifications/unsubscribe-auth/ACpoH_zZBZidsPDzgLBW511BxjL6lLhMks5q3lCdgaJpZM4C1i6D .