Re: [ANN] lein-html5-docs 2.0.0

2013-04-22 Thread Tassilo Horn
John Gabriele  writes:

Hi John,

>> > I think the final output would look better if you assumed the
>> > docstrings themselves were markdown-formatted and rendered them as
>> > html. (That is, only have the items under "Arglists" in a
>> > preformatted block --- everything else would be html.)
>>
>> Hm, that sounds like a good idea.  Is there some clojure lib that
>> takes a markdown-formatted string and returns plain HTML5 code?
>>
> Well, there's , which I think
> is actively maintained, though I've not used it.
>
> I think it would be great if I could tell lein-html5-docs: "treat
> docstrings as markdown, render them as html, and shell out to Pandoc
> [^1] to do it".
>
> [^1]: Pandoc supports some niceties I've gotten pretty used to, like
> tables, definition lists, deeply-nested lists, and LaTeX math.

Thanks, I've created an issue for that:

  https://github.com/tsdh/lein-html5-docs/issues/1

But don't hold you breath. ;-)

Bye,
Tassilo

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [GSoC 2013] core.matrix development

2013-04-22 Thread Mikera
On Thursday, 18 April 2013 17:26:13 UTC+8, Damian Skrodzki wrote:

> Hi,
>
> I'm Damian Skrodzki and I study at Gdańsk University of Technology. I 
> don't know Clojure yet - I have academic experiance with Lisp. I sow the 
> lecture about Clojure at 33rd Degree conference in Warsaw and I really 
> liked it. I really would like to participate in Clojure development.
>
> I feel good at Math and I saw there are a few projects related to Math 
> library to be done. Which projects from:
>   Algebraic Expressions
> Incanter support
> API Contract Validation
> are most important to you? And do think that there is a chance for me to 
> qualify for it having no experience in Clojure in I would be engaged 
> enough? This experience is listed as a requirement. Which one you would 
> suggest me to look through deeper if there are any real chances?
>

Hi Damian, I proposed these projects originally. 

I think the Incanter support is probably the most immediately valuable to 
the community: it would bring core.matrix multi-dimensional array 
capabilities to Incanter and also enable Incanter to be used as a 
visualisation / statistical front-end to core.matrix work. The algebraic 
expressions are interesting though more of a "blue sky" research project. 
The API contract validation would be very useful in the long term to ensure 
a robust code base, but is probably a lower priority right now - I 
suggested it because someone might have a passion / specialism in TDD / 
contract based programming and for them it would be a great project.

Can't really say what is needed to make a successful GSoC proposal as I 
haven't been through the process before. However I personally think that 
some demonstrated Clojure ability / community engagement would be 
important: the aim is to contribute meaningfully to an open source project, 
and it is hard to do that if you are struggling to pick up the language 
basics. It might be a good idea to contribute some patches / tests to learn 
the language and demonstrate your ability to the community?
 
Also, discussions on the core.matrix topics specifically are probably 
better directed to this group:
https://groups.google.com/forum/?fromgroups=#!forum/numerical-clojure



 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Do you know which language the clojure is written by?

2013-04-22 Thread ljcppunix
Hi,
Do you know which language the clojure is written by?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Do you know which language the clojure is written by?

2013-04-22 Thread dennis zhuang
Java.

But there is some clojure version written in ruby,python,c# and javascript.


2013/4/22 

> Hi,
> Do you know which language the clojure is written by?
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Do you know which language the clojure is written by?

2013-04-22 Thread Michael Klishin
2013/4/22 dennis zhuang 

> But there is some clojure version written in ruby,python,c# and javascript.


ClojureScript compiler is not implemented in JavaScript, it emits
JavaScript but implemented
in Clojure. Hopefully will be self-hosted one day!
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure is in GSoC 2013!

2013-04-22 Thread Maik Schünemann
Hello,

On Mon, Apr 8, 2013 at 9:33 PM, Daniel Solano Gómez wrote:

> Hello, all,
>
> I am happy to report that Clojure has been accepted as a mentoring
> organization for Google Summer of Code 2013.  Now is the time for
> sudents to start researching their projects and reaching out to members.
> At the same time, we need to start putting together an application
> template for students.  I'll write more in the coming days.
>
> Is there already a template by now ?
If not, what clojure-specific information should be in the application ?
* prior experience with clojure
* open source clojure projects one has worked on
* why applying for clojure ...

Is anything missing on the list?

> Sincerely,
>
> Daniel
>
kind regards
Maik

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




spelling mistake in docs?

2013-04-22 Thread Josh Kamau
Sometimes i get this error :

"No matching ctor found for class..."

Now i know "ctor" means constructor.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] Javelin, spreadsheet-like FRP for ClojureScript

2013-04-22 Thread Hank
Hi Alan,

Only saw your answer now, somehow Google groups didn't notify me. Thanks 
for clarifying.

-- hank

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: ANN How To Make Your Open Source Project Awesome (or: Not Suck)

2013-04-22 Thread Phillip Lord



Phil Hagelberg  writes:

> Michael Klishin writes:
>
>> It wasn't immediately clear to me, but it makes sense, given how short
>> the MIT license is.
>>
>> What licenses does it make sense to recommend?
>
> Given that Clojure libraries must be compatible with Clojure's license,
> the GPL is ruled out. 


I used to think that this was true, but actually I think it is not. The
GPL specifically talks about "standard interfaces". So you *could* build
a library or a tool that used GPL, and "linking" through to
clojure.core. The clojure.core libraries would not need to be GPL, and
the incompatability with EPL would not matter. 

