Re: Macro and metadata

2014-05-25 Thread James Reeves
A macro is a function that's evaluated at compile time rather than at runtime. Clearly the compiler needs some mechanism to distinguish between the two, correct? Clojure already has metadata and functions, so using a metadata flag on the var introduces no new types. It also has the advantage of be

Re: help with the lawyers?

2014-05-30 Thread James Reeves
I'd suggest contacting the Eclipse Foundation directly and getting their opinion. They'd probably be interested in any decision that bans EPL-based software from being used in the federal government. - James On 30 May 2014 04:31, rcg wrote: > Hello; > > Developing web site for government using

Re: text processing function

2014-06-01 Thread James Reeves
What about: {:fullname (get result 0), :lastname (get result 1), :firstname (get result 2), :middlename (get result 3)} If the "get" function can't find a result, it returns nil. - James On 1 June 2014 17:09, Glen Rubin wrote: > I am doing some text processing using clojure and attempting to

Re: Advice on implementing atomic read/write socket operations

2014-06-02 Thread James Reeves
Since two threads cannot use the connection concurrently, it sounds like you just need the locking macro: (locking conn (.write conn "blah") (.read conn)) - James On 2 June 2014 22:15, Joachim De Beule wrote: > Dear group, > > I have the following use case: I have a socket con

Re: loop/recur being functional

2014-06-03 Thread James Reeves
loop/recur is explicit tail recursion, and therefore will only work if the "recur" is in the tail position, i.e. the last form evaluated. For example, this function is tail recursive: (defn sum [coll result] (if (seq coll) (sum (rest coll) (+ result (first coll))) 0)) While this functi

Re: arguments passed to a macro

2014-06-05 Thread James Reeves
Well, the easiest option is to just use the import function: (ns example.myprogram) (import swing-imports) There is a reader macro, #=, that might work, but I wouldn't recommend it: (ns example.myprogram (:import #=swing-imports)) - James On 6 June 2014 01:12, Christopher Howard wrote: >

Re: [ANN] clecs 0.2.1

2014-06-08 Thread James Reeves
I think you're reaching for mutability a little too soon. You could aim to be more functional, then leave the mutation up to atoms or megarefs. For example: (def empty-system {:entities {}, :components {}}) (let [i (java.lang.concurrent.atomic.AtomicInteger. 1) (defn new-id [

Re: destructuring let and for

2014-06-10 Thread James Reeves
Could you explain a little more what your end goal is? It sounds like you want a map, but without knowing more about the purpose, it's difficult to say. - James On 10 June 2014 16:43, Francesco Lunelli wrote: > Hello everybody, I have a newbie question about destructuring and > assigning and

Re: How to unit test (defn-) functions?

2014-06-12 Thread James Reeves
On 12 June 2014 09:44, Hussein B. wrote: > > I like to use (defn-) when it comes to internal implementation functions. > But since they aren't exposed, how to unit test them? > Generally speaking it's a bad idea to unit-test private functions (in any language), as they're implementation details.

Re: using "hidden" parameters?

2014-06-13 Thread James Reeves
It is possible with macros: (defmacro next-number [] '(+ x 1)) Note that I'm using ' and not ` here, so the x isn't resolved. If I wanted to use backticks, I'd need to write: (defmacro next-number [] `(+ ~'x 1)) Macros also get an implicit &env binding that gives them access to the local en

Re: macro question

2014-06-16 Thread James Reeves
Macros differ from functions in two ways: 1. They're executed at compile-time, rather than run-time. 2. Their arguments are unevaluated. Your if-zero function probably doesn't act the way you expect it to, because you're expecting test-expr to be evaluated. If all of the arguments to your macro

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread James Reeves
Something like this, perhaps: (assoc m k (conj (m k []) v)) Where m is the map, k is the key, and v is the new value you want to append. This works because (m k []) will default to [] if the key k isn't in the map m. Usually if a key cannot be found, it defaults to nil. If you don't care so

Re: How to add elements to a vector that is the value of a map key?

2014-06-17 Thread James Reeves
On 17 June 2014 18:54, Mauricio Aldazosa wrote: > > user> (update-in {} [1] (fnil conj []) 22) > {1 [22]} > Good use of the fnil function! It's one of those functions I always forget exists. - James -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: Clojure, floats, ints and OpenGL

