Re: Attractive examples of function-generating functions

2012-08-08 Thread Ben Mabey

On 8/8/12 10:48 AM, Brian Marick wrote:

I'm looking for medium-scale examples of using function-generating functions. 
I'm doing it because examples like this:

(def make-incrementer
  (fn [increment]
(fn [x] (+ increment x

... or this:

(def incish (partial map + [100 200 300]))

... show the mechanics, but I'm looking for examples that would resonate more 
with an object-oriented programmer. Such examples might be ones that close over 
a number of values (which looks more like an object), or generate multiple 
functions that all close over a shared value (which looks more like an object), 
or use closures to avoid the need to have some particular argument passed from 
function to function (which looks like the `this` in an instance method).

Note: please put the flamethrower down. I'm not saying that "looking like 
objects" is the point of higher-order functions.

I'll give full credit.



Oh, I have the perfect one that I actually had to write the other day.  
(The funny thing was that I wrote the exact same functionality in Ruby 
several years ago.. I like the clojure version much better).  I'll let 
the code and midje facts speak for themselves:


;; some context: http://en.wikipedia.org/wiki/Urn_problem
(defn urn
  "Takes a coll of pairs representing a distribution with keys being 
the probability of the corresponding values.


Returns a function that when called will return a random value based on 
that distribution.


Example:

 (def multimnomial-urn (urn [[0.3 :red] [0.5 :black] [0.2 :green]]))

 (take 5 (repeatedly multimnomial-urn)) => [:red :black :black :red :green]
"
  [dist]
  {:pre [(= 1.0 (reduce + (map first dist)))]}
  (let [range-dist (last (reduce (fn [[total pseudo-cdf] [percent val]]
   (let [new-total (+ percent total)]
 [new-total (assoc pseudo-cdf 
new-total val)]))

 [0.0 (sorted-map)]
 dist))]
(fn []
  ;; TODO: use a better PRNG
  (let [rn (rand)]
(val (find-first #(< rn  (key %)) range-dist))

;;; test code
(ns foo.core-test
  (:use midje.sweet
foo.core
[useful.map :only [map-vals]]))

(defn ratios [m]
  (let [freqs (frequencies m)
total (reduce + (vals freqs))]
(map-vals freqs #(/ % total

(defn percentages [m]
  (-> m ratios (map-vals double)))

(facts "'#urn"
  (let [rand-key (urn [[0.3 :foo] [0.7 :bar]])]
(percentages (repeatedly 100 rand-key)) => (just {:foo (roughly 0.3 
0.1)
  :bar (roughly 0.7 
0.1)})))



;;; end code


Hopefully I understood the question and this helps some.  For an example 
in a book you could make it a bit simpler where the urn could only 
contain two potential values (binomial urn).



-Ben

--
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Attractive examples of function-generating functions

2012-08-08 Thread Robert Marianski
On Wed, Aug 08, 2012 at 08:00:26PM -0600, Jim Weirich wrote:
> 
> On Aug 8, 2012, at 1:50 PM, Timothy Baldridge  wrote:
> 
> > 
> > >>I'm looking for medium-scale examples of using function-generating 
> > >>functions.
> > 
> > 
> > I'm not sure if this is exactly what you're looking for, but this sort of 
> > thing is pretty cool: 
> > 
> > (defn make-point [x y]
> >   (fn [member]
> > (cond (= member :x) x
> >  (= member :y) y)))
> 
> Nice.  I always enjoyed this variation on the whole make-point theme:
> 
> (defn make-point [x y]
>  (fn [f] (f x y)))
> 
> (defn point-x [pt]
>  (pt (fn [x y] x)))
> 
> (defn point-y [pt]
>  (pt (fn [x y] y)))
> 
> (def pt (make-point 1 2))
> 
> (println  [(point-x pt)
>   (point-y pt)])
> 
> -- 
> -- Jim Weirich
> -- jim.weir...@gmail.com

Very nice. Similarly, I thought it was slick when I saw this idea used
as an example implementation for cons. Funny enough, it's exactly the
same except for the names.

(defn cons [a b]
  (fn [f] (f a b)))

(defn car [xs]
  (xs (fn [a b] a)))

(defn cdr [xs]
  (xs (fn [a b] b)))

Robert

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Question on Clojure/Heroku deployment

2012-08-08 Thread Shantanu Kumar
> I don't think it's possible to get that error if you have a top-level
> project.clj file, but if you send a tarball of the project to
> phil.hagelb...@heroku.com I can take a look.

Thanks Phil, I sent you a mail.

Shantanu

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Attractive examples of function-generating functions

2012-08-08 Thread Brian Rowe
Maybe SICP's simulator of digital circuits will provide some inspiration. I 
know when I read this I was deeply awed by what HOFs can do. Maybe 
Clojure's zippers would be good too?

On Wednesday, August 8, 2012 12:48:23 PM UTC-4, Brian Marick wrote:
>
> I'm looking for medium-scale examples of using function-generating 
> functions. I'm doing it because examples like this: 
>
> (def make-incrementer 
>  (fn [increment] 
>(fn [x] (+ increment x 
>
> ... or this: 
>
> (def incish (partial map + [100 200 300])) 
>
> ... show the mechanics, but I'm looking for examples that would resonate 
> more with an object-oriented programmer. Such examples might be ones that 
> close over a number of values (which looks more like an object), or 
> generate multiple functions that all close over a shared value (which looks 
> more like an object), or use closures to avoid the need to have some 
> particular argument passed from function to function (which looks like the 
> `this` in an instance method). 
>
> Note: please put the flamethrower down. I'm not saying that "looking like 
> objects" is the point of higher-order functions. 
>
> I'll give full credit. 
>
> - 
> Brian Marick, Artisanal Labrador 
> Contract programming in Ruby and Clojure 
> Occasional consulting on Agile 
>
>
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Sean Corfield
On Wed, Aug 8, 2012 at 5:58 PM, Andreas Kostler
 wrote:
>> Given that regular Clojure users cannot submit a pull request.
> Really? That's what I did...

Technically you can _submit_ pull requests but Clojure and contrib
projects cannot _accept_ them. You will generally see the pull request
closed with a polite note to go read the Clojure "contributing" page
and a request to sign a Contributor's Agreement and send that in.

I tend to reply to most contrib pull requests I see across the board
but may missed one or two. Which library did you submit a pull request
against?

We'd turn the feature off if we could. We've turned "issues" off on
all the contrib repositories (which is why the standard format readme
includes a link to the JIRA bug tracker for the project).
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Attractive examples of function-generating functions

2012-08-08 Thread Jim Weirich

On Aug 8, 2012, at 1:50 PM, Timothy Baldridge  wrote:

> 
> >>I'm looking for medium-scale examples of using function-generating 
> >>functions.
> 
> 
> I'm not sure if this is exactly what you're looking for, but this sort of 
> thing is pretty cool: 
> 
> (defn make-point [x y]
>   (fn [member]
> (cond (= member :x) x
>  (= member :y) y)))

Nice.  I always enjoyed this variation on the whole make-point theme:

(defn make-point [x y]
 (fn [f] (f x y)))

(defn point-x [pt]
 (pt (fn [x y] x)))

(defn point-y [pt]
 (pt (fn [x y] y)))

(def pt (make-point 1 2))

(println  [(point-x pt)
  (point-y pt)])

-- 
-- Jim Weirich
-- jim.weir...@gmail.com





-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Attractive examples of function-generating functions

2012-08-08 Thread Brian Marick

On Aug 8, 2012, at 2:50 PM, Timothy Baldridge wrote:

> I'm not sure if this is exactly what you're looking for, but this sort of 
> thing is pretty cool: 
> 
> (defn make-point [x y]
>   (fn [member]
> (cond (= member :x) x
>  (= member :y) y)))
> 

I actually have a whole chapter on this. (Arguably, the whole first part of the 
book leads up to that chapter.) I even use Point as an example!

But "it's functions all the way down!" is not what I'm looking for in this 
section. Because you wouldn't use such a scheme instead of conventional objects.

-
Brian Marick, Artisanal Labrador
Contract programming in Ruby and Clojure
Occasional consulting on Agile


-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Andreas Kostler
> Given that regular Clojure users cannot submit a pull request.
Really? That's what I did...


On 9 August 2012 06:56, Michael Klishin  wrote:

> Meikel Brandmeyer:
>
> > This does not necessarily include a specific version.
> > “Instructions for including the library as a dependency in Maven /
> Leiningen”
>
> Arguing just for the sake of it? Clojure learning curve is already steep
> enough.
>
> Lets make it even steeper by asking people to figure out UIs of
> all those Maven search resources and which version is the last and whether
> using -SNAPSHOT
> versions is safe.
>
> "Don't make me think" is a good rule to live by for library maintainers.
>
> MK
>
> mich...@defprotocol.org
>
> --
> 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
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Writing code to get the source of a function

2012-08-08 Thread Samuel Lê
Using serializable works fine for me. I find its code very instructive as
well. Thanks!

On Wed, Aug 8, 2012 at 7:18 PM, Alan Malloy  wrote:

> (println (with-out-str (foo))) is silly - it's the same as (do (foo) nil),
> which in many cases (eg, in this one) is the same as just (foo).
>
>
> On Wednesday, August 8, 2012 6:25:35 AM UTC-7, Joshua Ballanco wrote:
>
>> On Wed, Aug 08, 2012 at 09:19:15AM +, Samuel Lê wrote:
>> > Dear all,
>> >
>> > I am trying to write some code that would take a function name, get its
>> > source code, and create a new function based on the source code.
>> > Unfortunately, the function 'source' from clojure.repl doesn't seem to
>> be
>> > working for the functions I define.
>> > Here is my code:
>> >
>> > (ns test-src.core
>> >   (:require [clojure.repl]))
>> >
>> > (defn my-function [x]
>> >   (+ x 1))
>> >
>> > (defn print-src []
>> >   (println (clojure.repl/source my-function)))
>> >
>>
>> Try:
>>
>> (defn print-src []
>>   (println (with-out-str (clojure.repl/source my-function
>>
>> The "source" method is designed for the REPL, and so dumps to *out* by
>> default (you can confirm this yourself, appropriately enough, by doing
>> "(source source)")
>>
>> Cheers,
>>
>> Josh
>>
>>
>>
>> --
>> Joshua Ballanco
>>
>> ELC Technologies™
>> 1771 NW Pettygrove Street, Suite 140
>> Portland, OR, 97209
>> jbal...@elctech.com
>>
>> P +1 866.863.7365
>> F +1 877.658.6313
>> M +1 646.463.2673
>> T +90 533.085.5773
>>
>> http://www.elctech.com
>>
>  --
> 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
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Attractive examples of function-generating functions

2012-08-08 Thread Nelson Morris
On Wed, Aug 8, 2012 at 11:48 AM, Brian Marick  wrote:
> I'm looking for medium-scale examples of using function-generating functions.
>
> Such examples might be ones that ... use closures to avoid the need to have 
> some particular argument passed from function to function (which looks like 
> the `this` in an instance method).

I try and use a greedy parser combinator as the next jump, and as
example of hiding arguments.  String parsing is a small, yet
non-trivial example, that doesn't require domain knowledge.  Something
like:

(defn result [value]
  (fn [string]
[value string]))

(defn pred [predicate]
  (fn [string]
(if (predicate (first string))
  [(first string) (rest string)])))

(defn orp [f g]
  (fn [string]
(or (f string) (g string

(defn bind [parser f]
  (fn [string]
(if-let [[result s2] (parser string)]
  ((f result) s2

(defn many [parser]
  (let [f (bind parser
(fn [h]
  (bind (many parser)
(fn [rst]
  (result (cons h rst))]
(orp f
 (result []

(def letter (pred #(if % (Character/isLetter %

(def word
  (bind (many letter)
(fn [w] (result (apply str w)

(word "foo")
;=> ["foo" ()]

The closest I see to an implicit this is:

((bind word
   (fn [w1]
 (bind (pred #(= % \space))
   (fn [_]
 (bind word
   (fn [w2] (result [w1 w2]))) "foo bar baz")
;=> [["foo" "bar"] (\space \b \a \z)]

Here word and the space predicate are called on the string, but its
only ever mentioned as the argument.  However, it is kinda ugly
without a macro to hide all the bind/fn pairs.

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Question on Clojure/Heroku deployment

2012-08-08 Thread Phil Hagelberg
On Wed, Aug 8, 2012 at 1:58 PM, Shantanu Kumar  wrote:
> When I try to run `git push heroku master` I am getting this:
>
> -> Heroku receiving push
>  ! Heroku push rejected, no Cedar-supported app detected
>
> Can anybody help me with how to diagnose the problem? Is there a
> checklist I can try to verify from? I have a project.clj (works with
> Lein 1.7.1) in the toplevel directory of a git project. I also have a
> Procfile that works OK with foreman.

I don't think it's possible to get that error if you have a top-level
project.clj file, but if you send a tarball of the project to
phil.hagelb...@heroku.com I can take a look.

-Phil

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Michael Klishin
Meikel Brandmeyer:

> This does not necessarily include a specific version.
> “Instructions for including the library as a dependency in Maven / Leiningen”

Arguing just for the sake of it? Clojure learning curve is already steep enough.

Lets make it even steeper by asking people to figure out UIs of
all those Maven search resources and which version is the last and whether 
using -SNAPSHOT
versions is safe.

"Don't make me think" is a good rule to live by for library maintainers.

MK

mich...@defprotocol.org

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Attractive examples of function-generating functions

2012-08-08 Thread nicolas.o...@gmail.com
trampolines is a slightly different example.

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Question on Clojure/Heroku deployment

2012-08-08 Thread Shantanu Kumar
Hi,

When I try to run `git push heroku master` I am getting this:

-> Heroku receiving push
 ! Heroku push rejected, no Cedar-supported app detected

Can anybody help me with how to diagnose the problem? Is there a
checklist I can try to verify from? I have a project.clj (works with
Lein 1.7.1) in the toplevel directory of a git project. I also have a
Procfile that works OK with foreman.

Shantanu

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Attractive examples of function-generating functions

2012-08-08 Thread Timothy Baldridge
>>I'm looking for medium-scale examples of using function-generating
functions.


I'm not sure if this is exactly what you're looking for, but this sort of
thing is pretty cool:

(defn make-point [x y]
  (fn [member]
(cond (= member :x) x
 (= member :y) y)))

We're basically creating an immutable object without using a single data
structure:

(def pnt (make-point 1 2))

=> (pnt :x)
1
=> (pnt :y)
2

You can even get a bit more fancy:

(defn make-point [x y]
  (fn [member]
(cond (= member :x) x
  (= member :y) y
  (= member :with-x)
(fn [newx]
   (make-point newx y)

Timothy


>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Sean Corfield
On Wed, Aug 8, 2012 at 12:28 PM, Meikel Brandmeyer  wrote:
>> http://dev.clojure.org/display/design/Contrib+Library+READMEs
>
> None of the points mentioned there requires explicit specification of the 
> last available version.

See data.json which is the reference model.

Most of the contrib READMEs have been updated in the last 48 hours to
use this new format (so this discussion is moot - as well as being
bike-shedding :)
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Meikel Brandmeyer
Hi,

Am 08.08.2012 um 20:48 schrieb Sean Corfield:

> On Wed, Aug 8, 2012 at 11:46 AM, Sean Corfield  wrote:
>> On Wed, Aug 8, 2012 at 2:52 AM, Meikel Brandmeyer (kotarak)  
>> wrote:
>>> why recommending a specific version at all?
>>> 
>>> Just point to search.maven.org or mvnrepository.com and let the user choose
>>> one?
>> 
>> Because Clojure/core have decided - after quite a bit of discussion -
>> that providing specific version details is better for users.
> 
> Specifically:
> 
> http://dev.clojure.org/display/design/Contrib+Library+READMEs

None of the points mentioned there requires explicit specification of the last 
available version.

This does not necessarily include a specific version.
“Instructions for including the library as a dependency in Maven / Leiningen”

A link to eg. mvnrepository.com satisfies this for Maven Central.
“Links to the available releases on Maven Central and oss.sonatype.org”

Actually not providing a specific version in the dependency explanation would 
force people to understand what they are doing. I would prefer library authors 
spending time on writing good documentation for their libraries instead of 
serving trivial information on a silver platter.

Anyway, this is bike shedding.

Kind regards
Meikel



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: ANN lein-expectations 0.0.7

2012-08-08 Thread keeds
Silly question but how is Expectations better or different from Midje?
I'm just starting out with Midje and was just wondering?

Thanks,
Andrew

On Monday, 6 August 2012 19:43:18 UTC+1, Sean Corfield wrote:
>
> lein-expectations - the plugin for running Jay Fields' awesome 
> Expectations testing library - has been updated for Leiningen 2.0. 
>
> If you are using Leiningen 1.x, continue to use lein-expectations 0.0.5. 
>
> If you are on Leiningen 2.x, you should use lein-expectations 0.0.7 so 
> that exit on test failure is handled correctly. 
>
> 0.0.6 added a partial fix for exit codes in Leiningen 2.0 but it 
> didn't work properly with "with-profile". After discussions with Phil 
> H about exit status codes, the logic was changed / simplified for the 
> 0.0.7 release. 
> -- 
> Sean A Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
> World Singles, LLC. -- http://worldsingles.com/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Writing code to get the source of a function

2012-08-08 Thread Alan Malloy
(println (with-out-str (foo))) is silly - it's the same as (do (foo) nil), 
which in many cases (eg, in this one) is the same as just (foo).

On Wednesday, August 8, 2012 6:25:35 AM UTC-7, Joshua Ballanco wrote:
>
> On Wed, Aug 08, 2012 at 09:19:15AM +, Samuel Lê wrote: 
> > Dear all, 
> > 
> > I am trying to write some code that would take a function name, get its 
> > source code, and create a new function based on the source code. 
> > Unfortunately, the function 'source' from clojure.repl doesn't seem to 
> be 
> > working for the functions I define. 
> > Here is my code: 
> > 
> > (ns test-src.core 
> >   (:require [clojure.repl])) 
> > 
> > (defn my-function [x] 
> >   (+ x 1)) 
> > 
> > (defn print-src [] 
> >   (println (clojure.repl/source my-function))) 
> > 
>
> Try: 
>
> (defn print-src [] 
>   (println (with-out-str (clojure.repl/source my-function 
>
> The "source" method is designed for the REPL, and so dumps to *out* by 
> default (you can confirm this yourself, appropriately enough, by doing 
> "(source source)") 
>
> Cheers, 
>
> Josh 
>
>
>
> -- 
> Joshua Ballanco 
>
> ELC Technologies™ 
> 1771 NW Pettygrove Street, Suite 140 
> Portland, OR, 97209 
> jbal...@elctech.com  
>
> P +1 866.863.7365 
> F +1 877.658.6313 
> M +1 646.463.2673 
> T +90 533.085.5773 
>
> http://www.elctech.com 
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN lein-expectations 0.0.7

2012-08-08 Thread Sean Corfield
On Wed, Aug 8, 2012 at 1:02 AM, Jay Fields  wrote:
> On Aug 8, 2012, at 1:09 AM, Sean Corfield wrote:
>> expecting not to
>> throw a specific exception is a bit trickier...
> You can expect a specific exception easily, but not an exception message 
> easily...

Yeah, I haven't thought up ways to make exception handling cleaner
with Expectations yet. If I do, I'll open some tickets.

Overall tho', I love working with it and, in addition to unit tests,
we're also using it with clj-webdriver to run Selenium-based tests: it
makes for extremely readable tests!
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Sean Corfield
On Wed, Aug 8, 2012 at 11:46 AM, Sean Corfield  wrote:
> On Wed, Aug 8, 2012 at 2:52 AM, Meikel Brandmeyer (kotarak)  
> wrote:
>> why recommending a specific version at all?
>>
>> Just point to search.maven.org or mvnrepository.com and let the user choose
>> one?
>
> Because Clojure/core have decided - after quite a bit of discussion -
> that providing specific version details is better for users.

Specifically:

http://dev.clojure.org/display/design/Contrib+Library+READMEs
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Sean Corfield
On Wed, Aug 8, 2012 at 2:52 AM, Meikel Brandmeyer (kotarak)  
wrote:
> why recommending a specific version at all?
>
> Just point to search.maven.org or mvnrepository.com and let the user choose
> one?

Because Clojure/core have decided - after quite a bit of discussion -
that providing specific version details is better for users. I
certainly agree with them. One of the most common questions I hear
about libraries in general is "How do I add this to my project?" -
users want a specific string they can just copy'n'paste into
project.clj without needing to click through to Maven and figure out
group / artifact / version stuff!
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Attractive examples of function-generating functions

2012-08-08 Thread Brian Marick
I'm looking for medium-scale examples of using function-generating functions. 
I'm doing it because examples like this:

(def make-incrementer
 (fn [increment]
   (fn [x] (+ increment x

... or this:

(def incish (partial map + [100 200 300]))

... show the mechanics, but I'm looking for examples that would resonate more 
with an object-oriented programmer. Such examples might be ones that close over 
a number of values (which looks more like an object), or generate multiple 
functions that all close over a shared value (which looks more like an object), 
or use closures to avoid the need to have some particular argument passed from 
function to function (which looks like the `this` in an instance method). 

Note: please put the flamethrower down. I'm not saying that "looking like 
objects" is the point of higher-order functions. 

I'll give full credit. 

-
Brian Marick, Artisanal Labrador
Contract programming in Ruby and Clojure
Occasional consulting on Agile


-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: DAG (Direct Acyclic Graph) and Bayesian Network help

2012-08-08 Thread Chas Emerick
I just published an announcement regarding Raposo:

https://github.com/cemerick/raposo/blob/master/README.md

My apologies,

- Chas

--
http://cemerick.com
[Clojure Programming from O'Reilly](http://www.clojurebook.com)

On Jul 14, 2012, at 1:24 PM, Walter van der Laan wrote:

> Chas Emerick did a presentation on this: 
> http://blip.tv/clojure/chas-emerick-modeling-the-world-probabilistically-using-bayesian-networks-in-clojure-5961126
> 
> But AFAIK the "raposo" library has not been published yet.
> 
> On Saturday, July 14, 2012 4:20:17 PM UTC+2, Simone Mosciatti wrote:
> Hi guys,
> I'm trying to develop a Bayesian Network just "for fun" XD
> 
> My first problem is to understand how represent the graph necessary a DAG.
> 
> I come out with something : https://gist.github.com/3111539 
> (Very very first stage I just finish to write this code)
> 
> But I have some question to how represent properly the DAG.
> 
> I need to map every child of every node, or I just need to know the 
> (non-)descendants of every node ? Why ?
> 
> Do you have any useful link that I can use ? 
> 
> Thank you guys anyway.
> 
> PS: This is still me 
> http://stackoverflow.com/questions/11482474/clojure-dag-bayesian-network#comment15165499_11482474
> 
> -- 
> 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
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Functional Composition (with Overtone)

2012-08-08 Thread Sam Aaron
Hey everyone,

Chris Ford gave a talk on functional composition with Overtone in London 
recently and it's now online:

http://skillsmatter.com/podcast/home/functional-composition

Chris really delivers a beautifully paced introduction to a huge range of 
fundamental musical concepts through the "transmission vector" of Clojure. It's 
truly fantastic to watch how seemingly magic and untouchable concepts such as 
classical music can be destructured piece by piece into understandable Clojure 
code.

Sam

---
http://sam.aaron.name

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Overtone - Live @ Arnolfini

2012-08-08 Thread lambdatronic
Eppccc!!

On Friday, August 3, 2012 6:47:50 AM UTC-4, Sam Aaron wrote:
>
> Hi everyone, 
>
> for those interested, I just put up a screencast of a performance I did 
> with Overtone on Friday the 27th of July at the Arnolfini art gallery in 
> Bristol, UK: 
>
> https://vimeo.com/46867490 
>
> The screen resolution is a little odd as I mirrored my display to that of 
> the projector. Also, the sound starts cutting out for about 20s in the 
> middle due to some SuperCollider memory issues I managed to run into - it 
> was a hairy moment, but I managed to recover. 
>
> It was a lot of fun projecting Clojure code on a massive screen to an 
> audience of interesting art enthusiasts :-) 
>
> Also, the code I used to do the performance is here: 
>
> http://github.com/samaaron/arnold 
>
> Enjoy! 
>
> Sam 
>
> --- 
> http://sam.aaron.name 
>
>
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Writing code to get the source of a function

2012-08-08 Thread Joshua Ballanco
On Wed, Aug 08, 2012 at 09:19:15AM +, Samuel Lê wrote:
> Dear all,
> 
> I am trying to write some code that would take a function name, get its
> source code, and create a new function based on the source code.
> Unfortunately, the function 'source' from clojure.repl doesn't seem to be
> working for the functions I define.
> Here is my code:
> 
> (ns test-src.core
>   (:require [clojure.repl]))
> 
> (defn my-function [x]
>   (+ x 1))
> 
> (defn print-src []
>   (println (clojure.repl/source my-function)))
> 

Try:

(defn print-src []
  (println (with-out-str (clojure.repl/source my-function

The "source" method is designed for the REPL, and so dumps to *out* by
default (you can confirm this yourself, appropriately enough, by doing
"(source source)")

Cheers,

Josh



-- 
Joshua Ballanco

ELC Technologies™
1771 NW Pettygrove Street, Suite 140
Portland, OR, 97209
jballa...@elctech.com

P +1 866.863.7365
F +1 877.658.6313
M +1 646.463.2673
T +90 533.085.5773

http://www.elctech.com

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Writing code to get the source of a function

2012-08-08 Thread Moritz Ulrich
The source function only works for function where the .clj where the
function is defined is in the classpath. If you have control over all
functions, I'd suggest using
https://github.com/technomancy/serializable-fn when defining them.

On Wed, Aug 8, 2012 at 11:19 AM, Samuel Lê  wrote:
> Dear all,
>
> I am trying to write some code that would take a function name, get its
> source code, and create a new function based on the source code.
> Unfortunately, the function 'source' from clojure.repl doesn't seem to be
> working for the functions I define.
> Here is my code:
>
> (ns test-src.core
>   (:require [clojure.repl]))
>
> (defn my-function [x]
>   (+ x 1))
>
> (defn print-src []
>   (println (clojure.repl/source my-function)))
>
> When I try print-src on the repl, I get:
> test-src.core> (print-src)
> Source not found
> nil
> nil
>
> So my question is: how can I access to the source code of the functions I
> write?
>
> Many thanks,
> Sam
>
> --
> 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
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: What concurrency models to document?

2012-08-08 Thread Leonardo Borges
Hey,

A bit late to the party but something I'd love to see in the book is
an approachable summary/description/use cases of the main concurrency
models at play today: event-based and thread-based concurrency. I see
this section helping people compare Clojure with something like
Node.js or Ruby with EventMachine (Clojure has aleph[1] for that
purpose).

There is a lot of controversy around the topic and I believe even a
brief discussion on the subject will be beneficial.

This paper has a lot a good info:
http://static.usenix.org/events/hotos03/tech/full_papers/vonbehren/vonbehren_html/
(it is biased towards a threaded model though).

Would this be way out of scope for your book? - Even not exactly what
you were after when you asked about concurrency models?

[1] https://github.com/ztellman/aleph/

Cheers,
Leonardo Borges
www.leonardoborges.com


On Fri, Aug 3, 2012 at 1:11 PM, cej38  wrote:
> I think that you have to talk about concurrency!  It is on everyone's mind.
> I would like to see the discussion go further than what I have seen in most
> other Clojure books.  If you are REALLY interested in concurrency, you are
> probably interested in looking at using more than one node in a cluster.
> Two areas that are always interested in concurrency are big data and high
> performance computing.  I come from a background where the only idea of how
> to do concurrency is through the use of MPI.  I would like to learn how to
> get nodes on a cluster to talk to each other within a Clojure enviroment.
>
> Further, a paragraph or two about what use cases each of the node
> interconnect models would work best for would be absolutely awesome.  As an
> example, I know that all of the following exist but I don't know when to use
> what (I know clojure-hadoop is NOT what I want for my use cases).
>
> clojure-hadoop
> swamiji
> cacalog
> zookeeper-clj
> storm
> Avout
> lein-condor
>
> --
> 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
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: basic question , clojure io

2012-08-08 Thread nicolas.o...@gmail.com
There is no such thing in Clojure.
Separation of IO and non IO is done by:

- encouraging pure functions
- providing very good pure data structures, and libraries

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Overtone - Live @ Arnolfini

2012-08-08 Thread Sam Aaron
On 7 Aug 2012, at 15:16, Roberto Mannai  wrote:
> 
> Interesting, I guess the monome is hooked by:
> (def m (poly/init "/dev/tty.usbserial-m64-0790"))
> And the incoming events by (poly/on-press... Etc
> 

Yes, although in the future all the monome events will be sent directly to 
Overtone's event system. This is currently how MIDI devices are now handled and 
is the recommended approach to connecting external controls with Overtone. 
Using the event system allows you (and other band hackers connected to the JVM 
process) to bind handlers from arbitrary namespaces rather than having to have 
direct access to the `m` var in the ns you do poly/init.

> I even didn't suspect that Emacs would allow such graphical "overlays", have 
> any link to doc? 

It's not actually graphical - I run Emacs in a terminal emulator ;-) Docs for 
overlays can be found here:

http://www.gnu.org/software/emacs/manual/html_node/elisp/Overlays.html#Overlays

> Coming to the very exciting topic about interprocess comunication between 
> Emacs and a Midi controller I'll look forward to your code - I hope you'd 
> like give us at least a general overview of the architecture :)

Keep pestering me and I'll get round to it. I've only just started to explore 
the possibilities of having such a close relationship between Emacs and Clojure 
- but what I've seen so far is really promising. There will most certainly be 
more to come...

Sam

---
http://sam.aaron.name

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Writing code to get the source of a function

2012-08-08 Thread Samuel Lê
Dear all,

I am trying to write some code that would take a function name, get its
source code, and create a new function based on the source code.
Unfortunately, the function 'source' from clojure.repl doesn't seem to be
working for the functions I define.
Here is my code:

(ns test-src.core
  (:require [clojure.repl]))

(defn my-function [x]
  (+ x 1))

(defn print-src []
  (println (clojure.repl/source my-function)))

When I try print-src on the repl, I get:
test-src.core> (print-src)
Source not found
nil
nil

So my question is: how can I access to the source code of the functions I
write?

Many thanks,
Sam

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure group in DFW area

2012-08-08 Thread VishK
Hello,

Is this group still meeting? (When?)
Would be interested in attending the next one if possible to meet 
like-minded folks.

Regards
Vish 
(https://github.com/vishk)

On Wednesday, June 15, 2011 11:02:10 AM UTC-5, ch...@rubedoinc.com wrote:
>
> Everyone, sorry for late notice but are meeting tonight is cancelled 
> due to some scheduling conflicts. We have another meeting set for 
>
> Tuesday June 28th 630PM - 900PM @ 
>
> Rubedo, inc. 
> 14580 Beltwood Pkwy E Suite 103 
> Farmers Branch, TX 75244 
>
> See you then ! 
>
> On Jun 3, 9:46 am, "ch...@rubedoinc.com"  wrote: 
> > Meeting is growing strong!  We will be looking at some group projects 
> > to take on that we can use to stretch our clojure skills.  Make the 
> > next meeting to be a part of it! 
> > 
> > Wednesday June 15th 630PM - 900PM @ 
> > 
> > Rubedo, inc. 
> > 14580 Beltwood Pkwy E Suite 103 
> > Farmers Branch, TX 75244 
> > 
> > (wifi available) 
> > 
> > On May 20, 11:08 am, "ch...@rubedoinc.com"  
> > wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > Thanks everyone for attending.  Our next meeting is scheduled for 
> > 
> > > Our next meeting is scheduled for May 31th 630PM - 900PM @ 
> > 
> > > Rubedo, inc. 
> > > 14580 Beltwood Pkwy E Suite 103 
> > > Farmers Branch, TX 75244 
> > > (wifi available) 
> > 
> > > there will be pizza and sodas, so bring yourclojurequestions and 
> > > your appetite.  Reply in this thread if you will be attending so that 
> > > I can get a head count for pizza. 
> > 
> > > On May 16, 12:41 pm, "ch...@rubedoinc.com"  
> > > wrote: 
> > 
> > > > Meeting tonight, see you there ! 
> > 
> > > > Our next meeting is scheduled for May 16th 630PM - 900PM @ 
> > 
> > > > Rubedo, inc. 
> > > > 14580 Beltwood Pkwy E Suite 103 
> > > > Farmers Branch, TX 75244 
> > > > (wifi available) 
> > 
> > > > On May 4, 11:20 am, "ch...@rubedoinc.com"  
> wrote: 
> > 
> > > > > Thanks everyone for attending the first meeting.  It was great to 
> talk 
> > > > >clojurewith some like minded people who are excited by the 
> > > > > possibilities ! 
> > 
> > > > > Our next meeting is scheduled for May 16th 630PM - 900PM @ 
> > 
> > > > > Rubedo, inc. 
> > > > > 14580 Beltwood Pkwy E Suite 103 
> > > > > Farmers Branch, TX 75244 
> > > > > (wifi available) 
> > 
> > > > > Right now, we will try for two meetings each month. In the 
> beginning, 
> > > > > these will be mostly hack nights. As the group matures, we will 
> look 
> > > > > at doing presentations / talks onClojure. 
> > > > > As most of the group is relatively new toClojure, we decided to 
> start 
> > > > > with thehttp://projecteuler.net/problemsasaway to get familiar 
> > > > > with the language and have some common solutions to discuss. 
> > 
> > > > > At our next meeting, we will bring our solutions for problems 1-10 
> and 
> > > > > discuss how we went about solving them. 
> > 
> > > > > All are welcome ! 
> > 
> > > > > On Apr 25, 9:08 pm, Christopher Redinger  
> wrote: 
> > 
> > > > > > ch...@rubedoinc.com wrote: 
> > > > > > > Rubedo, inc. 
> > > > > > > 14580 Beltwood Pkwy E Suite 103 
> > > > > > > Farmers Branch, TX 75244 
> > 
> > > > > > > When: 630PM Monday May 2nd 
> > > > > > > What:ClojureInterest Group 
> > > > > > > Topic: 1st meeting, what our goals are, and how to take over 
> the world 
> > > > > > > withClojure 
> > 
> > > > > > Hi Chris! Thanks for offering to host the group. I've added a 
> link to 
> > > > > > this thread on theClojureUser Groups page:
> http://dev.clojure.org/display/community/Clojure+User+Groups. 
> > > > > > Hopefully to help people who might be looking. We can update the 
> link 
> > > > > > to something with a little more information if you get a page 
> set up 
> > > > > > somewhere. 
> > 
> > > > > > Also, if you choose to go through Meetup, they have provided us 
> with a 
> > > > > > code that gives a discount toClojuregroups. See the above page 
> for 
> > > > > > more information. 
> > 
> > > > > > Thanks again, and let me know if there's anythingClojure/core 
> can 
> > > > > > help you out with! 
> > 
> > > > > > Thanks, 
> > > > > > Chris

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Overtone - Live @ Arnolfini

2012-08-08 Thread Sam Aaron

On 7 Aug 2012, at 15:16, Roberto Mannai  wrote:
> 
> Interesting, I guess the monome is hooked by:
> (def m (poly/init "/dev/tty.usbserial-m64-0790"))
> And the incoming events by (poly/on-press... Etc
> 

Yes, although in the future all the monome events will be sent directly to 
Overtone's event system. This is currently how MIDI devices are now handled and 
is the recommended approach to connecting external controls with Overtone. 
Using the event system allows you (and other band hackers connected to the JVM 
process) to bind handlers from arbitrary namespaces rather than having to have 
direct access to the `m` var in the ns you do poly/init.

> I even didn't suspect that Emacs would allow such graphical "overlays", have 
> any link to doc? 

It's not actually graphical - I run Emacs in a terminal emulator ;-) Docs for 
overlays can be found here:

http://www.gnu.org/software/emacs/manual/html_node/elisp/Overlays.html#Overlays

> Coming to the very exciting topic about interprocess comunication between 
> Emacs and a Midi controller I'll look forward to your code - I hope you'd 
> like give us at least a general overview of the architecture :)

Keep pestering me and I'll get round to it. I've only just started to explore 
the possibilities of having such a close relationship between Emacs and Clojure 
- but what I've seen so far is really promising. There will most certainly be 
more to come...

Sam

---
http://sam.aaron.name

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


basic question , clojure io

2012-08-08 Thread centaurian_slug
does clojure have a strict split between side-effects and pure functions 
like haskell;
I guess what i have in my head is a rigorous split between effectfull 
'procedures' and pure 'functions',the latter cannot call the former; 
although i know thats' implemented through the more general mechanism of 
monads in haskell.


-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Michael Fogus
For the record I do not mind (and much prefer) to list the latest
stable release in the README. No problem.  In this case I made the
change, scheduled the release, and went somewhere else.  As it turns
out the release process is wonky so 0.6.2 has not yet made it out.
The previous version is now listed until the latest version makes it
out.

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Baishampayan Ghose
Meikel,

For you (and me) it's not a problem; I have even looked at pom.xml
files in certain cases to figure out the latest version, etc. but
"normal" people don't care, they wish to get started as soon as
possible.

People don't read README files as well, but on Github README files are
rendered as the home-page for a repository by default so we should try
to put in as much useful information right there as possible.

At the very least, you'd want to mention the latest stable release (a
SNAPSHOT as well if feasible) and the repository (in case it's not on
either central or clojars).

Regards,
BG

On Wed, Aug 8, 2012 at 3:36 PM, Michael Klishin
 wrote:
> Meikel Brandmeyer (kotarak):
>
>> why recommending a specific version at all?
>>
>> Just point to search.maven.org or mvnrepository.com and let the user choose 
>> one?
>
> Because users do not want to choose?
>
> Just give her a version to install, asking people to go through
> maven search results figuring out how to determine what's the most recent 
> version is at least not
> very friendly.
>
> MK
>
> mich...@defprotocol.org
>
> --
> 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
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ClojureScript & protocols

2012-08-08 Thread David Nolen
On Wed, Aug 8, 2012 at 3:52 AM, Alexander Solovyov
 wrote:
> On Wed, Aug 8, 2012 at 4:47 AM, David Nolen  wrote:
>>> Ok, I figured out (well, not I, but m0smith from #clojure): protocols
>>> should be imported using :require :as, rather than :use :only.
>>
>> This seems like a bug to me.
>
> Sure, it does look as one to me as well. Should I do something about
> it? Create an issue somewhere? I don't know what to do about bugs in
> Clojure yet.
>
> --
> Alexander
>

Yes please file a ticket: http://dev.clojure.org/jira/browse/CLJS

David

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Meikel Brandmeyer (kotarak)
Hi,

Am Mittwoch, 8. August 2012 12:06:36 UTC+2 schrieb Michael Klishin:
>
> Because users do not want to choose? 
>
> Just give her a version to install, asking people to go through 
> maven search results figuring out how to determine what's the most recent 
> version is at least not 
> very friendly. 
>
>
I'm not sure what the problem with this result page is: 
http://mvnrepository.com/artifact/org.clojure/core.cache.

If you don't find the most recent version at a glance, you probably don't 
read the README anyway.

Kind regards
Meikel

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Michael Klishin
Meikel Brandmeyer (kotarak):

> why recommending a specific version at all?
> 
> Just point to search.maven.org or mvnrepository.com and let the user choose 
> one?

Because users do not want to choose?

Just give her a version to install, asking people to go through
maven search results figuring out how to determine what's the most recent 
version is at least not
very friendly.

MK

mich...@defprotocol.org

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Meikel Brandmeyer (kotarak)
Hi,

why recommending a specific version at all?

Just point to search.maven.org or mvnrepository.com and let the user choose 
one?

Kind regards
Meikel

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: core.cache 0.6.2 is not available from Central

2012-08-08 Thread Michael Klishin
Fogus:
>
> > core.cache README currently recommends installing 0.6.2: 
>
> The README predates the push to Maven Central and it looks like the 
> release failed.  I will try again, but it'll be a bit before it makes 
> it to Central. 
>

Would it be possible to at least make README recommend installing 0.6.1?
Given that regular Clojure users cannot submit a pull request.

MK

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN lein-expectations 0.0.7

2012-08-08 Thread Jay Fields

On Aug 8, 2012, at 1:09 AM, Sean Corfield wrote:

> expecting not to
> throw a specific exception is a bit trickier...

You can expect a specific exception easily, but not an exception message 
easily...

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ClojureScript & protocols

2012-08-08 Thread Alexander Solovyov
On Wed, Aug 8, 2012 at 4:47 AM, David Nolen  wrote:
>> Ok, I figured out (well, not I, but m0smith from #clojure): protocols
>> should be imported using :require :as, rather than :use :only.
>
> This seems like a bug to me.

Sure, it does look as one to me as well. Should I do something about
it? Create an issue somewhere? I don't know what to do about bugs in
Clojure yet.

-- 
Alexander

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: beginner questions

2012-08-08 Thread Sean Corfield
On Wed, Aug 8, 2012 at 12:06 AM, Catonano  wrote:
> because it seems that in clojure.string there's no grep function
>
> Is grep gone ?

Look into re-find etc. There's pretty good regex support in core Clojure.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: beginner questions

2012-08-08 Thread Catonano
Sean,

2012/8/5 Sean Corfield 

> On Sun, Aug 5, 2012 at 12:53 AM, Catonano  wrote:
> > (clojure.contrib.str-utils2/grep #"myPattern" "one row \n another row")
>
> Just as a side note, the old monolithic contrib library has been
> deprecated and many parts are no longer maintained (and you may have
> problems trying to use it with Clojure 1.3 onward).
>
> The parts of old contrib that active maintainers have been moved to
> new modular libraries:
>
> http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
>

thank you for this information. I tried to move to Coljure 1.4 (as it's the
current version)

I could move from

clojure.contrib.str-utils2/split

to

clojure.string/split

but I couldn't move from

clojure.contrib.str-utils2/grep

to

clojure.string/grep

because it seems that in clojure.string there's no grep function

Is grep gone ?

I was using it to isolate a couple of lines in a javascript source code

Thanks again




> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> 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
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en