Re: slackpocalypse?

2017-05-18 Thread Jason Stewart
I'm experiencing the same thing, while I am able to connect with my other
slack teams.

On Thu, May 18, 2017 at 4:17 PM, Kenny Williams 
wrote:

> I am not able to connect via the web UI or Slack app either.
>
>
> On Thursday, May 18, 2017 at 1:15:17 PM UTC-7, Gregg Reynolds wrote:
>>
>> is it just me? i've been unable to connect to clojurians (by cellphone)
>> for about 30 minutes, but i can connect to other slack groups.
>>
>> have we hit https://github.com/clojurians/clojurians-chat/wiki/
>> Slackpocalypse?  we're almost to 10K subscribers.
>>
>> g
>>
>>
>> --
> 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.
>

-- 
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: How to do functional programming

2015-10-08 Thread Jason Stewart
The way I like to think about FP vs OO is that OO usually couples state
with identity and the code that operates on both, while FP defines a clear
boundary between data, state, and the functions that operate on the data.

Designing a FP program often involves looking at the data first, then
thinking about what transformations that the data needs in order to become
what you want it to be. I like to think of functions as instructions about
how to transform that data.

This is overly simplistic, and I would definitely recommend some background
reading/watching of videos.

A good starting point would be to watch these:
https://changelog.com/rich-hickeys-greatest-hits/

And read the book Functional Programming for the Object Oriented Programmer
by Brian Marick if you've been writing OO code for a long time.

Cheers,
Jason


On Thu, Oct 8, 2015 at 8:23 AM, Pattern-chaser 
wrote:

> I started in software with structured design. In the 80s/90s, I discovered
> OO, and was surprised to find that the main thing I gained was a different
> way of looking at things. This informed my designs from then on, even when
> I returned from C++ to C (I'm a firmware designer by specialisation). Now I
> want to find out about functional programming, in the hope that another new
> perspective will inform and improve my design and programming skills. The
> question I'm posing here is simple: how do you do functional programming?
>
> For an OO design, you put together a number of co-operating but autonomous
> class instances, and let them get on with it. Functional programming
> doesn't seem to involve classes or any of the OO concepts I'm used to. So
> how you do you design a program in a functional way?
>
> TIA for your advice, opinions and thoughts. :)
>
> --
> 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.
>

-- 
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: macro help

2015-10-02 Thread Jason Stewart
"Mastering Clojure Macros" by Colin Jones gets my vote as the go to book
for writing clojure macros.


On Fri, Oct 2, 2015 at 8:24 AM, Colin Yates  wrote:

