Re: Leiningen2 + lein-midje + lazytest question

2012-06-12 Thread Daniel E. Renfer

On 06/12/2012 12:05 PM, Phil Hagelberg wrote:

On Mon, Jun 11, 2012 at 1:46 PM, Phil Hagelbergp...@hagelb.org  wrote:

On Mon, Jun 11, 2012 at 12:52 PM, Cédric Pineaucedric.pin...@gmail.com  wrote:

My question is with the lazy-test dependency. Do I really have to put it as
a project dependency ?
It doesn't seem to be on the lein-midje path when puting it in the
dev-dependencies..

If it's required for lein-midje then lein-midje should add it to your
dependencies without you needing to do anything.

I should clarify that I know nothing about lein-midje in particular;
I'm just commenting on what the proper behaviour of plugins should be.

-Phil


The issue here is that Midje and lein-midje don't need Lazytest for 
normal operation, only for the --lazytest support. What would be the 
proper way to specify that dependency without requiring that everyone 
that uses Midje also carry around Lazytest?


I know the answer would probably be needing a lein-midje-lazytest 
artifact that adds that support, but that seems overkill.


--
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: defmulti and defmethods in separate namespaces without circular references?

2012-03-02 Thread Daniel E. Renfer
I use a lot of multimethods with my framework, Ciste[0] and it can work,
the only thing is you have to be very careful about what you put where,
and it helps to have a lot of namespaces.

What I do is try to keep all of my defmulti's in one namespace and have
only defmethod's in another namespace. Originally, I had one master
namespace that required all of the defmethod namespaces (my routes
namespace) and then all my action namespaces only require the defmulti
namespaces.

I've since then moved on to use the 'definitializer' functionality of
Ciste to require those defmethod namespaces after all of the other
namespaces have been required.

I'm not saying it's the best coding style, but it works for me and my
applications. Be prepared to move functions around a lot to always stay
one step ahead of the dreaded cyclic dependency horror.

0: https://github.com/duck1123/ciste

On 03/02/2012 10:55 AM, Cymen Vig wrote:
 On Friday, March 2, 2012 7:03:10 AM UTC-6, tim.visher wrote:

 I will not in any way claim to know how or why this works. I'm just
 starting to use multimethods myself, but I'll give you my set up that
 appears to be working at the moment.

 I have a namespace:

 (ns store.store)

 (defmulti serialize method)

 (defmulti slurp method)

 in store.clj

 I have 1 implementation:

 (ns store.file-system
   [:use [store.store]]
   …)

 (def base )

 (defmethod serialize :file-system [_ file-name contents]
   (fs-utils/write-to contents (str base / file-name)))

 (defmethod slurp :file-system [_ file-name]
   (clojure.core/slurp (str base / file-name)))

 I then use this from another namespace, requiring store.store and
 store.store.file-system:

 (ns library
   [:require [wallpaper-manager-core.store.file-system :as
 store-file-system]]
   [:require [wallpaper-manager-core.store.store :as store]])

 (binding [store-file-system/base (fs/home)]
   (def library (ref (read-library) :validator library-validator)))

 (defn serialize-library [library]
   (store/serialize :file-system library.clj library))

 And this all seems to work fine for me. Maybe someone else can explain
 why it does for me and doesn't for you. Maybe it has something to do
 with `use` vs. `require`?

 This does indeed work for me. What I was trying to do was avoid was
 having to do this part:

...
   [:require [wallpaper-manager-core.store.store :as store]])

 As each time I add a defmethod implementation of my defmulti I'd have
 to add another require. But maybe that isn't such a bad thing so I'll
 go with this approach. I prefer it over having a super parent (*)
 namespace unless i needed that super parent in multiple places.

 * by super parent I mean a namespace that is only used to include
 the namespaces that contain the defmulti and defmethods

 Thanks,
 Cymen
 -- 
 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: Bret Victor - Inventing on Principle

