Re: Clojure Spec and Human Readable Error Messages

2020-02-03 Thread David Simmons
Many thanks John.

I'll check out phrase. If you do get something working I'd love to see it 
as your approach seems the simplest to me.

cheers

Dave

On Monday, February 3, 2020 at 10:27:08 PM UTC, John Shaffer wrote:
>
> The phrase library can create human-readable error messages:
> https://github.com/alexanderkiel/phrase
>
> I've been working on something for a more natural (to me) approach, with 
> the ability to define error messages in-line with the predicate. E.g.,
>
> (s/defop max-length [n]
>   (sf/validator
>#(>= n (count %))
>(str "Must be " n " characters or less.")))
>
> I got this working with spec-alpha2, but my plan was to write some reforms 
> helpers, and I don't think there is any alpha2 support in ClojureScript. It 
> seems a lot harder to write specs for the shipping version of spec, but 
> I'll probably give it a shot this weekend.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/87755d5c-b66c-4045-817a-a1fac549f23c%40googlegroups.com.


Clojure Spec and Human Readable Error Messages

2020-02-03 Thread David Simmons
Hi All.

I've just come back to Clojure (after being away for a few years) and I'm 
incredibly impressed with how things have moved on. I particuarly like 
Clojure Spec but I'm struggling to understand how I can convert coercion 
erros to a human friendly for for end users to understand on a website - 
i..e user submits a form and gets an error back they can understand.

