Re: lein-exec 0.2.0 – Scripting in Clojure

2012-04-24 Thread John Gabriele
On Apr 23, 3:03 am, Shantanu Kumar kumar.shant...@gmail.com wrote:
 Hi,

 I'm happy to announce the Leiningen plugin lein-exec 0.2.0, that lets
 one write scripts with shebang in Clojure as we do in other languages
 like Python, Ruby Groovy etc.


Hi Shantanu,

Useful blog post, thanks!

I've been using lein-oneoff for this. What are the differences between
lein-exec and lein-oneoff?

Thanks,
---John

-- 
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 cheatsheets with several flavors of tooltips

2012-04-24 Thread John Gabriele
On Apr 23, 2:35 pm, Andy Fingerhut andy.finger...@gmail.com wrote:
 The tooltip version of the Clojure/Java cheatsheet is not published at [1] 
 just yet, but hopefully we can figure out how to make that happen in a while:

 [1]http://clojure.org/cheatsheet

 There is an updated link at the bottom of that page called Download other 
 versions that leads to [2]:

 [2]http://jafingerhut.github.com

Thanks so much for these, Andy!

---John

-- 
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: Clojure/dev Google Summer of Code 2012 Proposals Selected!

2012-04-24 Thread Sanel Zukan
 These proposals were selected as they not only had the best overall
 score as determined by the mentoring group

I'm just curious: Improved Clojars System was rejected but is the second 
one with highest scores in the list?

Sanel

On Tuesday, April 24, 2012 5:03:02 AM UTC+2, David Nolen wrote:

 Congratulations to the following students, their proposals have been
 accepted for Clojure/dev's Google Summer of Code 2012!

 Jon Rose
   - Lightweight Clojure editor
 Raphael Amiard
   - Pluggable backend infrastructure for ClojureScript
 Alexander Yakushev
   - Toolchain for dynamic Clojure development on Android
 Ambrose Bonnaire-Sargeant
   - Typed Clojure
 
 These proposals were selected as they not only had the best overall
 score as determined by the mentoring group but we believe that they
 will have a significant impact and are likely to be embraced and
 extended by the Clojure community. We received many proposals we
 wished to pursue but as a first year organization we feel pretty lucky
 to have been given four slots and we're confident that these
 four will keep everyone quite busy.

 We look forward to collaborating as a whole community with these
 students this summer. Collectively let's try our best to
 make sure these projects succeed! Doing so will improve our
 chances to be accepted as a mentoring organization next year and to
 accommodate an even larger number of proposals.

 A big cheers to the Clojure community, this is going to be a fun summer!



-- 
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: Clojure/dev Google Summer of Code 2012 Proposals Selected!

2012-04-24 Thread Raphaël AMIARD
I'm thrilled and honored to see that my proposal has been selected ! 

Thanks to all people involved in the process for their work and effort, 
and thanks for putting your trust in me and my proposal, i'll work hard 
to try and produce something worthy of integration into ClojureScript !



On Tuesday, April 24, 2012 5:03:02 AM UTC+2, David Nolen wrote:

 Congratulations to the following students, their proposals have been
 accepted for Clojure/dev's Google Summer of Code 2012!

 Jon Rose
   - Lightweight Clojure editor
 Raphael Amiard
   - Pluggable backend infrastructure for ClojureScript
 Alexander Yakushev
   - Toolchain for dynamic Clojure development on Android
 Ambrose Bonnaire-Sargeant
   - Typed Clojure
 
 These proposals were selected as they not only had the best overall
 score as determined by the mentoring group but we believe that they
 will have a significant impact and are likely to be embraced and
 extended by the Clojure community. We received many proposals we
 wished to pursue but as a first year organization we feel pretty lucky
 to have been given four slots and we're confident that these
 four will keep everyone quite busy.

 We look forward to collaborating as a whole community with these
 students this summer. Collectively let's try our best to
 make sure these projects succeed! Doing so will improve our
 chances to be accepted as a mentoring organization next year and to
 accommodate an even larger number of proposals.

 A big cheers to the Clojure community, this is going to be a fun summer!



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

Alan Kay talk

2012-04-24 Thread d...@axiom-developer.org
Alan Kay gave a very interesting talk which I think the Clojure
community might find enlightening. Specifically, near the end
he talks about building a DSL by careful domain analysis.
http://tele-task.de/archive/video/flash/14029

In relation to Clojure, are there lessons to learn from the Meta
language he mentioned? Does anyone have references to it?

His example from the talk deals with writing down the equations
of graphics primitives in a mathematical way and then deriving
executable code from the math.

In the area of parallel and concurrent programming we have
some equations that might form a basis of a mathematical
formulation. See
Parallel Program Design: A Foundation by K. Mani Chandy and
Jayadev Misra

