Fork me on GitHub
#clojure
<
2015-07-30
>
bmay00:07:24

emacs + cider autocomplete is acting up

bmay00:07:27

how can i disable it?

nullptr01:07:10

bmay: M-x company-mode

nullptr01:07:34

or M-x autocomplete-mode if you use that

Pablo Fernandez09:07:47

Is anybody using any error reporting service, like bugsnag, airbrake, etc with Clojure?

franziska09:07:46

yea, we use bugsnag.

leonoel10:07:41

is there a rationale behind contains? on transients not working with clojure but working with clojurescript ?

tcrayford10:07:41

@pupeno: @franziska shameless plug: Yeller's an error reporting service (that I built/run) written in (and for) Clojure: http://yellerapp.com

Pablo Fernandez10:07:48

tcrayford: I’ll check it out.

tcrayford11:07:58

let me know if you need anything - I'm the founder/CEO/only dev/ops person/marketing/sales/accounting, everything (the company is just me right now), always happy to help

tcrayford11:07:02

</shamless plug>

meow13:07:52

I worked up an example of a somewhat clever use of transducers. At least I thought it was clever. I'm trying to create a canonical example of the Sieve of Eratosthenes using channels. Check it out: https://github.com/clojure/core.async/wiki/Sieve-of-Eratosthenes

meow13:07:28

I start to get Stack Overflow Errors when I increase it to (time (consume 7000 (chan-of-primes)))

wilkerlucio13:07:49

hello friends, do you remember that name that we give to that type of initialisation function that can be called safely multiple times, I remember is something around "indepodent", but I think I'm writing it wrong

rickmoynihan14:07:56

Does anyone know how to specify your own private :repositories profile, whilst also ensuring s3-wagon-private is available as a plugin with leiningen? I'm having real problems as it seems things like the lein install and the lein deps subtask; don't merge those keys of your profile in -- which means private dependencies I have deployed on S3 aren't being picked up

meow15:07:44

I need to comp transducers in a recursive loop without blowing the stack. Any suggestions?

gtrak15:07:42

a transducer trampoline?

stuartsierra15:07:35

@meow: I'm not sure it's possible. Transducers use the stack. You can't compose them to arbitrary depth. It would be the same problem with any kind of function.

stuartsierra15:07:33

It's a fundamental limitation of code-generation via composition in a runtime without tail-call stack elimination.

meow15:07:25

@stuartsierra: thanks for the tips

gtrak15:07:25

mind you, I have no idea what that entails 😉

meow15:07:38

I think something simpler might do.

meow15:07:59