2012-02-24 Thread Daniel E. Renfer
On 02/24/2012 02:42 PM, Cedric Greevey wrote:
 On Fri, Feb 24, 2012 at 2:25 PM, Jay Fields j...@jayfields.com wrote:
 On Fri, Feb 24, 2012 at 2:12 PM, Cedric Greevey cgree...@gmail.com wrote:
 On Fri, Feb 24, 2012 at 2:06 PM, gaz jones gareth.e.jo...@gmail.com wrote:
 Are you Ken Wesson with a new account?
 Who?

 Wait. Surely you don't think that it's not possible for more than one
 person to prefer text to video as a way of disseminating verbal
 information over the internet, given all of text's advantages in such
 areas as bandwidth, cost, and tool support?
 Surely it's possible that you've never heard of Ken Wesson, he
 disappeared right before you joined, you respond to emails in the same
 manner, you share the same opinions. Seems legit, Ken.
 OK. I googled the group archives. Seems there was a Ken Wesson active
 on the list for a while, but he disappeared a couple of months before
 I joined. I'm not sure why people think I might be him.


Ken Wesson was noted for having strong opinions as was a noted hater of
videos where text will do.

https://groups.google.com/d/msg/clojure/0kCwGrFU5zs/NGclkY46fvEJ

-- 
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: Controlling the test environment

2012-01-20 Thread Daniel E. Renfer
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/15/2012 06:18 PM, Matt Stump wrote:
 
 
 Is there a way to set different values for global vars when running
 tests as opposed to the development or production environment?  I
 need to control which database my tests for a noir project connect
 to. Ideally I would like to do something like the following: for
 production and development, if an environment variable is set
 connect to the database server at the specified URL, if not then
 fall back to localhost.  For test start up an embedded server, and
 connect. After the test is done, rollback the global var to the
 previous value and resume connecting to the server on localhost or
 at the location specified by the environment variable.
 
 I could create some fixture with-test-database that modifies a
 global var, but that seems a little hackish.
 
 How are other people solving this problem?  Is there something
 similar pre-baked into noir, clojure.test or midje?
 

I wrote support for configuration with different environments into
Ciste.[1]

You create a config.clj file at the root of your application that
contains a map with each of the keys being a keyword naming the
environment and the value is a map for all the config options.

You can then use set-environment! or with-environment to set the
current environment.

You can then wrap some code in definitializer. That code will be run
whenever the environment changes. I set the environment when my
application runs and then wrap all my tests in (with-environment :test )


The config namespace should be isolated enough that you could use it
without involving any of the other features.



1: https://github.com/duck1123/ciste/
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8ZoO0ACgkQWorbjR01Cx59cACffeQeffgR0zgtqt5FXGaQy9gx
zz8An2pMclSd+qA8dxc8XMPB+gMbhNjR
=XbSs
-END PGP SIGNATURE-

-- 
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: How to read project.clj file.

2011-08-09 Thread Daniel E. Renfer
On 08/09/2011 05:35 AM, Shantanu Kumar wrote:
 
 
 On Aug 9, 12:22 pm, mmwaikar mmwai...@gmail.com wrote:
 Hi,

 Assuming there are some DB credentials specified in a project.clj file as a
 map, how should I read those credentials in my clojure code -

 1) should I use slurp and then parse that text?
 2) should I (use 'leiningen.core) and then (load-file project.clj)
 3) or something else

 Please let me know the best / idiomatic way to accomplish this.
 
 project.clj is available to Leiningen plugins. Assuming you are open
 to put the DB credentials elsewhere, I'd suggest putting it in another
 file that can be easily discoverable. This idea is implemented in Clj-
 DBCP:
 
 https://bitbucket.org/kumarshantanu/clj-dbcp/overview (jump to the
 section Create DataSource from `.properties` file)
 
 Regards,
 Shantanu
 

When it comes to loading config options, I always use my Ciste library
which has the ciste.config namespace. By default, it looks for a file
named config.clj in the root of the project.

config.clj contains a map with the keys being the environment names and
the values are maps of config options. It needs a bit more work, but it
serves my purposes.