My Google Foo doesn't appear to have helped but I can't believe I'm the 
only one to find this a problem (or maybe I don't fully understand spec).

any help gratefully received.

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
--- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/7c6662a8-1ce1-4b26-abd3-4c61a583ed13%40googlegroups.com.


Re: ANN: Reagent 0.3.0 - now with async rendering

2014-02-05 Thread David Simmons
Hi Dan

First of all thank you for Reagent - I'm enjoying playing with the library.

Do you have a simple example of passing child components and then rendering 
them as I cannot get this to work - I fairly new to Clojure so it could be 
user error.

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
--- 
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: Reagent 0.3.0 - now with async rendering

2014-02-05 Thread David Simmons
Thanks Dan I'll give this a go.

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


Recommendations for parsing/validating a JSON structure

2014-01-27 Thread David Simmons
Hi Folks.

I'm writing a web app which receives a JSON structure. I'd like to validate 
that the structure is correct i.e. mandatory fields are present, and then 
convert into the relevant Clojure data structure. As a bonus if  a 
particular field in the JSON structure is incorrect I'd like to be able to 
define the error message generated (in a similar way I can do for 
noir.validation).

Does anyone have any recommended libraries or the best way to approach this 
issue - I'm sure I'm not the first with this requirement.

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
--- 
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: Recommendations for parsing/validating a JSON structure

2014-01-27 Thread David Simmons
Thanks Korny. I'll take a look.

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


Help with Reduce

2013-12-09 Thread David Simmons
Hi 

I have the following function:

(defn group 
  [ validators]
  (fn [m]
(reduce (fn [maps f]
  (let [[m error-m] maps
[new-map errors] (f m)]
  [new-map (vec (flatten (if errors (conj error-m errors) 
error-m)))]))

[m []]
validators
)))

The following call (def foo group) returns a function. All as I'd expect. I 
then thought I'd replace the anonymous function with a named function...

(defn validate
  [maps f]
  (let [[m error-m] maps
[new-map errors] (f m)]
[new-map (vec (flatten (if errors (conj error-m errors) error-m)))]))


(defn group2 
  [ validators]
  (fn [m]
(reduce validate
[m []]
validators
)))
The following call (def foo group2) returns an empty vector. I would have 
though it would have returned a function. Am I missing something?

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
--- 
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: Help with Reduce

2013-12-09 Thread David Simmons
Hi Guru

odd. I'll give it another go.

Kind Regards

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
--- 
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: Help with Reduce

2013-12-09 Thread David Simmons
Hi Guru

Ah my mistake, silly typo in my version.

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


Help with Static Site Generator

2013-12-07 Thread David Simmons
Hi 

has anyone used Static (https://github.com/nakkaya/static) to create a 
site. The documentation is a little sparse and I'm struggling to set up my 
default.clj file. If someone has a version I could copy that would be great.

many thanks

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
--- 
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: Help with Static Site Generator

2013-12-07 Thread David Simmons


 Perfect - many 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.


Re: How would I do this in Clojure?

2013-12-06 Thread David Simmons


 Hi Folks


firstly a big thank you for all the help so far. I posted the original 
question because I've been looking at Midje which has the ability to stub 
out a function but have the stub function return different data each time 
it is called (it also counts the number of times the stubbed out function 
is called). Still being a Clojure newbie (and having heard that the Midje 
codebase is complex) I thought I'd ask how this could be done. I know about 
with-redefs so figured out how to stub a function but was struggling with 
calling something that returned a set of values.

So basically this is a learning exercise for me.

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


How would I do this in Clojure?

2013-12-05 Thread David Simmons
Hi

I'd like to be able to define a function that is passed a vector of items 
and returns a function such that each time the returned function is called 
it returns the next item in my-vector.

For example 

(def blah (my-function [1 2 3])

(blah) = 1
(blah) = 2
(blah) = 3

Is this possible?

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
--- 
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: How would I do this in Clojure?

2013-12-05 Thread David Simmons


 Guru and Kelker


thanks for such prompt replies.

I'll give both a try.

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
--- 
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: How would I do this in Clojure?

2013-12-05 Thread David Simmons


 Hi Puzzler


I like the first approach you defined and it works perfectly thank you. 

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


Red Tape Form Validation - a style question

2013-11-24 Thread David Simmons
Hi Folks

I've been looking at the red-tape form validation library and really like 
it (especially coming from a Django background). The one thing that makes 
me nervous is that the when validating data it uses exceptions if the data 
is invalid. 
I'd read somewhere that you should only use exceptions for error conditions 
you can't predict - I'd have thought that form validation was an example of 
where you'd expect there to be errors and hence handle them.

My question is: Do people think that the use of exceptions in this way is a 
reasonable approach?

BTW I think the library is great and the documentation first class so I'm 
in no way criticizing the author.

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


Breaking out of a map type function

2013-11-24 Thread David Simmons
Hi All.

Still struggling to get my head around Clojure - this is attempt number 4.

I wish to process each item in a vector. I know I can use map to do this 
e.g. (map my-func my-vector). My problem is that I need to be able to break 
out of the map if my-func returns an error when processing any of the 
items. I know map isn't what I'm looking for but is there a function or 
some idiomatic piece of clojure to achieve my aim.

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
--- 
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: Breaking out of a map type function

2013-11-24 Thread David Simmons
Hi Stu

I understand Reduce but can't quite see how this would work. Don't suppose 
you'd have a simple example would you?

Many thanks

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
--- 
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: Breaking out of a map type function

2013-11-24 Thread David Simmons


 @James - I'll take a look at take-while


@Michael - I thought using exceptions to break out of a stuff was 
considered bad practice?

cheers

Davew 

-- 
-- 
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: Breaking out of a map type function

2013-11-24 Thread David Simmons


 Many thanks James


-- 
-- 
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: Breaking out of a map type function

2013-11-24 Thread David Simmons


 Jernau - that looks perfect. I'll give it a go.


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
--- 
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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-19 Thread David Simmons
Hi Ryan

I'm really impressed with Caribou but would make one request that will make 
my life easier. I'm a big fan of Angular JS and the template tags for 
Angular and Caribou clash. Is there any chance these could be changed from 
{{ to {% (or something similar)? 

The best result for me would be the standard template tags get changed in 
Caribou but a compromise would be the ability to change the tags on a per 
page basis.

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
--- 
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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-19 Thread David Simmons
Hi Khalid 

yes I'm aware you can change the template tags (and the pitfalls :-)). I 
thought it would be easier to see if we could avoid this problem all 
together by using a different set of tags (especially as Caribou is Alpha 
release and hopefully open to change). BTW I don't intend to miss Angular 
and Caribou templates tags in the same page, I just want to be able to use 
the Caribous admin etc AND have my own pages use Angular.

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
--- 
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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-19 Thread David Simmons


 Ryan - that is great news. Are we allowed to know what else will be 
 release :-).


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
--- 
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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-18 Thread David Simmons
Hi Ryan

If I create a model Customer - will Caribou create a specific table 
Customer. I ask because using H2 Console I can't find any of the tables I'd 
have expected to find having created my model. (This may be user error as 
I'm not used to using H2). 

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
--- 
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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-18 Thread David Simmons
Hi Ryan

I'm probably doing something daft but I'm using H2 Console and connecting 
to taiga_development.h2.db (user: sa). running select * from wibble (the 
name of my model) returns table wibble not found. I can create instances 
of wibble via the Admin UI.

Like I've said I'm pretty sure this is user error but any pointers as to 
what I'm doing wrong would be really helpful.

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
--- 
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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-18 Thread David Simmons
Hi Ryan

please ignore my previous email - it was definitely a user error - looking 
at the wrong database (doh!).

Look forward to getting to grips with the framework over the next few days.

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
--- 
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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-17 Thread David Simmons
Hi Ryan

Congratulations on the release of Caribou. I've got a couple of questions.

1. If I create a model via the Admin UI, am I right in thinking that this 
does not actually create a clj file containing the details of the model 
which I could edit later via a text editor? 
2. Do you the concept of model validations so that a field must be numeric 
and between 10 and 50?

many thanks for you help.

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
--- 
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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-17 Thread David Simmons
Ryan

thanks for the great reply. I'll have to play a bit more to really get my 
head around this. I'd too would love to see a simple blog example not using 
the Admin interface to try and show how and where you'd define your models.

many thanks.

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

2013-04-30 Thread David Simmons
Hi All

thank you for your answers. I think I now understand (@Gregory - completely 
agree about Clojure  being pragmatic).

Onwards and Upwards

Kind Regards

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

2013-04-30 Thread David Simmons
Thanks Christophe.

Love the book BTW.

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




Clojure special forms

2013-04-29 Thread David Simmons
Hi

I am just setting out to learn Clojure (my 2nd attempt) and am starting to 
feel more comfortable with the language (and very excited about the 
possibilities).

However, I'm reading Clojure Programming (Emerick, Carper and Grand) and 
read that Special forms are the primitive building blocks on which the rest 
of the language is built. I therefore thought that every function defined 
in Clojure.core would be defined in terms of the specials forms in some 
way. So I looked at the source for reduce to see that it actually makes a 
call to java . reduce. This would imply that the special forms are not 
quite what I understood.

Am I right in thinking that certain Lisps do indeed define all of their 
higher level functions in terms of a very small subset of special forms or 
have I completely misunderstood.

Kind Regards

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

2013-04-29 Thread David Simmons
Hi Both.

Thank you for your prompt replies. Maybe I'm being purist but if one of the 
special forms is the dot you have all of Java to play with so presumably 
you could produce any of the other clojure functions. I thought that the 
special forms enabled you to produce all other elements of the language 
with just the special forms. Isn't having the dot cheating a bit :-).

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
--- 
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: Help with #'

2012-04-23 Thread David Simmons
Hi Stuart

fantastic - it is starting to make sense now. One follow on question.

Presumably this only applies to functions? If I replace (defn foo []
hello) with (def foo hello) I don't get the same results. Is this
because functions are handled differently?

many thanks (again)

Dave

On Apr 23, 2:48 am, Stuart Campbell stu...@harto.org wrote:
 Hi Dave,

 If you write

   (run-jetty routes ...)

 then the current value of routes is looked-up and passed to run-jetty.
 You won't see any change if you subsequently redefine routes, because the
 original definition is what was passed to run-jetty.

 On the other hand,

   (run-jetty #'routes ...)

 passes a var (seehttp://clojure.org/vars) to run-jetty. Now whenever
 run-jetty invokes your handler function, the currently-bound value of
 routes is invoked.

 Here's a simplified example:

   user (defn foo [] hello)
   #'user/foo
   user (def a foo)
   #'user/a
   user (def b #'foo)
   #'user/b
   user (defn foo [] goodbye)
   #'user/foo
   user (a)
   hello
   user (b)
   goodbye

 Cheers,
 Stuart

 On 23 April 2012 06:01, David Simmons shortlypor...@gmail.com wrote:



  Hi

  I'm new to Clojure but very keen to learn. I'm following Web
  Development with Clojure (http://www.vijaykiran.com/2012/01/11/web-
  application-development-with-clojure-part-1/) and came across the
  following code:

   (run-jetty #'routes {:port (or port 8080) :join? false}))

  I know that #'routes is the same as (var routes) and that it is
  passing the object rather than the actual value BUT I don't
  understand why this is used. Specifically if I replace #'route with
  route the code works fine. I've read somewhere this is something to do
  with autoloading changes to code when developing for the web. Does
  anyone have a simple explanaition for #' and why it is used here. If
  you have some simple clojure code to illustrate its use I'd be really
  grateful.

  many thanks in advance for any help.

  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- Hide quoted text -

 - Show quoted text -

-- 
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: Help with #'

2012-04-23 Thread David Simmons
Hi Tassilo

Perfect answer - the fog is definately beginning to lift!

Do you know why Clojure automatically dereferences functions but not
for other bound values?

cheers

Dave

On Apr 23, 1:36 pm, Tassilo Horn tass...@member.fsf.org wrote:
 David Simmons shortlypor...@gmail.com writes:

 Hi David,

  Presumably this only applies to functions?

 No, not really.

  If I replace (defn foo [] hello) with (def foo hello) I don't get
  the same results. Is this because functions are handled differently?

 --8---cut here---start-8---
 user (def foo hello)
 #'user/foo
 user (def a foo)   ;; a has the current value of foo
 #'user/a
 user (def b #'foo) ;; b's value is the Var foo
 #'user/b
 user (def foo goodbye)
 #'user/foo
 user a
 hello
 user b
 #'user/foo
 user @b
 goodbye
 --8---cut here---end---8---

 Please note that you have to dereference b explicitly to get the value
 currently bound to foo.  That's because b's value is again a Var.  It
 seems that Clojure dereferences Var's automatically, possibly multiple
 times, in case of function calls.  So in Stuard's example, both (b) and
 (@b) call the function currently bound to foo.

 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


Re: Help with #'

2012-04-23 Thread David Simmons
Cedric - apologies - fat fingers on my mobile phone!!

To both Cedric and Meikel - thank you both for your help.

I'm finding Clojure a great language to learn (if a little difficult
at first). It seems a much more consistent language than the others I
have studied which I think is fantastic.

Dave

On Apr 23, 7:36 pm, Cedric Greevey cgree...@gmail.com wrote:
 On Mon, Apr 23, 2012 at 2:32 PM, shortlypor...@googlemail.com

 shortlypor...@gmail.com wrote:

 [in reply to my confirmation that vars referencing vars referencing
 functions are still callable as functions]

  Sent from my HTC

 Beg pardon?

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


Help with #'

2012-04-22 Thread David Simmons
Hi

I'm new to Clojure but very keen to learn. I'm following Web
Development with Clojure (http://www.vijaykiran.com/2012/01/11/web-
application-development-with-clojure-part-1/) and came across the
following code:

 (run-jetty #'routes {:port (or port 8080) :join? false}))

I know that #'routes is the same as (var routes) and that it is
passing the object rather than the actual value BUT I don't
understand why this is used. Specifically if I replace #'route with
route the code works fine. I've read somewhere this is something to do
with autoloading changes to code when developing for the web. Does
anyone have a simple explanaition for #' and why it is used here. If
you have some simple clojure code to illustrate its use I'd be really
grateful.

many thanks in advance for any help.

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