This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-04
Channels
- # aatree (5)
- # admin-announcements (37)
- # alda (1)
- # announcements (4)
- # architecture (1)
- # aws (3)
- # beginners (82)
- # boot (230)
- # braid-chat (14)
- # cider (48)
- # cljs-dev (8)
- # cljsrn (31)
- # clojars (47)
- # clojure (72)
- # clojure-austin (2)
- # clojure-russia (396)
- # clojurescript (72)
- # community-development (3)
- # component (6)
- # core-async (6)
- # cursive (26)
- # datomic (42)
- # emacs (6)
- # events (35)
- # hoplon (57)
- # immutant (3)
- # jobs (2)
- # jobs-discuss (10)
- # ldnclj (16)
- # luminus (2)
- # off-topic (50)
- # om (181)
- # parinfer (285)
- # proton (68)
- # re-frame (19)
- # reagent (2)
- # ring-swagger (23)
- # yada (36)
@artiavis: Haven’t seen plumbing before, sorry. It’s a much more recent piece of software.
I think people rediscover the usefulness of dependency graphs and tend to reinvent them as they go to fit their own needs.
Not sure if this is the correct place to ask this, but would someone be able to get me started with building JOCL on OS X. I’m trying to play around with clojurecl.
does vec
order any of the items before returning the vector?
Is there a way to express a WHERE BINARY
clause with HoneySQL? As in SELECT * FROM foo WHERE BINARY bar = 'x'
?
@tord Not out of the box, but you can register support for your own custom clauses
See https://github.com/jkk/honeysql#extensibility, but there’s also an atom not mentioned there in which the clause rendering order is declared
@donaldball: Yes, I saw that, but it's too much hassle for my present use case (I only need it for a single query). I'll just use plain clojure.jdbc for now. Thanks for your help, anyway!
That's often how this kind of things end up. Unless you need lots of composability it's often faster/easier
I finally figured out how to set a timeout when getting an object from S3 with Amazonica. I posted it here: http://stackoverflow.com/q/35201340/17498
FWIW if it does come up again, you’d probably want to figure out how to apply the BINARY operator to values, not the WHERE clause itself, if I’m reading the mysql docs correctly
I’m trying to eval a thing in a particular *ns*
; the binding
part is easy, but how do I get a reference to a particular ns? clojure.core doesn’t have anything in particular AFAICT
Hello there, QQ: where does randomness come from in Clojure? Is there a PRNG somewhere that acts behind the scenes when you call (rand)?
Ahh, found it. just a call to (. Math (random)) — was hoping to be able to seed the generator somehow
@wunsch: You might be interested in this talk https://www.youtube.com/watch?v=u0t-6lUvXHo
kamn: wunsch: that library is much older; everything in the talk is still embedded in test.check (but can totally be used from there)
@gfredericks: cool thank you! I saw someone else make reference to the test.check prng
I think a solid RNG lib would be nice, but there's enough design questions that I haven't tried to re-tackle it
@gfredericks: Ah sorry. I just did a search of your repos and I didn't remember the talk well enough to realized it was put into text.check(though I do remember why you needed it)
I was surprised. Assumed there was a rand-seed or some other kind of thing i could mutate
wunsch: in "four" or test.check?
@wunsch: I just read the backlog and see that you're not really interested in immutability in particular; I think using java.util.Random is the normal approach
I have a jira ticket somewhere for adding a *rand*
to clojure.core
which would probably be exactly what you want
@gfredericks: yeah that’s what I was thinking. I assumed it would be made available in clojure.core
feel free to upvote that ticket
oh I see there’s https://github.com/clojure/data.generators
java.util.SplittableRandom is probably a better algorithm than java.util.Random, too
@tord you can simply use raw
for stuff like that too, that lets you use HoneySQL without having to write a custom helper
Yeah, I think for my particular purposes I’m less worried about the uh.. purity of the RNG and more concerned with reproducibility
@wunsch: the "four" library linked above has an alternate version of all of clojure's random functions with a background *rand*
: https://github.com/gfredericks/four/blob/master/src/four/stateful.clj
similar to data.generators, though that's oriented toward testing
anyone here using boot? or can give me advice on where i should go to get help with boot?
@pppaul: there is #C053K90BR
Can you overload functions if the paramater changes are more complex than just arity? I.e. I have this “buy” function. https://gist.github.com/heeton/757cc24be75838caea50
It takes nested parameters [app-state [_ item count]]
and I’d like to add a default mode where if the count isn’t specified it defaults to 1.
I don't think you can do it; it's not real pattern matching like in Haskell - there was a discussion about that some time ago and Clojure argument types are either Object
, double
or long
, nothing else. And destructuring only picks an Object
apart appropriately, you can't overload functions using that.
There's also :or
option in pattern matches but unfortunately that only works in maps, as in {a :a b :b :or {a 1 b 2})
, [a b :or {a 1 b 2}]
will compile but just not work a
and b
will always be nil
.
For your use case I propose something like this
(let [[app-state [_ item count]] whatever]
count (or count :default)]
...)
A bit ugly, but will work - if there's not enough elements in whatever
you'll get a nil
and can then or
the value.
You could also consider using core.match
(https://github.com/clojure/core.match) - it has a Haskell-like pattern matching, so you can then discriminate the action taken by pattern.
So that [app-state [_ item]]
will do something different than [app-state [_ item]]
(like do a self-call with the default filled in).
@jaen: Thanks for the explanation! As a beginnger I really appreciate getting the insight
Anyone have suggested readings for learning about the point of vars? I read David Nolen's post and I get the impression that vars are useful because of the indirection they give you between symbols and values. This indirection allows you to house meta-data and redefine stuff for repl-oriented programming.
Is that all they offer? Or am I missing something?
Is the language reference for clojure in http://clojure.org complete?
@currentoor: that's my understanding as well (and IMO it's justification enough), but can't guarantee I might be unaware of some other benefits.
@jaen: I totally agree that those two benefits are enough. I just wasn't sure if I was missing something. Of all the parts of this language I've studied, vars appeared to be one of the most subtle and novel.
symbols existing in their own right seemed wacky also
in a good way ^