The config function will either return the config map, or it will look
up the passed params in the map.

(use 'ciste.config)

(environment) = :development

(load-config)

(config :database :username) = root



Even if you don't use Ciste (there's a lot of stuff in there that may
not be relevant to your project) The config ns should at least get you
started.
https://github.com/duck1123/ciste/blob/master/src/main/clojure/ciste/config.clj


https://github.com/duck1123/ciste



signature.asc
Description: OpenPGP digital signature


Re: What is the reason Lisp code is not written with closing parenthesis on new lines?

2010-08-18 Thread Daniel E. Renfer
On 8/18/10 1:32 PM, Brian Goslinga wrote:
 Putting them on separate lines put the focus on the wrong element of
 the code.  You do not want to be focusing on the parentheses, you want
 to be focusing on the structure of the code.  The idiomatic lisp
 formatting style uses indentation to reveal the large scale structure
 of the code, and so the parentheses can be neatly tucked away.  With a
 little experience, the parentheses will start to fade from view.
 
 Additionally, putting them on separate lines waste vertical space, and
 you should be using an editor that supports paren matching so you
 don't need to count them.
 

Generally, when I am working on a function, I will put the closing
parens anywhere with a ton of whitespace all around. Once I'm done with
the function, I make sure to delete all of the excess breaks so that
it's a nice neat block of code.

Using paredit in emacs makes it really easy to handle the closing
parens. I'm sure there are other good tools for the other editors.



signature.asc
Description: OpenPGP digital signature


Re: Idea for personal Clojure project

2010-07-28 Thread Daniel E. Renfer
On 7/28/10 5:34 PM, Mark Engelberg wrote:
 Wordnet is the main existing thing that comes to mind as related to your
 idea.
 

You might also want to look into Freebase. Here's a Clojure client you
can use to query their data. http://github.com/rnewman/clj-mql



signature.asc
Description: OpenPGP digital signature


Re: Clojure 1.0.0 has been uploaded to Maven Central - Finally

2009-07-14 Thread Daniel E. Renfer

On Tue, 2009-07-14 at 06:58 -0700, AlamedaMike wrote: 
 Stefan, Meikel,
 
 Thanks much for this. It looks very interesting.
 
 Forgive a newb question but I just downloaded Maven for the first time
 30 minutes ago. I read the Maven in 5 minutes doc, and executed:
 
 mvn archetype:create -DgroupId=org.clojure  -DartifactId=clojure
 
 followed by:
 
 mvn package
 
 All the tests passed. I then ran:
 
 java -cp clojure-1.0-SNAPSHOT.jar  org.clojure.App
 
 and got Hello World as the output.
 
 My expectation is that one of the first two commands would go to a
 central repository and download a POM file based on the id parameter,
 which would in turn supply the data necessary to download the other
 dependencies necessary to build a complete set of clojure files.
 However, I'm just getting the 2,092 byte clojure jar file. What am I
 missing?
 
 Thanks in advance for any help.

As far as I'm aware, there is no archetype for Clojure projects just
yet. I tried making one, but my maven-fu is not quite up to snuff yet.

So, unless/until someone creates one and lets us know about it, you have
to set up the initial layout of the project manually.

What clojure being in the repository means is we can now specify a
dependency on clojure 1.0 and have maven automatically download it for
us. You will still have to install:install-file on clojure-contrib
yourself or find a repository that is hosting a version for you, but you
will only have to do that once per machine and that will be shared
amongst your projects.

I believe what you were doing was creating a new stub java project which
was overwriting (in your local repository) the clojure dependency. You
will want to replace the groupId and artifactId with your own namespace
and project name respectively, and then insert into the dependencies
section this:

dependency
  groupIdorg.clojure/groupId
  artifactIdclojure/artifactId
  version1.0.0/version
/dependency

You also might want to look into the clojure-maven-plugin[1] if you are
planning on doing AOT compilation of your clojure projects.

[1]: git://github.com/talios/clojure-maven-plugin.git