This would not extent to all libraries, though. So, for example, I would
not link a GPL library to https://github.com/technomancy/robert-hooke
legally (you could but that's a different issue!).



> I recommend the EPL; it's what you get when you run `lein new
> myproject`, and I feel like Rich made a pragmatic choice with a
> license that is copyleft without being virally so.

To my mind, choice of law clauses are poor. Why would I want to go to
New York to assert my legal rights for my code?


> If there is some reason you want to avoid copyleft, (corporate paranoia,
> etc.) then the Apache license seems like the best bet among non-copyleft
> ones, though the requirement that it be included in *every* single file
> is very annoying. 

Just the boilerplate surely? 


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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Something like cond, but with test-fns

2013-04-22 Thread Ken Scambler


>
> How different was what you came up with from this?
>
> (def else? (constantly true))
>
> (defmacro condval [vname & body]
>   `(cond
>  ~@(interleave (map (fn [p] `(~p ~vname)) (take-nth 2 body))
>(take-nth 2 (rest body)
>
> Just out of curiosity. :)
>

I just naively adapted the cond macro:

(defmacro condval
  [target & clauses]
(when clauses
  `(if (~(first clauses) ~target)
~(if (next clauses)
(second clauses)
(error "condval requires an even number of forms"))
(my-stuff.utils/condval ~target ~@(next (next clauses))


(defn else? [_] true)

Learned a lot from your version though, thanks!  I'm still yet to memorize 
all the useful combinators in the library.

 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[GSoC 2013]: General information + student application period opens today

2013-04-22 Thread Daniel Solano Gómez
Hello, all,

In the next couple of hours, the application period for students will
open, and I thought I would take a bit of time to let you know what's
going on and how you can participate:


For everyone


* Please talk about Google Summer of Code program at your local user
  group meetings.


For mentors
---

* Please take the time to sign up as a mentor on Melange [1].  You'll
  need to apply as a mentor to our organization (Clojure).

* Talk to students.  You'll want to get a feel for how working with a
  student over the course of the summer will go.  Here are some things
  to think about when assessing a student:
  
  * Does the student meet the prerequisites for the proposed project?

  * Is the student taking the time to think about and create a plan for
their project?  Is the plan reasonable?  Be sure to provide
feedback, but don't write the plan for them.

  * Can the student communicate effectively?  In addition to interacting
with mentors, students will also need to be able to interact with
the community at large, including publishing reports about their
progress over the summer.

* If you have questions about being a mentor, feel free to post them on
  this mailing list.

* If you can think of anything to add to the student applicaiton
  guidelines [2], let me know.
 

For students


* Talk to mentors and interact with the community.  The strongest
  applications will be those for which there is a history of
  involvement.

* Please review and follow the student application guidelines [2].

* Be sure to submit your application via Melange [1].  Failure to do so
  will result in us not knowing about it.


Thanks to everyone for your help so far.

Sincerely,

Daniel

[1]: http://www.google-melange.com/gsoc/homepage/google/gsoc2013
[2]: http://dev.clojure.org/display/community/Student+application+guidelines


signature.asc
Description: Digital signature


Re: [ANN] Javelin, spreadsheet-like FRP for ClojureScript

2013-04-22 Thread Alan Dipert
Np!
Alan


On Mon, Apr 22, 2013 at 7:41 AM, Hank  wrote:

> Hi Alan,
>
> Only saw your answer now, somehow Google groups didn't notify me. Thanks
> for clarifying.
>
> -- hank
>
>  --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Test strategy

2013-04-22 Thread Jonathon McKitrick
I guess the challenge is that the parsing and generating of the structures 
from JSON descends to several layers of functions, and the database object 
is created and inserted/updated at the lowest level.  I've tried a bulk 
insert after accumulating records into a higher level function, but 
sometimes I need to query for an item previously inserted, so I'm back to 
inserting each item as created.  The challenge is decoupling object 
creation from insertion without breaking the nested process approach.

On Friday, April 19, 2013 9:59:18 AM UTC-7, Chris Ford wrote:
>
> I'm a little unclear as to what your specific challenge is. I understand 
> you're trying to test fns that take a map produced by the JSON parser, and 
> extract specific fields.
>
> Would it be sufficient to just create literal maps to fake the output of 
> the JSON parser, use those as inputs to your extraction fns, and then just 
> compare the output to what you expected? If the issue is that the 
> extraction isn't done by top-level fns, and thus is hard to test, perhaps 
> you could just make them top-level fns?
>
> Cheers,
>
> Chris
>
>
> On 19 April 2013 15:14, Jonathon McKitrick 
> > wrote:
>
>> As a relatively new Clojure user, I have a relatively simple app which 
>> parses a complex JSON structure into a database.
>>
>> I have test code which verifies all the basic database functions, but I'm 
>> not sure how best to exercise all the parsing code.  The JSON parser is 
>> built-in, and most of my code is navigating each structure, picking out 
>> fields of interest to build the objects for the database.
>>
>> What would be a good strategy for tests that would exercise this 
>> intermediate layer of the app, between the JSON and the database, where the 
>> heart of the app logic actually lies?
>>
>> -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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 unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Clojure is in GSoC 2013!

2013-04-22 Thread Daniel Solano Gómez
On Mon Apr 22 13:01 2013, Maik Schünemann wrote:
> Hello,
> 
> On Mon, Apr 8, 2013 at 9:33 PM, Daniel Solano Gómez 
> wrote:
> 
> > Hello, all,
> >
> > I am happy to report that Clojure has been accepted as a mentoring
> > organization for Google Summer of Code 2013.  Now is the time for
> > sudents to start researching their projects and reaching out to members.
> > At the same time, we need to start putting together an application
> > template for students.  I'll write more in the coming days.
> >
> Is there already a template by now ?
> If not, what clojure-specific information should be in the application ?
> * prior experience with clojure
> * open source clojure projects one has worked on
> * why applying for clojure ...
> 
> Is anything missing on the list?

Yes there is a template now at [1], and I added your question about
open source project experience to it.

Thanks,

Daniel


> 
> > Sincerely,
> >
> > Daniel
> >
> kind regards
> Maik
> 
> -- 
> -- 
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 


signature.asc
Description: Digital signature


Re: [GSoC 2013] CinC

2013-04-22 Thread Daniel Solano Gómez
Hello, Aaron,

I apologise for the delay in replying to your message.

On Tue Apr 16 10:52 2013, Aaron Cohen wrote:
> As a mentor, what should I be doing at this point?

Please register as a mentor on Melange [1].  This allows you to comment
on and vote on student applications.  Continue talking with students,
and try to see how they could work out over the summer.

> I've been contacted by a couple of interested students so far, checking to
> see if I'm still interested in mentoring this (I am!)

That's great.  In case they don't know, you can point them to the
student application guidelines [2] and to submit an application on
Melange [1] once the window opens.

> I'm just not sure what my current next step should be.

At this point, it's mostly interacting with students to see how well you
could work with them over the summer and to help them prepare their
application.

Thanks a lot for your efforts.

Sincerely,

Daniel


> 
> --Aaron
> 
> 
> On Tue, Apr 9, 2013 at 8:54 PM, Daniel Solano Gómez 
> wrote:
> 
> > Hello,
> >
> > On Wed Apr 10 00:04 2013, Bronsa wrote:
> > > Actually, I would be interested in doing this if still available :)
> >
> > Well, now that we have been accepted as a mentoring organization, now is
> > the time to start getting in touch with potential mentors and develop a
> > proposal.  The student application period won't open until April 22, but
> > there is no reason to wait until then.
> >
> > Sincerely,
> >
> > Daniel
> >
> >
> >
> > > On Mon, Mar 4, 2013 at 6:53 PM, Aaron Cohen  wrote:
> > >
> > > > On Mon, Mar 4, 2013 at 11:26 AM, abp  wrote:
> > > >
> > > >> Is this work related?
> > > >>
> > > >> http://clojurewest.org/sessions#martin
> > > >> https://github.com/kanaka/clojurescript
> > > >>
> > > >
> > > > Nope, completely unrelated, though similar work.
> > > >
> > > > --Aaron
> > > >
> > > > --
> > > > --
> > > > 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 unsubscribe from this group and stop receiving emails from it, send
> > an
> > > > email to clojure+unsubscr...@googlegroups.com.
> > > > For more options, visit https://groups.google.com/groups/opt_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
> > > ---
> > > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> > an email to clojure+unsubscr...@googlegroups.com.
> > > For more options, visit https://groups.google.com/groups/opt_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
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 


signature.asc
Description: Digital signature


Request / Result Handler Trickery

2013-04-22 Thread Timothy Washington
Hi all,

I'm working on a problem that needs an extra set of eyes. I'm getting an
error while trying to write an algorithm that:

   1. Over 6400 times, makes a request to an external Java library, for
   results
   2. Asynchronously listens for those results and ...
   3. Maintains a list of filtered results, 10 (or 'n') at a time, while
   ...
   4. Making the next request until the list of 6400 is exhausted

Below is a very simplified outline of how I've set up my code. Before
getting into the nitty gritty, is there something obvious I can do to fix
this code? Is *alter* a blocking call?


;; A. this gets called for each result received from the "request-result"
call.
(defn *result-handler* [options result]

  ;; process the result
  …

  ;; peel off next request, and send
  (let [stock-list *(:remaining options)*]


(dosync (alter stock-list rest))

;; *** ERROR's here*: it peels off the first few items, but later, just
returns back to the original :remaining list
(request-result (first @stock-list))
  )
)

;; B. this is where we subscribe to get results

(subscribe-to-results (partial *result-handler* {:a a :b b *:remaining (ref
["orcl", "goog", "msft"])* } ))

;; C. now make request on the first few

(reduce (fn [rlst ech]
  …
  (request-result ech))
[ "ibm" "aapl" ])





Thanks in advance


Tim Washington
Interruptsoftware.ca

No 6: "I'm not a number. I'M A FREE MAN!!!"
No 2: "HA HA HA HA HAAA"

-- The Prisoner

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Multiple replacements in string using a map

2013-04-22 Thread Mond Ray
Something very odd going on here - one day it works the next day it fails :(

$ lein repl
nREPL server started on port 51502
REPL-y 0.1.10
Clojure 1.5.1
Exit: Control+D or (exit) or (quit)
Commands: (user/help)
Docs: (doc function-name-here)
  (find-doc "part-of-name-here")
  Source: (source function-name-here)
  (user/sourcery function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
  (user/clojuredocs name-here)
  (user/clojuredocs "ns-here" "name-here")
user=> (require '[clojure.string :as s])
nil
user=> ; code from the clojure google group to help map properties into 
paths

user=> ; first a way to take the keys and produce a regex

user=> (defn key-pattern
  #_=>   "Create a regex Pattern of the form '|', the key names
  #_=>   will be quoted in case they contain special regex characters"
  #_=>   [m]
  #_=>   (->> (keys m)
  #_=> (map #(java.util.regex.Pattern/quote (keyword %)))
  #_=> (s/join "|")
  #_=> java.util.regex.Pattern/compile))
#'user/key-pattern
user=> 

user=> ; second a way to use the above function to achieve the replacement

user=> (defn replace-map [text m]
  #_=>   "Replace keys in a String from matching values in a map"
  #_=>   (s/replace text
  #_=> (key-pattern m)
  #_=> (fn [field-name]
  #_=>   (java.util.regex.Matcher/quoteReplacement (str (get m (keyword 
field-name)))
#'user/replace-map
user=> 

user=> (def param-map {:$tld "com"})
#'user/param-map
user=> 

user=> (def url (replace-map "https://google.$tld"; param-map))
ClassCastException clojure.lang.Keyword cannot be cast to java.lang.String 
 user/key-pattern/fn--352 (NO_SOURCE_FILE:6)

user=> 

You see my full REPL session.

I reckon I must be doing something dumb wrong - any ideas on what's going 
on?

Thanks

Ray

On Saturday, 20 April 2013 09:51:21 UTC+2, Mond Ray wrote:
>
> Just tried again - using lein repl (clojure 1.4.0) and it worked fine.
>
> It was late - who knows what I did ;-)
>
> Thanks for checking guys.
>
> On Saturday, 20 April 2013 02:37:14 UTC+2, Andy Fingerhut wrote:
>>
>> I fired up a Clojure 1.5.1 REPL, did (require '[clojure.string :as s]) 
>> first, then copied and pasted those two function definitions, and did not 
>> get the errors you are seeing.  I don't have a good guess why you are 
>> getting those errors.  Did you do the require first?  What version of 
>> Clojure are you using?
>>
>> Andy
>>
>>
>> On Fri, Apr 19, 2013 at 5:17 PM, Mond Ray  wrote:
>>
>>> Old thread but what the heck... it doesn't work in my REPL
>>>
>>> user=> (defn key-pattern
>>>   #_=> "Create a regex Pattern of the form '|', the key 
>>> names
>>>   #_=> will be quoted in case they contain special regex characters"
>>>   #_=> [m]
>>>   #_=> (->> (keys m)
>>>   #_=> (map #(java.util.regex.Pattern/quote (name %)))
>>>   #_=> (s/join "|")
>>>   #_=> java.util.regex.Pattern/compile))
>>> #'user/key-pattern
>>> user=> 
>>>
>>> user=> (defn replace-map [text m]
>>>   #_=> (s/replace text
>>>   #_=>(key-pattern m)
>>>   #_=>(fn [field-name]
>>>   #_=>   (java.util.regex.Matcher/quoteReplacement (str (get m
>>>   #_=> (keyword field-name)))
>>> #'user/replace-map
>>> user=> (replace-map "/path/:p0/b/:p1" {:p0 "1" :p1 "2"})
>>> ClassCastException java.lang.String cannot be cast to clojure.lang.IFn 
>>>  user/key-pattern/fn--408 (NO_SOURCE_FILE:6)
>>>
>>> user=> (key-pattern {:a 1})
>>> ClassCastException java.lang.String cannot be cast to clojure.lang.IFn 
>>>  user/key-pattern/fn--408 (NO_SOURCE_FILE:6)
>>>
>>> Am I doing something wrong or is there a typo in your code?
>>>
>>>
>>>
>>> On Tuesday, 15 March 2011 16:35:04 UTC+1, Aaron Cohen wrote:
>>>
 On Mon, Mar 14, 2011 at 2:17 PM, Daniel Solano Gomez
  wrote:
 > On Mon Mar 14 13:02 2011, shuaybi2 shuaybi2 wrote:
 >> I have a string such as:
 >>
 >> "select * from account where acctId = _ACCT-ID_ and acctTyp = 
 _ACCT-TYP_"

 There are several clojure libraries that exist to improve the ease and
 safety of doing something like this. Amongst them are
 clojure.contrib.sql and ClojureQL, which take different approaches.
 They all should be sufficient to guard against SQL injection and
 should probably be the first place you look.

 For the more general question you were asking about how to generically
 replace a map of matches-to-replacements though, Daniel did a good job
 showing how to use a reduce over the map. That method will call
 "replaceAll" once per entry in the map, which is probably fine if you
 don't have many substitutions.

 Another way to do it is using clojure.string.replace, which has an
 often-overlooked third overload which matches with a regex and
 replaces with a "mapping function."

 Starting with a simple example:
 user=>(require '[clojure.string :as s])
>>>

Re: Multiple replacements in string using a map

2013-04-22 Thread Andy Fingerhut
You changed the definition of key-pattern.  The original had "name" where
your most recent version has "keyword".  Change it back to "name" and at
least I was able to get it to work.

Andy


On Mon, Apr 22, 2013 at 1:45 PM, Mond Ray  wrote:

> Something very odd going on here - one day it works the next day it fails
> :(
>
> $ lein repl
> nREPL server started on port 51502
> REPL-y 0.1.10
> Clojure 1.5.1
> Exit: Control+D or (exit) or (quit)
> Commands: (user/help)
> Docs: (doc function-name-here)
>   (find-doc "part-of-name-here")
>   Source: (source function-name-here)
>   (user/sourcery function-name-here)
>  Javadoc: (javadoc java-object-or-class-here)
> Examples from clojuredocs.org: [clojuredocs or cdoc]
>   (user/clojuredocs name-here)
>   (user/clojuredocs "ns-here" "name-here")
> user=> (require '[clojure.string :as s])
> nil
> user=> ; code from the clojure google group to help map properties into
> paths
>
> user=> ; first a way to take the keys and produce a regex
>
> user=> (defn key-pattern
>   #_=>   "Create a regex Pattern of the form '|', the key names
>   #_=>   will be quoted in case they contain special regex characters"
>   #_=>   [m]
>   #_=>   (->> (keys m)
>   #_=> (map #(java.util.regex.Pattern/quote (keyword %)))
>   #_=> (s/join "|")
>   #_=> java.util.regex.Pattern/compile))
> #'user/key-pattern
> user=>
>
> user=> ; second a way to use the above function to achieve the replacement
>
> user=> (defn replace-map [text m]
>   #_=>   "Replace keys in a String from matching values in a map"
>   #_=>   (s/replace text
>   #_=> (key-pattern m)
>   #_=> (fn [field-name]
>   #_=>   (java.util.regex.Matcher/quoteReplacement (str (get m
> (keyword field-name)))
> #'user/replace-map
> user=>
>
> user=> (def param-map {:$tld "com"})
> #'user/param-map
> user=>
>
> user=> (def url (replace-map "https://google.$tld"; param-map))
> ClassCastException clojure.lang.Keyword cannot be cast to java.lang.String
>  user/key-pattern/fn--352 (NO_SOURCE_FILE:6)
>
> user=>
>
> You see my full REPL session.
>
> I reckon I must be doing something dumb wrong - any ideas on what's going
> on?
>
> Thanks
>
> Ray
>
> On Saturday, 20 April 2013 09:51:21 UTC+2, Mond Ray wrote:
>>
>> Just tried again - using lein repl (clojure 1.4.0) and it worked fine.
>>
>> It was late - who knows what I did ;-)
>>
>> Thanks for checking guys.
>>
>> On Saturday, 20 April 2013 02:37:14 UTC+2, Andy Fingerhut wrote:
>>>
>>> I fired up a Clojure 1.5.1 REPL, did (require '[clojure.string :as s])
>>> first, then copied and pasted those two function definitions, and did not
>>> get the errors you are seeing.  I don't have a good guess why you are
>>> getting those errors.  Did you do the require first?  What version of
>>> Clojure are you using?
>>>
>>> Andy
>>>
>>>
>>> On Fri, Apr 19, 2013 at 5:17 PM, Mond Ray  wrote:
>>>
 Old thread but what the heck... it doesn't work in my REPL

 user=> (defn key-pattern
   #_=> "Create a regex Pattern of the form '|', the key
 names
   #_=> will be quoted in case they contain special regex characters"
   #_=> [m]
   #_=> (->> (keys m)
   #_=> (map #(java.util.regex.Pattern/**quote (name %)))
   #_=> (s/join "|")
   #_=> java.util.regex.Pattern/**compile))
 #'user/key-pattern
 user=>

 user=> (defn replace-map [text m]
   #_=> (s/replace text
   #_=>(key-pattern m)
   #_=>(fn [field-name]
   #_=>   (java.util.regex.Matcher/**quoteReplacement (str (get
 m
   #_=> (keyword field-name)))
 #'user/replace-map
 user=> (replace-map "/path/:p0/b/:p1" {:p0 "1" :p1 "2"})
 ClassCastException java.lang.String cannot be cast to clojure.lang.IFn
  user/key-pattern/fn--408 (NO_SOURCE_FILE:6)

 user=> (key-pattern {:a 1})
 ClassCastException java.lang.String cannot be cast to clojure.lang.IFn
  user/key-pattern/fn--408 (NO_SOURCE_FILE:6)

 Am I doing something wrong or is there a typo in your code?



 On Tuesday, 15 March 2011 16:35:04 UTC+1, Aaron Cohen wrote:

> On Mon, Mar 14, 2011 at 2:17 PM, Daniel Solano Gomez
>  wrote:
> > On Mon Mar 14 13:02 2011, shuaybi2 shuaybi2 wrote:
> >> I have a string such as:
> >>
> >> "select * from account where acctId = _ACCT-ID_ and acctTyp =
> _ACCT-TYP_"
>
> There are several clojure libraries that exist to improve the ease and
> safety of doing something like this. Amongst them are
> clojure.contrib.sql and ClojureQL, which take different approaches.
> They all should be sufficient to guard against SQL injection and
> should probably be the first place you look.
>
> For the more general question you were asking about how to generically
> replace a map of matches-to-replacements though, Daniel did a good job
> showing how to use a r

Re: New CSS library - Garden

2013-04-22 Thread Joel Holdbrooks
As of today, Garden is officially out of alpha and in to beta!

The library now sports media 
queries(via meta data) and 
parent 
selector 
references(ie. 
"&hover"). With these new features it is now possible to build more 
sophisticated stylesheets bringing us a step closer to having a viable CSS 
alternative in Clojure.

Over the course of the next few weeks, I plan to continue improving the 
library by adding "missing" features and functions to make the library as 
powerful as possible when it's release as 0.1.0 stable.

Now more than ever, I would like to encourage others in the community to 
reach out with suggestions and code review. This my first "real" Clojure 
library and after only six months with the language I'm sure it could 
benefit greatly from both of these things.


On Tuesday, April 9, 2013 12:58:50 PM UTC-7, Joel Holdbrooks wrote:
>
> Nobel Clojurians,
>
> I am pleased to announce the alpha version of 
> *Garden*, 
> a new library for writing CSS in Clojure.
>
> The project weds the best ideas from Hiccup, gaka, and cssgen and aims to 
> provide a clean and conventional way to author stylesheets without being 
> too simple or too complex.
>
> Currently the list of notable features include:
>
>- Nestable rules
>- Nestable declarations (this my change)
>- A builtin set of tools for working with CSS unit values
>- Convenient multiple selector syntax (IE. h1, h2, h3 { ... })
>- Output formatting options
>
> What's planned for the near future:
>
>- The ability to use Clojure meta as a media query
>- A builtin set of tools for working with CSS color values
>- & selector syntax for nested rules 
>
> For those of you who are interested in this sort of thing, please have a 
> look at the *project's repository* . 
> There is still quite a bit of ground to do cover and any 
> help/criticism/contribution would be greatly appreciated.
>
> Please feel free to offer suggestions, ask questions, open issues, or send 
> pull requests. I would love nothing more than to see this library succeed 
> where other's have not. 
>
>
> Truly,
>
> Joel Holdbrooks (aka noprompt)
>
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: New CSS library - Garden

2013-04-22 Thread Joel Holdbrooks
As of today, Garden is officially out of alpha and in to beta!

The library now sports media 
queries (via 
meta data) and parent selector 
references (ie. 
"&hover"). With these new features it is now possible to build more 
sophisticated stylesheets bringing us a step closer to having a viable CSS 
alternative in Clojure.

Over the course of the next few weeks, I plan to continue improving the 
library by adding "missing" features and functions to make the library as 
powerful as possible when it's release as 0.1.0 stable.

Now more than ever, I would like to encourage others in the community to 
reach out with suggestions and code review. This my first "real" Clojure 
library and after only six months with the language I'm sure it could 
benefit greatly from both of these things.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Multiple replacements in string using a map

2013-04-22 Thread Sean Corfield
On Mon, Apr 22, 2013 at 1:45 PM, Mond Ray  wrote:
> Something very odd going on here - one day it works the next day it fails :(

This code is different to what you posted the other day...

>   #_=> (map #(java.util.regex.Pattern/quote (keyword %)))

That won't work - Pattern/quote will not accept a keyword (which is
what the exception is telling you). In the code you posted before,
which did work, you had (name %) instead which would yield a String
from either a keyword or a string - which is clearly what you want
here.
--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Request / Result Handler Trickery

2013-04-22 Thread Neale Swinnerton
On 22 Apr 2013 20:19, "Timothy Washington"  wrote:
>
> Before getting into the nitty gritty, is there something obvious I can do
to fix this code? Is alter a blocking call?

You are seeing STM transaction restarts in action

It looks like you are assuming that STM  will serialise your transactions
like, say,  RDBMS transactions,  on a first come first served basis with
subsequent transactions blocked until the current one is complete?

If this is your assumption,  it's not correct I'm afraid.

You must write the body of the dosync  such that it can run multiple times,
each run starting with a different (but consistent)  view of the ref
universe.

Without more nitty gritty it's difficult to know more.  Possibly a queue is
a better fit here? Have you considered using one from java.util.concurrent
?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Request / Result Handler Trickery

2013-04-22 Thread Timothy Washington
Ah, that makes more sense. Light just went on. Let me fiddle with this a
bit longer.

Thanks very much.


Tim Washington
Interruptsoftware.ca

No 6: "I'm not a number. I'M A FREE MAN!!!"
No 2: "HA HA HA HA HAAA"

-- The Prisoner


On Mon, Apr 22, 2013 at 6:09 PM, Neale Swinnerton wrote:

>
> On 22 Apr 2013 20:19, "Timothy Washington"  wrote:
> >
> > Before getting into the nitty gritty, is there something obvious I can
> do to fix this code? Is alter a blocking call?
>
> You are seeing STM transaction restarts in action
>
> It looks like you are assuming that STM  will serialise your transactions
> like, say,  RDBMS transactions,  on a first come first served basis with
> subsequent transactions blocked until the current one is complete?
>
> If this is your assumption,  it's not correct I'm afraid.
>
> You must write the body of the dosync  such that it can run multiple
> times, each run starting with a different (but consistent)  view of the ref
> universe.
>
> Without more nitty gritty it's difficult to know more.  Possibly a queue
> is a better fit here? Have you considered using one from
> java.util.concurrent ?
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Head retention example

2013-04-22 Thread tyaakow
Thank you for the exhaustive explanation, Michal.


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] ClojureC 0.1

2013-04-22 Thread John Gabriele
On Sunday, April 21, 2013 4:50:57 PM UTC-4, Mark Probst wrote:
>
> Dear Clojurians,
>
> I'm happy to announce ClojureC 0.1:
>
>   https://github.com/schani/clojurec
>
>
Wow! Exciting news!

I'm curious: what (if any) differences do you see happening between 
Clojure(Script) and ClojureC? How close do you expect them to be? Do you 
have any notions yet of what C-library interop might look like?

Thanks!

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




binding funkiness

2013-04-22 Thread Daniel Higginbotham
I've encountered a situation where the binding function doesn't work as I 
expect it:

user> (def ^:dynamic *funkybind* false)

;; expected
user> (binding [*funkybind* true]
  *funkybind*)
true

;;expected
(binding [*funkybind* true]
  ((fn [] *funkybind*)))
true

;;... huh?
(binding [*funkybind* true] 
  (map (fn [_] *funkybind*) [1 2]))
(false false)

In the last example, why is the value of *funkybind* false instead of true?

Thanks!
Daniel

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: binding funkiness

2013-04-22 Thread Travis Vachon
Hi Daniel

map is creating a lazy seq, which isn't evaluated until the REPL's
forces it to be printed, which is outside the scope of the binding.

This:

(binding [*funkybind* true]
  (doall (map (fn [_] *funkybind*) [1 2])))

forces evaluation inside the binding, and does what you want.

This is something I've been bitten by a few times, but the power that
lazyness brings ends up being worth it, IMHO.

Good luck!

Travis

On Mon, Apr 22, 2013 at 9:41 PM, Daniel Higginbotham
 wrote:
> I've encountered a situation where the binding function doesn't work as I
> expect it:
>
> user> (def ^:dynamic *funkybind* false)
>
> ;; expected
> user> (binding [*funkybind* true]
>   *funkybind*)
> true
>
> ;;expected
> (binding [*funkybind* true]
>   ((fn [] *funkybind*)))
> true
>
> ;;... huh?
> (binding [*funkybind* true]
>   (map (fn [_] *funkybind*) [1 2]))
> (false false)
>
> In the last example, why is the value of *funkybind* false instead of true?
>
> Thanks!
> Daniel
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: binding funkiness

2013-04-22 Thread Carlo Zancanaro
If you want to capture the binding and have laziness together you can also
use `bound-fn`.

(binding [*funkybind* true] (map (fn [_] *funkybind*) [0 1]))
;=> (false false)
(binding [*funkybind* true] (map (bound-fn [_] *funkybind*) [0 1]))
;=> (true true)


On Tue, Apr 23, 2013 at 11:52 AM, Travis Vachon wrote:

> Hi Daniel
>
> map is creating a lazy seq, which isn't evaluated until the REPL's
> forces it to be printed, which is outside the scope of the binding.
>
> This:
>
> (binding [*funkybind* true]
>   (doall (map (fn [_] *funkybind*) [1 2])))
>
> forces evaluation inside the binding, and does what you want.
>
> This is something I've been bitten by a few times, but the power that
> lazyness brings ends up being worth it, IMHO.
>
> Good luck!
>
> Travis
>
> On Mon, Apr 22, 2013 at 9:41 PM, Daniel Higginbotham
>  wrote:
> > I've encountered a situation where the binding function doesn't work as I
> > expect it:
> >
> > user> (def ^:dynamic *funkybind* false)
> >
> > ;; expected
> > user> (binding [*funkybind* true]
> >   *funkybind*)
> > true
> >
> > ;;expected
> > (binding [*funkybind* true]
> >   ((fn [] *funkybind*)))
> > true
> >
> > ;;... huh?
> > (binding [*funkybind* true]
> >   (map (fn [_] *funkybind*) [1 2]))
> > (false false)
> >
> > In the last example, why is the value of *funkybind* false instead of
> true?
> >
> > Thanks!
> > Daniel
> >
> > --
> > --
> > 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 unsubscribe from this group and stop receiving emails from it, send an
> > email to clojure+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: binding funkiness

2013-04-22 Thread Timothy Baldridge
To simplify the problem:

((binding [*funkybind* true]
  (fn [] *funkybind*)))

This is the same problem as your lazy-seq example. The issue is that
*funky-bind* is not deref'ed when the anonymous fn is created, but when it
is executed. In this example, by the time the fn is executed, *funkybind*
has reverted back to its old state.

Timothy


On Mon, Apr 22, 2013 at 8:08 PM, Carlo Zancanaro
wrote:

> If you want to capture the binding and have laziness together you can also
> use `bound-fn`.
>
> (binding [*funkybind* true] (map (fn [_] *funkybind*) [0 1]))
> ;=> (false false)
> (binding [*funkybind* true] (map (bound-fn [_] *funkybind*) [0 1]))
> ;=> (true true)
>
>
> On Tue, Apr 23, 2013 at 11:52 AM, Travis Vachon 
> wrote:
>
>> Hi Daniel
>>
>> map is creating a lazy seq, which isn't evaluated until the REPL's
>> forces it to be printed, which is outside the scope of the binding.
>>
>> This:
>>
>> (binding [*funkybind* true]
>>   (doall (map (fn [_] *funkybind*) [1 2])))
>>
>> forces evaluation inside the binding, and does what you want.
>>
>> This is something I've been bitten by a few times, but the power that
>> lazyness brings ends up being worth it, IMHO.
>>
>> Good luck!
>>
>> Travis
>>
>> On Mon, Apr 22, 2013 at 9:41 PM, Daniel Higginbotham
>>  wrote:
>> > I've encountered a situation where the binding function doesn't work as
>> I
>> > expect it:
>> >
>> > user> (def ^:dynamic *funkybind* false)
>> >
>> > ;; expected
>> > user> (binding [*funkybind* true]
>> >   *funkybind*)
>> > true
>> >
>> > ;;expected
>> > (binding [*funkybind* true]
>> >   ((fn [] *funkybind*)))
>> > true
>> >
>> > ;;... huh?
>> > (binding [*funkybind* true]
>> >   (map (fn [_] *funkybind*) [1 2]))
>> > (false false)
>> >
>> > In the last example, why is the value of *funkybind* false instead of
>> true?
>> >
>> > Thanks!
>> > Daniel
>> >
>> > --
>> > --
>> > 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 unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to clojure+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_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
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.goo

Re: [ANN] ClojureC 0.1

2013-04-22 Thread Mark Probst
On Monday, April 22, 2013 6:18:56 PM UTC-7, John Gabriele wrote:
>
> I'm curious: what (if any) differences do you see happening between 
> Clojure(Script) and ClojureC? How close do you expect them to be?
>

I'd like them to be as close as reasonably possible.  Some differences that 
exist today are

* Fields can only be accessed in code following the types they declare. 
 I'm not too happy about this, but can't be bothered to fix it right now.

* Non-mutable fields cannot be set.  That's a feature.

* Only declared protocol methods can be implemented, i.e. you can't make up 
a new method for a type, implement it and call it.

* Integers are not floats and vice versa.

* Characters are not strings.
 

> Do you have any notions yet of what C-library interop might look like?
>

Not really.  Right now a low-level interface to C exists, similar to 
ClojureScript's `js*`, namely `c*`, but that's probably not what you'd want 
to use for binding on a larger scale.  We might co-opt SWIG.

Mark 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Multiple replacements in string using a map

2013-04-22 Thread Mond Ray
Man - you guys are good and *fast*.

I was pootling around with a version that would directly replace 
"/a/:key/b" {:key "value"} with "/a/value/b" and a failed version sneaked 
into my code.

Incidentally that is my only slight complaint about the code as it stands: 
I have to use something like

(def url (replace-map "https://google.$tld";  {:$tld "com"}))

rather than the more elegant and seemingly idiomatic

(def url (replace-map "https://google.:tld";  {:tld "com"}))

Since I am struggling to win this small battle, do you guys have any ideas 
(including that its not a good idea!)?

Cheers

Ray

On Monday, 22 April 2013 23:19:16 UTC+2, Sean Corfield wrote:
>
> On Mon, Apr 22, 2013 at 1:45 PM, Mond Ray > 
> wrote: 
> > Something very odd going on here - one day it works the next day it 
> fails :( 
>
> This code is different to what you posted the other day... 
>
> >   #_=> (map #(java.util.regex.Pattern/quote (keyword %))) 
>
> That won't work - Pattern/quote will not accept a keyword (which is 
> what the exception is telling you). In the code you posted before, 
> which did work, you had (name %) instead which would yield a String 
> from either a keyword or a string - which is clearly what you want 
> here. 
> -- 
> 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Multiple replacements in string using a map

2013-04-22 Thread rod naph
I scratched my itch with...


(defn map-replace [m text]
  (reduce
(fn [acc [k v]] (s/replace acc (str k) (str v)))
text m))


Hope it helps.

On Tuesday, April 23, 2013 5:55:51 AM UTC+1, Mond Ray wrote:
>
> Man - you guys are good and *fast*.
>
> I was pootling around with a version that would directly replace 
> "/a/:key/b" {:key "value"} with "/a/value/b" and a failed version sneaked 
> into my code.
>
> Incidentally that is my only slight complaint about the code as it stands: 
> I have to use something like
>
> (def url (replace-map "https://google.$tld";  {:$tld "com"}))
>
> rather than the more elegant and seemingly idiomatic
>
> (def url (replace-map "https://google.:tld";  {:tld "com"}))
>
> Since I am struggling to win this small battle, do you guys have any ideas 
> (including that its not a good idea!)?
>
> Cheers
>
> Ray
>
> On Monday, 22 April 2013 23:19:16 UTC+2, Sean Corfield wrote:
>>
>> On Mon, Apr 22, 2013 at 1:45 PM, Mond Ray  wrote: 
>> > Something very odd going on here - one day it works the next day it 
>> fails :( 
>>
>> This code is different to what you posted the other day... 
>>
>> >   #_=> (map #(java.util.regex.Pattern/quote (keyword %))) 
>>
>> That won't work - Pattern/quote will not accept a keyword (which is 
>> what the exception is telling you). In the code you posted before, 
>> which did work, you had (name %) instead which would yield a String 
>> from either a keyword or a string - which is clearly what you want 
>> here. 
>> -- 
>> 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Test strategy

2013-04-22 Thread Brian Marick

On Apr 22, 2013, at 7:55 PM, Jonathon McKitrick  wrote:

> I guess the challenge is that the parsing and generating of the structures 
> from JSON descends to several layers of functions, and the database object is 
> created and inserted/updated at the lowest level.  I've tried a bulk insert 
> after accumulating records into a higher level function, but sometimes I need 
> to query for an item previously inserted, so I'm back to inserting each item 
> as created.  The challenge is decoupling object creation from insertion 
> without breaking the nested process approach.

In Midje (https://github.com/marick/Midje), the test would look like this:

(fact
  (parse …json…) => …whatever the function returns…
  (provided
(db/insert …what's to be inserted…) => …whatever insert should return…))

In the case that return values are irrelevant, you'd write that as

(fact
  (parse …json…) => irrelevant
  (provided
(db/insert …what's to be inserted…) => irrelevant))

Read that as "parsing some particular json works provided it calls `insert` 
with this particular argument." (Usually the required argument will be 
described literally, but you can also require that the `insert` input match a 
predicate.)


Latest book: /Functional Programming for the Object-Oriented Programmer/
https://leanpub.com/fp-oo

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.