HTTPS for dev.clojure.org?

2017-01-09 Thread Luc
At a minimum, nginx could proxy jira no ? You could force http redirection to 
https.
My 2 cents.
Luc P.

-- 
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/d/optout.


Re: New to Clojure - productivity and debugging with Emacs

2017-01-09 Thread Bill Piel
ahawk,

I've been using clojure for years, but can still relate to the issues you 
are facing, which is why I wrote a debugging/development tool to help. It's 
called sayid. It can be used directly from the repl, but has an emacs/cider 
integration that makes it much more powerful. 

http://bpiel.github.io/sayid/

In a nutshell, sayid will let you capture all the args and return values 
from functions as they are executed -- then allow you to inspect, query and 
visualize them. The project is still in alpha and not thoroughly 
documented, so if you do decide to try it out and run into any issues, 
PLEASE get in touch by filing an issue or even emailing me. My address is 
on my github profile.

https://github.com/bpiel

Also, I presented it at the last Conj conference in Austin.  
https://www.youtube.com/watch?v=ipDhvd1NsmE








On Sunday, January 8, 2017 at 11:06:34 AM UTC-5, Matching Socks wrote:
>
> That is an ambitious project.  Divide and conquer.  One super duper 
> benefit of Clojure is that if you make a web app with, say, just Ring and 
> Compojure, you can later transplant that work into a more elaborate app 
> scaffolding, because it's all just plain maps.
>
> "quite a lot of map manipulation going on with the request and response 
> maps"
>
> On the bright side, map manipulation is *all* that is going on.  There are 
> no side effects.  Therefore, it can be very helpful to log the request and 
> response maps.  For example, make a Ring handler that does nothing but log 
> the request, delegate to the next handler, log its response, and return its 
> response; then stick that handler wherever in the handler stack makes you 
> curious.  Using the Emacs CIDER REPL you may change the handler stack and 
> fiddle with logging while the program runs, so logging is a convenient 
> debugging technique.
>
> "unless, of course, I read and understand their source"
>
> On the bright side again, there is not much source code there, at least 
> compared with what you'd expect in Java.  Also, the jar that Maven (etc) 
> can fetch for you *is* the source code, and Emacs can open such jars and 
> browse the files inside.  
>
> Some of the libraries have overview documentation that puts the API docs 
> in context.  Keep the Ring SPEC open, and the Liberator graph too if you 
> can figure out how to view more than a tiny bit of it.
>
> By all means point out gaps in the docs on the libraries' respective issue 
> trackers.
>

-- 
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/d/optout.


New to Clojure

2017-01-09 Thread (hash-map :new "to clojure" :need "assistance")
Hi all!

So, I'm new to Clojure! I'm coming in from a Java background and am 
currently working on a project that has prompted me to have a look at 
whether Clojure would be useful. 
I have started by going through the "Brave Clojure" website and working 
through the exercises and what I've seen has at many times just made me 
smile at the (at least so far) intuitiveness, simplicity and power of the 
language. My use case is this:

A real time (sealed bid) auctioning system. We have a maximum number of 
bids (example 100) that's set by the owner of the product. Our clients then 
bid on the product. Once a bid is made, it's committed to a database and 
the counter increments. The next bid is processed, and so on. Once the 
maximum number of bids is reached, bidding stops. This auctioning system is 
for a mobile application however the main code for the real time system 
sits on a web server. The mobile app is a very thin client so simply makes 
a call to the app server via an API which then processes that request (and 
returns the result). 

Requests are processed in order - so we're following a "first come first 
serve" approach. If at any time a request is due to be processed and the 
counter hits 100, all requests should gracefully "fail" and be blocked from 
bidding. Now this is obviously possible in Java, albeit with a lot more 
code and thinking about the different ways to make everything thread-safe, 
etc. This is a completely new project so there's no restriction on 
languages to be used, etc. PS: We're all Java developers.

I was really attracted to Clojure because of a) the JVM b) the fact that it 
seems to be able to handle concurrency effortlessly c) our API needs to 
scale and so we want to ensure that we can handle the 100K+ connections 
easily when the project reaches that stage. Obviously this is more to do 
with the hardware, but the way we build the API is a definite factor. 
Finally, there seems to be less verbose codebases on Clojure and it might 
help to keep our overall codebase light and readable! 