Could we write the mathematics of ACID and STM and then
derive correct, small implementations? Alan Kay makes a
compelling argument that this could change the game.

Tim Daly

-- 
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: Alan Kay talk

2012-04-24 Thread Baishampayan Ghose
On Tue, Apr 24, 2012 at 4:53 PM, d...@axiom-developer.org
d...@axiom-developer.org wrote:
 Alan Kay gave a very interesting talk which I think the Clojure
 community might find enlightening. Specifically, near the end
 he talks about building a DSL by careful domain analysis.
 http://tele-task.de/archive/video/flash/14029

I am sorry, I couldn't find the talk by Alan Kay. Can you please
provide a direct link to his talk?

Regards,
BG

-- 
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: Alan Kay talk

2012-04-24 Thread Kevin Ilchmann Jørgensen
Yes, their url handling is random.

https://www.tele-task.de/search/?query=Programming+and+Scaling

Should bring up the correct video.

/Kevin


On Tue, Apr 24, 2012 at 1:28 PM, Baishampayan Ghose b.gh...@gmail.com wrote:
 On Tue, Apr 24, 2012 at 4:53 PM, d...@axiom-developer.org
 d...@axiom-developer.org wrote:
 Alan Kay gave a very interesting talk which I think the Clojure
 community might find enlightening. Specifically, near the end
 he talks about building a DSL by careful domain analysis.
 http://tele-task.de/archive/video/flash/14029

 I am sorry, I couldn't find the talk by Alan Kay. Can you please
 provide a direct link to his talk?

 Regards,
 BG

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

-- 
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: Alan Kay talk

2012-04-24 Thread Michael Fogus
 In relation to Clojure, are there lessons to learn from the Meta
 language he mentioned? Does anyone have references to it?

I have looked at it a bit, it's called META-II.  Some info below:

* http://en.wikipedia.org/wiki/META_II
* http://www.bayfronttechnologies.com/mc_tutorial.html
* http://www.bayfronttechnologies.com/metaii.html

Some interesting languages related to META-II include OMeta and TMG,
both worth exploring.

 Could we write the mathematics of ACID and STM and then
 derive correct, small implementations? Alan Kay makes a
 compelling argument that this could change the game.

So interesting! My brain hurts thinking about this.

-- 
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: Alan Kay talk

2012-04-24 Thread Brad Lucas
The link Tim provided is the direct link but it doesn't 'work' unless 
you are already on the site.


I had the same problem.

Try going to the main page for the video here 
http://tele-task.de/archive/lecture/overview/5819/


There is a group of links of which one of is the flash link which will 
then 'work'. Try http://tele-task.de/archive/video/flash/14029/


- Brad

--
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: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-24 Thread dgrnbrg
I've worked with Tamas, and the VimClojure compatibility support is
now merged into the BitBucket repos, and Tamas' updated version is
merged with my GitHub repo.

On Apr 23, 12:34 am, Dave Ray dave...@gmail.com wrote:
 Note that Tomas recently extracted paredit from slimv, so it has its
 own home now:https://bitbucket.org/kovisoft/paredit
 Also, there have been several important bug fixes applied to paredit
 in the last few months. It would be great if any improvements you've
 made could make it back into the official version.

 Dave







 On Sun, Apr 22, 2012 at 10:24 PM, dgrnbrg dsg123456...@gmail.com wrote:
  I am having trouble porting my simple VimClojure support with the
  version 0.9.6 of the script. The integration w/ slimv's REPL appears
  to have increased. I'm not sure what the best course of action is,
  since I don't really want to continue trying to merge the codebases,
  and instead just fix any bugs in my implementation. There aren't any
  other new features to gain, otherwise.

  On Apr 22, 7:47 pm, John Szakmeister j...@szakmeister.net wrote:
  On Sun, Apr 22, 2012 at 3:28 PM, Evan Mezeske emeze...@gmail.com wrote:
   Version 0.9.3 does indeed support balanced map literals.

   I believe that the bitbucket repository is the official home of slimv 
   (from
   which paredit.vim comes): https://bitbucket.org/kovisoft/slimv/ .

  Just an FYI, but there seems to be version 0.9.6 here:
     http://www.vim.org/scripts/script.php?script_id=3998

  -John

  --
  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: lein-exec 0.2.0 – Scripting in Clojure

2012-04-24 Thread Shantanu Kumar
Hi John,

 Useful blog post, thanks!

Thanks!

 I've been using lein-oneoff for this. What are the differences between
 lein-exec and lein-oneoff?

Current latest versions of lein-exec (0.2.0) and lein-oneoff (0.2.0)
have some overlap, but let me list few differences AFAIC:

1. lein-oneoff works with Lein 1.x, lein-exec works with Lein 2

2. lein-oneoff can start up REPL, which is rather cool. lein-exec
cannot.

