This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-13
Channels
- # admin-announcements (208)
- # beginners (53)
- # boot (46)
- # cider (10)
- # cljs-dev (26)
- # cljsjs (10)
- # clojure (66)
- # clojure-dev (3)
- # clojure-russia (14)
- # clojurecup (5)
- # clojurescript (302)
- # cursive (22)
- # data-science (1)
- # datomic (10)
- # emacs (1)
- # events (2)
- # hoplon (91)
- # incanter (1)
- # ldnclj (3)
- # leiningen (1)
- # off-topic (2)
- # om (41)
- # re-frame (40)
- # reagent (78)
@misha I doubt it but wrapping with your own factory function is really not hard :)
How do I make figwheel pick up my custom ring handler?
When trying to run lein release, I’m getting this error: java.lang.Exception: Couldn't commit. git exit code: 1
Anybody seen it before? I don’t know why it can’t commit, but also, there’s nothing to commit.
@val_waeselynck: the whole point is to keep the factory-fn name. Of course I can create unlimited factories with the names different from ->User
, but my snippet above throws ArityException
(defn ->User
([email name]
{:email email :name name})
([email]
(->User email nil)))
does it, but I was wondering whether there is a way to extend existing function's arity w/o rewriting it@misha I'd recommend using (map->User {:email ...})
since you can name arguments, the ->User
factory fn is based on ordering and (->User name)
will yield problems while (map->User {:name ...})
just works
@thheller: one of the points of records - some shortcut when it comes to building one : ), so for 1-3 fields I'd rather use ->factory-fn, than map-> fn. For larger records – map->
is the way to go for sure.
@sveri : my question is that in this html template a lot of <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
, <li><a href="//laboutique.lemonstand.com/login" title="Login / Register">Login / Register</a></li>
and <img src="//d151ufcidijoq9.cloudfront.net/store-ctymko-test-52d08555555ba/themes/la-boutique-2ndreview/resources/images/logo.png" alt="La Boutique" />
are used and I cannot find it how to make these tags work on my selmer template
i'm totally lost:
boot.user=> (def ^:dynamic x nil)
#'boot.user/x
boot.user=> (binding [x 1] (println x))
1
nil
boot.user=> (binding [x 1] (for [i (range 2)] (println x)))
nil nil
(nil nil)
The for
is in the scope of the binding, but the part when REPL prints the list - is not. And you get the root value.
@misha your last snippet will create hash-maps, not records. I would use something like:
(def ->User
(let [old-fn ->User]
(fn
([email name] (old-fn email name))
([user] (->User user nil)))
))
but I'd totally prefer map->User
indeed
Hi! I'm building a plugin system. Having problems understanding ns
and what functions are available to call at what times. Specifically, since I am getting Caused by: java.lang.RuntimeException: Unable to resolve symbol: str in this context
.
The load-package!
functions looks like this
(defn load-package!
"Loads a ns at file-path, and return its ns declaration"
[file-path]
{:pre [string?]}
(load-file file-path)
(let [ns (clojure.tools.namespace.file/read-file-ns-decl file-path)]
(println (str "Initializing package: " (second ns)))
(require (second ns))
ns))
My question is: how can I have the standard library available in the packages? And how can I make it so that packages can require
my programs core
namespace? (`rad.core` in this case)
clojure.tools.namespace.file/read-file-ns-decl
returns a normal ( )
unevaluated list, where the first symbol is ns
. Code as data, etc...
Anyone have an elegant approach to the manipulation of a normalized value? For example, I have a function that receives normalized values between 0.0 and 1.0 that I want to use as args to some other function but I want to feed the other function values between say 0.3 and 0.9.
I could use some min/max for clamping, but I really want to change the scale so I still get the same spread of values, if that makes sense.
Similarly, I'd like to be able to shift values as if they circled around. So for that I could add some offset value, like 0.25, and then do (mod val 1)
so that it wraps around...
@jaen: because I'm tired and was thinking maybe there was a generalized need for this kind of thing that I could get some ideas from.
If it's supposed to be generalised then I guess the value would need to tag it's limits around so you could manipulate them. But this would be relatively slow (couldn't be unboxed), so that's probably a bad idea.
I'm doing color manipulations where the hue, saturation and value must all be provided as normalized values. I'm determining them using characteristics of polygons that I've also got in normalized form, like the face normal. But I don't want to make use of the whole range of saturation, for example, because at the extremes the color is no longer interesting.
Hey all, does anyone know which profile lein new
runs as? I'm trying to track down why a project has been built from a development version of a template
Then hmmm, maybe some sort of composable generators? So you could create a generator, compose it with things like scale, shift, clamp, and so on and then call the resulting function to obtain a value?
I was thinking this might be typical of some more generalized need to modify normalized values.
@jaen: Yeah, I'm trying to be creative so composable functions, or a transducer type approach would be nice.
nvm, it seems that it was just because the template had been locally installed
@ikitommi: Sorry for the delayed response, but your suggestion of using defroutes*
worked perfectly. I'm now using this:
(context* "/api" []
(context* "/users" []
users-routes) ; as defined in a different namespace
(context* "/videos" []
videos-routes))
this might be what I want: https://github.com/pleasetrythisathome/bardo
@meow: hope it's useful! let me know how it goes
i've been thinking of adding some more functionality for combining interpolators and general helpers to make things a little higher level
but have been really busy
@pleasetrythisathome: do you think it will be a good fit for what I'm trying to do?
no prob. let me know if i can help with understanding anything
looking awesome!
there's an example on extending to garden to do more complex blending
https://github.com/pleasetrythisathome/bardo/blob/master/examples/garden.cljx
garden's color stuff is pretty solid, + more complex interpolators and you should be able to do pretty much anything
Oh, nice. I'm using Karsten's http://thi.ng color library, but it will be easy to use your example there as well.
silver version looks rad!