My questions therefore are these:

With the time we have (around 1 month for this stage), is this something we 
can easily build in Clojure?
Is the movement from Java to Clojure easy for someone completely new to 
Clojure?
Are the libraries that we might use for this - I had a look at Ring briefly 
robust for our use case?
Does Clojure have good support for using AWS for example? (You can call 
Java from Clojure so I guess this wouldn't really be an issue.)
Does it interface well with MySQL?

I'd be very grateful if someone could point me in the right direction on 
this - like I said, really really like what I'm seeing of Clojure but just 
want to be sure from the community before I recommend this as an action to 
take!

(hash-map :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/d/optout.


Re: New to Clojure

2017-01-09 Thread Dennis Roberts
>From what you've described, it seems as though it would be easy to build 
the server side of this application in Clojure.

I found Clojure to be very easy to pick up. I won't say that the first few 
applications that I wrote in Clojure were great Clojure code, but it was 
easy for me to move from Java to Clojure.

Ring is a good start. You might also want to check into some libraries 
built on top of  Ring such as https://github.com/weavejester/compojure 
and https://github.com/metosin/compojure-api. We've found compojure-api to 
be extremely handy.

I haven't played with any AWS clients in Clojure, so I'm afraid I can't 
answer that question.

Clojure does integrate well with relational databases in general. We're 
using PostgreSQL, but any database that has a JDBC driver available should 
be easy to use. You may want to check into some of the Clojure libraries 
that provide DSLs for generating SQL statements. I've 
tried http://sqlkorma.com/ and https://github.com/jkk/honeysql, and I've 
had fairly good luck with both of them.

Dennis

On Monday, January 9, 2017 at 4:06:30 PM UTC-7, (hash-map :new "to clojure" 
:need "assistance") wrote:
>
> Hi all!
>
> So, I'm new to Clojure! I'm coming in from a Java background and am 
> currently working on a project that has prompted me to have a look at 
> whether Clojure would be useful. 
> I have started by going through the "Brave Clojure" website and working 
> through the exercises and what I've seen has at many times just made me 
> smile at the (at least so far) intuitiveness, simplicity and power of the 
> language. My use case is this:
>
> A real time (sealed bid) auctioning system. We have a maximum number of 
> bids (example 100) that's set by the owner of the product. Our clients then 
> bid on the product. Once a bid is made, it's committed to a database and 
> the counter increments. The next bid is processed, and so on. Once the 
> maximum number of bids is reached, bidding stops. This auctioning system is 
> for a mobile application however the main code for the real time system 
> sits on a web server. The mobile app is a very thin client so simply makes 
> a call to the app server via an API which then processes that request (and 
> returns the result). 
>
> Requests are processed in order - so we're following a "first come first 
> serve" approach. If at any time a request is due to be processed and the 
> counter hits 100, all requests should gracefully "fail" and be blocked from 
> bidding. Now this is obviously possible in Java, albeit with a lot more 
> code and thinking about the different ways to make everything thread-safe, 
> etc. This is a completely new project so there's no restriction on 
> languages to be used, etc. PS: We're all Java developers.
>
> I was really attracted to Clojure because of a) the JVM b) the fact that 
> it seems to be able to handle concurrency effortlessly c) our API needs to 
> scale and so we want to ensure that we can handle the 100K+ connections 
> easily when the project reaches that stage. Obviously this is more to do 
> with the hardware, but the way we build the API is a definite factor. 
> Finally, there seems to be less verbose codebases on Clojure and it might 
> help to keep our overall codebase light and readable! 
>
> My questions therefore are these:
>
> With the time we have (around 1 month for this stage), is this something 
> we can easily build in Clojure?
> Is the movement from Java to Clojure easy for someone completely new to 
> Clojure?
> Are the libraries that we might use for this - I had a look at Ring 
> briefly robust for our use case?
> Does Clojure have good support for using AWS for example? (You can call 
> Java from Clojure so I guess this wouldn't really be an issue.)
> Does it interface well with MySQL?
>
> I'd be very grateful if someone could point me in the right direction on 
> this - like I said, really really like what I'm seeing of Clojure but just 
> want to be sure from the community before I recommend this as an action to 
> take!
>
> (hash-map :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/d/optout.


Re: Private multimethods possible?

2017-01-09 Thread Didier
How would you declare a namespace within a namespace? Or two namespaces in 
the same file?

On Friday, 23 October 2009 04:41:13 UTC-7, Meikel Brandmeyer wrote:
>
> Hi, 
>
> On Oct 23, 8:45 am, Christophe Grand  wrote: 
>
> > Other solutions are to use @#'ns/private-var to access private vars from 
> the 
> > macro or to make the macro shallow using a public (usually higher-order) 
> > helper function (is this possible in the general case?). 
>
> It is not 100% possible in the general case but it the vast majority 
> of the cases, I'd say. 
>
> Concerning the private Vars: I'd actually suggest to dispose them 
> entirely. Namespaces can be split into an interface space contain the 
> public interface. It can 'use' a special internal namespace, which 
> does not belong to the public API of the library. All defs are normal, 
> public defs. 
>
> This approach solves all problems: 
> - The user knows, what the public API is. 
> - The macros can access everything they need. 
> - Code completion only finds the public stuff. 
> - It doesn't need modifications like a 'semi-private' or 'protected' 
> flag. 
>
> I think, Stephen exercised this approach in c.c.sql. 
>
> Sincerely 
> Meikel 
>
> PS: My opinion: design your library to be used with require and :as 
> instead of use. Document the public API. That is the contract. The 
> contract stays valid whether the system enforces it or not. 
>

-- 
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/d/optout.


Re: New to Clojure

2017-01-09 Thread Matching Socks
You mention SQL.  Note, that using JDBC in Clojure is really, really easy.  
It's a porcupine in Java, but in Clojure it's pure fudge.  Whatever your 
Java frame of reference for an ORM might be, Hibernate or Spring or 
whatever, bang! you probably won't need it.  Sure, there are JDBC wrappers 
for Clojure, to help with joins or portability or whatever, but when push 
comes to shove, if you need to do something "yourself", there is no mystery 
to it.  

For your one-month aspirations (ha!), Clojure is an interesting plan 
because you work in generic data structures and a lot of the alternative 
web-oriented libraries more-or-less agree about those structures.  So for 
example, you start out with Ring + Jetty, super simple, definitely good 
enough for Month No.1, but later you decide you need async and you want to 
switch to Aleph + Netty.  Amazingly little work will have to be thrown out 
and redone just on account of switching libraries.  You don't get dug in so 
deep with library- or framework-specific class names, as it were.  Clojure 
is a great insurance policy.

By the same token, with your own code, you spend so much less time dressing 
stuff up behind made-up APIs, and therefore those APIs are not a source of 
constant churn.  When you really want a hard subsystem boundary you can 
achieve it (same way you would in Java), but most of the time you avoid 
that song-and-dance and just call a duck a duck.  The Clojure way helps 
keep the prototyping stage of the project grounded in pragmatism.

-- 
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/d/optout.


Re: New to Clojure - productivity and debugging with Emacs

2017-01-09 Thread J.-F. Rompre
Hi ahawk,

If you have the time, by all means reach for all the references and books 
mentioned in this thread, and there is a wealth of free resources out 
there. However doing both that and learning a powerful tool such as 
Emacs/CIDER at the same time can be frustrating. If time is of the essence 
and to both "learn by doing " the best practices and get tooling working 
for you ASAP, I would recommend Eric Normand's FunctionalTV courses 
  and Arne Brasseur's Lambda Island 
, in addition to pursuing your own learning 
projects and experimentations - they are not free services however. 

Personally, it took me months to learn enough of Emacs/CIDER to feel the 
rewards, but it was more than worth it, and I can't think of doing any work 
without it now. (I switched from vim thanks to evil-mode, and started off 
following the example in Brave Clojure 
.  



On Sunday, January 8, 2017 at 2:52:13 AM UTC-5, ahawk wrote:
>
> Hi everyone
>
> I am a rather unexperienced Clojure user, so please bear with me.
>
> I am developing a web app using popular libraries such as ring, compojure, 
> liberator and friend to handle routing, content negotiation and 
> authentication. There is quite a lot of map manipulation going on with the 
> request and response maps. To 
>
 

-- 
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/d/optout.


Re: New to Clojure

2017-01-09 Thread Sean Corfield
> With the time we have (around 1 month for this stage), is this something we 
> can easily build in Clojure?

Hard to say. I would expect a small team already familiar with Clojure could 
probably build this in a month but I don’t know how long it’ll take your team 
to ramp up. Java-to-Clojure is easy for some and extremely hard for others.

> Is the movement from Java to Clojure easy for someone completely new to 
> Clojure?

See above. Familiarity with Java means the ecosystem and tooling (and 
stacktraces) won’t cause you any problems, but at the same time, if your 
developers are steeped in Java / OOP thinking, Clojure can be very confusing at 
first (How do I encapsulate my data? How do I write a loop? How do I handle 
state? Etc).

> Are the libraries that we might use for this - I had a look at Ring briefly 
> robust for our use case?

Yes, people are building solid production systems with Clojure all the time. 
We’ve used Clojure in production for nearly seven years now and we’ve been 
extremely happy with the stability of everything we’ve used.

> Does Clojure have good support for using AWS for example? (You can call Java 
> from Clojure so I guess this wouldn't really be an issue.)

It’ll depend on exactly what you plan to use from the vast AWS stable but, in 
general, yes since as you observe, you can always drop down to Java.

> Does it interface well with MySQL?

Yes, we run a large MySQL-based production system in Clojure – and all our JDBC 
access has been via Clojure for several years. Caveat: I maintain the 
clojure.java.jdbc Contrib library, so I may be a little biased here ☺

Sean



-- 
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/d/optout.


Re: associative destructuring on a list? (using :keys)

2017-01-09 Thread John Gabriele
Ah! Thank you, Francis! And sorry for the belated reply!

I ran into a terse example of it at 
 (see 
"(def options '(:debug true))") and was scratching my head. Now that you 
explained it though, I remembered seeing an explanation of it somewhere. 
Turns out I'd forgotten reading about that bit of magic in the "Clojure 
Programming" book (p.35).

-- John



On Friday, January 6, 2017 at 7:36:51 PM UTC-5, Francis Avila wrote:

> A list/seq (not a vector) which is destructured as a map will be first 
> read into a map as by (apply hash-map the-seq)
>
> This curiosity exists so the "keyword argument" idiom works:
>
> (defn my-options [_ & {:keys [a b] :as options}]
>   options)
> => #'user/my-options
> (my-options nil :a 1 :b 2 :c 3)
> => {:c 3, :b 2, :a 1}
>
> (my-options nil :a 1 :b 2 :c)
> IllegalArgumentException No value supplied for key: :c
>
> Keyword arguments have in general fallen out of favor (they were more 
> idiomatic in Clojure's early days), so you may not see this as often. 
> Generally people just pass an option map unless the function is meant 
> purely for "easy" interactive use (vs "simple" programmatic use). This is 
> because it's more difficult to call a keyword-argumented function correctly 
> when the keyword arguments are not literals.
>
> On Friday, January 6, 2017 at 4:54:52 PM UTC-6, John Gabriele wrote:
>>
>> I've used associative destructing in the usual fashion:
>>
>> some-app.core=> (def m {:a 1 :b 2})
>> #'some-app.core/m
>>
>> some-app.core=> (let [{:keys [a b]} m] (str a "-" b))
>> "1-2"
>>
>> but what is going on here:
>>
>> some-app.core=> (def li '(:a 1 :b 2))
>> #'some-app.core/li
>>
>> ;; Wat?
>> some-app.core=> (let [{:keys [a b]} li] (str a "-" b))
>> "1-2"
>>
>> I didn't think lists were associative... As in:
>>
>> some-app.core=> li
>> (:a 1 :b 2)
>>
>> some-app.core=> (associative? li)
>> false
>>
>> ;; So this is expected:
>> some-app.core=> (let [{a 1 b 3} li] (str a "-" b))
>> "-"
>>
>> some-app.core=> (def v [:a 1 :b 2])
>> #'some-app.core/v
>>
>> ;; ...as is this (since vectors *are* associative):
>> some-app.core=> (let [{a 1 b 3} v] (str a "-" b))
>> "1-2"
>>
>>

-- 
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/d/optout.