3. lein-oneoff can start up swank, lein-exec doesn't know about swank

4. Let's say we have a file hello.clj with content as follows:

(println Hello World!)

How long does it take for lein-exec and lein-oneoff to run it?
This is what I got:

tmp shantanu$ time lein oneoff hello.clj
Hello World!

real0m5.935s
user0m15.050s
sys 0m0.795s
tmp shantanu$ time lein2 exec hello.clj
Hello World!

real0m2.115s
user0m6.809s
sys 0m0.277s

I think the improvements may be due to Leiningen 2.

5. lein-exec supports piping, not sure about lein-oneoff (I couldn't
figure out a way to.)

6. lein-exec can work both with and without project-context. lein-
oneoff works only without project context. This capability is new in
Leiningen 2.

7. In lein-oneoff you specify all dependencies in the beginning using
#_(defdeps ..). In lein-exec you are free to pull in dependencies at
any point in the code.

8. lein-oneoff doesn't preserve the name of the script in *command-
line-args*; lein-exec does.

Hope that helps.

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: StackOverflowError caused by apply-template

2012-04-24 Thread Shogo Ohta
 I think that falls under the heading of don't do that. :)
I see.

Actually, I found the error when I just used clojure.test, like this:

  (clojure.test/are [x y] (= (f x) y) 'x 'y) ;= StackOverflowError

I think it's not as much obvious as clojure.template's case.
At that time, I didn't know that clojure.test uses clojure.template
and
why the error was raised.

On Apr 23, 10:13 am, Stuart Sierra the.stuart.sie...@gmail.com
wrote:
 I think that falls under the heading of don't do that. :)

 clojure.template (which I wrote) wasn't a great idea to begin with. It was
 slightly useful in clojure.test, but I haven't found a use for it since.

 -S







 On Sunday, April 22, 2012 8:02:45 AM UTC-4, Shogo Ohta wrote:

  Hi,

  I've run into such an error:

    (clojure.template/apply-template '[x] 'x '[[x]]) ;=
  StackOverflowError

  It appears to be caused by replacing x with [x] infinitely
  recursively. Is it a bug or spec?

-- 
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: lein-exec 0.2.0 – Scripting in Clojure

2012-04-24 Thread John Gabriele
Hi Shantanu,

Thanks for the detailed reply.

BTW, an issue I ran into: when using lein-exec 0.1 (installed via
lein plugin install lein-exec 0.1) with lein 1.7.1, trying `lein
exec foo.clj`, it tells me:

Couldn't find project.clj, which is needed for exec

Also, re.

 7. In lein-oneoff you specify all dependencies in the beginning using
 #_(defdeps ..). In lein-exec you are free to pull in dependencies at
 any point in the code.

Note, the `#_` is optional.

---John

-- 
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: lein-exec 0.2.0 – Scripting in Clojure

2012-04-24 Thread Shantanu Kumar


On Apr 24, 6:08 pm, John Gabriele jmg3...@gmail.com wrote:
 Hi Shantanu,

 Thanks for the detailed reply.

 BTW, an issue I ran into: when using lein-exec 0.1 (installed via
 lein plugin install lein-exec 0.1) with lein 1.7.1, trying `lein
 exec foo.clj`, it tells me:

     Couldn't find project.clj, which is needed for exec

lein-exec 0.1 can be used only in the context of a project. This is
related to a limitation in Leiningen 1.x wherein a plugin can run
either in project-context or out of it, not both. lein exec in 0.1
is same as lein exec -p in 0.2.0.

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: ANN: Clojure/dev Google Summer of Code 2012 Proposals Selected!

2012-04-24 Thread Alexander Yakushev
I am as well honored and excited to be selected for further participation!

I promise to do my best in order to fulfill all the tasks I plan to work 
on. Great thanks to everyone who made this happen, and I'm sure that the 
Clojure/dev organization performance on GSoC will prove itself worthy for 
more slots in the upcoming years.

In their letter Google announced something called Community Bonding Period 
(which seems like time for both students and organization/mentors to 
communicate on the formal points and the like). I wonder is it enough to 
follow the mailing list to catch up with the necessary information the 
organization may provide (maybe some guidelines, license preferences etc.) 
or another channel of communication will be set up?

Thank you again!

On Tuesday, April 24, 2012 6:03:02 AM UTC+3, David Nolen wrote:

 Congratulations to the following students, their proposals have been
 accepted for Clojure/dev's Google Summer of Code 2012!

 Jon Rose
   - Lightweight Clojure editor
 Raphael Amiard
   - Pluggable backend infrastructure for ClojureScript
 Alexander Yakushev
   - Toolchain for dynamic Clojure development on Android
 Ambrose Bonnaire-Sargeant
   - Typed Clojure
 
 These proposals were selected as they not only had the best overall
 score as determined by the mentoring group but we believe that they
 will have a significant impact and are likely to be embraced and
 extended by the Clojure community. We received many proposals we
 wished to pursue but as a first year organization we feel pretty lucky
 to have been given four slots and we're confident that these
 four will keep everyone quite busy.

 We look forward to collaborating as a whole community with these
 students this summer. Collectively let's try our best to
 make sure these projects succeed! Doing so will improve our
 chances to be accepted as a mentoring organization next year and to
 accommodate an even larger number of proposals.

 A big cheers to the Clojure community, this is going to be a fun summer!



-- 
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: lein-exec 0.2.0 – Scripting in Clojure

2012-04-24 Thread John Gabriele
On Apr 24, 9:15 am, Shantanu Kumar kumar.shant...@gmail.com wrote:

 lein-exec 0.1 can be used only in the context of a project. This is
 related to a limitation in Leiningen 1.x wherein a plugin can run
 either in project-context or out of it, not both. lein exec in 0.1
 is same as lein exec -p in 0.2.0.

Ah, thanks for the info. :)

