Re: too circular?

2013-08-27 Thread Dennis Haupt
thx 2013/8/26 Marshall Bockrath-Vandegrift > Dennis Haupt writes: > > > (defn fib-n [n] > > (let [fib (fn [a b] (cons a (lazy-seq (fib b (+ b a)] > > (take n (fib 1 1 > > > > can't i do a recursion here? how can i achieve this without doing an > > "outer defn"? > > You just need to giv

Re: [ANN] nativot 0.1.0 (leiningen plugin) public beta

2013-08-27 Thread Alex Fowler
Oh right, there is the license hassle. I am going to contact JDotSoft and see if it is possible to make it all more friendly! вторник, 27 августа 2013 г., 4:26:42 UTC+4 пользователь Mikera написал: > > JarClassLoader looks cool > > Aren't there some pretty severe licensing restrictions though? Lo

Re: core.async - handling nils

2013-08-27 Thread Max Penet
It's a real problem for me too, I also wonder what was the intention behind this. I guess there could be a very good reason for this special treatement of nils, but I haven't seen it yet. I would love to hear about this from people involved in core.async development. On Friday, August 16, 201

[ANN] migae-examples: Clojure, servlets, Google App Engine

2013-08-27 Thread Gregg Reynolds
Hi list, migae-examples is a series of examples demonstrating the use of Clojure to implement servlets for both standard servlet containers and Google App Engine. The purpose is not so much to explain how to code as to show what's going on behind the

stringify an interned function

2013-08-27 Thread Erebus Mons
Hello, I am new to clojure, and I am trying to define a function that turns a function-name into a string, but I am stuck. Here is what I tried: user> (defn some-func [] true) I am looking for a function stringify that would do the following user> (stringify some-func) "some-func" I

Re: stringify an interned function

2013-08-27 Thread Jim
On 27/08/13 10:39, Erebus Mons wrote: I am looking for a function stringify that would do the following user> (stringify some-func) "some-func" (-> #'some-func meta :name str) (defn stringify [func] (-> func var meta :name str)) Jim -- -- You received this message becau

Re: stringify an interned function

2013-08-27 Thread Jim
On 27/08/13 13:13, Jim wrote: (defn stringify [func] (-> func var meta :name str)) I'm sorry this won't work...try this: (defn stringify [fvar] (-> fvar meta :name str)) and pass in the var object like this: (stringify (var some-func)) OR (stringify #'some-func) btw,

Re: stringify an interned function

2013-08-27 Thread Jim
or convert it to a macro and it should work as you hoped :) (defmacro stringify [f] `(-> ~f var meta :name str)) HTH, Jim On 27/08/13 13:26, Jim wrote: On 27/08/13 13:13, Jim wrote: (defn stringify [func] (-> func var meta :name str)) I'm sorry t

Re: core.async - handling nils

2013-08-27 Thread Timothy Baldridge
The reason for not allowing nils isn't a complex one, and basically boils down to the following: a) to avoid race conditions, we need a single value to signal "the channel is closed". As mentioned, nil is the obvious choice for this as it matches lazy seqs and fits well with the rest of clojure:

Re: stringify an interned function

2013-08-27 Thread Erebus Mons
Jim wrote: > or convert it to a macro and it should work as you hoped :) > > (defmacro stringify [f] >`(-> ~f > var > meta >:name > str)) > > HTH, Cool! That is exactly what I was looking for! Best, EM > > Jim > > > On 27/08/13 13:26, Jim wrote: >> On

profiler?

2013-08-27 Thread Jay Fields
What are you all using these days? I've been using YourKit and I'm fairly happy with it. Just making sure I'm not missing out on some new hotness. Cheers, Jay -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

Re: profiler?

2013-08-27 Thread Dennis Haupt
yep, yourkit 2013/8/27 Jay Fields > What are you all using these days? I've been using YourKit and I'm > fairly happy with it. Just making sure I'm not missing out on some new > hotness. > > Cheers, Jay > > -- > -- > You received this message because you are subscribed to the Google > Groups "C

Re: profiler?

2013-08-27 Thread Jim
On 27/08/13 15:06, Jay Fields wrote: What are you all using these days? I've been using YourKit and I'm fairly happy with it. Just making sure I'm not missing out on some new hotness. Cheers, Jay I used to use JVisualVM and Jconsole but for some reason both stopped working when I updated to

Re: profiler?

2013-08-27 Thread Ben Mabey
On 8/27/13 8:06 AM, Jay Fields wrote: What are you all using these days? I've been using YourKit and I'm fairly happy with it. Just making sure I'm not missing out on some new hotness. Cheers, Jay YourKit plus VisualVM in some cases (I'm not as familiar w/YourKit and I really like the VisualGC

Re: core.async - handling nils

2013-08-27 Thread Mike Anderson
On 27 August 2013 20:45, Timothy Baldridge wrote: > The reason for not allowing nils isn't a complex one, and basically boils > down to the following: > > a) to avoid race conditions, we need a single value to signal "the channel > is closed". As mentioned, nil is the obvious choice for this as i

Re: core.async - handling nils

2013-08-27 Thread Timothy Baldridge
All your arguments come down to this: "I have an arbitrary seq of things I want to send down a channel". It's exactly that concept I that I push against. Everything you've mentioned thus far is a data structure. Channels are not data structures they are concurrency management primitives, treat the

Re: core.async - handling nils

2013-08-27 Thread David Nolen
On Tue, Aug 27, 2013 at 10:51 AM, Mike Anderson < mike.r.anderson...@gmail.com> wrote: > To me it's all about consistency with other Clojure constructs. You can > safely put nils in sequences, vectors, lists, sets etc.. nil is a valid > "value" just like anything else. So why can't you put them in

Re: core.async - handling nils

2013-08-27 Thread Brandon Bloom
> In every use of channels I've had thus far, nil is better expressed as an empty collection, false, 0, :tick, or some other "ground value". I agree completely. But I'll note that you mention false being useful... If you're writing completely general operators, like map, which are *sometimes* qui

Re: core.async - handling nils

2013-08-27 Thread Timothy Baldridge
Right, the use of false is a special case. I'm thinking of a mouse event stream, may have a button channel that sends true or false based on the state of the mouse button. Even saying that though, I would probably opt for :clicked and :unclicked or somethig of that nature. Timothy On Tue, Aug 27

Re: core.async - handling nils

2013-08-27 Thread Softaddicts
+1 We built a distributed software sending/receiving *messages* based on different protocols. All our protocols wrap data in an envelope. The receiver can then decide how to handle the message based on the envelope. Obviously, nil makes a bad envelope. A nil message on a channel never had any

Rxjava + Clojure Users

2013-08-27 Thread Dave Ray
Hi. I'm writing to see if there's anyone out there using RxJava [1] from Clojure and to get their opinion on it's current, built-in support for non-Java languages. Just to recap, the current implementation knows about clojure.lang.IFn allowing functions to be passed directly to RxJava methods:

Re: core.async - handling nils

2013-08-27 Thread Ben Wolfson
On Tue, Aug 27, 2013 at 7:51 AM, Mike Anderson wrote: > On 27 August 2013 20:45, Timothy Baldridge wrote: > >> The reason for not allowing nils isn't a complex one, and basically boils >> down to the following: >> >> a) to avoid race conditions, we need a single value to signal "the >> channel i

Heroku app using core.async?

2013-08-27 Thread Bastien
Hi, I just managed to use core.async for the need I described in my previous email and tried to push this to heroku, but git bitten: Could not find artifact core.async:core.async:jar:0.1.0-SNAPSHOT in clojars (https://clojars.org/repo/) Could not find artifact core.async:core.async:jar:0.1

Re: Rxjava + Clojure Users

2013-08-27 Thread Ben Mabey
On 8/27/13 10:03 AM, Dave Ray wrote: Hi. I'm writing to see if there's anyone out there using RxJava [1] from Clojure and to get their opinion on it's current, built-in support for non-Java languages. Just to recap, the current implementation knows about clojure.lang.IFn allowing functions

Re: core.async - handling nils

2013-08-27 Thread Brandon Bloom
As long as we don't go full Haskell mode: data Message a = Value a | Done On Tue, Aug 27, 2013 at 11:20 AM, Timothy Baldridge wrote: > Right, the use of false is a special case. I'm thinking of a mouse event > stream, may have a button channel that sends true or false based on the > state of th

Re: Heroku app using core.async?

2013-08-27 Thread Shaun Gilchrist
Hey, I encountered late one night but it was because oss.sonatype.org was temporarily down for scheduled maintenance. Are you still seeing this now? I just pushed to heroku and saw it pull the core.async dep as expected: "Retrieving org/clojure/core.async/0.1.0-SNAPSHOT/core.async-0.1.0-20130827.0

Re: Heroku app using core.async?

2013-08-27 Thread Bastien
Hi Shaun, Shaun Gilchrist writes: > Hey, I encountered late one night but it was because oss.sonatype.org > was temporarily down for scheduled maintenance. Are you still seeing > this now? I just pushed to heroku and saw it pull the core.async dep > as expected: > > "Retrieving org/clojure/core.

Re: core.async - handling nils

2013-08-27 Thread Mike Anderson
I still don't see why you would want to to arbitrarily limit what you can put down a channel. FWIW, plenty of other concurrency management primitives allow nils as values (java.util.concurrent.AtomicReference, Clojure atoms / refs / agents to name but a few). My motivating use case is the ability

eval/macros with functions with metadata

2013-08-27 Thread Ben Wolfson
or, the dreaded "no matching ctor found" exception. Is there a way to write the function (defn eval-at-one [f] (eval `(~f 1))) such that it works when invoked like this: (eval-at-one (fn [x] x)) ;; --> 1 and like this (eval-at-one (with-meta (fn [x] x) {})) ;; -> IllegalArgumentException No

Re: core.async - handling nils

2013-08-27 Thread guns
On Wed 28 Aug 2013 at 09:38:06AM +0800, Mike Anderson wrote: > Of course, if anyone has an actual technical argument why it is > necessary/better to use nil as a sentinel value, I would be delighted to > learn of it and would consider myself enlightened. Forgive me if someone already mentioned th

Re: core.async - handling nils

2013-08-27 Thread Mikera
Well, that's certainly a good explanation of why core.async works the way it does now - it's a natural and sensible starting point to build on Java Queues. I don't think that this necessarily implies that we have to follow this model in the future Clojure API though. The Java designers didn't a

Can you explain the result of a expression?

2013-08-27 Thread ljcppunix
Hi, (take 1 (map #(do (print \.) %) (range))) result: (0) I think it should be (.0), why? thank you! -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com

Re: Can you explain the result of a expression?

2013-08-27 Thread Dave Sann
chunked lazy sequences On Wednesday, 28 August 2013 12:51:27 UTC+10, ljcp...@gmail.com wrote: > > Hi, > > (take 1 (map #(do (print \.) %) (range))) > result: (0) > > I think it should be (.0), why? thank you! > > -- -- You received this message because you are su

Easiest way to map over leaf nodes of nested sequence

2013-08-27 Thread JvJ
I feel like this question has been asked about a trillion times, but I was having a hard time finding a straight answer. Is there a really straightforward way in the standard library or in one of the contrib libraries to do something like this: (nested-map inc '(1 (2 3) (4 (5 (6) ===> '(2 (

Re: Easiest way to map over leaf nodes of nested sequence

2013-08-27 Thread Gary Fredericks
Clojure.walk On Aug 27, 2013 10:05 PM, "JvJ" wrote: > I feel like this question has been asked about a trillion times, but I was > having a hard time finding a straight answer. Is there a really > straightforward way in the standard library or in one of the contrib > libraries to do something li

Re: core.async - handling nils

2013-08-27 Thread guns
On Tue 27 Aug 2013 at 07:42:53PM -0700, Mikera wrote: > On Wednesday, 28 August 2013 09:54:51 UTC+8, guns wrote: > > > > On Wed 28 Aug 2013 at 09:38:06AM +0800, Mike Anderson wrote: > > > > > Of course, if anyone has an actual technical argument why it is > > > necessary/better to use nil as a sen

Re: Easiest way to map over leaf nodes of nested sequence

2013-08-27 Thread JvJ
I suppose that works, but it seems a little inelegant to do this: (prewalk #(if (sequential? %) % (f %)) xs) instead of just (prewalk f xs) On Tuesday, 27 August 2013 20:06:38 UTC-7, gfredericks wrote: > > Clojure.walk > On Aug 27, 2013 10:05 PM, "JvJ" > wrote: > >> I feel like this question has b

Re: core.async - handling nils

2013-08-27 Thread Alan Busby
On Wed, Aug 28, 2013 at 12:18 PM, guns wrote: > Oh, I was confused; I was thinking about sentinel values in user code. > Yes, I imagine a single private (Object.) would work just fine, with > very little overhead. > First, I'd hope that sentinel values would be handled by the back-end implementa

Re: core.async - handling nils

2013-08-27 Thread guns
On Wed 28 Aug 2013 at 12:50:19PM +0900, Alan Busby wrote: > On Wed, Aug 28, 2013 at 12:18 PM, guns wrote: > > > Oh, I was confused; I was thinking about sentinel values in user > > code. Yes, I imagine a single private (Object.) would work just > > fine, with very little overhead. > > Third, I'd

Re: core.async - handling nils

2013-08-27 Thread Mike Anderson
On 28 August 2013 11:50, Alan Busby wrote: > On Wed, Aug 28, 2013 at 12:18 PM, guns wrote: > >> Oh, I was confused; I was thinking about sentinel values in user code. >> Yes, I imagine a single private (Object.) would work just fine, with >> very little overhead. >> > > First, I'd hope that sent