Daniel E. Renfer




--~--~-~--~~~---~--~~
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 for Scientific and other CPU-intensive Computing

2009-07-01 Thread Daniel E. Renfer

Mark Engelberg mark.engelb...@gmail.com writes:

 On Tue, Jun 30, 2009 at 12:29 AM, Konrad
 Hinsenkonrad.hin...@laposte.net wrote:
 What is particularly nice about Clojure is that in most situations
 you don't need to switch to Java for speed. You can optimize your
 code by adding type hints and switching to low-level data structures
 (unboxed ints and floats, arrays, ...) and get performance equal to
 Java.

 I have heard this claim about Clojure's speed a number of times, and I
 am curious what the evidence for this claim is.  As far as I know, no
 one has written a suite of meaningful benchmarks to compare the
 performance of Clojure versus Java.

 On the other hand, every month or so, someone posts here saying they
 tried to do a single benchmark, and it runs quite a bit slower than
 Java.  People help out, and usually some ways to improve the code are
 found, but I don't think I've ever seen the code actually get to the
 point where it has performance equal to Java.


I think a problem with a lot of these micro-benchmarks is someone will
find a small function in java and then try to write a clojure function
that does the same thing the same way. 

I think a lot of the times you don't really see the speed increase until
you take into account that you will do things differently in the larger
picture with clojure than you would with java.

When you take into account that clojure offers up algorithms that would
be downright unwieldy to attempt in java do you really see the speeds
even out.

Daniel E. Renfer

--~--~-~--~~~---~--~~
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: Concerns About Pushing Clojure 1.0.0 to Maven Central Repo?

2009-05-10 Thread Daniel E. Renfer

Phil Hagelberg p...@hagelb.org writes:

 Howard Lewis Ship hls...@gmail.com writes:

 clojure-lang because there will be a clojure-contrib artifact for the
 same group.

 And this is ... a bad thing? I'm lost.

 -Phil

Good, at least I'm not the only one.

Why can't we have both clojure and clojure-contrib as Id's?

Daniel E. Renfer

--~--~-~--~~~---~--~~
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
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: CL libraries - Newbie question

2009-05-10 Thread Daniel E. Renfer

 Myriam Abramson mabram...@gmail.com wrote:
 Is there something to do that easily? After all the syntax is not that
 much different and that's what lisp do well.

Stuart Sierra the.stuart.sie...@gmail.com writes:
 I'd never say this out loud on comp.lang.lisp, but I can't think of
 any CL libraries for which there is not a functionally equivalent,
 more robust, better-maintained Java library.

 Yeah, Java APIs aren't Lisp APIs.  Whatever.  Java libraries tend to
 be used by more than two people, so they have a higher likelihood of
 actually working.

Not to mention the fact that, despite the fact that Clojure instantly
has access to all of the libraries written in other JVM languages, the
number of Clojure libraries is increasing every day it seems. There is a
good chance now that whatever you're looking to do in Clojure has at
least been toyed with and dumped into a github repository.

It seems to me that it wouldn't be that easy to have a tool to
automatically port CL libraries to Clojure. Sure, they're both lisps,
and a good number of the functions are the same, but it seems to me that
there are just too many small differences to create a tool to convert
the two with any amount of accuracy. Plus, chances are the library would
be much better of taking advantage of some of the neat toys that Clojure
has that other languages don't in most cases.

Daniel E. Renfer

--~--~-~--~~~---~--~~
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
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: Documenting Clojure Code

2009-01-30 Thread Daniel E. Renfer

Mark,

Glad to see you are putting some more work into clj-doc again. I tried
compiling it a couple weeks ago, and after I downloaded the 4 or 5
libraries it depended on and fixed some of the references to code that
had been moved, I got an exception when I tried running it. I gave up
after that.

Is clj-doc usable yet, or should I still wait a little bit? Ideally I
would like to be able to include an ant task in my build file that
generates all the documentation for the code in my project much like you
can get in Java-land with javadoc.