this is the code: new-xf (comp cur-xf (filter #(not= 0 (mod % prime))))

meow15:07:30

so I'm thinking if I just accumulate a set of primes to test mod against...

meow15:07:43

then the xform isn't based on comp, it just filters against the growing list of previous primes

spinningarrow15:07:30

Is there a clojure function that takes a function and something else as arguments, and calls the function on the something else?

spinningarrow15:07:16

like apply, but instead of taking a list of args as the second argument, it takes in only one value

stuartsierra15:07:05

(fn [f x] (f x)) ?

spinningarrow16:07:16

@stuartsierra: yes, exactly that! is there a builtin function that does that?

spinningarrow16:07:03

very definitive. thanks!

stuartsierra16:07:12

You're welcome simple_smile

spinningarrow16:07:00

what I’m trying to figure out is, if there's a condp that looks like this:

(condp #(%1 %2) x
  zero? “it’s a zero!”
  nil? “it’s nil!”)
is there something better than the #(%1 %2)?

stuartsierra16:07:49

I would probably just write normal cond and call the functions.

rauh16:07:03

@spinningarrow: There is a few people who wrote themselves a condp->

spinningarrow16:07:09

@stuartsierra: fair enough I suppose. Just trying to explore different ways of writing code and seeing what looks more expressive simple_smile

spinningarrow16:07:26

@rauh: that sounds interesting - anywhere I can take a look?

spinningarrow16:07:58

^ cool, thanks!

chris16:07:34

How do I iterate through a range without creating a list? for example, say I just want to print out all the numbers from 1 to 10000000 but I don’t need that list for anything, and I don’t want it in memory.

potetm16:07:00

@chris: range is lazy. It doesn’t hold anything in memory unless you keep a reference to the head of the list.

potetm16:07:00

So

(doseq [i (range 0 100)]
  (println i))
does what you want.

potetm16:07:54

Though there’s also dotimes if you want to explicitly do something with a counter and that’s it.

fhanreich16:07:53

or (lazy-seq (your-custom-fn-that-returns-10000000-items)) ?

chris16:07:49

ok, thanks

meow18:07:39

@gtrak @stuartsierra @rauh - I think I have a decent implementation now without blowing the call stack: https://github.com/clojure/core.async/wiki/Sieve-of-Eratosthenes

ordnungswidrig19:07:04

@meow: I think you can replace the chan-of-ints with a prime wheel: https://wiki.haskell.org/Prime_numbers_miscellaneous#Prime_Wheels

meow19:07:38

@ordnungswidrig: I don't know haskell so I might be missing something, but it seems like this might fall into the category of "there are much better ways of calculating primes than using channels."

meow19:07:45

If not, you'll have to give me a more specific suggestion. The code I've written is intentionally contrived and is using channels just because it can, not because it's the best way to find primes.

meow19:07:10

Also, Rob Pike did it so we should do it, too, only in Clojure. 😉

meow19:07:16

But if you've got an improvement that still uses channels I'd love to hear it. @rauh has suggested using a more general stateful transducer that uses volatile! which is new to me so I need to take a break and then learn about that.

rauh19:07:05

@meow: You could substitute the volatile with a simple atom. It'd just be tiny bit slower.

meow19:07:42

@rauh: that's what I figured, but I still want to learn about volatiles

bronsa19:07:02

@rauh what's the point of using an atom if a volatile suffices?

meow19:07:08

and get my head around stateful transducers

rauh19:07:48

@bronsa: No point doing that. simple_smile It was just an example

bronsa19:07:02

ah ok, I misunderstood you then, sorry simple_smile

ordnungswidrig19:07:28

@meow: oh, the idea is not to sieve every number (chan-of-ints) but only the odd numbers, or better, every number of the form 6k+1 and 6k-1

voxdolo20:07:16

Can anyone point me to how to run a repl using a standalone uberjar I've built from my app?

voxdolo20:07:28

trying to figure out a resource access issue that I'm only seeing in the built jar

voxdolo20:07:02

just figured it out simple_smile thanks @rauh!

noisesmith20:07:19

it can be done without nrepl too

noisesmith20:07:41

java -cp your.uber.jar clojure.main

voxdolo20:07:40

oh, interesting. I just ended up running java -jar your.uber.jar and it seems to behave as I'd expect it to

voxdolo20:07:54

(felt pretty dumb after trying that and it just worked)

malabarba21:07:07

I'm using :gen-class in one of my namespaces, and I'm trying to use that class in other files

malabarba21:07:20

But I keep getting classNotFound exceptions

malabarba21:07:27

am I doing something stupid here?

malabarba21:07:35

(btw, Hi everyone :))

lvh21:07:42

Why would lein with-profiles dev pprint show dependencies that lein with-profiles dev deps :tree doesn’t?

voxdolo21:07:28

malarba: off chance, but did you require and import it? have to have the naked require or the import won't work.

voxdolo21:07:09

lvh: I'd expect that to be the other way around, with deps :tree showing more (since it includes surrogate dependencies)

malabarba21:07:27

voxdolo: Hm, no I just imported it as part of the ns

malabarba21:07:35

I'll try requiring

voxdolo21:07:56

that should clear it up… that's caused me some heartache working on java integrations before

voxdolo21:07:19

s/puredanger/alexmiller/

voxdolo21:07:35

and actually, this more closely resembles what you're seeing (for the same reasons): http://kotka.de/blog/2009/11/The_Missing_Class_Phenomenon.html

malabarba21:07:02

Requiring worked!

voxdolo21:07:06

sweet 😄

malabarba21:07:09

I'm reading that stuff now

meow22:07:27

@ordnungswidrig: Thanks for the info on wheels. I'll keep it in mind. simple_smile