Hi,
My 2 cents: this solution may be subject to escaping issues. When one needs
to pass parameters to Javascript, I often recommend to inject one
> There's an example of Ring sessions linked from the Ring wiki:
>
> https://gist.github.com/608048
>
> Does that help?
>
> - James
On May 10, 6:19 am, James Reeves wrote:
> On 10 May 2011 07:24, Shree Mulay wrote:
>
> > For the life of me, I can't get sessions to work, immaterial of which
> >
On May 10, 9:20 pm, Matthew Boston wrote:
> Maybe try looking at the source of a project on github using logins/
> sessions. One I'm currently using for reference is from
> 4clojurehttps://github.com/dbyrne/4clojure
>
Hey Matthew,
I'm looking at the code. If I can't get headway on Ring, I mi
Hi,
Am 11.05.2011 um 03:00 schrieb Ken Wesson:
> Anyway, maybe this will come in handy:
Clojure 1.3 will support timeouts; however on the deref side, not on promise
definition. It'll also handle the not-delivered issue.
user=> (def p (promise))
#'user/p
user=> (future (Thread/sleep 5000) (deli
Hi Shree,
while I wouldn't dare give you technical advice, I may have something
to offer as a fellow Clojure noob. I did try Sandbar for my project,
but found, as I delved deeper into the universe of Clojure web
development, that I was altogether over-complicating everything. This,
and the fact th
I made a little library called clj-ripple for the easy embedding of
Ripple code (for navigating the Semantic Web) inside Clojure programs.
It works by translating Clojure sexps to Ripple code strings through a
macro and then executes and returns the resulting stacks as lazy
sequences.
The git rep
> (clojure.set/rename-keys {1 :a 2 :b 3 :c} {1 2 2 3 3 4})
>
> returns
>
> {4 :a}
That's caused by the collision between new and existing keys. Renaming
1 to 2 blows [2 :b]: {2 :a, 3 :c}; then renaming 2 to 3 blows [3 :c],
leaving {3 :a}; and the last just renames 3 to 4: {4 :a}.
--
You receive
This renames keys to avoid collisions, using an array map to preserve
the order of the keys:
user=> (rename-keys {1 :a 2 :b 3 :c} (array-map 3 4 2 3 1 2))
{2 :a, 3 :b, 4 :c}
On May 11, 7:22 am, Armando Blancas wrote:
> > (clojure.set/rename-keys {1 :a 2 :b 3 :c} {1 2 2 3 3 4})
>
> > returns
>
I've been using 1.3.0 alphas for real work for a little while now, and would
like to raise a couple of issues around type hinting so as to calibrate my
expectations and understanding and/or provoke some discussion about some
inconsistencies I'm seeing.
Some observations from a REPL interaction
(sorry for the prior hiccup, I accidentally sent a draft of my message)
I've been using 1.3.0 alphas for real work for a little while now, and would
like to raise a couple of issues around type hinting so as to calibrate my
expectations and understanding and/or provoke some discussion about some
Swank cdt is unbelievably awesome and many thanks for the superb
effort!
On windows with swank-clojure 1.4.0-SNAPSHOT, there seems to be a
small issue with displaying source once a breakpoint is hit.
I get a message saying "clojure\set.clj - source not found". Digging
into swank source, the method
On 1.3 master there is:
clojure.core/deref
([ref] [ref timeout-ms timeout-val])
Also reader macro: @ref/@agent/@var/@atom/@delay/@future/@promise. Within a
transaction,
returns the in-transaction-value of ref, else returns the
most-recently-committed value of ref. When applied to a var, age
For the intrepid, the first release of swank-clj is out.
This is a refactored swank-clojure, and features sldb integration.
Some highlights:
* line based breakpoints
* stepping
* exception restarts
See the readme at https://github.com/hugoduncan/swank-clj
--
Hugo Duncan
--
You received this
Thanks, that sound good! I'll have a look at the clojars project and
yours once it is in the right state for that.
On 10 Mai, 18:04, Paul deGrandis wrote:
> I'm also working on a project to augment clojars called clopi (Clojure
> Package Index), that will let you filter results based on project
>
Have you seen this?
http://www.assembla.com/wiki/show/clojure/Enhanced_Primitive_Support
•hint for return goes on arg vector
◦e.g. (defn ^:static foo ^long [x] …)
◦this so it supports multi-arity with varied returns
I couldn't find a practical use of doing (defn ^String foo [] ...)
what's hinting
On May 11, 2011, at 1:20 PM, Armando Blancas wrote:
> Have you seen this?
> http://www.assembla.com/wiki/show/clojure/Enhanced_Primitive_Support
>
Indeed, though that's old. See
http://dev.clojure.org/display/doc/Enhanced+Primitive+Support instead.
> I couldn't find a practical use of doing
On May 11, 2011, at 11:09 AM, Chas Emerick wrote:
> Of course, this isn't how 1.3.0 alphas work now, but unless things are really
> locked down, I hope the above is a reasonable starting point for discussing
> how to smooth out the inconsistencies that currently exist.
After some clarifying di
Thanks for the link to the new documentation.
> That's how one hints a non-primitive return type; that's been the case for a
> long time now.
I know, but haven't needed it; I guess it's for Java interop.
> hinting arg vectors in order to indicate function return types is a
> syntactically poor
On Wed, May 11, 2011 at 11:04 AM, Chas Emerick wrote:
> Somewhat worse from the standpoint of semantic consistency, hinting the var
> with ^String yields good — yet confusing — results:
> => (defn ^String foo
> ([])
> (^long [a])
> (^double [a b]))
> #'user/foo
> => #(Double. (foo 0
On Wed, May 11, 2011 at 11:09 AM, Chas Emerick wrote:
> (defn foo
> ^String ([] "bar")
> ^double ([a] 5.6)
> ([a b] :not-hinted-at-all))
>
Given the current implementation I really don't see how this could work.
Keeping the old fn type-hint in a separate place from the new primitive type
hi
On Wed, May 11, 2011 at 3:10 PM, Armando Blancas
wrote:
> I can see the inconsistency but for multiple arity/body functions
> that's not a bad place to put it. My suggestion would be to extend
> (declare) à la maclisp and keep the actual fn clean of hints (at least
> the signature).
> http://bitsa
On May 11, 2011, at 4:45 PM, Ken Wesson wrote:
> On Wed, May 11, 2011 at 11:04 AM, Chas Emerick wrote:
>> Somewhat worse from the standpoint of semantic consistency, hinting the var
>> with ^String yields good — yet confusing — results:
>> => (defn ^String foo
>> ([])
>> (^long [a])
>>
James,
>From this code, I can't figure out where you "instantiate" the session
var, store to it, and read back from it? I know there's not
instantiation in clojure(???). I hope your able to get what I'm having
trouble figuring out.
I'm not sure whether the magic happens here:
(let [n (session :n
Paul,
I'm using ring, hiccup, compojure, and clutch (for my database
connectivity via CouchDB). I'm avoiding Sandbar, cause I can't figure
too much of it out anyways) at this point, at least.
I think the only thing I'm using compojure for is [GET POST ANY
defroutes].
I'm building the "core compo
The "magic" is in wrap-session, which adds the session middleware to your stack.
At that point, your ring handler will see that it's request map has a
new key (:session) which is a map containing all your session
variables.
You can assoc anything into that map and it will be stored in the session
On May 11, 2011, at 4:47 PM, David Nolen wrote:
> On Wed, May 11, 2011 at 11:09 AM, Chas Emerick wrote:
> (defn foo
> ^String ([] "bar")
> ^double ([a] 5.6)
> ([a b] :not-hinted-at-all))
>
> Given the current implementation I really don't see how this could work.
> Keeping the old fn typ
On 12 May 2011 00:04, Shree Mulay wrote:
> From this code, I can't figure out where you "instantiate" the session
> var, store to it, and read back from it? I know there's not
> instantiation in clojure(???). I hope your able to get what I'm having
> trouble figuring out.
The session is read from
On Wed, May 11, 2011 at 7:43 PM, Chas Emerick wrote:
> (defn ^String foo [])
> (defn foo ^long [])
>
The real problem is that first case was never actually specifying a return
type - it is a type hint on the var that happened to store an fn. The fn
itself can only return Object (<=1.2.0).
Now f
On May 11, 2011, at 9:04 PM, David Nolen wrote:
> On Wed, May 11, 2011 at 7:43 PM, Chas Emerick wrote:
> (defn ^String foo [])
> (defn foo ^long [])
>
> The real problem is that first case was never actually specifying a return
> type - it is a type hint on the var that happened to store an fn
Shree,
I would suggest that you try to use only Ring first. Once you get how
it works, take a look at Sandbar and see if that may work better for
you in specific situations.
The session code in Sandbar is stable. It will not change much in the
next release. In fact it may become its own project b
I'm wondering what resources would be best to learn how Clojurians
write their code.
I've been developing for about 4 years in several object-oriented
languages (mostly C# and Ruby). I understand Clojure's syntax well and
I'm familiar with a lot of the features of Clojure (although I'm sure
severa
Dear James, et al.,
Here is what I'm trying to do:
---
;;Login form to login. To login successfully, let
;;password = secret
(defn login-view []
(html
[:p
(form-to [:post "/login/" ]
"User name: "
[:input {:name "name", :type "te
Dear Aaron, et al.,
I have been wrapping my sessions. Perhaps there's something I'm
missing???
(def app
(-> #'main-routes
(wrap-reload '(SocialNetworkCore.core)) ;;remove wrap-reload
from production code
(wrap-params) ;; wraps params (inputs from
forms) - makes
Thanks Brenton,
I've gone through your example, and tried to replicate it at my
end(for my use cases) but was unable to. I demoed most of the examples
you've provided and they look GREAT! I hope that I'll be able to make
projects work (and look) like the examples you've shared with us one
day.
Th
On Wed, May 11, 2011 at 10:27 PM, Shree Mulay wrote:
>
> ;;takes the input params from the login form and stores the
> ;;logged in user into a session. You get logged in when the
> ;;password value is = secret
> (defn login-controller [params session]
> (do (println (params "password") (params "n
Aaron, et al.,
That didn't seem to make any difference. I believe the example I got
"dosync" from wanted the whole thing to move forward as a transaction
(???). Anyhow, this is what it looks like now:
(defn login-controller [params session]
(do (println (params "password") (params "name")))
(
James,
I even tried the examples you gave me:
(defroutes main-routes
(GET "/" [] (welcome))
(GET "/form" [] (render-form))
(GET "/login/" [] (login-view))
; (POST "/login/" {request :request params :params} (login-
controller request params))
(POST "/login/" {params :params sess
On Wed, May 11, 2011 at 9:04 PM, David Nolen wrote:
> On Wed, May 11, 2011 at 7:43 PM, Chas Emerick wrote:
>>
>> (defn ^String foo [])
>> (defn foo ^long [])
>
> The real problem is that first case was never actually specifying a return
> type - it is a type hint on the var that happened to store
On Wed, May 11, 2011 at 10:10 PM, J.R. Garcia wrote:
> I'm wondering what resources would be best to learn how Clojurians
> write their code.
>
> I've been developing for about 4 years in several object-oriented
> languages (mostly C# and Ruby). I understand Clojure's syntax well and
> I'm familia
I've released a new version of lein-daemon. daemon is like 'lein run',
only it runs the process in the background rather than blocking.
0.3 and up is a complete re-write, that no longer depends on apache
commons daemon. The new version has no dependencies on any external
programs.
For more, see h
On Wed, May 11, 2011 at 11:58 PM, Ken Wesson wrote:
> On Wed, May 11, 2011 at 9:04 PM, David Nolen
> wrote:
> > On Wed, May 11, 2011 at 7:43 PM, Chas Emerick
> wrote:
> >>
> >> (defn ^String foo [])
> >> (defn foo ^long [])
> >
> > The real problem is that first case was never actually specifyi
Factual has been using Clojure for over a year now in narrowly defined
corners of our production stack. Just recently, we've made a decision
to use it more widely. For one thing, Cascalog is starting to be a big
win for us. And we'll most likely be starting up whole new projects
that are mainly Clo
On Thu, May 12, 2011 at 1:04 AM, David Nolen wrote:
> On Wed, May 11, 2011 at 11:58 PM, Ken Wesson wrote:
>>
>> On Wed, May 11, 2011 at 9:04 PM, David Nolen
>> wrote:
>> > On Wed, May 11, 2011 at 7:43 PM, Chas Emerick
>> > wrote:
>> >>
>> >> (defn ^String foo [])
>> >> (defn foo ^long [])
>> >
Hi,
I am trying to import .clj files. What is the variable( load-
path/swank-clojure-classpath) that should point to the directory
containing other .clj files with their own namespaces ? I use
ClojureBox.
I am loading the file using C-c C-l but I see this error
Could not locate message
44 matches
Mail list logo