Re: [ClojureScript] Deleting and local state
You assumed correctly about the build-all function. Adding a {:key :id} solves my problem. Still I would hope that OM would fall back to value comparison if no key is provided.(like the delete function) This should probably be added to the tutorial since people will run into it quite fast. Thank you. Gary: thanks for the link, it explained in more detail what I was seeing. On Saturday, October 18, 2014 5:17:40 PM UTC+2, Daniel Kersten wrote: Can you provide a little more code? Specifically, the render function of the events parent. I assume you are doing something like (om/build-all event-component (:events factory)) Is there a unique id in each event by any chance? Presumably what is happening is that react doesn't properly detect which event was actually removed - only that one of them was removed (I've seen this a few times...) so if you provide what React calls a key then it can use this to disambiguate and correctly render the list. For example: If your events look like this {:id 3 :other :data} Then you can do something like this: (om/build-all event-component all-events {:key :id}) If you don't have a field in the event that can be used as a key (a number, string or keyword that is unique across all events), then you could try something like this instead: (map-indexed (fn [idx event] (build event-component event {:react-key idx})) all-events) https://github.com/swannodette/om/wiki/Documentation#build On 18 October 2014 14:33, Andreas Liljeqvist bon...@gmail.com wrote: I have a vector of events in my factory-row. An event can be selected by clicking on it: (merge {:onClick #(om/set-state! owner :selected true)} (when selected {:style {:background white}})) If it is selected it will display a white background. This works fine. Problem is when I delete an item. 1. Select the first item on the row (turns white) 2. Delete the first item on the row (item disappears but the second item turns white) (will-mount [_] (let [delete (om/get-state owner :delete)] (go (loop [] (let [event (! delete)] (om/transact! factory :events (fn [xs] (vec (remove (partial = event) xs (recur)) Why is local-state propagated to the next item in the list? Thanks -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com. To post to this group, send email to clojur...@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
[ClojureScript] Ecmascript6 is a threat?
Do you guys think that Ecmascript6 is a threat to clojurescript? -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
[ClojureScript] Re: 2014 State of Clojure ClojureScript Survey ends Oct 17th
On Tuesday, 14 October 2014 16:21:13 UTC+3, Alex Miller wrote: Just a reminder that this Friday is the last day to complete the 2014 State of Clojure ClojureScript surveys: http://blog.cognitect.com/blog/2014/10/3/2014-state-of-clojure-clojurescript-survey So far 1110 people have filled out the State of Clojure survey and 544 people have filled out the State of ClojureScript. If you haven't filled out the surveys yet, we would love for your answers to be included. The raw data and some analysis will be posted next week. Alex Do you intend to publish the resutls? -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
[ClojureScript] Writing Clojurescript with Angular
Hello, I am pushing very strong clojurescript in my company. Currently we use cljs + angular. I am curious to know how many people use this stack and do you have any recommendation? Thanks. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] 2014 State of Clojure ClojureScript Survey ends Oct 17th
Yes, they do. Probably within two weeks from now, according to the original announcement. No hard deadline though. On Sunday, 19 October 2014, Yehonathan Sharvit vie...@gmail.com wrote: On Tuesday, 14 October 2014 16:21:13 UTC+3, Alex Miller wrote: Just a reminder that this Friday is the last day to complete the 2014 State of Clojure ClojureScript surveys: http://blog.cognitect.com/blog/2014/10/3/2014-state-of-clojure-clojurescript-survey So far 1110 people have filled out the State of Clojure survey and 544 people have filled out the State of ClojureScript. If you haven't filled out the surveys yet, we would love for your answers to be included. The raw data and some analysis will be posted next week. Alex Do you intend to publish the resutls? -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com javascript:;. To post to this group, send email to clojurescript@googlegroups.com javascript:;. Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] Ecmascript6 is a threat?
Not anymore than Java 8 to Clojure. JavaScript is getting better, but it's still not a lisp and it's still not using immutable values *by default*. On Sunday, 19 October 2014, Yehonathan Sharvit vie...@gmail.com wrote: Do you guys think that Ecmascript6 is a threat to clojurescript? -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com javascript:;. To post to this group, send email to clojurescript@googlegroups.com javascript:;. Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] 2014 State of Clojure ClojureScript Survey ends Oct 17th
I hope to have something including the raw results published early this week but depends how long it takes to make a report. Alex On Sunday, October 19, 2014 5:47:21 AM UTC-5, Gary Verhaegen wrote: Yes, they do. Probably within two weeks from now, according to the original announcement. No hard deadline though. On Sunday, 19 October 2014, Yehonathan Sharvit vie...@gmail.com wrote: On Tuesday, 14 October 2014 16:21:13 UTC+3, Alex Miller wrote: Just a reminder that this Friday is the last day to complete the 2014 State of Clojure ClojureScript surveys: http://blog.cognitect.com/blog/2014/10/3/2014-state-of-clojure-clojurescript-survey So far 1110 people have filled out the State of Clojure survey and 544 people have filled out the State of ClojureScript. If you haven't filled out the surveys yet, we would love for your answers to be included. The raw data and some analysis will be posted next week. Alex Do you intend to publish the resutls? -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] Extending a clojurescript protocol inside a macro
Thanks, that's definitely a step in the right direction. It still doesn't work, but there is now a function for arity 1 of invoke in the __proto__ map. There's still a `true` value for cljs.core$ifn$-invoke however, which I'm guessing is related to why it's not working. I would desperately like to make use of the various macroexpands, but so far I have had absolutely zero luck getting a working clojurescript repl that has access to my application code. Going to spend some more time trying to get that working now. On Sunday, October 19, 2014 3:37:54 AM UTC+1, Dom Kiva-Meyer wrote: You are resolving the protocol method symbol. `(-invoke ...) expands to (your.namespace/-invoke ...) To fix this, you need to quote (not syntax-quote) and unquote the symbol. `(~'-invoke ...) expands to (-invoke ...) Make liberal use of clojure.core/macroexpand, clojure.core/macroexpand-1, and clojure.walk/macroexpand-all when writing macros. On Sat, Oct 18, 2014 at 4:58 PM, Russell Dunphy rus...@russelldunphy.com wrote: I'm having real difficulty trying to write a macro that creates a defrecord which implements certain protocols in Clojurescript. I've created a minimal example project that shows the problem I'm having at https://github.com/rsslldnphy/cljs-protocols-in-macros The example has two records, one created with a plain defrecord that implements IFn, the other that does exactly the same but in a macro. The plain defrecord works as expected, but the one created in a macro doesn't - it's not callable as a function. Weirdly it returns true for (ifn?) however. Looking at the js console (screenshot in the repository) the macro created record seems to have a value of `true` in its __proto__ map for cljs.core.IFn (whereas all the other entries in the __proto__ map are functions, and the plain defrecord has function entries for the different arities of `invoke`). I'm lost at this point (and new to Clojurescript). Am I doing something wrong? Is this even possible? Thanks, Russell -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com. To post to this group, send email to clojur...@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] Extending a clojurescript protocol inside a macro
Phew! Got it working. Thanks for your tip, Dom. For some reason I had the idea that macros written for clojurescript needed to be expanded in a clojurescript repl. Once I realised that was incorrect things became much easier. In the end i just needed to also quote unquote the `IFn` protocol name like this: (defmacro defthing [name args] `(defrecord ~name ~args ~'IFn (~'-invoke [this#] (str Hello, ~(first args) On Sunday, October 19, 2014 2:40:49 PM UTC+1, Russell Dunphy wrote: Thanks, that's definitely a step in the right direction. It still doesn't work, but there is now a function for arity 1 of invoke in the __proto__ map. There's still a `true` value for cljs.core$ifn$-invoke however, which I'm guessing is related to why it's not working. I would desperately like to make use of the various macroexpands, but so far I have had absolutely zero luck getting a working clojurescript repl that has access to my application code. Going to spend some more time trying to get that working now. On Sunday, October 19, 2014 3:37:54 AM UTC+1, Dom Kiva-Meyer wrote: You are resolving the protocol method symbol. `(-invoke ...) expands to (your.namespace/-invoke ...) To fix this, you need to quote (not syntax-quote) and unquote the symbol. `(~'-invoke ...) expands to (-invoke ...) Make liberal use of clojure.core/macroexpand, clojure.core/macroexpand-1, and clojure.walk/macroexpand-all when writing macros. On Sat, Oct 18, 2014 at 4:58 PM, Russell Dunphy rus...@russelldunphy.com wrote: I'm having real difficulty trying to write a macro that creates a defrecord which implements certain protocols in Clojurescript. I've created a minimal example project that shows the problem I'm having at https://github.com/rsslldnphy/cljs-protocols-in-macros The example has two records, one created with a plain defrecord that implements IFn, the other that does exactly the same but in a macro. The plain defrecord works as expected, but the one created in a macro doesn't - it's not callable as a function. Weirdly it returns true for (ifn?) however. Looking at the js console (screenshot in the repository) the macro created record seems to have a value of `true` in its __proto__ map for cljs.core.IFn (whereas all the other entries in the __proto__ map are functions, and the plain defrecord has function entries for the different arities of `invoke`). I'm lost at this point (and new to Clojurescript). Am I doing something wrong? Is this even possible? Thanks, Russell -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com. To post to this group, send email to clojur...@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
[ClojureScript] Writing Clojurescript with Angular
I'm not using this, but I'd be interested to know if you're using Gyr or just direct JS interop? -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
[ClojureScript] Re: Writing Clojurescript with Angular
On Sunday, October 19, 2014 2:28:52 AM UTC-7, Yehonathan Sharvit wrote: Hello, I am pushing very strong clojurescript in my company. Currently we use cljs + angular. I am curious to know how many people use this stack and do you have any recommendation? Thanks. My company has worked on several projects using cljs + Angular. I wrote a blog post last year outlining some of it: http://keminglabs.com/blog/angular-cljs-weather-app/ The decision was a pragmatic one at the time, but in the most few months we've been doing new work using React/Om, which feels much nicer to use from ClojureScript than Angular does. I recall in particular the cljs-js datatype coercion got tricky in places and it was easy to trip over. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
[ClojureScript] Om + GSS
Does anybody have experience using Om GSS (gridstylesheets.org) together? Especially in live environment like lein-figwheel. Plain Om + GSS combination works fine (as I hope; I haven't investigated this far because of struggling with problem described below), but when lein-figwheel sends update to the browser and om root is remounted by my system, GSS becomes crazy. I tried to disable GSS observer and make wrapper like https://github.com/petehunt/react-gss but ended my day with fragile, complex system which is not really working. My initial intention was completely different, I had a hope to make my development process fast and result robust and beautiful using those three tools from the future. Thanks in advance for any useful info. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
Re: [ClojureScript] Re: Writing Clojurescript with Angular
Now cljs supports 'specify' so it'll be a bit easier to work with angular than when Kevin wrote his original blog post. http://dev.clojure.org/jira/browse/CLJS-414 I tried to build something with CLJS/Angular before Om was a thing, and I found it hard to keep track of what kind of data I was passing around, and to reconcile immutable ops with mutable JS data structures. No longer worth it, imo. Haven't tried gyr. On Sun, Oct 19, 2014 at 1:10 PM, Kevin Lynagh ke...@keminglabs.com wrote: On Sunday, October 19, 2014 2:28:52 AM UTC-7, Yehonathan Sharvit wrote: Hello, I am pushing very strong clojurescript in my company. Currently we use cljs + angular. I am curious to know how many people use this stack and do you have any recommendation? Thanks. My company has worked on several projects using cljs + Angular. I wrote a blog post last year outlining some of it: http://keminglabs.com/blog/angular-cljs-weather-app/ The decision was a pragmatic one at the time, but in the most few months we've been doing new work using React/Om, which feels much nicer to use from ClojureScript than Angular does. I recall in particular the cljs-js datatype coercion got tricky in places and it was easy to trip over. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups ClojureScript group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.
[ClojureScript] Re: Newbie advice on cljs + om?
Here are a few things I've picked up working on a large Clojure/Clojurescript app the last several months. Some of this is just personal opinion or what works for me, so as usual YMMV. 1) Reagent vs Om - I went back and forth (several times) between these two early in the project. I'm using Reagent now, but I have no qualms about using Om if it fits the app better. There are lots of factors of course, but for me the decision now comes down to this - if it makes sense for the app to store all the state in a single atom, use Om. If not, use Reagent. For my current app, multiple atoms is a more natural fit, so Reagent has been a good choice. Not that you can't use a single atom with Reagent, it's just less convenient dealing with deeply nested data without the benefit of cursors, and you lose the performance advantage (i.e. with a single atom, any change to any part of app state will cause every component that reference any part of app state to re-render). Sean Corfield has introduced a pull request to add cursor support to Reagent, but I haven't tried it (I just don't have time to be messing with various forks - once it makes it into Reagent proper, I look forward to trying it out). 2) CSS/JS frameworks - I started off using Bootstrap, then switched to Foundation and I'm much happier with the results. It just seems cleaner, and I am finding it easier to create semantic classes, which lets me avoid putting a billion classes on each item in my markup, plus lets me shrink the CSS file by cutting out unused stuff. One cool thing about Foundation is that if you are only using their mixins to create semantic styles, you can set a flag to turn off generation of all the presentational classes, which makes the generated CSS tiny (I'm targeting Cordova, so the less markup/CSS, the better). With any framework, I avoid their JS components and just use the markup/styling. I did try Om-bootstrap (twice actually) and each time I could never get even the most basic examples working, I think it was just too immature back then. When you think about how these frameworks work, often times we can do a lot better using the power of React. For example, consider the ubiquitous drop-down menu. In a framework like Boostrap/Foundation, the implementation is basically the same. The markup is usually a div with 2 inner div's, one for the always-visible part of the menu, and one for the menu itself, which is hidden to start with. The displaying of the menu is usually toggled by adding a CSS class. So while this is easy enough to do in React, another approach that's more Reacty is to only generate the menu markup when it is visible, rather than always creating it and hiding it until needed. That being said, often times I do just use the traditional approach and toggle visibility using styles for one specific reason - animations. There are some libraries for doing animation with React, I just haven't had time to look into them, and it's SOOO easy with CSS, not to mention one of the most common performance tips you see for Cordova is to use CSS animations because they tend to be hardware-accelerated on mobile browsers. So in general, when I need an animated effect for a menu or panel sliding in versus just appearing, I stick with the CSS approach, otherwise I do it the React way and just generate the markup I need for the current application state. 3) JS components - so a lot of those components that come with frameworks can be problematic with React, and like I said before emulating or replacing their functionality is easy to do in a lot of cases. But there are times when you REALLY need to integrate a complex component - a D3 chart, a calendar control, ACE editor, etc. The way you do this with React is to let React create the DOM node for the component, then tell React to forget about it and never update it. Check out this blog from Robert Stuttaford for a great detailed explanation/example - http://www.stuttaford.me/2014/08/10/om-interop-with-3rd-party-libs/ 4) Cross-browser - For the DOM and event stuff, React is the driver here. You would still use the Google Closure library for things like accessing the browser history, AJAX, and there are some nice general utilities in there for stuff like date/time handling. Most of these things have 3rd party libraries available that simply wrap Google Closure, so you can avoid the direct JS interop code. Just don't try to use the Closure library to do stuff that React is in control of. I've never actually tried it, but for example say you grab a ref to a node React manages and then use Closure to register event listeners on it or manipulate it in some way, bad things are bound to happen (at best, React just overwrites all your changes on the next render cycle, at worst ???). 5) IDE - I started using Lighttable and it's still working pretty well for me. It does sometimes crash after several days of heavy