This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-05
Channels
- # bangalore-clj (2)
- # beginners (132)
- # boot (311)
- # cider (5)
- # cljs-dev (27)
- # cljsjs (2)
- # cljsrn (16)
- # clojure (76)
- # clojure-art (1)
- # clojure-france (8)
- # clojure-russia (35)
- # clojure-spain (3)
- # clojure-spec (2)
- # clojure-uk (11)
- # clojureindia (1)
- # clojurescript (98)
- # core-async (3)
- # css (9)
- # cursive (9)
- # datascript (7)
- # datomic (7)
- # emacs (30)
- # jobs (1)
- # lein-figwheel (7)
- # london-clojurians (1)
- # lumo (14)
- # off-topic (6)
- # om (1)
- # planck (3)
- # protorepl (1)
- # re-frame (27)
- # reagent (17)
- # spacemacs (10)
- # untangled (1)
- # yada (16)
@weavejester is this how it's supposed to be used: (cljfmt.core/reformat-form '(let [a 1 b 2] (+ a b)))
@pupeno typically you work off a string that’s formatted in some way already. cljfmt corrects any problems with the formatting.
@pupeno If you want to format from scratch, zprint might be a better option.
I prototyped a virtual DOM for Three.js in cljs, not powerful enough but at least works https://www.youtube.com/watch?v=5NHYiW2Y-Jg
Source code https://github.com/Quamolit/quatrefoil and demo http://repo.quamolit.org/quatrefoil/ if you re interested...
Can I extend-type for all seq data type, eg. (extend-type ISeq SomeProtocol ...)
I tried, But not work.
clojure
dev:cljs.user=> (doc extend-type)
-------------------------
cljs.core/extend-type
([type-sym & impls])
Macro
Extend a type to a series of protocols. Useful when you are
supplying the definitions explicitly inline. Propagates the
type as a type hint on the first argument of all fns.
type-sym may be
* default, meaning the definitions will apply for any value,
unless an extend-type exists for one of the more specific
cases below.
* nil, meaning the definitions will apply for the nil value.
* any of object, boolean, number, string, array, or function,
indicating the definitions will apply for values of the
associated base JavaScript types. Note that, for example,
string should be used instead of js/String.
* a JavaScript type not covered by the previous list, such
as js/RegExp.
* a type defined by deftype or defrecord.
(extend-type MyType
ICounted
(-count [c] ...)
Foo
(bar [x y] ...)
(baz ([x] ...) ([x y & zs] ...))
`dev:cljs.user=> (doc ISeq) ------------------------- cljs.core/ISeq Protocol Protocol for collections to provide access to their items as sequences. `
I must be thinking of this wrong but isn't’ there a library for clojurescript that I could use something like (fake-routes ....)
Hi! I've encountered weird compiler behaviour with :pseudo-names true
. This code https://github.com/ul/carbon-snake/blob/master/src/carbon_snake/core.cljs#L130-L145 is transformed into that js https://gist.github.com/ul/fc23aee02cb5769f4c542be13ef32a16
Problem is that this var https://gist.github.com/ul/fc23aee02cb5769f4c542be13ef32a16#file-core-js-L68 always stays null because $temp__6753__auto__$jscomp$57$$
is undefined.
In development mode and :advanced
compilation everything works perfectly. Code becomes broken when :pseudo-names true
is enabled.
((fn [x] (satisfies? cljs.core/IFn x)) {})
`that may not be possible
Don't take my word for it
are you aware of instance?
?
that doesn't seem to be dynamic either
you could always check manually: (= cljs.core/PersistentArrayMap (type {}))
(defprotocol Yo (yo [x])) (extend-protocol Yo IMeta (yo [x] "IMeta yo")) (yo []) ;=> Boom!
yes I know this is a protocol, but I'm wondering why it doesn't make sense to extend a protocol to another
I should use multimethods for thing like that and use prefer function to resolve dispatch ambiguity
@weavejester: ah, ok. In my case, I need to run some code and display it too, so, I just have the code.
@emccue are you still trying to achieve all the URLs working? I think I have the solution.
I created a library called Free Form to make forms with Reagent and Re-frame and to play with it and display it's capabilities, I created a project called Free Form Examples: https://github.com/pupeno/free-form-examples
It started out of a re-frame template but I normally modify them quite a bit (I like grouping subscriptions, events, functions, views etc by component not by type).
But, if you look at the Clojure side, instead of the single empty file, it has this: https://github.com/pupeno/free-form-examples/blob/master/src/clj/free_form_examples/core.clj
This is what creates the ring handler I mentioned yesterday: https://github.com/pupeno/free-form-examples/blob/master/src/clj/free_form_examples/core.clj#L12-L17
And this bit you can ignore because it's just to serve the app in production, when I deploy to Heroku: https://github.com/pupeno/free-form-examples/blob/master/src/clj/free_form_examples/core.clj#L19-L21
Then I tell figwheel to use that handler: https://github.com/pupeno/free-form-examples/blob/master/project.clj#L40
Maybe I should write a blog post about it.
Feel free to check out the app and run it. It doesn't require any database or anything like that, so, it should be very straightforward and you can play with it and see whether it behaves the way you want.
Happy to help.
@rauh I managed to fix the styling issues. I used System Properties instead of an atom.
what is a nice way to write this function in clojurescript? (R is ramda.js) const touches = R.curry((node, link) => link.source == node || link.target == node )
is there a way to use “resources/public/main.cljs.edn” with boot-reload? This creates a warning “adzerk.boot-reload.public.main contains a reserved JavaScript keyword” that I can’t seem to work around - I’d very much like to keep “resources/public"
@lambdacoder It is just a warning, you can still use it, and the next version of boot-reload will fix this.
that warning prevents reloading from working tho
boot-reload injects its init ns and detects changes correctly, but they arent pushed to the browser - the warning is
Oh, didn't notice that when investigating it.
one sec, I'll push a snapshot with a fix
I just noticed 0.5.1-SNAPSHOT seems to fix it, but its not in clojars yet
awesome, thanks a lot 🙂
Okay, snapshot should now be deployed. If you can confirm it works, I'll do a release right away.
hrm, "Could not find artifact adzerk:boot-reload:jar:0.5.1-SNAPSHOT in clojars (https://repo.clojars.org/)” but I see it on http://clojars.org
I had tried to get that jar a few minutes ago, cache issue?
Perhaps a local cache issue, should be available in repo: http://repo.clojars.org/adzerk/boot-reload/0.5.1-SNAPSHOT/
ah local cache indeed, it existed in my ~/.m2 as a glorified 404
well even after completely erasing ~/.m2 the jar is still not found, ill install manually
mvn won’t install the jar either: mvn install:install-file -Dfile=boot-reload-0.5.1-20170205.160151-1.jar -Dpomfile=boot-reload-0.5.1-20170205.160151-1.pom Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install-file (default-cli) on project standalone-pom: The artifact information is incomplete or not valid:
which is odd cause the fields it says are missing are in the pom file
Odd. I removed the version from my ~/.m2 and it got successfully downloaded from Clojars.
and now it seems solved magically heh, rerunning my boot dev task downloaded it
well I deleted the resolver-status.properties file it had recreated
testing now 🙂
warning is gone and reloading works !
Great, deploying proper release now
I ran into this issue when using the reloaded workflow with tools.namespace and using cljc files: http://dev.clojure.org/jira/browse/TNS-45?focusedCommentId=44148. I’m looking for opinions on how to support the reloaded workflow, cljc files, and serving resources from the classpath for uberjars. I’m currently favoring serving from the filesystem during development to avoid classpath issues with tools.namespace, and using a different handler in production to serve resources from the classpath.
Yeah. For toy projects I appreciate having everything self contained in a single jar. Compiling cljs output to resources/public is also the default configuration in most cljs app templates I’ve seen.
there is a function that lets you control which directories are reloaded .. set-refresh-dirs!
or something like that
Yeah, I’ve had some success with that. I think an exclude-refresh-dirs!
is closer to what is needed since you know where the compiled output is going but often want other resources to be refreshed.