2013-09-16 Thread James Reeves
On 16 September 2013 09:03, Mikera wrote: > > Obviously this is just a microbenchmark, but it fits my general experience > that floats are a reasonable bit faster than doubles, typically 20-100% > (doubles are closer when it is pure number crunching since 64-bit CPUs are > actually pretty good at

Re: much lower recursion depth with memoization

2013-09-22 Thread James Reeves
On 23 September 2013 00:28, John Lawrence Aspden wrote: > Nice, but it won't work for me, since I'm trying to avoid computing all > the values in the table, and so I can't use the pump-priming approach. I > don't know what values I'm going to need primed! > I'm sure there are ways round it, but I

Re: Could not find artifact org.clojure:clojure:pom:1.2.0-master-SNAPSHOT in central

2013-09-28 Thread James Reeves
The 4clojure 1.3.0.1 version is very old, and it looks like you're trying to use a modern dependency (compojure 1.1.5) with many old dependencies, which probably isn't going to go well even if you fix the deps problem. Why not update the repository to the latest 2.0.0-rc2 version and work off that

Re: Newbie seeks advice

2013-10-06 Thread James Reeves
The key to writing an algorithm functionally is to break it up into simple components. You're performing three calculations: (def x (myfunc x)) (def buffer (in_buffer buffer x)) (+ (nth buffer 1) (nth buffer 3)) Let's tackle each in turn. The first is a continually changing value

Re: What non-deprecated Clojure Web libraries to use?

2013-10-27 Thread James Reeves
Compojure isn't deprecated. What made you think it was? - James On 27 October 2013 17:43, Scott M wrote: > Ring seems well maintained, but Noir and Compojure are marked deprecated. > > Can anyone lay out a Clojure Web library "stack" (up to templating) that > is current and maintained? > > Any

Any interest in Compojure/Ring screencasts?

2013-10-29 Thread James Reeves
I'm considering putting together a screencast, or a series of screencasts, based on my Functional Web Architecture talk. The base presentation would be improved, and I'd probably wind up going into more detail on certain topics. I'll probably cha

Re: Which Json parser can parse a complete jason string?

2013-10-30 Thread James Reeves
Cheshire should parse the whole JSON object. I haven't noticed any problem with it. What do you mean by "one layer of json string"? Could you provide an example? - James On 30 October 2013 21:36, Gary Zhao wrote: > Hi > > I noticed jason parser such as Cheshire, data.json only parse one layer

Re: tomcat 6/7 stream closed error in ring json - works in lein ring server

2013-11-03 Thread James Reeves
Hi Colin, One of the compromises Ring makes for efficiency is that the body of a request is an InputStream, rather than a static string or byte array pre-loaded into memory. Because it's a stream, it can potentially be consumed by previous middleware. For some reason you have both wrap-json-body

Re: tomcat 6/7 stream closed error in ring json - works in lein ring server

2013-11-03 Thread James Reeves
s consumed by the first JSON middleware before the second can get to up. - James On 4 November 2013 01:40, Colin Yates wrote: > Hi James, > > Not sure why I did that double wrapping.. > > However, wouldn't that also fail in Jetty? > > > On 4 November 2013 01:

Re: Python doctest in clojure?

2013-11-09 Thread James Reeves
The standard clojure.test namespace included in Clojure has this functionality (or something very similar) by default. You can attach tests as metadata to a function, either like: (defn foo {:test (fn [] (is (= (foo 1) 2)))} [x] (+ x 1)) Or like: (with-test (defn

Re: Regarding Clojure's license

2013-11-12 Thread James Reeves
You may wish to look at this post: https://groups.google.com/d/msg/clojure/bpnKr88rvt8/VIeYR6vFztAJ - James On 12 November 2013 09:55, wrote: > To Rich Hickey: > Why did you choose the Eclipse Public License for Clojure? > 1. How did you make your license selection? > 2. What advantages does

Re: Regarding Clojure's license

2013-11-12 Thread James Reeves
On 12 November 2013 15:17, Kalinni Gorzkis wrote: > Thus, Rich Hickey's choice of the EPL has the same rationale as the GPL. > That violates the principle of free software. License incompatibilities > like this divide the open-source community. Please change. > You've misunderstood what the ratio

Re: Regarding Clojure's license

2013-11-12 Thread James Reeves
On 12 November 2013 16:26, Phillip Lord wrote: > While we are talking, does anyone know why (contains? [:a :b :c] :b) > returns false? > This would be better placed in its own thread I think, but it's because the contains? function checks for the presence of keys, not values. In a vector, the key

Re: Regarding Clojure's license

2013-11-12 Thread James Reeves
I'm afraid your jokes are a little too subtle for me, Phillip :) - James On 12 November 2013 17:01, Phillip Lord wrote: > James Reeves writes: > > > On 12 November 2013 16:26, Phillip Lord >wrote: > > > >> While we are talking, does anyone know why (co

Re: A Design (Simplification) Problem

2013-11-13 Thread James Reeves
Hi Oskar, I've recently been working on a similar problem. I've had some success with FRP (functional reactive programming), and I've written a library, Reagi, to implement what is hopefully a style of FRP that remains true to Clojure's ideology. First, let's

Re: Do web apps need Clojure?

2013-11-13 Thread James Reeves
On 13 November 2013 22:38, Marcus Blankenship wrote: > > We’re a Python / Django shop, and some folks are getting excited about > using Clojure for building web apps. Certainly there are numerous > open-source options to assist us (Pedastal, Ring, Compojure, Caribou, etc), > but I think it begs

Re: Do web apps need Clojure?

2013-11-14 Thread James Reeves
On 14 November 2013 16:22, Brian Craft wrote: > > I don't believe the legos analogy is very accurate for clojure. Or, > rather, it's more of a vision than a reality. I'm unaware of any libraries > in clojure that you can piece together to give you the features of > django-south, django admin, and

Re: Do web apps need Clojure?

2013-11-14 Thread James Reeves
On 14 November 2013 17:55, Brian Craft wrote: > > On Thursday, November 14, 2013 9:17:32 AM UTC-8, James Reeves wrote: > >> >> For instance, database migrations. This was something I thought about a >> lot a few years ago, until I gradually realised that I wasn

Re: maintainability, DSLs, declarative APIs, etc.

2013-11-15 Thread James Reeves
The first rule of macro club is "Don't write macros." Macros are powerful, but they should be considered the last avenue of attack. Often macros are a slim wrapper around an API made out of functions, and there just to provide some syntax sugar. Libraries that use macros more extensively, like co

Re: [ANN] Cornet 0.1.0 - Clojure asset pipeline for minification and compilation of LessCSS and CoffeeScript (...more coming soon)

2013-11-16 Thread James Reeves
Hi Marcin, Why did you choose to group LESS compilations, CoffeeScript minification, caching and resource minification in one middleware function? Why not have a separate middleware function for each? For example, instead of: (compiled-assets-loader "precompiled" :lesscss-list ["css/bootstrap.

Re: [ANN] Cornet 0.1.0 - Clojure asset pipeline for minification and compilation of LessCSS and CoffeeScript (...more coming soon)

2013-11-16 Thread James Reeves
On 16 November 2013 13:02, Marcin Skotniczny wrote: > Well, I made sure you can do it:). I created the grouped middleware > functions for convenience's sake and I intend to add more. > Ah, interesting! That's a design I'm more comfortable with. > Although this might not be good enough, becaus

Re: [ANN] Cornet 0.1.0 - Clojure asset pipeline for minification and compilation of LessCSS and CoffeeScript (...more coming soon)

2013-11-16 Thread James Reeves
On 16 November 2013 17:55, Marcin Skotniczny wrote: > Cornet works on lower layer and does not use ring-spec or HTTP. All the > functions and middleware in Cornet take path as String and return > java.net.URL (either "file:/..." or "jar:file:/") [as a side note: at some > point I want it to be ab

Re: [ANN] Cornet 0.1.0 - Clojure asset pipeline for minification and compilation of LessCSS and CoffeeScript (...more coming soon)

2013-11-16 Thread James Reeves
On 16 November 2013 19:46, Marcin Skotniczny wrote: > > Doesn't this approach risk unnecessary repetition? >> >> I am not sure if I catch your drift... What I wanted to have is a direct > replacement for clojure.java.io/resource function - so if at some layer > you come down to using this functio

Re: [ANN] overload-middleware 0.1.1

2013-11-16 Thread James Reeves
It may be useful for certain web services. If the server gets overloaded by a temporary spike, the clients could pick a random sleep time before trying again. - James On 16 November 2013 21:15, Cedric Greevey wrote: > I can think of very few web apps where this would be a desirable approach. >

Re: [ANN] overload-middleware 0.1.1

2013-11-16 Thread James Reeves
On 16 November 2013 21:45, Cedric Greevey wrote: > Web browsers don't "pick a random sleep time before trying again", though; > they display a 500 error page and the user promptly clicks "reload" while > making an exasperated sigh. > > If the client is something other than a web browser, then we'

Re: [ANN] overload-middleware 0.1.1

2013-11-16 Thread James Reeves
On 16 November 2013 22:49, Cedric Greevey wrote: > On Sat, Nov 16, 2013 at 5:06 PM, James Reeves wrote: > >> Web servers are often used to serve information to clients other than web >> browsers. >> > > [citation needed] > Just google "web services".

Re: [ANN] overload-middleware 0.1.1

2013-11-16 Thread James Reeves
On 17 November 2013 01:52, Cedric Greevey wrote: > The distribution will be narrow and peak at around 1 second, though, which > may not be what you want. Of course, the OP has since indicated that he > meant non-web uses of HTTP rather than serving web sites... > Web services are generally consi

Re: [ANN] overload-middleware 0.1.1

2013-11-17 Thread James Reeves
On 17 November 2013 05:25, Cedric Greevey wrote: > On Sat, Nov 16, 2013 at 9:35 PM, James Reeves wrote: > >> On 17 November 2013 01:52, Cedric Greevey wrote: >> >>> The distribution will be narrow and peak at around 1 second, though, >>> which may not be

Re: [ANN] overload-middleware 0.1.1

2013-11-17 Thread James Reeves
On 17 November 2013 13:04, Clinton Dreisbach wrote: > People, you are not going to win a fight with a Level 65 Troll Wizard. > Back away slowly. > > Rob, this is a cool library: thanks for writing it. > Point taken. I've added this library to clojure-toolbox.com. I can see this library being ve

Re: How to store the results in a vector ?

2013-11-17 Thread James Reeves
Try using ??- and ??<-. These will output to a vector. (??<- [?category] ((select-fields info-tap ["?category"]) ?category)) - James On 17 November 2013 21:05, sindhu hosamane wrote: > Hello friends , > > (?<- (stdout)[?category]((select-fields info-tap ["?category"]) ?category) > ) > > Abov

Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread James Reeves
On 19 November 2013 14:22, Brian Craft wrote: > > For example, I have a project with rather modest requirements, one of them > being abstract path manipulation. In javascript: > > path.normalize(path.join("one", "two", "..", "three")) > 'one/three' > > ruby: > > irb(main):003:0> Pathname.new("one

Re: Super-simple recursive-descent parser in Clojure?

2013-11-19 Thread James Reeves
If anything, parsing is easier to do with immutable structures, as backtracing is trivial. You don't need a mutable stream of symbols, you just need to have parsing functions with a type signature like: tokens -> [ast tokens] Rather than the function parsing a stream of tokens and returning

Re: Breaking out of a map type function

2013-11-24 Thread James Reeves
Another option is to take-while the values in the sequence are valid, and then map over the ones that are. - James On 24 November 2013 16:50, Stuart Halloway wrote: > Hi Dave, > > You can use reduce for this job, and have the reducing function return a > (reduced retval) when you want to break

Re: Breaking out of a map type function

2013-11-24 Thread James Reeves
Something like: (defn safe-sum [coll] (reduce (fn [s x] (if x (+ x s) (reduced s))) coll)) This will compute the sum until it hits a "falsey" (i.e. nil or false) value. Alternatively, you could write it: (defn safe-sum [coll] (apply + (take-while identity coll))) - James On 24 November 20

Re: [ANN] fsrun : file change notifier high order lein task

2013-11-27 Thread James Reeves
It'll be easier to get feedback if you push it to Clojars. I want to try it out, but not enough to clone the repo and manually install it. Since it's only version 0.1.0, it's not as if it's expected to be flawless. - James On 27 November 2013 07:00, Deniz Kurucu wrote: > Ah yes, sorry it is n

Re: How to store the results in a vector ?

2013-11-27 Thread James Reeves
Hi Sindhu Let's start from the beginning. You have some source of data. I'll simulate this with a vector: (def info [["Warning" "Something went wrong"] ["Status" "Error"] ["Sequence Hold" "Holding"]]) No doubt your actual data looks quite different, but bear with me. Nex

Re: How to store the results in a vector ?

2013-11-28 Thread James Reeves
I don't think you're accounting for leading and trailing whitespace. A field like: ; GasTurbine2103/01 ; Will produce a string like: " GasTurbine2103/01 " The only field that doesn't have leading and trailing whitespace is the timestamp, which works correctly. There's a standard Clojure

Re: Any elegant solutions for this problem?

2013-12-01 Thread James Reeves
There's also: (->> xs (partition-by string?) (partition 2) (mapcat (fn [[[s] xs]] (for [x xs] [s x] - James On 1 December 2013 19:39, Ryan wrote: > Haha, no worries, it happens :) > > That seems to work nice as well! > > Ryan > > > On Sunday, December 1, 2013 9:36:47 PM UT

Re: I need a vector not a list?

2013-12-01 Thread James Reeves
Seqs in Clojure are very much like iterators in other languages. They're an abstraction for navigating a sequential data structure. Also because values in Clojure are immutable, you rarely, if at all, encounter situations where those objects need to be copied. Why would you, when you can just refe

Re: I need a vector not a list?

2013-12-02 Thread James Reeves
; Iterators - stateful cursors that conflate iteration with a check for > whether more elements exist > Seqs - immutable persistent views of a collection that separate iteration > from checking for more elements > > http://clojure.org/sequences > > > On Sunday, Decembe

Re: reduce vs fold

2013-12-03 Thread James Reeves
Hi Caleb, This surprised me as well. It seems that if you try to fold a map, the function has two arguments: (r/fold + (r/map (fn [k v] v) {:a 1 :b 2})) ;; works (r/reduce + (r/map (fn [k v] v) {:a 1 :b 2})) ;; doesn't work (r/reduce + (r/map (fn [[k v]] v) {:a 1 :b 2})) ;; works (r/

Re: Am I missing something?

2013-12-04 Thread James Reeves
On 3 Dec 2013 23:28, "James Laver" wrote: > Some examples: > 1. The :params key is used by ring.middleware.params, compojure and ring.middleware.format so it's impossible to know where a given param is coming from > 2. ring.middleware.params does not provide a convenience map that merges :query-pa

Re: Am I missing something?

2013-12-04 Thread James Reeves
On 4 December 2013 10:37, James Laver wrote: > > On 4 Dec 2013, at 09:06, James Reeves wrote: > > > It sounds like part of the issue is with ring.middleware.format > overloading the :params key, but it also seems like you might have an > unusual set of requirements. &g

Re: Am I missing something?

2013-12-04 Thread James Reeves
On 4 December 2013 14:04, James Laver wrote: > > I’m pretty sure that’s the behaviour I was already seeing. Imagine this > scenario: > - I access this route passing in the ID of the database record I wish to > modify > - I pass in a new value for it in the post data (okay, bad example, you’re > n

Re: Type hints inside generated code

2013-12-04 Thread James Reeves
Try something like: (let [x (with-meta (gen-sym) {:tag String}] (defn foo [~x] ...)) - James On 4 December 2013 19:55, dm3 wrote: > Hello, > > I've been having a little problem when trying to generate java interop > code and avoid reflection warnings. I have to generate a bunch of >

Re: Advice on choosing the right data structure

2013-12-04 Thread James Reeves
On 4 December 2013 20:27, dabd wrote: > > I tried a purely functional approach with zippers but ran into some > trouble with the zipper API. I also think I will would have performance > problems too as there is a lot of bookkeeping in a zipper (paths, parents > associated with a loc). > You thin

Re: Advice on choosing the right data structure

2013-12-04 Thread James Reeves
On 4 December 2013 21:09, dabd wrote: > I didn't get there because I ran into problems with the zipper API. When > you call 'children' on a loc you get a seq of nodes instead of a seq of > locs which causes me problems in a recursive algorithm operating on locs. > Have you tried using next and

Re: How would I do this in Clojure?

2013-12-05 Thread James Reeves
On 5 December 2013 20:58, Gary Trakhman wrote: > This is possible with atoms and refs and such, but I wonder if the > use-case can't simply be handled with existing seq functions? > > This is going against the grain of clojure's FP approach. > Right. It would be useful to know why this functiona

Re: accessing big-resource - what are people doing?

2013-12-07 Thread James Reeves
It sounds like you either need a local cache, so each client only needs to download the file once, or to place the data on an external database that's accessibly publicly in some fashion. - James On 7 December 2013 12:06, Jim - FooBar(); wrote: > Hi all, > > Technically speaking this is not a

Re: My first attempt at a macro: "can not recognize symbol"

2013-12-10 Thread James Reeves
Remember that only the last form will be returned. So: (defn foo [] 1 2 3 4) will always return 4. The same principle applied with your macro. You define four forms, but only return the last one. Instead, try wrapping all the forms in a "do" block. As an aside, this doesn't look like a good

Re: My first attempt at a macro: "can not recognize symbol"

2013-12-10 Thread James Reeves
On 10 December 2013 18:24, larry google groups wrote: > > > As an aside, this doesn't look like a good use-case for macros > >. You'd probably be better defining a map with keys for : > > worker, :channel, etc. Either that or a protocol. > > Thank you much for your help. But I thought this is exac

Re: Should I be using deftype, gen-class or defrecord instead of this hack?

2013-12-12 Thread James Reeves
It's hard to offer an opinion without some sense of the data structures you are producing. In the case of sorting by identifier, why do you need a new type? It sounds like you're basing your logic on data types, rather than the data itself. - James On 12 December 2013 04:26, Tim wrote: > As a

Re: Should I be using deftype, gen-class or defrecord instead of this hack?

2013-12-12 Thread James Reeves
ve, but I am trying to reduce the scope down to > question at hand and not get into unraveling the entire spec. > > Does that help? & Thanks. > > On Thursday, December 12, 2013 7:59:26 AM UTC-5, James Reeves wrote: > >> It's hard to offer an opinion without som

Re: Should I be using deftype, gen-class or defrecord instead of this hack?

2013-12-12 Thread James Reeves
the bounds of the question are there > other approaches to doing the same thing? I initially just wanted to use > with-meta that could attach to any data, but obviously with-meta limits > what it can be attached to which led to the above approach. > > Thanks, > > On Thursday, Dec

Re: [ANN] Hoplon: web applications in Clojure and ClojureScript

2013-12-18 Thread James Reeves
It looks interesting, but it really needs an overview of the syntax. The purpose of the examples is clear, but the mechanism is a mystery. - James On 18 December 2013 20:05, Micha Niskin wrote: > Documentation is here: http://hoplon.io > > We continue to add documentation all the time. Servers

Re: [ANN] Hoplon: web applications in Clojure and ClojureScript

2013-12-18 Thread James Reeves
quot;Sexp Markup > Syntax" that attempts to explain the syntax. What needs to be improved > there? > > > On Wednesday, December 18, 2013 3:56:02 PM UTC-5, James Reeves wrote: > >> It looks interesting, but it really needs an overview of the syntax. The >> purpose of the e

Re: [ANN] Hoplon: web applications in Clojure and ClojureScript

2013-12-19 Thread James Reeves
atomically and consistently, even though the >individual cells are updating themselves one at a time. The consistency >guarantee ensures that each cell sees the world as if it updates >atomically; no cell can ever see other cells in a half-evaluated state; >each cell acts as if

Re: Library can depend on an older version of itself?

2013-12-23 Thread James Reeves
I don't have any suggestions as to how this might be achieved, I'm afraid, but I am very curious as to *why* you'd want to do this. - James On 24 December 2013 00:07, Michael Bradley, Jr. wrote: > Is there a straightforward way to setup a Clojure library so that it can > depend on an older ver

Re: How do I serve clojure pages with nginx

2013-12-25 Thread James Reeves
I currently serve a web app on a Ubuntu server. Here's the configuration I use: In "/etc/nginx/sites-available/": server { listen 80; location / { proxy_set_header X-Real-IP$remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy

[ANN] Reagi 0.7.0 with ClojureScript support

2013-12-25 Thread James Reeves
Happy Holidays and Merry Christmas, Reagi 0.7.0 has been released, now with support for ClojureScript. Reagi is an FRP library that introduces two new reference types: behaviors and event streams. Behaviors model continuous change, and work a little like delays, while events represent discrete ch

Re: [ANN] Reagi 0.7.0 with ClojureScript support

2013-12-26 Thread James Reeves
lug > another stream as source to current. What are caveats of doing things in > such way? I ask this question in general, not only as related to reagi > functionality. May be it makes streams <>? > > > четверг, 26 декабря 2013 г., 1:15:57 UTC+2 пользователь James Reeves >

Re: Is Clojure right for me?

2013-12-26 Thread James Reeves
What sort of web development were you planning to do? - James On 25 December 2013 21:06, Massimiliano Tomassoli wrote: > Hi, > I'm not sure if Clojure is the right language for me. I'd like to use > Clojure mainly for web development but I don't know if it's already mature > enough to be produc

Re: [ANN] Reagi 0.7.0 with ClojureScript support

2013-12-26 Thread James Reeves
ug/unplug existing streams looks > natural for me. But if you point me alternate solution for this case which > emphasizes immutability, I will be happy. > > > On Thursday, December 26, 2013 12:14:51 PM UTC+2, James Reeves wrote: > >> Reagi's event streams are not dissimil

Re: Is Clojure right for me?

2013-12-26 Thread James Reeves
On 26 December 2013 12:24, Massimiliano Tomassoli wrote: > On Thursday, December 26, 2013 11:16:07 AM UTC+1, James Reeves wrote: >> >> What sort of web development were you planning to do? >> >> > I'd like to build websites. What kind depends on what my cli

Re: Is Clojure right for me?

2013-12-26 Thread James Reeves
On 26 December 2013 16:32, Massimiliano Tomassoli wrote: > Thank you, Malcolm. I'm completely new to LISP and its dialects and I'm a > little bit worried about the absence of support for OOP in Clojure. How do > you decompose large systems in Clojure? > You write functions. To quote Alan J. Perli

Re: Is Clojure right for me?

2013-12-26 Thread James Reeves
On 26 December 2013 19:53, Massimiliano Tomassoli wrote: > > Why implicit? Objects communicate through well-defined channels. OOP can > certainly be misused but it served me well for over 20 years (C++/C#). And > Scala proves that FP and OOP are orthogonal paradigms. I can't see how the > lack of O

Re: Is Clojure right for me?

2013-12-26 Thread James Reeves
On 26 Dec 2013 21:04, "Softaddicts" wrote: > > a) encapsulation of unmutable state ? What for ? > b) inheritance ? see a) > c) polymorphism ? Multimethods (which are more flexible) or protocols > > Nice words but not much else. > > Comparing C versus C++ is fair but this comparison does not relate

Re: Is Clojure right for me?

2013-12-26 Thread James Reeves
On 27 December 2013 00:16, Massimiliano Tomassoli wrote: > On Thursday, December 26, 2013 11:04:00 PM UTC+1, Luc wrote: >> >> Ok I'll drop the subject. Still cannot understand why people cannot >> try something new w/o sticking to the stuff they know already until they >> are >> totally immersed i

Re: Namespaces [was Re: Is Clojure right for me?]

2013-12-27 Thread James Reeves
On 27 December 2013 18:08, Mark Engelberg wrote: > > On Fri, Dec 27, 2013 at 6:34 AM, Stuart Halloway < > stuart.hallo...@gmail.com> wrote: > >> Yes, thanks Mark. It seems to me that you are saying "namespaces make >> poor maps". Stipulated. So why not use records or maps? >> > > This is close,

Re: How do I serve clojure pages with nginx

2013-12-27 Thread James Reeves
ike I am doing something wrong with the conf file. Any ideas? > Thanks again. I hope this will work. > > > On Wednesday, December 25, 2013 10:06:58 AM UTC-4, James Reeves wrote: > >> I currently serve a web app on a Ubuntu server. Here's the configuration >> I use: >

Re: How do I serve clojure pages with nginx

2013-12-27 Thread James Reeves
exec or script > in the conf file? Thanks. > > > On Fri, Dec 27, 2013 at 9:20 PM, James Reeves wrote: > >> Perhaps try nomilkforme.conf instead of nomilkfor.me.conf ? >> >> - James >> >> >> On 28 December 2013 00:27, Zeynel wrote: >> >>>

Re: Namespaces [was Re: Is Clojure right for me?]

2013-12-28 Thread James Reeves
On 28 December 2013 08:21, Mark Engelberg wrote: > > `with-precision` has the same limitations as bindings -- if you want to > produce, for example, a lazy sequence involving decimal arithmetic, you're > going to get burned. Maybe in some projects you can get away with just > setting a default p

Re: In your opinion, what's the best, and what's the worst aspects of using Clojure?

2013-12-28 Thread James Reeves
The worst aspect of Clojure is probably its dependency on the JVM - which also happens to be one of its best attributes as well. A lot of the rough edges Clojure has can be traced back to trade-offs with running on a VM built for another language. The stacktraces of lazy sequences, the limitations

Re: How do I serve clojure pages with nginx

2013-12-28 Thread James Reeves
inusweb.net/ >> docs/deployment.md#running_standalone with >> >> >> java -jar myapp-0.1.0-SNAPSHOT-standalone.jar >> >> >> On Wednesday, December 25, 2013 10:06:58 AM UTC-4, James Reeves wrote: >>> >>> I currently serve a web app on a Ubuntu se

Re: How do I serve clojure pages with nginx

2013-12-28 Thread James Reeves
ureadahead-other.log.1.gz > > Is there a way to tell upstart to include nomilkforme.log? > > On Saturday, December 28, 2013 1:16:31 PM UTC-4, James Reeves wrote: > >> Upstart gives you useful tools like respawning failed services, log >> rotation, and starting on server

Re: How do I serve clojure pages with nginx

2013-12-28 Thread James Reeves
.log.1.gz > ureadahead.log.1.gz > ureadahead-other.log.1.gz > > > On Sat, Dec 28, 2013 at 1:38 PM, James Reeves wrote: > >> Logs are automatically gzipped up after a while, I believe. You can use >> something like zcat to take a look inside. >> >>

Re: How do I serve clojure pages with nginx

2013-12-28 Thread James Reeves
get this: > > root@ubuntu:/deploy# start nomilkforme > start: Job failed to start > > > On Sat, Dec 28, 2013 at 1:16 PM, James Reeves wrote: > >> Upstart gives you useful tools like respawning failed services, log >> rotation, and starting on server boot. &g

Re: Hello, here´s a new clojur adict... with a question.

2014-01-14 Thread James Reeves
You could also write: (println (@sx2 4)) On 14 January 2014 11:35, Andreas Olsson wrote: > thanks... this works > > (println ((deref sx2) 4)) > > > > Den tisdagen den 14:e januari 2014 kl. 12:29:02 UTC+1 skrev Jim foo.bar: > >> an atom cannot be used as a function! deref it first to get the v

Re: OOP question re: The Language of the System

2014-01-19 Thread James Reeves
On 19 January 2014 19:55, Brian Craft wrote: > http://www.youtube.com/watch?v=ROor6_NGIWU > > Around 56:28 Rich is talking about whether components pass a data > structure, or "an object that has all these verbs and knows how to do stuff > ...". > > Clojure data types also have verbs, in protocol

Re: (go (loop [ ..] (try ... (catch ..)))) won't compile

2014-01-22 Thread James Reeves
Just pull the exception out of the loop logic: (go (loop [xs (range 10)] (if-let [x (first xs)] (if (= ::error (try (println x) (catch Throwable t ::error))) (recur (rest x)) - James On 22 January 2014 11:05, László Török wrote: > Hi, > > I have a processing loop in a go b

Solutions for subclassing java.io.InputStream

2014-01-23 Thread James Reeves
Hi folks, Is anyone aware of any Clojure solutions or libraries for subclassing the java.io.InputStream class? The proxy function doesn't work in this case, and gen-class requires some fiddling to get operational. Ideally I'd be looking for a library that derives an InputStream from an IFn. Is t

Re: [ANN?]: ring-jetty-adapter with jetty 9.1.x

2014-01-23 Thread James Reeves
You might want to give it a different name, like ring-jetty9-adapter, otherwise it might be confused with the ring-jetty-adapter package in Ring itself. - James On 23 January 2014 22:39, Andrey Antukh wrote: > Hi! > > I have port the current ring-jetty-adapter from current ring repository to >

Re: Looking for a reference binary parsing

2014-01-24 Thread James Reeves
You might want to take a look at Gloss ( https://github.com/ztellman/gloss) and Buffy ( https://github.com/clojurewerkz/buffy ). - James On 24 January 2014 15:08, Kashyap CK wrote: > Hi, > I need to write a parser for MP4 - essentially, read an MP4 file and > create an in-memory representation

Re: CSS sometimes disappears in uberjar web app using wrap-resource

2013-02-06 Thread James Reeves
Could you try replacing the wrap-resource middleware with the route/resources function? The latter operates in a slightly different way to the Ring middleware, and if the Compojure route works without issue, I might have an idea what the problem is. i.e. your code should look like: (defroutes app

Re: CSS sometimes disappears in uberjar web app using wrap-resource

2013-02-07 Thread James Reeves
On 7 February 2013 16:37, larry google groups wrote: > Okay, got all this working. Thank you very much for your tip. Can you say > what you think the problem was? I noticed that the wrap-resource middleware didn't account for the HTTP HEAD method, while route/resources does. According to the HT

Re: Easier imperative-style programming

2013-02-11 Thread James Reeves
You want to think more abstractly. What are the common elements in your code? For instance, a naive first pass: (defn move [subject delta] (update-in subject [:position] v+ delta)) (defn key-held [key] (@*keys-held* :left)) (defmacro on [subject event action] `(if ~event (-> ~subject ~act

Re: regarding Ring, am I reinventing the wheel?

2013-02-15 Thread James Reeves
A Ring middleware function takes a handler as its argument, and returns a new handler, so you could write: (defn wrap-pre-event-hooks [handler] (fn [request] (handler (process-pre-event-hooks request However, I'm curious as to what all your process-* functions are actually doing. It see

<    3   4   5   6   7   8   9   10   >