---John

-- 
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: Clojure/dev Google Summer of Code 2012 Proposals Selected!

2012-04-24 Thread David Nolen
On Tue, Apr 24, 2012 at 3:56 AM, Sanel Zukan san...@gmail.com wrote:

  These proposals were selected as they not only had the best overall
  score as determined by the mentoring group

 I'm just curious: Improved Clojars System was rejected but is the second
 one with highest scores in the list?

 Sanel


I discussed that proposal with the mentor Phil Hagelberg. The Clojure
community is going to move forward on improving Clojars - no need to wait
for summer time. In anycase score was not the ultimate deciding factor as I
stated already.

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: ANN: Clojure/dev Google Summer of Code 2012 Proposals Selected!

2012-04-24 Thread David Nolen
I think the proposals are of broad enough appeal. Please discuss them here.
Thanks!

On Tue, Apr 24, 2012 at 9:55 AM, Alexander Yakushev yakushev.a...@gmail.com
 wrote:

 I am as well honored and excited to be selected for further participation!

 I promise to do my best in order to fulfill all the tasks I plan to work
 on. Great thanks to everyone who made this happen, and I'm sure that the
 Clojure/dev organization performance on GSoC will prove itself worthy for
 more slots in the upcoming years.

 In their letter Google announced something called Community Bonding
 Period (which seems like time for both students and organization/mentors to
 communicate on the formal points and the like). I wonder is it enough to
 follow the mailing list to catch up with the necessary information the
 organization may provide (maybe some guidelines, license preferences etc.)
 or another channel of communication will be set up?

 Thank you again!


 On Tuesday, April 24, 2012 6:03:02 AM UTC+3, David Nolen wrote:

 Congratulations to the following students, their proposals have been
 accepted for Clojure/dev's Google Summer of Code 2012!

 Jon Rose
   - Lightweight Clojure editor
 Raphael Amiard
   - Pluggable backend infrastructure for ClojureScript
 Alexander Yakushev
   - Toolchain for dynamic Clojure development on Android
 Ambrose Bonnaire-Sargeant
   - Typed Clojure

 These proposals were selected as they not only had the best overall
 score as determined by the mentoring group but we believe that they
 will have a significant impact and are likely to be embraced and
 extended by the Clojure community. We received many proposals we
 wished to pursue but as a first year organization we feel pretty lucky
 to have been given four slots and we're confident that these
 four will keep everyone quite busy.

 We look forward to collaborating as a whole community with these
 students this summer. Collectively let's try our best to
 make sure these projects succeed! Doing so will improve our
 chances to be accepted as a mentoring organization next year and to
 accommodate an even larger number of proposals.

 A big cheers to the Clojure community, this is going to be a fun summer!

  --
 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: Embed clojurescript literals in server response

2012-04-24 Thread Brent Millare
fetch uses goog.net.XhrIo under the hood, which has the disadvantage of 
making an additional request. My question is regarding on the initial 
request which includes the javascript, how can I send clojurescript 
literals, or is the best way to just parse existing clojurescript text 
embedded as maybe a hidden form.

On Monday, April 23, 2012 10:55:00 PM UTC-4, kovasb wrote:

 If you are using clojure on the backend, I'd look into
 https://github.com/ibdknox/fetch , it really simplifies things.

 It is possible to send compiled clojurescript data, though its harder
 to get up and running with that, and if you are only sending data (as
 opposed to functions) , it might not be worth it.



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

[ANN] leinjacker: a library for Leiningen plug-in authors

2012-04-24 Thread Daniel Solano Gómez
Hello, all,

I was recently working on a Leiningen plug-in and got annoyed that I was
repeating myself.  So, I have published 'leinjacker', a library that
contains some utilities for plug-in authors.  It doesn't have much at
the moment, the main highlights are:

1. A version of eval-in-project that works with Lein 1.x and Lein 2.

2. Some functions for querying and manipulating project dependencies.

I hope it's useful for others.  I'm open to accepting any patches for
additional functionality which would be of use to others.

Enjoy,

Daniel


signature.asc
Description: Digital signature


Re: [ANN] leinjacker: a library for Leiningen plug-in authors

2012-04-24 Thread Daniel Solano Gómez
I just realised I didn't post a link.

Predictably, it's on github: https://github.com/sattvik/leinjacker

On Tue Apr 24 12:26 2012, Daniel Solano Gómez wrote:
 Hello, all,
 
 I was recently working on a Leiningen plug-in and got annoyed that I was
 repeating myself.  So, I have published 'leinjacker', a library that
 contains some utilities for plug-in authors.  It doesn't have much at
 the moment, the main highlights are:
 
 1. A version of eval-in-project that works with Lein 1.x and Lein 2.
 
 2. Some functions for querying and manipulating project dependencies.
 
 I hope it's useful for others.  I'm open to accepting any patches for
 additional functionality which would be of use to others.
 
 Enjoy,
 
 Daniel




signature.asc
Description: Digital signature


Re: Should read-string support \x.. escaped characters?

2012-04-24 Thread Brandon Bloom
Surprisingly, this differs from JSON, which only supports \u...

