Re: idiomatic extension to -> / --> ?

2014-01-18 Thread Jordan Berg
You can also use as-> in 1.5+ (-> 2 (+ 2) (as-> x (* 1 x 3))) I like this a bit more than the (#()) approach, personally On Sat, Jan 18, 2014 at 12:07 AM, Alex Baranosky wrote: > What I think is the interesting part of the question is the inclusion of the > word "idiomatic". I'm not sur

Re: [ANN] com.stuartsierra/frequencies "0.1.0"

2014-01-26 Thread Jordan Berg
Actually looks like Stuart ended up doing a non-SNAPSHOT release of 0.1.0 after the announcement based on the github README. On Sun, Jan 26, 2014 at 1:19 PM, Michael Klishin wrote: > > 2014-01-27 Mimmo Cosenza > >> You could clone and deploy it yourself into clojars. The only caveat is to >> giv

Re: Solving allocation problems; code review and core.logic

2014-03-05 Thread Jordan Berg
Sounds like you might be able to model it as a knapsack problem with budgets as weights and scores as values. For a little intuition into what will happen, consider a greedy algorithm to solve the knapsack. Assuming that the individual budgets are relatively small compared to the total budget the

Re: Closure Accordion Widget

2012-11-26 Thread Jordan Berg
If you do decide you are interested in a non-Jquery solution, I think that you could probably combine a few animated zippys[1] to get the same functionality as an accordion with a little additional CLJS code. [1] http://closure-library.googlecode.com/svn/docs/class_goog_ui_AnimatedZippy.html On

Re: n00b question on embedded defrecord

2012-12-09 Thread Jordan Berg
On Sun, Dec 9, 2012 at 4:45 PM, mond wrote: > ; I have these records defined > > (defrecord Customer [firstName lastName emailAddress deliveryAddress > invoiceAddress]) > (defrecord Address [street number town postcode]) > This looks fine > > ; I have this small sample data > (def customers >

Re: CLJS: undefined and nil are "equally" nil?

2013-01-14 Thread Jordan Berg
I find this to be useful: cljs.user> (nil? (.-key (js-obj))) true I like not having to use undefined? for this On Tue, Jan 15, 2013 at 1:08 AM, Frank Siebenlist < frank.siebenl...@gmail.com> wrote: > ClojureScript:cljs.user> (def a nil) > nil > ClojureScript:cljs.user> (def b) > > ClojureScrip

Re: Help with Clojurescript + DOM Manipulation

2013-01-25 Thread Jordan Berg
You use this-as: (this-as thisname (whatever thisname)) where you name this what you want with thisname Cheers On Fri, Jan 25, 2013 at 1:46 PM, Ari wrote: > Additionally, ".each()" is another option -- > > (defn listen-to-links > [links] > (.each links > (fn [idx, el] >

Re: String interpolation in ClojureScript

2013-02-08 Thread Jordan Berg
js* is used internally in cljs to implement some operators and the interpolation helps there. I don't think js* is really meant to be used too much outside of core. Any reason to not just use str? (def x "david") (str "hello " x) 2013/2/8 > Why does ClojureScript support string interpolatio

Re: String interpolation in ClojureScript

2013-02-08 Thread Jordan Berg
t; > On Feb 8, 2013, at 1:56 PM, Jordan Berg wrote: > > js* is used internally in cljs to implement some operators and the > interpolation helps there. I don't think js* is really meant to be used > too much outside of core. Any reason to not just use str? > > (def x

Re: String interpolation in ClojureScript

2013-02-08 Thread Jordan Berg
Just got a chance to test it from clojurescript and seems to work (only tested the examples from the docstring). Guess that is the nice part of macros working from clojure. Cheers 2013/2/8 Jordan Berg > That is pretty cool, hadn't seen that before. > > > 2013/2/8 David S

Re: Easier imperative-style programming

2013-02-11 Thread Jordan Berg
I think cond-> would work well https://github.com/clojure/clojure/blob/master/changes.md#24-new-threading-macros On Mon, Feb 11, 2013 at 3:10 PM, JvJ wrote: > I'm writing a simple game engine in Clojure, and each game object supplies > its own unique update function, which takes the original o

Re: help make a macro that takes an input and will evaluate only the unquoted parts

2013-02-19 Thread Jordan Berg
Not sure if it is exactly what you are looking for, but that looks fairly similar to how string interpolation works: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/strint.clj Maybe you can somehow make that work for you? On Tue, Feb 19, 2013 at 1:35 PM, AtKa

Re: Clojurescript and google closure library versions?

2011-12-22 Thread Jordan Berg
I changed the curl command in the bootstrap script locally to download r1376 since the day google released it, and I haven't had a problem since. Not sure if there is an official reason for not switching over yet though. Jordan On Tue, Dec 20, 2011 at 9:42 AM, Dave Sann wrote: > Hi all, > > Do

Re: for behavior difference between clojure and clojurescript?

2012-02-29 Thread Jordan Berg
Hi, You should be using == for comparison between numbers. (for [a [0 1] b [0 1] :when (not (== 0 a b))] [a b]) has the same results between clojure and clojurescript. Cheers, Jordan On Wed, Feb 29, 2012 at 5:36 PM, Benjamin Peter wrote: > Hello, > > when I was trying to port

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-23 Thread Jordan Berg
It would be straightforward in clojurescript as well. Google provides a bunch of different tooltips in the closure library: http://closure-library.googlecode.com/svn/docs/class_goog_ui_Tooltip.html http://closure-library.googlecode.com/svn/docs/class_goog_ui_AdvancedTooltip.html http://closure-