Btw, the bookmark I have to your generated clj-doc documentation is
still my prefered way to find the function I'm looking for. Are you
still keeping that up to date, or has it stagnated since you first
announced it?

Mark McGranaghan mmcgr...@gmail.com writes:
 Hi Kevin,

 You should try clj-doc:

 http://github.com/mmcgrana/clj-doc

 clj-doc generates HTML API documentation that is searchable via
 JavaScript and includes source snippets for the code that defined each
 var.

 I update clj-doc tonight to include example docs, just clone my
 clj-doc repo and open example/index.html in your browser to see what
 the docs look like.

 In my update I also made it easier to generate docs for your own sets
 of libs: check out the README and let me know if you have any
 questions/problems.

 I've had clj-doc on hold for a little while as I've been waiting for
 various documentation-related features to find their way into core,
 especially the ns docstrings. Now that we have most of those (though
 (def foo docstring :bar) is noticeably missing) I'm going to be
 working more on clj-doc.

 Hope you find it useful,
 - Mark McGranaghan


--~--~-~--~~~---~--~~
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
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: Accessing this in gen-class constructor

2008-12-27 Thread Daniel E. Renfer

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

The first parameter to these functions should be the reference the object.

so try:

(defn -init [this]
(.setDescription this this is a derived class)

On 12/27/2008 08:05 PM, CuppoJava wrote:
 Here's my stab at it.
 I'm having problems with the setDescription() line.
 Thanks for your help
   -Patrick
 
 (ns test)
 (gen-class
  :name test.MyDerivedClass
  :extends [SuperClass]
  :init init
  :constructors {[] [String]})
 
 (defn -init []
   ;The following line doesn't work.
   ;I need to call setDescription on this object
   ;who's reference is not available yet.
   (. this setDescription this is a derived class)
 
   ;Superclass constructor
   [[derived class] nil]
  

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAklW0qAACgkQWorbjR01Cx5qaACgyUEFNoNDlPt6YNNhbCCwI92r
FmEAniT/gtGvnmOjDFZVBKIco8tZ4aDQ
=FtTB
-END PGP SIGNATURE-

--~--~-~--~~~---~--~~
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
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: SPARQL DSL - a humble request for review and guidance

2008-12-21 Thread Daniel E. Renfer

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/21/2008 12:03 PM, Adam Harrison (Clojure) wrote:
 
 Hi folks,
 
 First let me say 'Thankyou very much' for Clojure - it has enabled me to 
 finally take the plunge into learning a Lisp without feeling like I'm 
 abandoning a ten year investment in the Java platform and its libraries. 
 I bought 'Practical Common Lisp' about eighteen months ago and read it 
 half heartedly, never making it to a REPL; however I now have the luxury 
 of working on a project of my own and decided the time was right to 
 revisit the promised land of Lisp. I have been aware of Clojure for 
 about six months, and, given my experience of Java, it seemed like the 
 obvious place to start. I've spent the past couple of weeks devouring 
 lots of general Lisp related documentation, Rich's Clojure webcasts and 
 Stuart's 'Programming Clojure' book. I am pleased to report that my Lisp 
 epiphany occurred yesterday when I found I could understand this macro 
 pasted to lisp.org by Rich:
 
 (defmacro defnk [sym args  body]
  (let [[ps keys] (split-with (complement keyword?) args)
ks (apply array-map keys)
gkeys (gensym gkeys__)
letk (fn [[k v]]
   (let [kname (symbol (name k))]
 `(~kname (~gkeys ~k ~v]
`(defn ~sym [...@ps  k#]
   (let [~gkeys (apply hash-map k#)
 ~@(mapcat letk ks)]
 ~...@body
 
 I am now spoiled forever, and although my powers are weak, I realise I 
 have become one of those smug Lisp types condemned to look down on all 
 other programming languages for the rest of their lives. Thankyou's and 
 cliched tales of enlightenment dispensed with, I can now move on to the 
 plea for aid :)
 
 My current project involves semantic web technologies, at this point 
 specifically SPARQL queries over RDF triple stores (for those unfamiliar 
 with SPARQL it will suffice to say that it's a straightforward query 
 language modelled after SQL, but operating over graphs rather than 
 tables). Like their SQL counterpart, the Java APIs for performing these 
 queries are verbose and cumbersome, and I am hoping that they can be 
 hidden behind some cunning Lisp macros to provide an expressive and 
 tightly integrated semantic query capability (similar to Microsoft's 
 LINQ). Unfortunately my ambitions far exceed my skills at this point, 
 and I am hoping to garner some gentle mentoring to steer me in the right 
 direction from the outset.
 
 My first inclination is to start with the simplest thing which will 
 work, which is to create a function which takes a SPARQL query string as 
 an argument and returns a list of results:
 
 (sparql 
 PREFIX foaf: http://xmlns.com/foaf/0.1
 SELECT ?name
 WHERE
 {
?person foaf:mbox \mailto:adam-cloj...@antispin.org\; .
?person foaf:name ?name
 })
 
 However this style is poor for several reasons: it looks ugly, quotation 
 marks have to be escaped manually, and interpolation of variables into 
 the query string is a chore which further decreases readability. What I 
 really want is a nice DSL:
 
 (let [mbox mailto:adam-cloj...@atispin.org;]
  (sparql
(with-prefixes [foaf http://xmlns.com/foaf/0.1;]
  (select ?name
(where
  (?person foaf:mbox mbox)
  (?person foaf:name ?name)
 
 Clearly this is going to require a macro, because for a start I don't 
 want the symbols representing SPARQL capture variables (the ones 
 starting with '?') to be evaluated - I want to take the name of the 
 symbol, '?' and all, and embed it into the query string which this DSL 
 will ultimately generate before calling into the Java API. On the other 
 hand, I do want some things evaluated - I want to embed the value 
 ('mailto:adam-clog...@antispin.org') bound to the symbol 'mbox' in the 
 query string, not the name of the symbol.
 
  From my position of total ignorance, I can see two broad approaches to 
 tackling this. The first is to implement (sparql ...) as a macro which 
 is responsible for interpreting the entire subtree of forms below it, 
 building a query string by selectively evaluating some forms whilst 
 using others as navigational markers which give context. It would honour 
 the grammar which defines SPARQL queries, and either signal an error or 
 be guaranteed to generate syntactically correct queries. The macro would 
 also have insight into the format of the data which would be returned 
 (gleaned from the 'select' part) and so could return something useful 
 like a list of maps where the keys are the names of the capture 
 variables that appear in the select clause. I have no idea how to do 
 this, but it feels like the 'right' way.
 
 The other approach, which is IMO a bit hacky, but within my reach, is to 
 define 'with-prefixes', 'select' and 'where' as individual macros whose 
 first arguments are expanded into the relevant subcomponent of the query 
 string and whose final argument is a string to be appended to the end. 
 

Re: Blogging About Clojure?

2008-12-19 Thread Daniel E. Renfer

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/19/2008 04:23 PM, Tom Emerson wrote:
 On Tue, Dec 16, 2008 at 2:05 PM, Randall R Schulz rsch...@sonic.net wrote:
 Does anyone have any recommendations?
 
 I use WordPress on my site and like it a lot: does everything I need,
 and then some I suspect.
 
 wordpress.com will host your blog for free, I think.
 
 Also blogger.com (owned by Google) looks to be quite good and quite
 popular, and also is free.
 
 Anyway, they're the big two.
 
  -tree
 
I'm curious, does anyone here have any experience using Roller?
(http://rollerweblogger.org/project/) Personally, I use Wordpress, but I
think it may be interesting to switch to a java-based blogging platform
in the event I decide to do any extending with Clojure.
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAklMIoYACgkQWorbjR01Cx74uQCgjg8kLPc8buXx7p3nhggsvZEl
1wYAoJEaJIz/Uud7ErZ9T6X9bfhji0Gc
=h4ne
-END PGP SIGNATURE-

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