On Friday, December 23, 2011 5:43:00 PM UTC-8, Dave Sann wrote:

 When sending data as strings from clojurescript to clojure there will be 
 issues if the source data contains certain unicode characters. (I think in 
 range 128-255 - extended latin characters mostly).

 This is because the goog string conversion used by pr-str encodes these 
 characters as \x.. not \u00..

 read-string will throw an exception if it encounters these characters.

 Should read-string support these character escapes?



 by way of work around, I am using:

 (require '[clojure.string :as s])

 (defn unescape [string]
   (s/replace 
 string #\\x(..) 
 (fn [m] (str (char (Integer/parseInt (second m) 16))

 (defn my-read-string [s]
   (read-string (unescape s)))

 Causes : https://github.com/ibdknox/pinot/issues/16

 Cheers

 Dave



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

[CLJS] Disable name mangling for 'static'

2012-04-24 Thread Jonathan Fischer Friberg
Hi,

I want to create a (partially static) server with nodejs and express.
I want to be able to write something like the following:

(def app (.createServer express))

(.use app (.static express public))

(.listen app 8080)

The problem here is that clojurescript seems to compile
the name 'static' to 'static$'.
No matter how I do it, this is the case.

I have tried various tricks with js* and such,
but all have been unsuccessful.

Any ideas?

Jonathan

-- 
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: [CLJS] Disable name mangling for 'static'

2012-04-24 Thread David Nolen
It's a known bug. We should not munge JS reserved words that appear in
property access. Patch welcome.

David

On Tue, Apr 24, 2012 at 3:31 PM, Jonathan Fischer Friberg 
odysso...@gmail.com wrote:

 Hi,

 I want to create a (partially static) server with nodejs and express.
 I want to be able to write something like the following:

 (def app (.createServer express))

 (.use app (.static express public))

 (.listen app 8080)

 The problem here is that clojurescript seems to compile
 the name 'static' to 'static$'.
 No matter how I do it, this is the case.

 I have tried various tricks with js* and such,
 but all have been unsuccessful.

 Any ideas?

 Jonathan

 --
 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: Embed clojurescript literals in server response

2012-04-24 Thread Evan Mezeske


 I would like to evaluate other methods which may involve:
 -parsing hidden strings in the html code


The way that I've been doing this, for better or worse, has been to insert 
a Javascript function call into the HTML output by my server, like:

script type=text/javascript
  $(function() {my_cljs_ns.initialize('data');});
/script

Where 'data' is some clojure datastructure that has been run through pr-str 
and had single quotes escaped.  The clojurescript function called by the 
generated javascript has to be marked with :export to make this work.  When 
called, it calls read-string on its first argument.

This seems more or less equivalent to just using a hidden form field.  I 
don't really see much of an advantage either way.  This approach has been 
working great for me so far.
 

 -compiling or retrieving from cache, javascript code generated from 
 clojurescript serverside with the data literals in javascript form already, 
 no parsing of clojurescript needed.


Why are you trying to avoid parsing the clojurescript client-side?  Are you 
working with a very large data structure?  Dynamically compiling the form 
to javascript on the server side is going to be very expensive, although I 
guess if it's very cache-friendly it might work out well.

Be aware that if you're using the compiled clojurescript approach, and are 
using advanced optimizations, that you'll need to make careful use of 
:export and possibly even :externs to make the pre-compiled and 
dynamically-compiled javascript work together.

Using the pr-str/read-string approach is likely to be *much* simpler than 
this, and is definitely the approach I'd recommend.
 

-- 
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: Disable name mangling for 'static'

2012-04-24 Thread Chris Granger
If I remember right, I did this as a workaround:

(js/my.ns.express.static public)

Cheers,
Chris.

On Apr 24, 12:33 pm, David Nolen dnolen.li...@gmail.com wrote:
 It's a known bug. We should not munge JS reserved words that appear in
 property access. Patch welcome.

 David

 On Tue, Apr 24, 2012 at 3:31 PM, Jonathan Fischer Friberg 







 odysso...@gmail.com wrote:
  Hi,

  I want to create a (partially static) server with nodejs and express.
  I want to be able to write something like the following:

  (def app (.createServer express))

  (.use app (.static express public))

  (.listen app 8080)

  The problem here is that clojurescript seems to compile
  the name 'static' to 'static$'.
  No matter how I do it, this is the case.

  I have tried various tricks with js* and such,
  but all have been unsuccessful.

  Any ideas?

  Jonathan

  --
  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: Disable name mangling for 'static'

2012-04-24 Thread Bronsa
This should fix it
http://dev.clojure.org/jira/browse/CLJS-202

2012/4/24 Chris Granger ibdk...@gmail.com

 If I remember right, I did this as a workaround:

 (js/my.ns.express.static public)

 Cheers,
 Chris.

 On Apr 24, 12:33 pm, David Nolen dnolen.li...@gmail.com wrote:
  It's a known bug. We should not munge JS reserved words that appear in
  property access. Patch welcome.
 
  David
 
  On Tue, Apr 24, 2012 at 3:31 PM, Jonathan Fischer Friberg 
 
 
 
 
 
 
 
  odysso...@gmail.com wrote:
   Hi,
 
   I want to create a (partially static) server with nodejs and express.
   I want to be able to write something like the following:
 
   (def app (.createServer express))
 
   (.use app (.static express public))
 
   (.listen app 8080)
 
   The problem here is that clojurescript seems to compile
   the name 'static' to 'static$'.
   No matter how I do it, this is the case.
 
   I have tried various tricks with js* and such,
   but all have been unsuccessful.
 
   Any ideas?
 
   Jonathan
 
   --
   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


-- 
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: Disable name mangling for 'static'

2012-04-24 Thread Jonathan Fischer Friberg

 This should fix it


Nice!

The workaround I'm currently using is

(.use app (js* require('express')['static']('public')))

(the closure compiler wont allow require('express').static ... )

Jonathan

On Tue, Apr 24, 2012 at 10:22 PM, Bronsa brobro...@gmail.com wrote:

 This should fix it
 http://dev.clojure.org/jira/browse/CLJS-202


 2012/4/24 Chris Granger ibdk...@gmail.com

 If I remember right, I did this as a workaround:

 (js/my.ns.express.static public)

 Cheers,
 Chris.

 On Apr 24, 12:33 pm, David Nolen dnolen.li...@gmail.com wrote:
  It's a known bug. We should not munge JS reserved words that appear in
  property access. Patch welcome.
 
  David
 
  On Tue, Apr 24, 2012 at 3:31 PM, Jonathan Fischer Friberg 
 
 
 
 
 
 
 
  odysso...@gmail.com wrote:
   Hi,
 
   I want to create a (partially static) server with nodejs and express.
   I want to be able to write something like the following:
 
   (def app (.createServer express))
 
   (.use app (.static express public))
 
   (.listen app 8080)
 
   The problem here is that clojurescript seems to compile
   the name 'static' to 'static$'.
   No matter how I do it, this is the case.
 
   I have tried various tricks with js* and such,
   but all have been unsuccessful.
 
   Any ideas?
 
   Jonathan
 
   --
   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


  --
 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: Disable name mangling for 'static'

2012-04-24 Thread David Nolen
Fixed in master thanks.

On Tue, Apr 24, 2012 at 4:22 PM, Bronsa brobro...@gmail.com wrote:

 This should fix it
 http://dev.clojure.org/jira/browse/CLJS-202


 2012/4/24 Chris Granger ibdk...@gmail.com

 If I remember right, I did this as a workaround:

 (js/my.ns.express.static public)

 Cheers,
 Chris.

 On Apr 24, 12:33 pm, David Nolen dnolen.li...@gmail.com wrote:
  It's a known bug. We should not munge JS reserved words that appear in
  property access. Patch welcome.
 
  David
 
  On Tue, Apr 24, 2012 at 3:31 PM, Jonathan Fischer Friberg 
 
 
 
 
 
 
 
  odysso...@gmail.com wrote:
   Hi,
 
   I want to create a (partially static) server with nodejs and express.
   I want to be able to write something like the following:
 
   (def app (.createServer express))
 
   (.use app (.static express public))
 
   (.listen app 8080)
 
   The problem here is that clojurescript seems to compile
   the name 'static' to 'static$'.
   No matter how I do it, this is the case.
 
   I have tried various tricks with js* and such,
   but all have been unsuccessful.
 
   Any ideas?
 
   Jonathan
 
   --
   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


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

fnil should delay evaluation of its argument?

2012-04-24 Thread blais
Does anybody else feel that (fnil) should delay evaluation of its argument?
Maybe I've been abusing mutability a bit too much, but for a map which 
refers to mutable object instances, I've found this useful:


(defmacro fnil*
  Delayed evaluation version of fnil, where the default expression 
gets

 

evaluated every time it is required.
  ([f x]
 `(fn
([a#] (~f (if (nil? a#) ~x a#)))
([a# b#] (~f (if (nil? a#) ~x a#) b#))
([a# b# c#] (~f (if (nil? a#) ~x a#) b# c#))
([a# b# c#  ds#] (apply ~f (if (nil? a#) ~x a#) b# c# ds#
  ([f x ~y]
 `(fn
([a# b#] (~f (if (nil? a#) ~x a#) (if (nil? b#) ~y b#)))
([a# b# c#] (~f (if (nil? a#) ~x a#) (if (nil? b#) ~y b#) c#))
([a# b# c#  ds#] (apply ~f (if (nil? a#) ~x a#) (if (nil? b#) ~y 
b#) c# ds#
  ([f x ~y ~z]
 `(fn
([a# b#] (~f (if (nil? a#) ~x a#) (if (nil? b#) ~y b#)))
([a# b# c#] (~f (if (nil? a#) ~x a#) (if (nil? b#) ~y b#) (if (nil? 
c#) ~z c#)))
([a# b# c#  ds#] (apply ~f (if (nil? a#) ~x a#) (if (nil? b#) ~y 
b#) (if (nil? c#) ~z c#) ds#)

-- 
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: Alan Kay talk

2012-04-24 Thread jim
That talk was one of the inspirations for my DSL talk at ClojureWest.
I did several blog posts about DSL's in Clojure, starting with
http://www.clojure.net/2012/02/15/DSL-Intro/

I think there's a lot of leverage to be gained with the kinds of ideas
he talks about.

Jim

-- 
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: Embed clojurescript literals in server response

2012-04-24 Thread Brent Millare



 script type=text/javascript
   $(function() {my_cljs_ns.initialize('data');});
 /script


Today I coded up a method. Currently I'm creating divs of a class that is 
invisible. Then I just use some node searcher to grab the content then call 
read-string on it. Seems easier to do then inserting the javascript 
function call as you are doing, but my method involves more computation 
(probably very negligible). It's simple and it works.

(ns foo (:require [goog..]) (:require-macros [enfocus.macros :as em]))

(defn node-raw-text [selector]
  (let [store (atom)]
(em/at js/document
   selector
   (fn [node]
 (reset! store (goog.dom/getRawTextContent (first node)
@store))

;; then later you can call something like so
(reader/read-string (node-raw-text [:div#default-cljs-data]))

 

 Why are you trying to avoid parsing the clojurescript client-side?  Are 
 you working with a very large data structure?  Dynamically compiling the 
 form to javascript on the server side is going to be very expensive, 
 although I guess if it's very cache-friendly it might work out well.

 Be aware that if you're using the compiled clojurescript approach, and are 
 using advanced optimizations, that you'll need to make careful use of 
 :export and possibly even :externs to make the pre-compiled and 
 dynamically-compiled javascript work together.
  


Basically, I want to see what's possible. If someone's done the research on 
how to do it this way, I'd like to see it. There's a different trade-off 
being made with each method.

-- 
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: Embed clojurescript literals in server response

2012-04-24 Thread Evan Mezeske


 Basically, I want to see what's possible. If someone's done the research 
 on how to do it this way, I'd like to see it. There's a different trade-off 
 being made with each method.


If you're looking for an example, the clojurescript browser REPL 
dynamically compiles forms and sends them to the client for evaluation:


https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/repl/browser.clj

I don't think the browser REPL makes any attempt to work against 
pre-compiled code with advanced optimizations, though.  That's something 
that I have not yet seen explored.

-- 
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 clojure.java.jdbc 0.2.0

2012-04-24 Thread Michael
Would be convenient to have set-parameters public. I'm experimenting with a 
couple of fns to insert into oracle and oracle's sequences for generated 
keys are a headache. What's below is not fully tested but should give you 
an idea of the sql I'm dealing with. Any pointers on how to leaverage 
java.jdbc more with less custom code would be appreciated.

(defn- oracle-insert-sql [table pk-col-name pk-seq-name ks]
  (let [cols (apply str (interpose \, (map jdbc/as-identifier ks)))
n (count ks)
qmarks (apply str (interpose \, (repeat n \?)))]
(str insert into  (jdbc/as-identifier table)
 \( (jdbc/as-identifier pk-col-name) \, cols ) values (
 (jdbc/as-identifier pk-seq-name) .nextval, qmarks \

(defn oracle-insert-record [table pk-col-name pk-seq-name record]
  (let [sql (oracle-insert-sql table pk-col-name pk-seq-name (keys record))]
(with-open [^PreparedStatement pstmt (.prepareStatement 
(jdbc/connection) sql,
(into-array 
[(jdbc/as-identifier pk-col-name)]))]
  (set-parameters pstmt (vals record))
  (jdbc/transaction
   (.executeUpdate pstmt)
   (vec (ijdbc/resultset-seq* (.getGeneratedKeys pstmt)))

(defn oracle-insert-records [table pk-col-name pk-seq-name  records]
  (when-let [record (first records)]
(let [ks (keys record)
  sql (oracle-insert-sql table pk-col-name pk-seq-name (keys 
record))  
  value-groups (map #(map (partial get %) ks) records)]
  (apply jdbc/do-prepared sql value-groups

-- 
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 clojure.java.jdbc 0.2.0

2012-04-24 Thread Michael

Would it be possible to make resultset-seq a dynamic var so that you can 
bind in custom result set mapping without having to make two passes through 
the results? For instance, I would want to map sql date/timestamp to joda 
DateTime and T/F to true/false directly.



-- 
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: Alan Kay talk

2012-04-24 Thread Kai
The implications of Kay's talk are potent; and when one considers that his 
team at VPRI have mostly fulfilled their vision to reduce the tens/hundreds 
of millions of lines of code needed for personal computing down to under 
20,000 lines (includes OS, networking, graphics, office apps, web 
browsing), the implications are stunning. 

There's much more information available at VPRI's website on the STEPS 
project: 

http://vpri.org/html/writings.php 

There, filter by Fundamental New Computer Technologies and look at the 
annual reports to the NSF for detailed descriptions; the most recent report 
was released Oct. 31 2011, at http://www.vpri.org/pdf/tr2011004_steps11.pdf

The OMeta language is described  in Alessandro Warth's doctoral 
dissertation: http://www.vpri.org/pdf/tr2008003_experimenting.pdf

- Kai

-- 
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 clojure.java.jdbc 0.2.0

2012-04-24 Thread Michael
I think I was leaking result sets.

(defn oracle-insert-record [table pk-col-name pk-seq-name record]
  (let [sql (oracle-insert-sql table pk-col-name pk-seq-name (keys record))]
(with-open [^PreparedStatement pstmt (.prepareStatement 
(jdbc/connection) sql,
(into-array 
[(jdbc/as-identifier pk-col-name)]))]
  (set-parameters pstmt (vals record))
  (jdbc/transaction
   (.executeUpdate pstmt)
   (with-open [rs (.getGeneratedKeys pstmt)]
  (vec (ijdbc/resultset-seq* rs)))


On Tuesday, April 24, 2012 11:04:11 PM UTC-4, Michael wrote:

 Would be convenient to have set-parameters public. I'm experimenting with 
 a couple of fns to insert into oracle and oracle's sequences for generated 
 keys are a headache. What's below is not fully tested but should give you 
 an idea of the sql I'm dealing with. Any pointers on how to leaverage 
 java.jdbc more with less custom code would be appreciated.

 (defn- oracle-insert-sql [table pk-col-name pk-seq-name ks]
   (let [cols (apply str (interpose \, (map jdbc/as-identifier ks)))
 n (count ks)
 qmarks (apply str (interpose \, (repeat n \?)))]
 (str insert into  (jdbc/as-identifier table)
  \( (jdbc/as-identifier pk-col-name) \, cols ) values (
  (jdbc/as-identifier pk-seq-name) .nextval, qmarks \

 (defn oracle-insert-record [table pk-col-name pk-seq-name record]
   (let [sql (oracle-insert-sql table pk-col-name pk-seq-name (keys 
 record))]
 (with-open [^PreparedStatement pstmt (.prepareStatement 
 (jdbc/connection) sql,
 (into-array 
 [(jdbc/as-identifier pk-col-name)]))]
   (set-parameters pstmt (vals record))
   (jdbc/transaction
(.executeUpdate pstmt)
(vec (ijdbc/resultset-seq* (.getGeneratedKeys pstmt)))

 (defn oracle-insert-records [table pk-col-name pk-seq-name  records]
   (when-let [record (first records)]
 (let [ks (keys record)
   sql (oracle-insert-sql table pk-col-name pk-seq-name (keys 
 record))  
   value-groups (map #(map (partial get %) ks) records)]
   (apply jdbc/do-prepared sql value-groups



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