Fork me on GitHub
#clojure
<
2016-02-04
>
jjttjj00:02:00

@danielsz cool. thanks for system by the way :)

jjttjj00:02:58

@jaen awesome, thanks!

danielsz00:02:48

FYI, system now has the Duct abstractions.

gcv00:02:23

@artiavis: Haven’t seen plumbing before, sorry. It’s a much more recent piece of software.

gcv00:02:00

I think people rediscover the usefulness of dependency graphs and tend to reinvent them as they go to fit their own needs. simple_smile

artiavis00:02:19

@gcv: definitely agree with you on the pervasive usefulness of dependency graphs.

o-i01:02:21

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.

jethroksy05:02:22

Is there a way to "close" a manifold.deferred loop prematurely?

chrisetheridge07:02:59

does vec order any of the items before returning the vector?

tord12:02:51

Is there a way to express a WHERE BINARY clause with HoneySQL? As in SELECT * FROM foo WHERE BINARY bar = 'x'?

donaldball13:02:00

@tord Not out of the box, but you can register support for your own custom clauses

donaldball13:02:05

See https://github.com/jkk/honeysql#extensibility, but there’s also an atom not mentioned there in which the clause rendering order is declared

tord13:02:18

@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!

mpenet13:02:11

That's often how this kind of things end up. Unless you need lots of composability it's often faster/easier

ljosa15:02:34

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

donaldball16:02:20

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

lvh18:02:20

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

wunsch18:02:14

Hello there, QQ: where does randomness come from in Clojure? Is there a PRNG somewhere that acts behind the scenes when you call (rand)?

wunsch18:02:42

Ahh, found it. just a call to (. Math (random)) — was hoping to be able to seed the generator somehow

wunsch19:02:38

Thank you!

kamn19:02:53

I think this is a library he made based on that talk but I have not used it myself

wunsch19:02:26

@kamn: cool will def. check both out

wunsch19:02:07

lol like the reference there

gfredericks19:02:27

kamn: wunsch: that library is much older; everything in the talk is still embedded in test.check (but can totally be used from there)

wunsch19:02:59

@gfredericks: cool thank you! I saw someone else make reference to the test.check prng

gfredericks19:02:03

I think a solid RNG lib would be nice, but there's enough design questions that I haven't tried to re-tackle it

kamn19:02:22

@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)

wunsch19:02:38

I was surprised. Assumed there was a rand-seed or some other kind of thing i could mutate

wunsch19:02:07

er *rand-seed*

gfredericks19:02:36

wunsch: in "four" or test.check?

gfredericks19:02:26

@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

gfredericks19:02:45

I have a jira ticket somewhere for adding a *rand* to clojure.core

gfredericks19:02:58

which would probably be exactly what you want

wunsch19:02:45

@gfredericks: yeah that’s what I was thinking. I assumed it would be made available in clojure.core

gfredericks19:02:56

feel free to upvote that ticket simple_smile

wunsch19:02:49

cool thank you!

gfredericks19:02:21

java.util.SplittableRandom is probably a better algorithm than java.util.Random, too

ddellacosta19:02:32

@tord you can simply use raw for stuff like that too, that lets you use HoneySQL without having to write a custom helper

wunsch19:02:27

Yeah, I think for my particular purposes I’m less worried about the uh.. purity of the RNG and more concerned with reproducibility

wunsch19:02:37

If that makes sense, but this is also my first time coming across SplittableRandom

wunsch19:02:43

Looking forward to digesting all of this material

gfredericks19:02:58

@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

wunsch19:02:14

Yeah will take a closer look

gfredericks19:02:15

similar to data.generators, though that's oriented toward testing

pppaul20:02:42

anyone here using boot? or can give me advice on where i should go to get help with boot?

martinklepsch20:02:20

@pppaul: there is #C053K90BR simple_smile

pppaul20:02:38

thanks, didn't notice it simple_smile

heeton22:02:40

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.

jaen22:02:37

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.

jaen22:02:04

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.

jaen22:02:54

For your use case I propose something like this

(let [[app-state [_ item count]] whatever]
      count (or count :default)]
  ...)

jaen22:02:23

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.

jaen22:02:13

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.

jaen22:02:55

So that [app-state [_ item]] will do something different than [app-state [_ item]] (like do a self-call with the default filled in).

heeton22:02:02

@jaen: Thanks for the explanation! As a beginnger I really appreciate getting the insight

jaen22:02:39

Sure, no problem. Hopefully I didn't mess something up : )

currentoor22:02:03

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.

currentoor22:02:14

Is that all they offer? Or am I missing something?

lockdown23:02:45

Is the language reference for clojure in http://clojure.org complete?

jaen23:02:59

@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.

currentoor23:02:21

@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.

currentoor23:02:12

symbols existing in their own right seemed wacky also

currentoor23:02:28

in a good way ^

jaen23:02:55

Well, I wouldn't call them 100% novel, you have reference types in other languages, but them being reified an accessible to the end user (to say, hang the metadata on or rebind on a per thread basis) is certainly an interesting aspect.