> Thanks for your comments - very helpful!
>
> The reference to destructuring might be irrelevant now. Previously I
> noticed that the _map construction_ was emitted from the macro rather than
> the symbol bound to the map. For example, some variation of quoting meant
> (defmacro a [m] (println m)) called with (a {:1 1}) emitted (println {:1
> 1}) rather than (println m). Now I think about it is because an earlier
> iteration of the macro used ~m - I’m not at the desk so I can’t confirm.
>
> Any pointers a decent Clojure macro book? I found lots of blogs around
> from google but not a single one of them mentioned the (let [m-state
> (gensym)] `(let [~m-state ~state])) ‘trick’.
>
> Thanks again.
>
> On 2 Oct 2015, at 10:50, gianluca torta  wrote:
>
> Hi Colin,
>
> as far as I can tell, your solution looks fine... here are a couple of
> comments on your step-by-step analysis
>
> cheers,
> Gianluca
>
>
> 1(defmacro form [state & elements]
>> 2  (let [m-state (gensym)]
>> 3`(let [~m-state ~state]
>> 4   [:div.form.horizontal
>> 5~@(map (fn [[f m & rest]]
>> 6 `[~f (assoc ~m
>> 7 :value (get @(:values ~m-state) (:id ~m))
>> 8 :on-change #(swap! (:values ~m-state) assoc
>> (:id ~m) "UPDATED"))
>> 9   ~@rest])
>> 10   elements)])))
>>
>> 0 - ` means "emit, don't evaluate", ~@ means "splice, e.g. remove the
>> outer sequence so [a ~@[1 2]] becomes [a 1 2] and ' means 'the symbol of
>> rather than the value of'.
>>
> ~@ means "evaluate and splice", i.e., it overrides the "don't evaluate" of
> ` and splices the result in the outer sequence
> ~ means just "evaluate" without the splicing
>
>
>> 2 - declare m-state, which is lexically scoped to the macro and is bound
>> to a random identifier created by gensym
>> 3 - the back-tick (syntax-quote) returns the form rather than evaluating
>> the form, so the macro will return (let* [m-8_324230_ ]) The [~m-state
>> ~state] is just bewildering though.
>> 3 - in addition, the 'state' argument appears to be destructured, but
>> only to one level so if the state contains an atom it is the var of the atom
>>
> 'state' is evaluated due to ~, not sure what you mean by 'destructured,
> but only to one level'
>
>
>> 4 - literal text emitted in-line
>> 5 - splice the results of the map (i.e. rather than [:div.form.horizontal
>> [child1 child2]] return [:div.form.horizontal child1 child2])
>> 5 - also destructure each element assuming [f m(ap) and 0 or more other
>> args]
>>
> yes, the destructuring is just a normal destructuring of the args passed
> to the fn by map
>
>
>> 6 - emit [ where  is the first symbol, 'f' l in each element. Also
>> prevent this being evaluated in the macro with the syntax-quote as (5) has
>> introduced some new scope because of the ~@ - not sure.
>>
> as said above, rather than introducing a new scope, ~@ just overrides the
> "don't evaluate" of back-tick
>
>
>> 6 - also associate onto the symbol m (which is assumed to be associative,
>> e.g. a map)...
>> 7/8 - extract data out of the 'run-time' (e.g. not macro-time) value of
>> the provided state (magically captured under ~m-state)
>> 9 - splice in the rest of the arguments, if any, that were part of the
>> element
>> 10 - and do that magic for each element
>>
>
>
> --
> 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.
>
>
> --
> 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.
>

-- 
You 

Hosting Providers

2014-04-18 Thread Jason Stewart
Hi Adrian,

The only hosting provider that comes to my mind, thinking of your requirements 
is heroku. Applying patches is usually as simple as making an empty commit and 
pushing to heroku. Not every application will fit into the heroku way of 
doing things, but in my experience the ones that do are easy to manage without 
having to worry too much about devops.

Cheers,
Jason

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


clj-pdf: how to serve a pdf with ring

2014-03-23 Thread Jason Stewart
Hi Mathias,

It looks like you've misplaced a paren in your code example:

  (piped-input-stream
   (fn [output-stream])
   (pdf ...)

piped-input-stream accepts a single function argument. Also, according to the 
docs, once the function is finished executing, the output stream is closed. I 
believe that what may be happening is that the stream is closed before you can 
serve it up as the body of your response. I would try creating an InputStream 
another way. Ring will automatically close the input stream after the request 
is served.

-- 
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: How to override the default port on 3000?

2014-02-25 Thread Jason Stewart
The lein-ring plugin accepts a port number as an argument:

lein ring server 8080

Note, that in order to bind to port 80, you will need elevated (root)
privileges.


On Tue, Feb 25, 2014 at 9:21 AM, action actioncao2...@gmail.com wrote:

 I do like this:
 #lein new compojure-app guestbook
 #cd guestbook
 #lein ring server

 The server runs on port 3000 by default.
 But how to override the default port?
 Such as runs on port 80?

 thinks


  --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clojure@googlegroups.com
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


ANN: ring-token-authentication. A ring middleware to authenticate API requests

2014-02-15 Thread Jason Stewart
I've just pushed the first version of ring-token-authentication, a Ring 
middleware to authenticate HTTP API requests.

Token authentication is a popular way to authenticate API requests over 
HTTP. A client sends a token in the Authorization header like so:

Authorization: Token token=notasecret

The token is then parsed from the authorization header and checked for 
authenticity on the server side.

This middleware aims to make it easy to add HTTP token authentication to 
your application, like it is in many other frameworks.


This is my first open source Clojure project, and I'm excited to share it 
with you.
Come check it out at https://github.com/jstewart/ring-token-authenticationor on 
clojars here: 
https://clojars.org/ring-token-authentication

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