clojure repl quits after calling static java method

2009-01-17 Thread larry

I'm calling a java static method Play.midi in JMusic from Clojure
REPL.
After it plays the notes and says: "completed MIDI playback",  the
Clojure REPL quits.
How do I keep the Clojure REPL from quitting after making this call to
Java?

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



clojure.contrib.str-utils in counterclockwise

2011-03-27 Thread larry
In installed counterclockwise plugin for eclipse. clojure.contrib is
supposed to be installed with this but when I try:


(require 'clojure-contrib.str-utils)

I
Could not locate clojure_contrib/str_utils__init.class or
clojure_contrib/str_utils.clj on classpath:  (test.clj:2)

How do I fix this?
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


why can't string functions be part of standard clojure lib?

2011-05-21 Thread larry
Let's say you're a new user and you want to split a  string on a
delimiter in clojure.

Okay, I  google  "string split" in clojure.
I find this at http://clojure.github.com/clojure/clojure.string-api.html

(ns your.namespace.here
  (:require '[clojure.string :as str]))

and see there is a "split" function.


Okay I try this:
(ns user
  (:require '[clojure.string :as str]))

(def x "dfas,d,d,dsf")

(split x  ",")

I get an error message:
Clojure 1.2.0
java.lang.Exception: lib names inside prefix lists must not contain
periods (test.clj:1)
1:1 user=> #
1:2 user=>

Is the doc out of date?

Now I try newLisp. I look for string split. I find this the "parse"
function.
I try this:

(set 'x "dfd,dfs,fds,asf,sdf")
"dfd,dfs,fds,asf,sdf"
> (parse x {,})
It just works.

Can't clojure just go ahead and include a string library in the
standard library?
Or make it easier to use libraries in general. I always have a problem
with require, use,etc.etc.

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


question about partial

2012-04-16 Thread larry
I trying to grok partial and -> so I have the following example.

(defn f[x y] (+ x y))

((partial f 2) 3) works as expected , returning 5

but if I try to use ->

(-> 3 (partial f 2)) 

I get #

But if I first define

(def fp (partial f 2))

then

(-> 3 fp) returns 5 as expected

What's going on ? 

-- 
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: question about partial

2012-04-16 Thread larry


On Monday, April 16, 2012 10:02:48 AM UTC-7, Cedric Greevey wrote:
>
> (-> 3 ((partial f 2))) should also work.
>


I just wrote that it DOESN'T WORK. That's the point of the question.I  
should get 5 instead I get
t# 


-- 
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: question about partial

2012-04-17 Thread larry
Oops , thanks for pointing it out. Sorry Cedric, gotta learn to read more 
closely.

On Monday, April 16, 2012 10:22:50 PM UTC-7, Ambrose Bonnaire-Sergeant 
wrote:
>
> Compare the number of brackets in Cedric's example to yours.
>
> Ambrose
>
>
>
>>
>> On Monday, April 16, 2012 10:02:48 AM UTC-7, Cedric Greevey wrote:
>>>
>>> (-> 3 ((partial f 2))) should also work.
>>>
>>
>>
>> I just wrote that it DOESN'T WORK. That's the point of the question.I  
>> should get 5 instead I get
>> t# 
>>
>>
>>  -- 
>> 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 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

closure example doesn't need let?

2012-05-12 Thread larry

I saw this example of a simple closure in Joy of Clojure and on some 
Clojure tutorial page.

(defn adder[n]
  (let [x n]
 (fn[y] (+ y x

Is the let necessary?  It seems redundant.
I tried it like this and it seems to work fine. 

(defn adder[n]
   (fn[y] (+ y n))

-- 
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: Game of Life

2009-03-03 Thread Larry Sherrill

Hi Phil,

Thanks for the tips. Yes, alter and doseq do look better.

As far as the "running" variable, there is one thread painting the
squares and another thread responding to the mouse click on start/
stop. This was the only way I could think of that the user could stop
the paint thread, using a Java idiom. I'll read up on binding.

Thank again!
Larry

On Mar 3, 1:30 pm, Phil Hagelberg  wrote:
> lps540  writes:
> > I've written a small example of Conway's Game of Life using Clojure
> > and Swing. Comments/critiques are welcome.
>
> Interesting program!
>
>     (for [x (range 32) y (range 48)]
>                 (ref-set cells
>                   (assoc (deref cells) [x y] (= 0 (rand-int 5)
>
> While you can use ref-set this way, it's much more concise to use alter:
>
>     (for [x (range 32) y (range 48)]
>       (alter cells assoc [x y] (= 0 (rand-int 5
>
> You should use this in calc-state as well.
>
> Also, the paint-cells function is called only for side-effects. Instead
> of using dorun+map, you should use doseq:
>
>   (defn paint-cells [graphics]
>     (doseq [cell @cells]
>       (let [x (first (first cell))
>             y (second (first cell))
>             state (second cell)]
>         (doto graphics
>           (. setColor (if state Color/RED Color/WHITE))
>           (. fillRect (* 10 x) (* 10 y) 10 10)
>
> I'm not sure if making "running" a ref makes sense here. Do you need to
> coordinate change in it across threads, or will the change only happen
> in one thread? If it's the former, using a thread-local var with
> "binding" is probably a better choice.
>
> Also, instead of calling (deref cells), you can use @cells for short.
>
> -Phil
--~--~-~--~~~---~--~~
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
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: Game of Life

2009-03-03 Thread Larry Sherrill

Thanks everyone for the suggestions. Very helpful.

On Mar 3, 2:03 pm, "Stephen C. Gilardi"  wrote:
> On Mar 3, 2009, at 3:03 PM, lps540 wrote:
>
> > I've written a small example of Conway's Game of Life using Clojure
> > and Swing. Comments/critiques are welcome.
>
> Very nice example!
>
> Here's a more compact determine-new-state:
>
> (defn determine-new-state [x y]
>    (let [count (reduce + (for [dx [-1 0 1] dy [-1 0 1]]
>                            (if (cells [(+ x dx) (+ y dy)]) 1 0)))]
>      (or (and (cells [x y]) (> count 2) (< count 5))
>          (= count 3
>
> I'm guessing someone can make the reduce even tighter.
>
> I considered using :when (not (and (zero? dx) (zero? dy))) in the for  
> expression, but it seemed simpler to account for the extra count when  
> (cells [x y]) is true in the new state expression down below.
>
> --Steve
>
>  smime.p7s
> 3KViewDownload
--~--~-~--~~~---~--~~
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
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: Game of Life

2009-03-03 Thread Larry Sherrill

> Am I "over interpreting" the meaning of the copyright clause at the top of 
> the published code ?

Yes. I hesitated to put it there but went ahead out of habit. :> I'll
either remove it or stick some minimal open source license on it.
Thanks for pointing that out.

On Mar 3, 4:53 pm, Laurent PETIT  wrote:
> Hello Larry,
>
> is there a reason why the code of this port of Game of Life does not seem to
> be under an open source license (e.g. EPL, etc.) ?
>
> I was interested in playing with your code, but I'm a bit reluctant when I
> see an "all rights reserved" in the top of the file ...
> It seems to me like your code is open to suggestions from others, but not
> for sharing with others ?
>
> Am I "over interpreting" the meaning of the copyright clause at the top of
> the published code ?
>
> Regards,
>
> --
> Laurent
>
> 2009/3/4 Larry Sherrill 
>
>
>
>
>
> > Thanks everyone for the suggestions. Very helpful.
> > - Afficher le texte des messages précédents -
>
> > On Mar 3, 2:03 pm, "Stephen C. Gilardi"  wrote:
> > > On Mar 3, 2009, at 3:03 PM, lps540 wrote:
>
> > > > I've written a small example of Conway's Game of Life using Clojure
> > > > and Swing. Comments/critiques are welcome.
>
> > > Very nice example!
>
> > > Here's a more compact determine-new-state:
>
> > > (defn determine-new-state [x y]
> > >    (let [count (reduce + (for [dx [-1 0 1] dy [-1 0 1]]
> > >                            (if (cells [(+ x dx) (+ y dy)]) 1 0)))]
> > >      (or (and (cells [x y]) (> count 2) (< count 5))
> > >          (= count 3
>
> > > I'm guessing someone can make the reduce even tighter.
>
> > > I considered using :when (not (and (zero? dx) (zero? dy))) in the for
> > > expression, but it seemed simpler to account for the extra count when
> > > (cells [x y]) is true in the new state expression down below.
>
> > > --Steve
>
> > >  smime.p7s
> > > 3KViewDownload
> > - Afficher le texte des messages précédents -- 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
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: Game of Life

2009-03-04 Thread Larry Sherrill

I've incorporated everyone's suggestions and thought I would post the
resulting smaller code. I refactored init-cells away and just pass in
an init or new function to calc-state to reuse the for loop. I made
determine-next-state a little more verbose than technically necessary
to make conway's rules more obvious to me. The refs "cells" and
"running" don't feel very functional but I don't know how to get rid
of them.

(import '(javax.swing JFrame JPanel JButton)
'(java.awt BorderLayout Dimension Color)
'(java.awt.event ActionListener))

(def cells (ref {}))

(def running (ref false))

(defn determine-initial-state [x y]
  (= 0 (rand-int 5)))

(defn determine-new-state [x y]
  (let [neighbor-count
 (count (for [dx [-1 0 1] dy [-1 0 1]
  :when (and (not (= 0 dx dy))
 (cells [(+ x dx) (+ y dy)]))]
  :alive))]
(if (cells [x y])
(< 1 neighbor-count 4)
(= neighbor-count 3

(defn calc-state [cell-state]
  (dosync
(ref-set cells
  (reduce conj {}
(for [x (range 32) y (range 48)]
  [[x y] (cell-state x y)])

(defn paint-cells [graphics]
 (doseq [[[x, y] state] @cells]
   (doto graphics
 (. setColor (if state Color/RED Color/WHITE))
 (. fillRect (* 10 x) (* 10 y) 10 10

(defn toggle-thread [panel button]
(if @running

  (do (dosync (ref-set running false))
  (. button (setText "Start")))

  (do (dosync (ref-set running true))
  (. button (setText "Stop"))
  (. (Thread.
 #(loop []
(calc-state determine-new-state)
(. panel repaint)
(Thread/sleep 100)
(if @running (recur
 start

(defn main[]

(calc-state determine-initial-state)

(let [f (JFrame.)
  b (JButton. "Start")
  panel (proxy [JPanel] [] (paint [graphics] (paint-cells
graphics)))]

(doto f
(. setLayout (BorderLayout.))
(. setLocation 100 100)
(. setPreferredSize (Dimension. 320 540))
(. add b BorderLayout/SOUTH)
(. add panel BorderLayout/CENTER)
(. setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
(. pack)
(. setVisible true))

(. b addActionListener
   (proxy [ActionListener] []
(actionPerformed [evt] (toggle-thread panel b))

(main)


Thanks for everyone. Very good learning experience.
Larry
http://lpsherrill.blogspot.com


--~--~-~--~~~---~--~~
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
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: Parallel Game of Life

2009-03-16 Thread Larry Sherrill

It would be interesting to throw gridgain (http://www.gridgain.com/)
into the mix and let people register their machines as part of a CA
grid. Not sure the remote overhead would pay for itself but it would
be interesting.

On Mar 16, 3:03 am, bOR_  wrote:
> Nice! A few more days of work and I've time to play with these kind of
> things again. Here are some comments, based on your description.
>
> As game of life is a cellular automata, you do not need any blocking
> at all, so you could use agents, rather than refs. It does become an
> asynchronous CA then, but that fits for game of life :).
>
> Every cell would be an agent. Agents read the state of their
> neighbouring cells and update their own state. If world is a vector of
> agents, then (doseq [a world] (send a update)) (apply await world)
> would update the whole grid once, using all the processors that java
> can find.
>
> On Mar 16, 5:31 am, Scott Fraser  wrote:
>
> > I have taken Larry's "Game of Life" example that he originally posted
> > here:
>
> >http://groups.google.com/group/clojure/msg/fdfc88f1ba95bdee
>
> > ...and updated it to use all the CPU's your JVM has access to. My
> > first attempts ran into the classic map -> pmap slowdown. My next
> > attempt had too much dosync, in that there were many threads but they
> > were all waiting for each other.
>
> > I finally rewrote the calc-state routine to batch the units of work
> > into meaty sizes, and to minimize the dosync granularity. It gets the
> > batches of new-state together, then goes and applies these in batches.
> > In both events I use pmap.
>
> > Now it is running really fast on my 4-core Intel i7. You will really
> > notice a difference at larger grid sizes. On my i7 it keeps the 8 (due
> > to hyperthreading) "cpus" busy at about 60% when I run a huge grid.
>
> > I also updated paint-cells with a type hint that greatly reduces
> > reflection in that performance critical code.
>
> > I am very new to clojure and would appreciate feedback. I am concerned
> > I may have overcomplicated things with my usage of the map/pmap form.
> > I am guessing there may be a simpler way to write what I did.
>
> > Note at the start it will automatically select how many "available-
> > procs" you have. Try tweaking this on your hardware to see how it
> > impacts performance. Watching the threads with a profiler is
> > interesting.
>
> > Here is is:
>
> > (def cells (ref {}))
> > (def running (ref false))
> > ;(def x-cells ( * 32 4))
> > ;(def y-cells ( * 48 4))
> > (def x-cells 32)
> > (def y-cells 32)
> > (def range-cells (for [x (range x-cells) y (range y-cells)] [x y]))
> > (def length-range-cells (count range-cells))
> > (def cell-size 10)
> > (def life-delay 0)
> > (def life-initial-prob 3)
> > (def available-procs (.. java.lang.Runtime getRuntime
> > availableProcessors))
>
> > (defn determine-initial-state [x y]
> >   (= 0 (rand-int life-initial-prob)))
>
> > (defn determine-new-state [x y]
> >   (let [alive (count (for [dx [-1 0 1] dy [-1 0 1]
> >                            :when (and (not (= 0 dx dy))
> >                                    (cells [ (mod (+ x dx) x-cells)
> > (mod (+ y dy) y-cells)]))]
> >                        :alive))]
> >     (if (cells [x y])
> >       (< 1 alive 4)
> >       (= alive 3
>
> > (defn update-batch-of-new-cells [new-cells list-of-batches]
> >   (dosync
> >     (dorun (map #(commute new-cells assoc (first %) (second %))
> >              list-of-batches))
> >     ))
>
> > (defn calc-batch-of-new-cell-states [cell-state batch-cells]
> >   (doall (map
> >            #(let [new-cell-state (cell-state (first %) (second %))]
> >               [[(first %) (second %)] new-cell-state])
> >            batch-cells)))
>
> > (defn calc-state [cell-state]
> >   (let [new-cells (ref {})]
> >     (dorun (pmap #(update-batch-of-new-cells new-cells %)
> >              (pmap #(calc-batch-of-new-cell-states cell-state %)
> >                (for [cpu (range available-procs)] (take-nth available-
> > procs (drop cpu range-cells))
> >     (dosync (ref-set cells @new-cells
>
> > (defn paint-cells [#^java.awt.Graphics graphics]
> >   (doseq [[[x,y] state] @cells]
> >     (doto graphics
> >       (. setColor (if state Color/RED Color/WHITE))
> >       (. fillRect (* cell-size x) (* cell-size y) cell-size cell-
> > size
>
> > (defn toggle-thread [#^JPanel panel button]
> >   (if @running
> >     (do (dosync (ref-set running false))
> >       (. button (setText "Start")))
> >     (do (dosync (ref-set running true))
> >       (. button (setText "Stop"))
> >       (. (Thread.
> >            #(loop []
> >               (calc-state determine-new-state)
> >               (. panel repaint)
> >               (if life-delay (Thread/sleep life-delay))
> >               (if @running (recur
> >         start
>
> > (defn -main[]
>
> >   (calc-state determine-initial-state)
>
> >   (let [f (JFrame.)
> >         b (JButton. "Start")
> >         panel (proxy [JPanel] [] (paint 

Re: Game of Life

2009-03-16 Thread Larry Sherrill

Very cool. Thanks for the tip. I didn't know a type hint would make
that much difference.

Another possible speedup would be to use send/actor to take advantage
of multiprocessor machines. Would be curious if the overhead would pay
for itself in this situation.

Thanks, Larry

On Mar 14, 8:03 pm, Scott Fraser  wrote:
> Hi Larry
>
> I have a performance tweak, that gives about an order of magnitude
> speedup to paint-cells when running this with a large grid and no or
> little (Thread/sleep life-delay) in toggle-thread. That is how I am
> running it now - 128 x 192 cells with no delay! It is also noticeably
> faster on the more typical size grid.
>
> Type hint is on the graphics param:
>
> (defn paint-cells [#^java.awt.Graphics graphics]
>     (time (doseq [[[x,y] state] @cells]
>          (doto graphics
>             (. setColor (if state Color/RED Color/WHITE))
>             (. fillRect (* cell-size x) (* cell-size y) cell-size cell-
> size)
>
> Example, with type hint:
>
> "Elapsed time: 45.871193 msecs"
> "Elapsed time: 39.209662 msecs"
> "Elapsed time: 43.899504 msecs"
>
> Without:
>
> "Elapsed time: 529.635331 msecs"
> "Elapsed time: 438.145769 msecs"
> "Elapsed time: 442.839872 msecs"
>
> I would imagine there may be some other way to get clojure to cache
> the reflected handle to Graphics, but I am still a little new to this
> so don't have any other ideas on how to eliminate the high amount of
> reflection without a type hint.
>
> -Scotthttp://fraser.blogs.com/
>
> On Mar 4, 4:17 pm, Larry Sherrill  wrote:
>
> > I've incorporated everyone's suggestions and thought I would post the
> > resulting smaller code. I refactored init-cells away and just pass in
> > an init or new function to calc-state to reuse the for loop. I made
> > determine-next-state a little more verbose than technically necessary
> > to makeconway'srules more obvious to me. The refs "cells" and
> > "running" don't feel very functional but I don't know how to get rid
> > of them.
>
> > (import '(javax.swing JFrame JPanel JButton)
> >         '(java.awt BorderLayout Dimension Color)
> >         '(java.awt.event ActionListener))
>
> > (def cells (ref {}))
>
> > (def running (ref false))
>
> > (defn determine-initial-state [x y]
> >   (= 0 (rand-int 5)))
>
> > (defn determine-new-state [x y]
> >   (let [neighbor-count
> >          (count (for [dx [-1 0 1] dy [-1 0 1]
> >                   :when (and (not (= 0 dx dy))
> >                              (cells [(+ x dx) (+ y dy)]))]
> >                   :alive))]
> >     (if (cells [x y])
> >         (< 1 neighbor-count 4)
> >         (= neighbor-count 3
>
> > (defn calc-state [cell-state]
> >   (dosync
> >     (ref-set cells
> >       (reduce conj {}
> >         (for [x (range 32) y (range 48)]
> >           [[x y] (cell-state x y)])
>
> > (defn paint-cells [graphics]
> >      (doseq [[[x, y] state] @cells]
> >        (doto graphics
> >          (. setColor (if state Color/RED Color/WHITE))
> >          (. fillRect (* 10 x) (* 10 y) 10 10
>
> > (defn toggle-thread [panel button]
> >     (if @running
>
> >       (do (dosync (ref-set running false))
> >           (. button (setText "Start")))
>
> >       (do (dosync (ref-set running true))
> >           (. button (setText "Stop"))
> >           (. (Thread.
> >                  #(loop []
> >                     (calc-state determine-new-state)
> >                     (. panel repaint)
> >                     (Thread/sleep 100)
> >                     (if @running (recur
> >                  start
>
> > (defn main[]
>
> >     (calc-state determine-initial-state)
>
> >     (let [f (JFrame.)
> >           b (JButton. "Start")
> >           panel (proxy [JPanel] [] (paint [graphics] (paint-cells
> > graphics)))]
>
> >         (doto f
> >             (. setLayout (BorderLayout.))
> >             (. setLocation 100 100)
> >             (. setPreferredSize (Dimension. 320 540))
> >             (. add b BorderLayout/SOUTH)
> >             (. add panel BorderLayout/CENTER)
> >             (. setDefaultCloseOperation JFrame/EXIT_ON_CLOSE)
> >             (. pack)
> >             (. setVisible true))
>
> >         (. b addActionListener
> >            (proxy [ActionListener] []
> >                 (actionPerformed [evt] (toggle-thread panel b))
>
> > (main)
>
> > Thanks for everyone. Very good learning experience.
> > Larryhttp://lpsherrill.blogspot.com
--~--~-~--~~~---~--~~
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
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: Parallel Game of Life

2009-03-16 Thread Larry Sherrill

Hi Kyle,

I added life-conway.clj to the files section last week. It has rand,
clear, and bounded buttons, and the ability to use your mouse to draw
the pattern rather than rely on rand. It's a good way to experiment
with different automata such as gliders.

Larry Sherrill

On Mar 16, 9:33 am, "Kyle R. Burton"  wrote:
> On Mon, Mar 16, 2009 at 12:31 AM, Scott Fraser  
> wrote:
>
> > I have taken Larry's "Game of Life" example that he originally posted
> > here:
>
> >http://groups.google.com/group/clojure/msg/fdfc88f1ba95bdee
>
> > ...and updated it to use all the CPU's your JVM has access to...
>
> Scott,
>
> Your changes indeed make it run significantly faster for me.  Thanks!
>
> I added a 'reset' button and changed some of the java method calls to
> be a bit more (I think) idomatic clojure.
>
> The full file is 
> here:http://asymmetrical-view.com/personal/code/clojure/life.clj
>
> And a patch is attached (you also left off the import statements in you 
> email).
>
> FYI: Scott Fraser is giving a talk on clojure at the Philly Emerging
> Technologies for the Enterprise conference next week:
>
>  http://phillyemergingtech.com/abstractsTab.php?sessID=39
>  http://phillyemergingtech.com/speakers.php
>
> Regards,
>
> Kyle Burton
>
> --
> --- 
> ---
> kyle.bur...@gmail.com                            http://asymmetrical-view.com/
> --- 
> ---
>
>  life.patch
> 3KViewDownload
--~--~-~--~~~---~--~~
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
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
-~--~~~~--~~--~--~---



Enclojure plugin Netbeans

2010-02-24 Thread Larry Wykel
Anyone!!!

.

Anyway if your using Enclojure etc in Netbeans let me describe exactly what 
happens when I attempt to install plugin

Latest MacOS Snow Leopard
NetBeans 6.8 with just Ruby
Enclojure plugin from Git

File came down with a .zip extention



1. I renamed the file to same name with .nbm extension

2. Went into Netbeans plugin manager.downloads and added the file. I 
found it
and it showed up fine  and I could click the "install" button.

3. the process then runs and it loads when its done ti gave me no 
choice to restart it just restarted Netbeans.

4. Netbeans closed and restarted but when it came back up the Menu was 
gone except for Netbeans prefs and
the Netbeans Icon was in the Dock.

5. When you attempt to open clicking on the Icon does nothing. You 
cannot even git rid of it.
I actually go into the Activity monitor and kill the Netbeans 
process, then remove Netbeans and reinstall.

6. When I do Netbeans comes up fine and shows the Enclojure plugin 
installed. But you cannot activate it.

Just wanted to let you know if quickly looking at these iissues you 
know what the problem is or can suggest something

I am sure the plugin will do what I am after fro now once I get it activated.

Lar

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


Posting

2010-02-24 Thread Larry Wykel
I just joined, got confirm, the clicked link. Posted msg to group. got email 
back confirming but is not showing up
in messages

Lar

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


D&D + Clojure?

2018-03-27 Thread Larry Christensen
I have a Dungeons & Dragons app built in Clojure and ClojureScript. With The 
Original OrcPub <http://www.orcpub.com> and The New OrcPub 
<https://www.orcpub2.com> I have about 300K monthly users and have been 
used by millions of people over the past few years. I'm looking for people 
who might want to contribute to building some cool features for a fun app!

-Larry Christensen a.k.a RedOrc
Supreme Leader
OrcPub

-- 
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: D&D + Clojure?

2018-03-27 Thread Larry Christensen
That would be super cool, I knew I couldn't be the only D&D Clojurist out 
there. I'll look into the details and get back to you. I'll may just open 
source it on Github, which should make it easy.

On Tuesday, March 27, 2018 at 2:42:34 PM UTC-6, tbc++ wrote:
>
> Nice! I think I used this app the other day when working on a campaign and 
> didn't know it was using Clojure. I'd be open to contribute in my spare 
> time. What's the process for getting involved?
>
> Timothy Baldridge
>
> On Tue, Mar 27, 2018 at 2:03 PM, Larry Christensen  > wrote:
>
>> I have a Dungeons & Dragons app built in Clojure and ClojureScript. With The 
>> Original OrcPub <http://www.orcpub.com> and The New OrcPub 
>> <https://www.orcpub2.com> I have about 300K monthly users and have been 
>> used by millions of people over the past few years. I'm looking for people 
>> who might want to contribute to building some cool features for a fun app!
>>
>> -Larry Christensen a.k.a RedOrc
>> Supreme Leader
>> OrcPub
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> “One of the main causes of the fall of the Roman Empire was that–lacking 
> zero–they had no way to indicate successful termination of their C 
> programs.”
> (Robert Firth) 
>

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


lazy maps in Clojure?

2013-01-20 Thread Larry Travis
One of the neat things about Clojure (maybe all functional languages) is 
that functions can be defined either extensionally or intensionally. How 
can one create a Clojure structure that mixes these two types of 
definition?


That is, I would like to define a function f that saves its result the 
first time it is called against any particular argument so that if and 
when f is later called against the same argument, it does a look-up via 
a hash map rather than repeating a possibly expensive computation. I 
think I see how to do this with a ref to a mutable map (where, given an 
argument k, f would first try to find (f k) in the map but, if k is not 
currently a key of the map, the function would compute the value v = (f 
k) and then, in addition to returning v, add the entry  to the map 
as a side effect. But this seems ugly. Is there some way to do what I 
want here without making explicit use of refs?


Lazy-seqs don't give me what I want because the arguments to be given to 
f don't occur in any kind of predictable sequence.


  --Larry

--
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: lazy maps in Clojure?

2013-01-21 Thread Larry Travis
Thanks, all. Memoize appears to be exactly what I was looking for. Is 
there no end to discovering eminently useful capabilities hidden away 
some place in Clojure's API?


For the moment I don't see what Meikel Brandmeyer's lazymap gives me 
that memoize doesn't, but I will look into it.

  --Larry

On 1/21/13 1:55 AM, Jozef Wagner wrote:

Or maybe https://bitbucket.org/kotarak/lazymap ?

On Monday, January 21, 2013 7:38:01 AM UTC+1, Alex Baranosky wrote:

memoize, or delay maybe

On Sun, Jan 20, 2013 at 10:29 PM, AtKaaZ > wrote:

memoize?


On Mon, Jan 21, 2013 at 7:27 AM, Larry Travis
> wrote:

One of the neat things about Clojure (maybe all functional
languages) is that functions can be defined either
extensionally or intensionally. How can one create a
Clojure structure that mixes these two types of definition?

That is, I would like to define a function f that saves
its result the first time it is called against any
particular argument so that if and when f is later called
against the same argument, it does a look-up via a hash
map rather than repeating a possibly expensive
computation. I think I see how to do this with a ref to a
mutable map (where, given an argument k, f would first try
to find (f k) in the map but, if k is not currently a key
of the map, the function would compute the value v = (f k)
and then, in addition to returning v, add the entry 
to the map as a side effect. But this seems ugly. Is there
some way to do what I want here without making explicit
use of refs?

Lazy-seqs don't give me what I want because the arguments
to be given to f don't occur in any kind of predictable
    sequence.

  --Larry



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

functions as return values

2013-02-23 Thread Larry Travis
In Clojure, if I have a function call that asks for return of a 
function, for example


user> ((fn [a] (fn [b] (+ (inc a) (* b b 5)

I get the function name

#

But what I would like to get is an expression that defines this 
function, for example


(fn [b] (+ 6 (* b b)))

Is there some way that I can suppress the evaluation of this expression?

  --Larry




--
--
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: functions as return values

2013-02-23 Thread Larry Travis

I am afraid I didn't ask my question clearly.


Michael's "solution" would give as output

(fn [b] (+ (inc a) (* b b)))



What I want as output is

(fn [b] (+ 6 (* b b)))


... where those expressions within the inner-lambda scope (of the 
original nested-lambda expression) that can be evaluated by the binding 
of the outer-lambda parameter -- that is, the expressions "a" and "(inc 
a)" -- have been fixed with their values, but what is then output is the 
resulting Clojure function definition determined by the unevaluatable 
remainder of the inner-lambda scope.


It occurs to me that whether what I am asking for is possible at all 
depends on how closures are realized within Clojure, but I think that 
there would be a way of realizing them in terms of source code rather 
than compiled code -- and that this source code wouldn't be compiled 
until values for their open variables become available.

  --Larry




On 2/23/13 5:50 PM, Michael Klishin wrote:


2013/2/24 Larry Travis mailto:tra...@cs.wisc.edu>>

Is there some way that I can suppress the evaluation of this
expression?


((fn [a]
  '(fn [b] (+ (inc a) (* b b 5)
--
MK



On 2/23/13 4:50 PM, Larry Travis wrote:
In Clojure, if I have a function call that asks for return of a 
function, for example


user> ((fn [a] (fn [b] (+ (inc a) (* b b 5)

I get the function name

#user$eval4164$fn__4165$fn__4166@29770daa>


But what I would like to get is an expression that defines this 
function, for example


(fn [b] (+ 6 (* b b)))

Is there some way that I can suppress the evaluation of this expression?

  --Larry 


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




Need help getting Snow Leopard, Aquamacs, Clojure, and Slime to work

2010-06-20 Thread Larry Travis
To save my life, I can't get Snow Leopard, Aquamacs, Clojure, and Slime 
to work.  I have installed Aquamacs 2.0, then ELPA, then the packages 
/clojure-mode/, /slime/, and /slime-repl/. (I have also tried to install 
the packages /clojure-test-mode/ and /swank-clojure/, but in each case 
am told "File exists:  /clojure-mode-1.7.1/clojure-mode.el" -- 
apparently indicating that these packages don't install anything not 
already present from the installation of the package /clojure-mode/.)


So far so good. But then when I open a new file, say /foo.clj/ (and 
indeed am presented with a buffer in clojure mode), and do /M-x slime/, 
I get the error message "Symbol's function definition is void: 
define-slime-contrib".  As I understand things, what I should get the 
first time I do /M-x slime/ is something like "Clojure is not 
installed.  Do you want to install it? Yes or No" -- but I don't.


I would surely appreciate it if somebody can tell me what I have failed 
to do or what I am doing wrong.


For what it's worth, when I go through the same series of steps but with 
Carbon Emacs rather than Aquamacs, when I do /M-x slime/, I also get an 
error message but a different one, viz. "Searching for program: No such 
file or directory, lisp".


I hope somebody has an answer for me w.r.t.  Aquamacs, but I will be 
happy if I can get either version of Emacs to work with clojure and slime.


Thanks.

  --Larry Travis

--
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: Need help getting Snow Leopard, Aquamacs, Clojure, and Slime to work

2010-06-22 Thread Larry Travis

On 6/21/10 8:07 AM, Joost wrote (shown here as corrected in a 2nd msg):

For core swank-clojure (without the elisp parts), you start a swank
server somewhere (using leiningen or some other script) and connect to
that using slime-connect. This means you need to install swank-
clojure in your clojure project, and can use general  Slime and
clojure-mode in Emacs.
   
Thanks. I'm not sure what you mean by "leiningen" or by a "clojure 
project" (which almost certainly reveals my inexperience with respect to 
clojure installation and/or programming!) but I think I can figure it 
out with some exploration.


  --Larry Travis

--
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: Need help getting Snow Leopard, Aquamacs, Clojure, and Slime to work

2010-06-22 Thread Larry Travis

On 6/21/10 5:31 AM, patrik karlin wrote:

Hello theres a wherry "spartan" screencast on vimeo that install all this with
regular emacshttp://vimeo.com/11844368
   
Thanks.  I'm going to try Joost's advice first and, if that doesn't 
work, I'll study your screencasts -- adapting them to Aquamacs if I can.


  --Larry Travis

--
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: Need help getting Snow Leopard, Aquamacs, Clojure, and Slime to work

2010-06-23 Thread Larry Travis
Thanks again.  I have to be away from home and my iMac for the next ten 
days so it will be some time before I can work through your suggestions, 
but I will certainly give them a try. I'll let you know what kind of 
success I have.  I very much appreciate your help.

 --Larry Travis

Joost wrote:

On Jun 22, 7:36 am, Larry Travis  wrote:
  

Thanks. I'm not sure what you mean by "leiningen" or by a "clojure
project" (which almost certainly reveals my inexperience with respect to
clojure installation and/or programming!) but I think I can figure it
out with some exploration.



Leinging is a build/dependencies tool for clojure that should make it
fairly easy to include swank-clojure in your project (I mean, clojure
program).

But really, all you need is swank.swank and the rest of the .clj code
from swank-clojure in your class path, and some code like this:

(ns your-namespace
  (:require [swank.swank]))

(defn run-swank []
  (swank.swank/start-repl 4005 :host "localhost"))

Calling (your-namespace/run-swank) will start a server that you can
connect to with M-x slime-connect from Emacs.

HTH,
Joost.

  


--
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: A newbie's summary - what worked, what didn't

2011-03-28 Thread Larry Travis

Kasim:
I just discovered ClojureW, and it looks promising. I will report my 
reaction after I get time to thoroughly test it for the kinds of things 
I am doing.


In the meantime, a request:

When you work 'on a "Just Works" emacs setup' for Mac Os X consider 
whether you can create such a setup for the Aquamacs version of emacs 
that many of us Mac Os X users prefer (because it gives us the power and 
versatility of emacs without having to learn dozens of non-obvious key 
chords).


Thanks.

  --Larry





On 3/28/11 12:46 AM, Kasim wrote:

Hi,

I am the guy who did ClojureW. I just updated the instruction to get a 
REPL with Jline. Thank you for reporting. I am also working on a "Just 
Works" emacs setup for all platforms and would be happy to hear your 
opinion. I really want to make it as simple as ClojureW.


Have fun,

Kasim

<http://groups.google.com/group/clojure?hl=en> 


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

can't set up Clojure 1.2.1

2011-07-14 Thread Larry Travis
I need to upgrade from the older version of Clojure I have been using so 
I downloaded Version 1.2.1 and followed these instructions from 
http://clojure.org/getting_started:


In the directory in which you expanded clojure.zip, run:

java -cp clojure.jar clojure.main

This will bring up a simple read-eval-print loop (REPL).

==
But this is what I get:

bash-3.2$ java -cp clojure.jar clojure.main
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main
Caused by: java.lang.ClassNotFoundException: clojure.main
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)



I don't know how to find my way around in the Java world. What should I 
do differently?


Thanks for your help.

  --Larry

--
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: can't set up Clojure 1.2.1

2011-07-14 Thread Larry Travis

Jonathan:
Thanks.  When the instructions said "the directory in which you expanded 
clojure.zip" I took that to mean the directory I was in when I expanded 
clojure.zip, not the directory that was created to hold the zip-file 
contents.

  --Larry

On 7/14/11 10:05 PM, Jonathan Cardoso wrote:

Weird =S.

That only happens when you're not on the folder containing the 
clojure.jar or when you try to call clojure from a different folder 
without setting the classpath.

--
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 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: can't set up Clojure 1.2.1

2011-07-15 Thread Larry Travis
Thanks, Sergey.  The problem was indeed a classpath problem. The part of 
my ignorance about Java that seems to cause me the most trouble is my 
ignorance about Java classpaths. I think some Clojurians underestimate 
the difficulties involved in learning Clojure without knowing Java 
first.  I wish that the Clojure books available, most of which are quite 
excellent otherwise, did not assume a previous knowledge of Java on the 
reader's part but included an early section covering what it is 
essential to know about Java and the JVM before one can fully understand 
Clojure and become proficient in it.


Of course, the best response to such a criticism is "Don't just 
criticize. Write such a book." It will be a while before I know enough 
to do so!

  --Larry

On 7/15/11 9:16 AM, Sergey Didenko wrote:
Larry, it seems that the current folder "." is not in your default 
classpath. Either try "...-cp ./clojure.jar ..." or add "." into your 
default CLASSPATH.



--
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 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: can't set up Clojure 1.2.1

2011-07-16 Thread Larry Travis

Phil:
You ask whether, if I had found it, the following web page would have 
helped:


http://dev.clojure.org/display/doc/Getting+Started+with+Emacs

The answer: Definitely yes.

The page advises me to use for bringing up a Clojure REPL

java -cp path/to/clojure.jar clojure.main

whereas the page

http://clojure.org/getting_started

advises

java -cp clojure.jar clojure.main

I followed the latter advice blindly because I didn't know what "-cp" 
was doing.


What I have now done is follow the Confluence advice for setting the 
value of the Aquamacs variable 'inferior-lisp-program, and so far things 
are working well. Some time soon I want to set up a Slime plus Swank 
Clojure plus Leiningen environment instead, but right now I prefer to 
spend the time I have for such things digging deeper into Clojure proper.


By the way, I don't want to come across as unhappy with Clojure and 
Clojurians.  Starting with the creation of the language itself, I very 
much appreciate what you guys have done and are doing, and I predict 
that that creation and the subsequent evolution of the language will 
ultimately go down as a major development in the history of computer 
science -- at least, for the very important areas of programming 
multi-processor systems and of experimental programming (so important, 
for example, for artificial intelligence research).

  --Larry


On 7/16/11 10:10 AM, Phil Hagelberg wrote:

On Fri, Jul 15, 2011 at 11:29 PM, Larry Travis  wrote:

Thanks, Sergey.  The problem was indeed a classpath problem. The part of my
ignorance about Java that seems to cause me the most trouble is my ignorance
about Java classpaths. I think some Clojurians underestimate the
difficulties involved in learning Clojure without knowing Java first.

I updated the Confluence getting started page to address this last week:

 Clojure is unlike most language in that you don't generally install Clojure
 itself; it's just a library that's loaded into the JVM. You don't
interact with
 it directly, you use a build tool and editor/IDE integration instead.

 * IDEs and Editors
   [...]
* Build Tools
   [...]

http://dev.clojure.org/display/doc/Getting+Started

Would this have helped if you had found it? Using the jar file
directly is really not very common or convenient which is why it's not
well-documented, but people coming from other languages naturally
assume that the first step is to "install Clojure".

It's unfortunate that the Getting Started page on clojure.org is in
such an embarrassing state of disarray, but according to Clojure Core
they can't spare any resources to fix it at the present time. The
community-editable pages are generally much more helpful, but they
aren't as prominent or easy to find.

-Phil



--
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: What's the efficient functional way to computing the average of a sequence of numbers?

2012-03-30 Thread Larry Travis
I too think this is interesting because because it serves to illustrate 
some important general aspects of Clojure with a very simple problem.


I wrote four Clojure programs contrasting different ways of solving the 
problem, and then timed the application of each ten times to a 
million-item sequence /mill-float-numbs/ of floating-point random 
numbers.  Here are the interesting results:


(defn average1
  [seq1]
  (/ (reduce + seq1) (count seq1)))

(defn average2
  [seq1]
  (loop [remaining (rest seq1)
cnt 1
accum (first seq1)]
(if (empty? remaining)
  (/ accum cnt)
  (recur (rest remaining)
(inc cnt)
(+ (first remaining) accum)

(defn average3
  [seq1]
  (letfn [(count-add
 [ [cnt accum] numb]
 [(inc cnt) (+ accum numb)] ) ]
(let [result-couple (reduce count-add [0 0] seq1)]
  (/ (result-couple 1) (result-couple 0)

(defn average4
  [seq1]
(let [result-couple (reduce
  (fn [ [cnt accum] numb]
[(inc cnt) (+ accum numb)] )
  [0 0]
  seq1)]
  (/ (result-couple 1) (result-couple 0

user=> (time (dotimes [i 10] (average1 /mill-float-numbs/)))
"Elapsed time: 526.674 msecs"

user=> (time (dotimes [i 10] (average2 /mill-float-numbs/)))
"Elapsed time: 646.608 msecs"

user=> (time (dotimes [i 10] (average3 /mill-float-numbs/)))
"Elapsed time: 405.484 msecs"

user=> (time (dotimes [i 10] (average4 /mill-float-numbs/)))
"Elapsed time: 394.31 msecs"

  --Larry

On 3/30/12 1:31 AM, Benjamin Peter wrote:

I think this topic is interesting. My guess would be, that the
sequence would have been traversed completely by the reduce call and
therefore clojure could know it's size and provide a constant time
count.

Could this be implemented? Is it?


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

Leiningen-noobie question

2012-04-28 Thread Larry Travis
I have installed Leiningen not so much to manage projects but to enable 
use of /clojure-jack-in/ as a means of getting Swank and Slime to work.  
And they do work for me.  But now I have a question that I can't find an 
answer for in any  Leiningen documentation I know about. I have a 
largish, previously created group of /clj/ local files that exist on my 
system and whose function definitions I want to use in my further work.  
Is there a way to specify such local files in a project :dependencies 
declaration -- or do I have to do a /load-file/ on each of them once I 
get a Slime REPL running for the project (or maybe insert them all into 
the /src/core.clj/ file of the project and do a single /load-file/ on it)?


That question is surely complicated enough to indicate how badly 
confused I am! Thanks for help.

  --Larry


--
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: Leiningen-noobie question

2012-04-28 Thread Larry Travis

Sean,
Your advice makes good sense, but I can't make it work. Per that advice, 
I paste some of my function definitions into the core.clj file of the 
project "prjctOne" and proceed thusly:


larrytravis$ lein install
Copying 1 file to /Users/larrytravis/prjctOne/lib
No namespaces to :aot compile listed in project.clj.
Created /Users/larrytravis/prjctOne/prjctOne-1.0.0-SNAPSHOT.jar
Wrote pom.xml
[INFO] Installing 
/Users/larrytravis/prjctOne/prjctOne-1.0.0-SNAPSHOT.jar to 
/Users/larrytravis/.m2/repository/prjctOne/prjctOne/1.0.0-SNAPSHOT/prjctOne-1.0.0-SNAPSHOT.jar


But when I create a new project prjctTwo, I can't figure out what 
dependency declaration for it gives a prjctTwo Slime REPL access to the 
functions in prjctOne.  That is, what would correspond to the [utilities 
"0.0.1-SNAPSHOT"] vector in your example?

  --Larry

On 4/28/12 4:46 AM, Sean Corfield wrote:

On Sat, Apr 28, 2012 at 12:21 AM, Larry Travis  wrote:

I have installed Leiningen not so much to manage projects but to enable use
of clojure-jack-in as a means of getting Swank and Slime to work.  And they
do work for me.  But now I have a question that I can't find an answer for
in any  Leiningen documentation I know about. I have a largish, previously
created group of clj local files that exist on my system and whose function
definitions I want to use in my further work.  Is there a way to specify
such local files in a project :dependencies declaration -- or do I have to
do a load-file on each of them once I get a Slime REPL running for the
project (or maybe insert them all into the src/core.clj file of the project
and do a single load-file on it)?

Once possibility is to put all those files into a project together,
let's called it utilities and assume it has a 0.0.1-SNAPSHOT version.

Then you can run 'lein install' and it'll package them up and put them
in your local repository.

Then, wherever you want to use them in another project, just declare a
dependency on [utilities "0.0.1-SNAPSHOT"] and Leiningen will
automatically pull them in (from your local repo).

Then you just use/require the namespace(s) containing the relevant functions.

Does that help?


--
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: Leiningen-noobie question

2012-04-28 Thread Larry Travis

Sean:
Your suggestion doesn't work.  The Slime REPL comes up fine when I use 
the dependency vector you suggest (some of the vectors I have tried 
prevent the Swank server from starting), but the REPL doesn't know 
anything about the functions defined in prjctOne or about the name-space 
in which they exist.


So I guess for the nonce I'll just use load-file commands in the Slime 
REPL to make use of my local stash of clj files, and I'll worry some 
time later about getting Leiningen to construct dependencies on those 
files.  I'd rather spend my time on getting my programs to work than on 
getting my programming environment to work.


If you get any more ideas about how I might try to solve my problem, let 
me know.  Thanks.

  --Larry

On 4/28/12 5:07 PM, Sean Corfield wrote:

On Sat, Apr 28, 2012 at 2:41 PM, Larry Travis  wrote:

  That is, what would correspond to the [utilities
"0.0.1-SNAPSHOT"] vector in your example?

Try [prjctOne "1.0.0-SNAPSHOT"]


--
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: Leiningen-noobie question

2012-04-28 Thread Larry Travis

Neale:
Indeed, that's exactly the dependency vector I needed.  I'm impressed by 
your expertise. Thanks very much to both you and Sean.

  --Larry


On 4/28/12 7:01 PM, Neale Swinnerton wrote:

leiningen relies on maven dependency resolution...

the dependency entry is of the form

[groupId/artifactId "version"]

You have the groupId and the artifactId both set to prjctOne. You can 
tell this from the path it's installed into your local repo. I believe 
this is default behaviour if you specify a simple project name in 
project.clj (i.e one without a /)


This is the key entry in your logging:

[INFO] Installing 
/Users/larrytravis/prjctOne/prjctOne-1.0.0-SNAPSHOT.jar to 
/Users/larrytravis/.m2/repository/prjctOne/prjctOne/1.0.0-SNAPSHOT/prjctOne-1.0.0-SNAPSHOT.jar


So you need...

[prjctOne/prjctOne "1.0.0-SNAPSHOT"]

Neale
{t: @sw1nn <https://twitter.com/#%21/sw1nn>, w: sw1nn.com 
<http://sw1nn.com/> }




On Sun, Apr 29, 2012 at 12:42 AM, Larry Travis <mailto:tra...@cs.wisc.edu>> wrote:


Sean:
Your suggestion doesn't work.  The Slime REPL comes up fine when I
use the dependency vector you suggest (some of the vectors I have
tried prevent the Swank server from starting), but the REPL
doesn't know anything about the functions defined in prjctOne or
about the name-space in which they exist.

So I guess for the nonce I'll just use load-file commands in the
Slime REPL to make use of my local stash of clj files, and I'll
worry some time later about getting Leiningen to construct
dependencies on those files.  I'd rather spend my time on getting
my programs to work than on getting my programming environment to
work.

If you get any more ideas about how I might try to solve my
problem, let me know.  Thanks.
 --Larry


On 4/28/12 5:07 PM, Sean Corfield wrote:

On Sat, Apr 28, 2012 at 2:41 PM, Larry
Travismailto:tra...@cs.wisc.edu>>  wrote:

 That is, what would correspond to the [utilities

"0.0.1-SNAPSHOT"] vector in your example?

Try [prjctOne "1.0.0-SNAPSHOT"]


-- 
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
<mailto: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
<mailto:clojure%2bunsubscr...@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 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: Leiningen-noobie question

2012-04-30 Thread Larry Travis

Phil, Neale, Sean:
You guys are all way ahead of me as to why I am getting the results I am 
getting, but it is only Neale's advice that works.  That is


[prjctOne/prjctOne "1.0.0-SNAPSHOT"]   works, but


[prjctOne "1.0.0-SNAPSHOT"]  does not.

  --Larry


On 4/30/12 11:14 AM, Phil Hagelberg wrote:

Neale Swinnerton  writes:


So you need...

[prjctOne/prjctOne "1.0.0-SNAPSHOT"]

Actually this is incorrect; you never need to specify the group ID if
it's the same as the artifact ID.

-Phil



--
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: Leiningen-noobie question

2012-05-02 Thread Larry Travis

Phil:
I now can't get the behavior to reproduce either.  I have no idea what 
kind of dumb mistake I was making in the first place, and I'm very sorry 
to have wasted your time. (For what it's worth, both dependency-vector 
versions work in my reproduction attempts -- but you probably already 
knew that they would!)

  --Larry




On 5/1/12 11:22 AM, Phil Hagelberg wrote:

On Mon, Apr 30, 2012 at 9:28 PM, Larry Travis  wrote:

Phil, Neale, Sean:
You guys are all way ahead of me as to why I am getting the results I am
getting, but it is only Neale's advice that works.  That is

[prjctOne/prjctOne "1.0.0-SNAPSHOT"]   works, but


[prjctOne "1.0.0-SNAPSHOT"]  does not.

Interesting. I've never seen that behaviour before; it sounds like a bug.

I'm trying to reproduce this problem here but am unable to. Can you
provide steps to reproduce it locally? What version of Leiningen is
this?

-Phil



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


Why doesn't doc work in clojure-jack-in slime-repl?

2012-05-04 Thread Larry Travis

A command like

user> (doc hash-map)

in the slime-repl created by clojure-jack-in

results in

Unable to resolve symbol: doc in this context
  [Thrown class java.lang.RuntimeException]

Can this be fixed or do I have to do my doc requests someplace else?

  --Larry


--
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: Why doesn't doc work in clojure-jack-in slime-repl?

2012-05-04 Thread Larry Travis

Thank you, Roberto.  Works like a charm.
  --Larry

On 5/4/12 2:32 PM, Roberto Mannai wrote:

You should "use" it:

user> (use 'clojure.repl)
nil
user> (doc doc)
...


On Fri, May 4, 2012 at 9:27 PM, Larry Travis <mailto:tra...@cs.wisc.edu>> wrote:


A command like

user> (doc hash-map)

in the slime-repl created by clojure-jack-in

results in

Unable to resolve symbol: doc in this context
 [Thrown class java.lang.RuntimeException]

Can this be fixed or do I have to do my doc requests someplace else?

 --Larry


-- 
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
<mailto: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
<mailto:clojure%2bunsubscr...@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 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 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: Why doesn't doc work in clojure-jack-in slime-repl?

2012-05-04 Thread Larry Travis

Roberto:
This indeed looks like it will be useful. Thanks.

Your require-all-snippet.clj script loaded OK except for:

Attempting to require  clojure.parallel : couldn't require  
clojure.parallel

Exception
 #java.lang.ClassNotFoundException: jsr166y.forkjoin.ParallelArray>


  --Larry


On 5/4/12 3:00 PM, Roberto Mannai wrote:
If you are studying the doc maybe you could find useful this bunch of 
scripts: http://pastebin.com/cXL1wNVC
They are an updated version of what posted here: 
http://www.learningclojure.com/2010/03/conditioning-repl.html





--
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: Why doesn't doc work in clojure-jack-in slime-repl?

2012-05-04 Thread Larry Travis

Phil:
Thanks.  I obviously need to start doing my Clojure programming with a 
Slime cheatsheet in front of me!

  --Larry

On 5/4/12 4:00 PM, Phil Hagelberg wrote:

Another way to do it is just use C-c C-d C-d for docs lookup.

-Phil



--
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: Best Clojure Learning Resource for Lisper

2012-05-07 Thread Larry Travis

Lee's comments ring true for me so let me extend them.

Before I discovered Clojure, my experience as a programmer had been 
mainly in the area of artificial-intelligence experimental programming.  
I was once a reasonably proficient Lisp programmer, but pre-CL and 
pre-CLOS, that is, mainly using Xerox PARC's Interlisp.


Fast prototyping is central to such experimental programming, and Lisp  
REPL's and IDE's have contributed as much to Lisp's pre-eminent 
usability for experimental programming as has the language itself.


So, when starting to use Clojure, my major frustrations were wrt Java 
interop and (to quote Lee) "... setup, editing environments, build tools 
and configurations, dependencies, classpaths, etc."


What I found of most use to begin with was Clojure Box (see 
http://clojure.bighugh.com), " an all-in-one installer for Clojure 
<http://clojure.org> on Windows. It's inspired by the Lispbox 
<http://gigamonkeys.com/book/lispbox>: you simply install and run this 
one thing, and you get a REPL <http://clojure.org/dynamic> and all the 
syntax highlighting and editing goodies from clojure-mode and Slime, 
plus all the power of Emacs under the hood." Unfortunately, it has not 
been upgraded to Clojure 1.3.0 and is no longer being maintained -- and, 
anyway, I wanted to work on a Mac.


And something almost as good as Clojure Box is now available for Macs 
(as well as for Windows and Linux systems). See


https://github.com/technomancy/swank-clojure/blob/master/README.md

If you are not into the intricacies of Emacs multi-key chording, using 
Aquamacs helps a bit. (Despite the statement in the README that 
"Swank-clojure and SLIME are only tested with GNU Emacs; forks such as 
Aquamacs  ... are not officially supported", use of the Aquamacs Emacs 
fork does work.)


I agree with Lee that, if you don't know Emacs (or don't want to be 
learning it at the same time you are learning Clojure), the clooj IDE 
should be useful as a starter -- maybe eventually something more as 
features like SLIME's debugging aids are added to it.


There are several excellent books useful as Clojure learning aids. (I 
particularly recommend Halloway and Bedra, "Programming Clojure"; Fogus 
and Hauser, "The Joy of Clojure"; and Emerick, Carper, and Grand, 
"Clojure Programming".) Unfortunately, none of them contain a chapter 
that has yet to be written by somebody: "Everything a Clojure programmer 
who has never used Java needs to know about it."


I hope this helps.
  --Larry




On 5/7/12 9:34 AM, Lee Spector wrote:


On May 7, 2012, at 12:37 AM, HelmutKian wrote:


Hey there,

I'm a fairly experienced Common Lisp programmer.  By that I mean I've read PAIP, On Lisp, 
Let Over Lambda, and written several "real world" CL applications and taught 
the principles of FP using Racket as a TA.

Now I'm looking to learn Clojure. What would be the best resource for someone 
who is already pretty comfortable with Lisp?

For me, coming to Clojure ore from Common Lisp and Scheme than from Java, the biggest 
hurdles weren't the language itself but rather the issues with setup, editing 
environments, build tools and configurations, dependencies, classpaths, etc. Many of the 
concepts underlying these things were foreign to me, at least in their Java-world guises. 
If any of this rings true to you then I'd recommend starting with the clooj lightweight 
IDE, which makes a lot of these issues go away (for me at least), in conjunction with 
leiningen (invoked from the command line after adding dependencies to your project.clj) 
to manage dependencies. You can get clooj here: https://github.com/arthuredelstein/clooj 
-- I'd download the latest "standalone" jar, double click it to launch the IDE, 
create a project, and begin working there. If you do your Lisping in emacs then there's 
great support for that route in Clojure too, and maybe that's where you want to end up, 
but I (and others) have found setup and configuration to be nontrivial. Doubtless others 
on this list will disagree with that :-), and of course YMMV, but that's my 2cents.

On the language itself I recommend watching Rich Hickey's "Clojure for Lisp Programmers" 
talk (part 1 is here: http://blip.tv/clojure/clojure-for-lisp-programmers-part-1-1319721) for 
starters. After that I personally used Stuart Halloway's "Programming Clojure" text but 
there are now several others that are also good.

  -Lee



--
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: Best Clojure Learning Resource for Lisper

2012-05-07 Thread Larry Travis

Sean and Lee:
In general, I have considered the difference between Aquamacs and GNU 
Emacs to be that the former prioritizes computer-user interaction via 
mouse, command-bars and menus (which requires a lot of hand movement 
between keyboard and mouse, but enables the user to dispense with 
memorizing the meanings of dozens of key chords) -- while the latter 
minimizes user need to move hands off the keyboard thus facilitating 
fast touch typing (using key combinations to move point, set mark, copy 
region, etc.)


Whether key bindings (especially those that involve the Apple command 
key) conform to Apple style helps if you are used to them from other Mac 
applications, but is a secondary difference. By the way, I can't find 
just what bindings to the command key Emacs 24 (for Os X) does use. 
(Aquamacs comes with 41!) The Emacs-24 _C-h b_ listing doesn't seem to 
show them.


A difference that I find very useful is the use of tabs in Aquamacs for 
rapidly controlling which buffers are being displayed. (One can create a 
new buffer either in a new frame or under a new tab in an existing frame.)


There are other differences, but none of the differences between 
Aquamacs and GNU Emacs (including the ones just mentioned) are critical 
to what makes a good Emacs-based Clojure IDE, and I will be perfectly 
happy with either Aquamacs or GNU Emacs as the base of a "Mac Clojure 
Box" downloadable as are many Mac applications (from the Mac Apps 
Store?) and installable simply by dragging an icon into the applications 
folder.


Talk about being a parasitic noobie.  I wish I had the expertise to help 
Phil Hagelberg and other swank-clojure and Leiningen contributors toward 
achieving this goal.  What they have developed so far takes us a long 
way toward it  (whether or not it is one of the goals they have 
explicitly in mind).

  --Larry




On 5/7/12 10:40 PM, Sean Corfield wrote:

On Mon, May 7, 2012 at 8:21 PM, Lee Spector  wrote:

My recollection was that Aquamacs had more support for Mac OS native menus and 
other GUI elements too...

Probably, yes. I installed it last year and I seem to recall some
native chrome and a menubar - but then folks recommended using Emacs
24 so I switched and haven't had any problems. I expand Emacs to
near-fullscreen and I like the lack of distractions (lack of chrome)
since I work in it all day.


What I should have said would be "really wonderful," more precisely, is something with 
"close to single click download/install of a complete [emacs] Clojure programming 
environment"

That's certainly true. Any Emacs-based approach is a multi-step setup
right now and everyone seems to have their own favorite way to set
things up. I've helped a number of Mac users get Emacs 24 + Starter
Kit + Leiningen + Swank-Clojure up and running and I always seem to
forget some minor step and have to redo _something_ :)


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

How do I set jvm options for a lein repl

2012-05-20 Thread Larry Travis
How do I set jvm options for a /lein repl/ initiated independently of a 
project?   In particular, I want the heap expansion that results from 
doing "M-x clojure-jack-in" in an emacs /project.clj/ buffer with 
":jvm-opts [ "-Xms4G" "-Xmx4G"]" in its defproject form.

  --Larry

--
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: How do I set jvm options for a lein repl

2012-05-21 Thread Larry Travis
I should be switching over to Leiningen 2 shortly in any case, but I am 
curious. How does one "set JVM_OPTS as an environment variable"?

  --Larry


On 5/21/12 11:42 AM, Phil Hagelberg wrote:

On Mon, May 21, 2012 at 5:28 AM, Raju Bitter  wrote:

How do I set jvm options for a lein repl initiated independently of a
project?   In particular, I want the heap expansion that results from doing
"M-x clojure-jack-in" in an emacs project.clj buffer with ":jvm-opts [
"-Xms4G" "-Xmx4G"]" in its defproject form.

Larry is looking for a way to set that value across all projects, not
just for one project.

You can set :jvm-opts in the user profile if you're using Leiningen 2.
Otherwise set JVM_OPTS as an environment variable.

-Phil



--
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: How do I set jvm options for a lein repl

2012-05-21 Thread Larry Travis
It took me a while to figure out how to put multiple entries into an 
environment variable (that is, settings for both min and max heap sizes, 
to wit, "export JVM_OPTS=\ -Xms4G\ -Xmx4G") but, once I did, Phil's and 
Luc's suggestions have worked well and things have gone swimmingly. They 
work for both bash and eshell. Thanks much to you all.

  --Larry


On 5/21/12 6:16 PM, Softaddicts wrote:

The bash example is

export JVM_OPTS=-Xms4G ...

missed the = ...

Luc

If you are running in a unix shell, something like

JVM_OPTS=-Xms4G ...

Followed by
export JVM_OPTS

Bash allows you to combine the two as in:

export JVM_OPTS-Xms4G ...

In a windows Cmd shell, something like this should work:

set JVM_OPTS=Xms4G ...

before running lein from the command line.

Luc





I should be switching over to Leiningen 2 shortly in any case, but I am
curious. How does one "set JVM_OPTS as an environment variable"?
--Larry


On 5/21/12 11:42 AM, Phil Hagelberg wrote:

On Mon, May 21, 2012 at 5:28 AM, Raju Bitter   wrote:

How do I set jvm options for a lein repl initiated independently of a
project?   In particular, I want the heap expansion that results from doing
"M-x clojure-jack-in" in an emacs project.clj buffer with ":jvm-opts [
"-Xms4G" "-Xmx4G"]" in its defproject form.

Larry is looking for a way to set that value across all projects, not
just for one project.

You can set :jvm-opts in the user profile if you're using Leiningen 2.
Otherwise set JVM_OPTS as an environment variable.

-Phil


--




--
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: General subsequence function

2012-06-27 Thread Larry Travis

Something like this will give you what you want:

 (defn subseqx
  [s start end]
(cond
  (instance? clojure.lang.IPersistentVector s)
  (subvec s start end)

  (instance? java.lang.String s)
  (subs s start end)

  :else
  (let [slice (drop start (take end s))]
(cond
 (instance? clojure.lang.IPersistentList s)
 (apply list slice)

 (instance? clojure.lang.PersistentTreeSet s)
 (apply sorted-set slice)

 (instance? clojure.lang.PersistentTreeMap s)
 (apply sorted-map (concat slice))

 :else
 slice

And you can add conditions for other kinds of ordered collections if and 
when a need arises.  This is neither simple nor pretty, but an advantage 
of no-side-effects functional programming is that when you call a pure 
function you don't need to worry about how simple or pretty might be its 
internal details.

  --Larry

On 6/27/12 3:24 PM, Warren Lynn wrote:

Thanks, but this does not keep the concrete type.

On Wednesday, June 27, 2012 3:42:25 PM UTC-4, Ulises wrote:

> I'd forgotten that 'into adds things in the "default" place for
whatever type you're using, hence the reversal on lists. I'm not
sure if there's a simple way to get the same type out again while
preserving order.

How about:

(defn sub-seq [start end coll]
  (take (- end start) (drop start coll)))

U

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

Can I examine the state of a Clojure lazy sequence?

2012-07-08 Thread Larry Travis
(1) Is there any way I can extract from a Clojure lazy sequence at some 
given point in its use those of its members that have so far been 
realized? For example, can I extract the cache of realized members, turn 
it into a vector, and then process that vector independently of further 
use of the lazy sequence?


(2) If I can't extract the cache, is there some way that I can at least 
discover how many realized sequence members have so far been put into 
the cache?


It is obvious that, if all I want is an initial segment of a lazy 
sequence, I can force the initial segment's realization and get hold of 
it for further processing (independent of its source) with the take 
function -- but I want to know how many and what members of the lazy 
sequence have so far been realized independently of my forcing their 
realization -- for example, in order to evaluate and compare success so 
far of alternative solution paths being simultaneously pursued by an AI 
algorithm.


Thanks in advance for any relevant advice.
  --Larry

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


Meaning of "="

2012-10-02 Thread Larry Travis

What is the rationale for this?

user> (=  [1 2 3 4]  '(1 2 3 4))
true

I was quite surprised when this turned out to be the cause of a bug in a 
function I am constructing. Vectors and lists differ so substantially in 
their implementation and in their behavior that a vector and a list 
should not be considered "equal" just because they contain the same 
elements in the same order.


  --Larry


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


What is this function?

2012-10-09 Thread Larry Travis
As participants in this googlegroup have often observed, an excellent 
way to learn Clojure is to study the source definitions of its API 
functions.   This advice works better for learners who know Java, which 
I don't. I sometimes think that, if I were to teach a "Clojure 
Programming" course, I would list a "Java Programming" course as a 
prerequisite (for both teacher and students!). But here is some 
Clojure.core source code that raises a problem for me which surely 
doesn't have anything to do with not knowing Java.


user> (source list*)
(defn list*
  "Creates a new list containing the items prepended to the rest, the
  last of which will be treated as a sequence."
  {:added "1.0"
   :static true}
  ([args] (seq args))
  ([a args] (cons a args))
  ([a b args] (cons a (cons b args)))
  ([a b c args] (cons a (cons b (cons c args
  ([a b c d & more]
 (cons a (cons b (cons c (cons d (spread more)))

--
What is the function _spread_?  It is not in the Clojure API -- and the 
definition of _list*_ seems to me to be complete without it.

  --Larry

--
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: What is this function?

2012-10-09 Thread Larry Travis

Mark, Andy, Tassilo:
Very helpful, gentlemen. You are kind and skillful tutors. Thank you much.
  --Larry

--
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: What is this function?

2012-10-09 Thread Larry Travis
Pursuing the thinking behind my original comment, I challenged myself to 
see how many ways I could write a function equivalent to list* without 
using _spread_ (assuming I had the full Clojure API available to me -- 
which, of course, the author of list* did not have).  Here are four ways:


*(defn second-list*
  [& args]
  (concat (butlast args) (last args)))

(defn third-list*
  [& args]
  (let [r-args (reverse args)]
(reduce conj (seq (first r-args)) (rest r-args

(defn fourth-list*
  [& args]
  (let [r-args (reverse args)]
(loop [remaining (rest r-args)
  accum (first r-args)]
  (if (empty? remaining)
accum
(recur (rest remaining)
  (cons (first remaining) accum))

(defn fifth-list*
  [& args]
  (if (empty? (rest args))
(first args)
(cons (first args) (apply fifth-list* (rest args)*


But, alas, each of the four is a slowpoke relative to the original:

user> (time (dotimes [_ 10] (list* 1 2 3 4 5 6 7 [8 9])))
"Elapsed time: 26.558 msecs"

user> (time (dotimes [_ 10] (second-list* 1 2 3 4 5 6 7 [8 9])))
"Elapsed time: 97.019 msecs"

user> (time (dotimes [_ 10] (third-list* 1 2 3 4 5 6 7 [8 9])))
"Elapsed time: 96.829 msecs"

user> (time (dotimes [_ 10] (fourth-list* 1 2 3 4 5 6 7 [8 9])))
"Elapsed time: 100.863 msecs"

user> (time (dotimes [_ 10] (fifth-list* 1 2 3 4 5 6 7 [8 9])))
"Elapsed time: 75.925 msecs"

Here is the comparable timing for Ben's list+ alternative:

user> (time (dotimes [_ 10] (list+ 1 2 3 4 5 6 7 [8 9])))
"Elapsed time: 84.891 msecs"

  --Larry

On 10/9/12 5:57 PM, Ben Wolfson wrote:

I took Larry's comment to mean that one could implement list* without
spread 



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

Using functions from Java packages

2012-12-16 Thread Larry Travis
It almost certainly has something to do with my abysmal ignorance about 
things Java, but I don't understand this difference:


(1)
user> (map  Math/sqrt  [5  6  16])

Unable to find static field: sqrt in class java.lang.Math
  [Thrown class java.lang.RuntimeException]

(2)
user> (map  #(Math/sqrt  %)  [5  6  16])
(2.23606797749979  2.449489742783178  4.0)

Thanks for helping me understand.
  --Larry

--
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: Using functions from Java packages

2012-12-16 Thread Larry Travis
Thank you, gentlemen. Jim and Luc, your answers are both helpful. Luc's 
answer illustrates why a Java tyro often has problems understanding 
Clojure. Somebody like me who is trying to master Clojure, having come 
to it via a language path that doesn't include Java, needs a 
prerequisite crash course in Java concepts. (I hope it isn't necessary 
for him actually to learn Java programming skills. Reserving 
programming-skill learning for Clojure is a lot more fun!) Anybody have 
any recommendations of a book that could be used for such a crash course?

  --Larry


On 12/16/12 1:53 PM, Softaddicts wrote:

First example tries to access a public static field in the Math class.

Second example calls the static member function of the Math class.

The difference is in the missing set of parenthesis.

A static field or member function is attached to the class, not to a specific 
object
and can be accessed through the class itself. Hence the / notation.

On the other hand, (.addListener x ...) refers to the member fn addListener of 
the given object x.

You will rarely find Java object specific public fields directly accessible, 
most of the
time you need to use a getter to access them, hence the profusion of .getXzzz
when you look at interop code.

Static fields attached to a class are most of the time immutable, they are a way
to make constants public and avoid the getter wrapper syndrom.

Last thing, a class can define classes so you may need to access
Aclass$Bclass/field to get access to a class static field defined within a 
class.

This does not apply to an object of class B, the usual (.memberFn object ...)
would still apply assuming you are handed an object created from an inner class.


Luc P.




It almost certainly has something to do with my abysmal ignorance about
things Java, but I don't understand this difference:

(1)
user> (map  Math/sqrt  [5  6  16])

Unable to find static field: sqrt in class java.lang.Math
[Thrown class java.lang.RuntimeException]

(2)
user> (map  #(Math/sqrt  %)  [5  6  16])
(2.23606797749979  2.449489742783178  4.0)

Thanks for helping me understand.
--Larry

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


--
Softaddicts sent by ibisMail from my ipad!



--
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: Macro tutorials?

2011-10-10 Thread Larry Johnson
Hi, Nicolas, and thanks.

I'm new to clojure (I've been  working through Programming Clojure), and
most of my long work life has gravitated around c, shell scripts, and perl.
That being said, I've tinkered with Lisp dialects for the past twenty-five
years (mostly elisp, scheme, and common lisp), and have always struggled
with both the overall meaning of Lisp (when should I use it, when should I
not?), and with macros.

I downloaded and read the intro to On Lisp, and it looks like exactly what I
need.  I'm going to work through the book, and make comments here about how
it relates to my learning of clojure (assuming that it isn't deemed
off-topic noise).

Regards,
Larry



On Mon, Oct 10, 2011 at 7:33 AM, Nicolas  wrote:

> A good book to learn lisp macros, is On Lisp from Paul Graham. This
> book really cover advanced topics and concepts, and has many chapters
> related to macros.
>
> The book is freely available in online format from Paul Graham
> Website: http://www.paulgraham.com/onlisp.html
>
> On Oct 6, 1:02 pm, Michael Jaaka  wrote:
> > Thanks to all! You have helped a lot!
> > Also I will consider reading "Practical Common Lisp".
> >
> > On Oct 6, 9:42 am, Stefan Kamphausen  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi.
> >
> > > You might consider reading Peter Seibel's excellent Practical Common
> Lisp
> > > which has some nice macro-work in it. If after that you're still hungry
> for
> > > more, consider Let Over Lambda by Doug Hoyte.
> >
> > > Admitted, both cover Common Lisp, but the differences will not keep you
> from
> > > getting a deeper understanding of how macros work and where and how
> they can
> > > be used.
> >
> > > (This is more an answer to the subject of this thread, less to the
> question
> > > in your body :)
> >
> > > Regards,
> > > Stefan
>
> --
> 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
>



-- 

*Off the Beaten Path in Technology
http://otbeatenpath.wordpress.com
*

-- 
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: Literate programming

2011-10-27 Thread Larry Johnson
I'm a bit reluctant to get into this, because I'm new to clojure (and don't
know the backstory of this post), but an old hand at literate programming (I
recently did a podcast interview with Donald Knuth on LP).  I'll be
interested in the results of your survey.

Larry

On Wed, Oct 26, 2011 at 3:06 PM,  wrote:

> I see that my Literate Programming session is beginning to gain some
> traction. I would encourage you to bring examples. We can discuss the
> merits and possibly gain some new insights. If nothing else, please
> sign up for the Literate Software session at Clojure-Conj. I promise
> to keep it short.
>
> Literate programming can take various forms. I am working on a survey
> of literate software. I came across an interesting non-latex example
> worth sharing:
>
> http://jashkenas.github.com/coffee-script/documentation/docs/nodes.html
>
> Notice how well they have documented an apparently simple line as in:
>
>  exports.Base = class Base
>
>  The Base is an abstract base class for all nodes in the syntax tree.
>  Each subclass implements the compileNode method, which performs the
>  code generation for that node. To compile a node to JavaScript, call
>  compile on it, which wraps compileNode in some generic extra smarts,
>  to know when the generated code needs to be wrapping up in a
>  closure. An options hash is passed and cloned throughout, containing
>  information about the environment from higher in the tree (such as
>  if a returned value is being requested by the surrounding function),
>  information about the current scope, and indentation level.
>
> Notice how this is not only giving trivial information (e.g. Base is
> an abstract base class) but WHY it exists (..as a base for all nodes in
> the syntax tree). It gives operational information (to compile a node..)
> as well as information about the effect (..which wraps...). It shows
> how global information is used (An options hash..) and WHY (containing
> information about the environment...)
>
> Code only tells you HOW something is done at the time it is done.
> It's like having a recipe without an idea what you would make.
>
> If our standards of documentation were raised to this level then large
> systems like Axiom, Clojure, and ClojureScript would be much easier to
> maintain and modify in the long term.
>
> If you want your code to live beyond you, make it literate.
>
> Tim Daly
> d...@literatesoftware.com
>
>
>
> --
> 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




-- 

*Off the Beaten Path in Technology
http://otbeatenpath.wordpress.com
*

-- 
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: Literate programming

2011-10-27 Thread Larry Johnson
My two favorite articles on Literate Programming are both from Donald
Knuth's book *Literate Programming*.  One is "Computer Programming as an
Art", and the other is "Literate Programming".  When I was preparing to
interview Knuth a bit over a year ago I re-read the entire book.  I expected
it to be a somewhat outdated description of WEB, TANGLE, and WEAVE.  On the
contrary it was wonderfully timeless.  When I mentioned that to Knuth he
sort of grumbled something to the effect of "Well, yes, some things in
computer science have a long shelf life" (that's a paraphrase, but it was
something like that).

I haven't been working with it for awhile, but I did a somewhat primitive
modification to the XML Docbook markup language (I just added a few
appropriate tags for "tangling" the executable source code, and "weaving"
the well formatted article documenting the code)  which I used as the source
language, then wrote a tangle and weave in perl.  I got the idea from Norman
Walsh's article Literate Programming in XML which can be found at
http://nwalsh.com/docs/articles/xml2002/lp/paper.html

The advantage of this was that given the array of tools for rendering
Docbook "weaving" was a piece of cake, and perl had a good range of modules
for doing the "tangle".

As I stated, I'm very new to clojure, but I've always been fascinated with
LP, and I'm very happy to see this discussion going on here.

Larry



On Wed, Oct 26, 2011 at 10:49 PM, jaime  wrote:

> is there a place introducing (e.g. overview) more about Literate? have
> no ideas about this stuff.
>
> On Oct 27, 3:06 am, d...@axiom-developer.org wrote:
> > I see that my Literate Programming session is beginning to gain some
> > traction. I would encourage you to bring examples. We can discuss the
> > merits and possibly gain some new insights. If nothing else, please
> > sign up for the Literate Software session at Clojure-Conj. I promise
> > to keep it short.
> >
> > Literate programming can take various forms. I am working on a survey
> > of literate software. I came across an interesting non-latex example
> > worth sharing:
> >
> > http://jashkenas.github.com/coffee-script/documentation/docs/nodes.html
> >
> > Notice how well they have documented an apparently simple line as in:
> >
> >   exports.Base = class Base
> >
> >   The Base is an abstract base class for all nodes in the syntax tree.
> >   Each subclass implements the compileNode method, which performs the
> >   code generation for that node. To compile a node to JavaScript, call
> >   compile on it, which wraps compileNode in some generic extra smarts,
> >   to know when the generated code needs to be wrapping up in a
> >   closure. An options hash is passed and cloned throughout, containing
> >   information about the environment from higher in the tree (such as
> >   if a returned value is being requested by the surrounding function),
> >   information about the current scope, and indentation level.
> >
> > Notice how this is not only giving trivial information (e.g. Base is
> > an abstract base class) but WHY it exists (..as a base for all nodes in
> > the syntax tree). It gives operational information (to compile a node..)
> > as well as information about the effect (..which wraps...). It shows
> > how global information is used (An options hash..) and WHY (containing
> > information about the environment...)
> >
> > Code only tells you HOW something is done at the time it is done.
> > It's like having a recipe without an idea what you would make.
> >
> > If our standards of documentation were raised to this level then large
> > systems like Axiom, Clojure, and ClojureScript would be much easier to
> > maintain and modify in the long term.
> >
> > If you want your code to live beyond you, make it literate.
> >
> > Tim Daly
> > d...@literatesoftware.com
>
> --
> 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
>



-- 

*Off the Beaten Path in Technology
http://otbeatenpath.wordpress.com
*

-- 
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: Literate programming

2011-10-28 Thread Larry Johnson
On Thu, Oct 27, 2011 at 11:52 PM, daly  wrote:

>
> Any means of publication can be the medium for literate programming.
> As I rule I prefer Latex but anything will do.
>
> All you need is a distinguished means of quoting and naming the
> chunks. In html this could be as simple as:
>   
>  your code
>   
> and you need a program, often called "tangle", to extract the chunk
>   tangle mywebpage.html somename >mysomename.file
>
>
Yep.  That's all my Rube Goldberg-ish system did.  The chunk of machine
recognizable code was named as an attribute in a modified  tag.
The "weave" just stripped it out so you were left with "typeset ready"
Docbook markup.  The "tangle" just yanked out the target source code and
wrote it to a file in the proper order.

>
> The hardest part of literate programming is the mindset.
>
> In order to do literate programming you need to change your focus
> from traditional programming to writing for humans and, as a side
> effect, writing for the machine.
>  
> 
>

For programmers who are resistant to even commenting code LP must seem
nightmarish (at least at first).  Not only are you required to provide
comments, but those comments have to be a complete, well formatted, human
readable, journal article.  Also, it takes some time getting one's head
wrapped around the fact that the order in which the target language source
code appears in the article is not necessarily the order in which the
machine needs it for compilation and execution purposes.

When LP is practiced consistently it prevents a number of bad habits, and I
can't see that those good effects change whether one is using a "top down"
or "bottom up" approach to programming.  Since you're writing a complete,
well formatted, human readable, article on how the code works, you can't
just cut-and-paste code into a project without really understanding what the
code is doing (well, I guess you can, but that would become obvious while
you or another reader were trying to follow the article).
-- 

*Off the Beaten Path in Technology
http://otbeatenpath.wordpress.com
*

-- 
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: Clojure Conj extracurricular activities spreadsheet

2011-10-31 Thread Larry Johnson
Damn, Damn, Damn.  I'm very new to clojure, and joined this forum just a
few weeks ago.  The fact that there are sessions at Clojure Conj  on two of
my passions (Go and Literate Programming), and that I'm unable to attend,
frustrates me to no end.

I assume that the session on Go refers to the Asian board game known as
Go/Baduk/Wei Chi.  If someone could pop a note to me offline on what work
Clojure programmers are doing with Go, I'd really appreciate it.



On Mon, Oct 31, 2011 at 1:58 PM, h.h  wrote:

> Can someone add me (hunter.hutchinson) to:
> * Clojurescript
> * Go
> * Pallet
> * D3 & Clojurescript
> * The web & Clojure
>
> Thanks!
>
> On Oct 31, 7:36 am, Fogus  wrote:
> > I've added everyone to this thread as an editor of the spreadsheet.
> > Please feel free to add yourself and your sessions at your leisure.
>
> --
> 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
>



-- 

*Off the Beaten Path in Technology
http://otbeatenpath.wordpress.com
*

-- 
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: Clojure Conj extracurricular activities spreadsheet

2011-10-31 Thread Larry Johnson
Ahh.  Yes, it is really, really hard.  I may have misunderstood the nature
of the session.

Larry

On Mon, Oct 31, 2011 at 5:18 PM, Gary Trakhman wrote:

> I think we're just playing it, no?  :-)   Isn't it really really hard
> to solve go?
>
> On Mon, Oct 31, 2011 at 5:12 PM, Larry Johnson
>  wrote:
> > Damn, Damn, Damn.  I'm very new to clojure, and joined this forum just a
> few
> > weeks ago.  The fact that there are sessions at Clojure Conj  on two of
> my
> > passions (Go and Literate Programming), and that I'm unable to attend,
> > frustrates me to no end.
> >
> > I assume that the session on Go refers to the Asian board game known as
> > Go/Baduk/Wei Chi.  If someone could pop a note to me offline on what work
> > Clojure programmers are doing with Go, I'd really appreciate it.
> >
> >
> >
> > On Mon, Oct 31, 2011 at 1:58 PM, h.h 
> wrote:
> >>
> >> Can someone add me (hunter.hutchinson) to:
> >> * Clojurescript
> >> * Go
> >> * Pallet
> >> * D3 & Clojurescript
> >> * The web & Clojure
> >>
> >> Thanks!
> >>
> >> On Oct 31, 7:36 am, Fogus  wrote:
> >> > I've added everyone to this thread as an editor of the spreadsheet.
> >> > Please feel free to add yourself and your sessions at your leisure.
> >>
> >> --
> >> 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
> >
> >
> > --
> >
> > Off the Beaten Path in Technology
> > http://otbeatenpath.wordpress.com
> >
> > --
> > 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 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
>



-- 

*Off the Beaten Path in Technology
http://otbeatenpath.wordpress.com
*

-- 
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: Overused phrases in the Clojure community

2011-11-16 Thread Larry Johnson
On Tue, Nov 15, 2011 at 11:05 PM, Carl Cotner  wrote:

> In general, I agree that it's annoying to continue seeing certain words
> used over and over. But the use of the word "idiomatic" in particularseems to 
> be very idiomatic in the Clojure community, so I don't mind it.
>
> :-)
>
>
> On Tue, Nov 15, 2011 at 8:16 PM, thenwithexpandedwingshesteershisflight <
> mathn...@gmail.com> wrote:
>
>> Can we please get bored of saying "idiomatic" and "in particular"
>> please ?
>>
>>
>
>
I don't want to take this topic (or myself) too seriously, but the word
"idiomatic" is a clear and well understood word among programmers.  It's
useful and specific.  I come from a perl background, where "there is more
than one way to do it", but despite the many ways to do it, there was
idiomatic perl on the one hand, and everything else on the other.  It's
useful for me to ask, when I'm learning a new language, "How would this be
written in idiomatic befunge?"

I'll keep the word idiomatic, just as I'll keep the overused word "word".
I'll promise not to overuse it, and I'll try not to use it incorrectly.

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



-- 

*Off the Beaten Path in Technology
http://otbeatenpath.wordpress.com
*

-- 
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: Literate programming

2011-12-22 Thread Larry Johnson
On Thu, Dec 22, 2011 at 2:54 PM, daly  wrote:

>
> >
> > The combination of literate + TDD seems forbidding.
>
> Are you finding it hard to explain why you wrote a test?
>
> Tim Daly
>
>
I decided awhile back when trying to answer questions about literate
programming, that people get caught up in the moving parts, and not in what
the approach actually yields.  Your statement above puts it nicely and
succinctly, and hearkens back to Knuths original articles.  Lately I
emphasize the woven text (without inititially calling it that) and ask the
person I'm talking with to imagine writing an article or book about their
code, how it works, with proofs where appropriate.  That article should be
written as a work of literature.  Not all literature has to be Hugo or
Melville (or Jack Kerouac, or Gertrude Stein for that matter).  Some
programs are more appropriately Mickey Spillane or Terry Pratchett, or even
in the style of a manual for an electric razor.  The point is that it
should be satisfying to read and comprehensively informative.

Test code, and descriptions of external libraries are no different from any
other sections of the article or book.  The most important thing is to
introduce them into the work at point most conducive to the reader's
understanding.

I really believe that there's no programming or engineering methodology
which doesn't lend itself to literate programming.  If it can be described,
it can be presented in the form of an article.  If it can't be describe in
human language it's probably terrible code.

Larry

-- 
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: Literate programming

2011-12-22 Thread Larry Johnson
Probably the most effective way to really hammer the benefits of literate
programming into the clojure community would be to take a manageable but
serious and well known clojure program, module, or library, and render it
into literate form.  As a clojure programmer, I'm not even there.  But as
someone to help with the literate part, I'd be thrilled to help 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

How can I make this kind of error message more useful?

2012-01-03 Thread Larry Travis
I have been solving Clojure problems now for many months and can no 
longer exactly be considered a Clojure NOOB, but I still have an awful 
lot to learn about Clojure.  One thing that has caused difficulties from 
the beginning is that I don't know Java and don't know how to exploit 
the Java eco-structure -- and thus I can't figure out how to use all the 
inter-op potential, and I have a hard time interpreting Java-oriented 
error messages.


For example, on doing a particular load-file I get this very useful 
error message:


java.lang.Exception: Unmatched delimiter: ] (source-file:323)


But my error messages are more likely to look like this:

java.lang.Exception: Unsupported binding form: (quote symb) 
(NO_SOURCE_FILE:5045)



Where does the 5045 come from and what does it mean?  Is there some way 
I could manage and load my defn files, or manage my evaluations of defn 
expressions in the REPL, so that such error messages would always give 
me a useful line number like the 323 in the first example?


Thanks for your help.
  --Larry


--
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: How can I make this kind of error message more useful?

2012-01-03 Thread Larry Travis

David and Meikel:
Thanks for your responses, but it appears to me that what you say 
applies only to error messages referring to evaluation of defn 
expressions.  Constructing my function definitions in a file separate 
from the REPL and then recompiling the entire file with a load-file 
whenever I make a change results in the correct line number being given 
to me for errors detected by the compiler -- but if an error occurs 
later when I am exercising the compiled code, the line number given to 
me doesn't appear to refer to the source file from which the compiling 
was done -- nor does the line number given to me for an error occurring 
in evaluation of an expression entered in the REPL refer to the REPL 
line within which the expression occurred.  To wit, for my original 
example error message


java.lang.Exception: Unsupported binding form: (quote symb) 
(NO_SOURCE_FILE:5045)


the REPL line which resulted in the error message was 15392, not 5045.

So where does the 5045 come from?
--Larry




On 1/3/12 12:59 PM, Meikel Brandmeyer wrote:

Hi,

Am 03.01.2012 um 18:24 schrieb David Nolen:


On Tue, Jan 3, 2012 at 12:09 PM, Larry Travis  wrote:

But my error messages are more likely to look like this:

java.lang.Exception: Unsupported binding form: (quote symb) 
(NO_SOURCE_FILE:5045)


Where does the 5045 come from and what does it mean?  Is there some way I could 
manage and load my defn files, or manage my evaluations of defn expressions in 
the REPL, so that such error messages would always give me a useful line number 
like the 323 in the first example?

You obviously type in a lot in the repl. NO_SOURCE_FILE usually means repl, and 
5045 is exactly that line typed into the repl. If you want to change that, you 
have to put your function definitions into files. Loading from the file will 
then give the accurate information form the former example.


If you want accurate error locations make sure to recompile the whole file 
instead of evaluating expressions one at a time. The tools could of course 
improve here by setting the line number explicitly when evaluating expressions 
one at a time.

VimClojure does set the file and line information correctly when sending single 
definitions from a clojure buffer to a server backend. So the last function 
sent will always give accurate information. However the definitions following 
the sent toplevel form might get slowly out of sync. So reloading the whole 
file from time to time is a good idea to get everything in sync again. (Beware 
other dangers like redefined protocols etc.)

Sincerely
Meikel



--
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: Any demand for ClojureCLR support under slime / emacs?

2010-12-15 Thread Larry Coleman
I don't know enough emacs Lisp to be much help with coding, but I can help 
test.

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

Why won't leiningen install for me?

2011-01-22 Thread Larry Travis

I get the following when I try to install Leiningen:

---
larrytravis$   lein-install.sh   self-install

Downloading Leiningen now...

dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
  Referenced from: /opt/local/bin/curl
  Reason: no suitable image found.  Did find:
/opt/local/lib/libintl.8.dylib: mach-o, but wrong architecture

/Users/larrytravis/bin/lein-install.sh: line 175:  2851 Trace/BPT 
trap  $HTTP_CLIENT "$LEIN_JAR" "$LEIN_URL"


Failed to download 
https://github.com/downloads/technomancy/leiningen/leiningen-1.4.2-standalone.jar



Can anybody advise me as to what I am doing wrong?

/lein-install.sh/ is the script available at:

https://github.com/technomancy/leiningen/raw/stable/bin/lein

Also I can't download /leiningen-1.4.2-standalone.jar/ directly from 
https://github.com/technomancy/leiningen/downloads, but I don't think I 
would know what to do with it if I could! I am a Java tyro (who knows 
some other lisps reasonably well) trying to use clojure under Mac Os X 
and Emacs, but I am having a lot of problems getting clojure to run 
conveniently in that environment.


Thanks for your help.
  --Larry Travis

--
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: Why won't leiningen install for me?

2011-01-25 Thread Larry Travis

Mark, John, Gaz:
Your responses are all suggestive but I don't know where to go from here 
so I am going to make one more cry for help -- and to this group rather 
than the leiningen-specific one suggested by Mark because my basic 
problem is really how-to-get-clojure/emacs-running-under-MacOsX.


Here is the situation, and my further questions:

-- I am running OsX 10.6 on a machine that has never had an earlier OsX 
version running on it so there should not be problems involving 10.5 to 
10.6 upgrade.


-- I have downloaded and installed Macports -- including a recent 
upgrade. If Macports' version of curl is indeed the culprit, how do I 
get it replaced with a version that could download leiningen?  Do I dare 
just simply uninstall Macports -- which I am not using right now in any 
case? (All I want to do right now is work with Clojure!)


-- Although it surprised me, when I checked to see to what kernel my 
iMac was defaulting, I was told i386. What else could the leiningen 
installation process be asking for? Surely it wouldn't be expecting x86_64.


-- In the webpage Mark pointed me to is the assertion: "If only ppc and 
i386 are present, while you require x86_64, then the library cannot be 
loaded."  But also, from a different commentator: "This issue was fixed 
in a later version of MacPorts with better 10.6 x86_64 compatibility." 
Is there some way to determine if the installation process is indeed 
expecting an x86_64 architecture?


Thanks again.
  --Larry

-- 

On 1/22/11 2:16 PM, gaz jones wrote:

are you sure you dont have curl installed by macports or something?
/usr/bin/curl on mac os x works fine with https for me... someone at
work had this problem and they had (unknowingly) installed curl
through macports...

On Sat, Jan 22, 2011 at 1:28 PM, Bizics  wrote:

Hi Larry,
I had problems installing too.
Turns out curl on mac os x does not support https as required by
github now.
I had to download and rebuild curl with the +ssl flag for https to be
supported and then things worked fine.
I could dig up my notes from when I did it if you need more
information.

Cheers,
John


On Jan 21, 4:49 pm, Larry Travis  wrote:

I get the following when I try to install Leiningen:

---
larrytravis$   lein-install.sh   self-install

Downloading Leiningen now...

dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
Referenced from: /opt/local/bin/curl
Reason: no suitable image found.  Did find:
  /opt/local/lib/libintl.8.dylib: mach-o, but wrong architecture

/Users/larrytravis/bin/lein-install.sh: line 175:  2851 Trace/BPT
trap  $HTTP_CLIENT "$LEIN_JAR" "$LEIN_URL"

Failed to 
downloadhttps://github.com/downloads/technomancy/leiningen/leiningen-1.4.2-st...


Can anybody advise me as to what I am doing wrong?

/lein-install.sh/ is the script available at:

https://github.com/technomancy/leiningen/raw/stable/bin/lein

Also I can't download /leiningen-1.4.2-standalone.jar/ directly 
fromhttps://github.com/technomancy/leiningen/downloads, but I don't think I
would know what to do with it if I could! I am a Java tyro (who knows
some other lisps reasonably well) trying to use clojure under Mac Os X
and Emacs, but I am having a lot of problems getting clojure to run
conveniently in that environment.

Thanks for your help.
--Larry Travis

--
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 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: Why won't leiningen install for me? (NOW IT DOES!)

2011-01-25 Thread Larry Travis
You guys are great!  As my dad used to say when he had been greatly 
helped: Each of you is a scholar and a gentleman.


I admire your expertise. You each had knowledgeable and quite helpful 
suggestions. I ended up using Alex's ideas for getting the Leiningen 
installation process to avoid Macports' version of /curl/ and go back to 
the Mac OsX's original version, and from there on everything has worked 
well. Later I will install a version of Macports specifically adapted to 
Snow Leopard, /a la/ the link from Mark -- or replace Macports with 
Homebrew, as recommended by Gaz -- but right now I don't need either, 
and I want to spend my time digging more deeply into how Clojure enables 
one to utilize multi-core processors.


And the Clojure IDE I've got running to support that digging is just 
beautiful: Snow Leopard + Aquamacs + Slime.


Thanks again.
  --Larry






On 1/24/11 8:44 PM, Alex Osborne wrote:

Hi Larry,

As a quick temporary workaround you could just set your PATH environment
variable so that it picks up the curl executable from /usr/bin instead
of the broken MacPorts one from /opt/local/bin.

$ which curl
/opt/local/bin/curl
$ export PATH=/usr/bin:$PATH
$ which curl
/usr/bin/curl

You'll need to do that each time you install/upgrade Leiningen though.

Since you're not using MacPorts, personally I'd opt to just rename the
entire MacPorts directory (/opt/local) out of the way:

$ sudo mv /opt/local /opt/local.broken

You could then delete it or reinstall it at a later time, whatever you
prefer.

Cheers,

Alex


Mark Rathwell  writes:



 Seems pretty clear that your macports version of curl is the problem, it's up 
to you what you want to do about it.  I don't know if uninstalling it would 
leave you with the OS X version of
 curl or not.  Link to get you started:

 http://www.richarddooling.com/index.php/2009/09/12/macports-on-snow-leopard/




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

Question about the Clojure load-file command

2011-03-12 Thread Larry Travis
I'm having trouble getting the load-file command to work in a Clojure 
repl.  On some files it works and on some it doesn't. Here is an example 
of its not working:


I do:

(load-file "/Users/larrytravis/AquaFiles/sdku-project-defns")


And I get the error message:

java.lang.Exception: Unable to resolve symbol: selection in this context 
(sdku-project-defns:867)



The file "sdku-project-defns" definitely exists in the directory 
"/Users/larrytravis/AquaFiles" and is retrievable from there with other 
applications. Why does the Clojure repl append ":867" to the file's name 
and then tell me that the changed name is an unresolvable symbol?


Thanks for any advice any of you might have.  I hope the question isn't 
impossibly dumb.


  --Larry Travis


--
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: Question about the Clojure load-file command

2011-03-12 Thread Larry Travis

Ken:
The cause of my difficulty indeed was a corrupted file. I was looking 
for it in a completely different direction, and I clearly don't know how 
to correctly parse Java error messages!


Thank you very much for sharing your cleverness and your expertise.
  --Larry



On 3/12/11 7:39 PM, Ken Wesson wrote:

On Sat, Mar 12, 2011 at 7:49 PM, Larry Travis  wrote:

I'm having trouble getting the load-file command to work in a Clojure repl.
On some files it works and on some it doesn't. Here is an example of its not
working:

I do:

(load-file "/Users/larrytravis/AquaFiles/sdku-project-defns")


And I get the error message:

java.lang.Exception: Unable to resolve symbol: selection in this context
(sdku-project-defns:867)


The file "sdku-project-defns" definitely exists in the directory
"/Users/larrytravis/AquaFiles" and is retrievable from there with other
applications. Why does the Clojure repl append ":867" to the file's name and
then tell me that the changed name is an unresolvable symbol?

I think it's telling you that "selection" is an unresolvable symbol
and that it appears on line 867 of your file.

The file may simply contain a bug. Most likely it's a lack of a
forward declaration. If you were developing at the REPL "selection"
may have been defined before you defined the stuff that uses it, but
if "selection" isn't earlier in the file than what's using it, you'll
get this error on load in a fresh session.



--
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: Question about the Clojure load-file command

2011-03-13 Thread Larry Travis

Ken:
Your question is an interesting one.  My answer may serve as a word to 
the wise: I do my Clojure source-code editing in Emacs (actually 
Aquamacs, but the difference is not important for what I am saying 
here). As any Emacs user knows, when one has several Emacs frames 
(windows) in action and is hurriedly (and maybe also carelessly) moving 
back and forth among them, he sometimes starts typing for a change he 
wants to make in one frame when the point (cursor) is actually sitting 
in a frame different from the one in which he intends to be making the 
change.  Usually, such a false start can quickly be caught and 
corrected, but I suspect that in this case I made such a false start and 
didn't fully correct for it.


  --Larry



On 3/12/11 9:09 PM, Ken Wesson wrote:

On Sat, Mar 12, 2011 at 9:46 PM, Larry Travis  wrote:

Ken:
The cause of my difficulty indeed was a corrupted file. I was looking for it
in a completely different direction, and I clearly don't know how to
correctly parse Java error messages!

Thank you very much for sharing your cleverness and your expertise.

You're welcome. (But ... the file was actually *corrupted*? How did
*that* happen?)



--
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: Clojure load-file command (+ Aquamacs, Bluefish)

2011-03-14 Thread Larry Travis

Ken:
There are a lot of things to like about Aquamacs, and its creator David 
Reitter deserves high praise as of course do the Emacs creators on whose 
shoulders he stands. The problem we have raised here is, for the present 
at least, the only complaint I have about Aquamacs. And there is 
probably a quick fix.  When you have several separate Aquamacs frames 
(windows) open simultaneously,  the current focus (that is, where your 
typing will go) is the frame where the cursor is blinking. There is 
probably a system variable whose setting determines obviousness of the 
cursor. I haven't found it yet but I haven't looked very hard.


If for some reason I ever do want to change editors, I'm tempted to try 
Bluefish. It was recommended for Clojure editing by ramsa...@comcast.net 
on this mailing list just yesterday.

  --Larry




On 3/13/11 3:23 PM, Ken Wesson wrote:

On Sun, Mar 13, 2011 at 1:51 PM, Larry Travis  wrote:

Ken:
Your question is an interesting one.  My answer may serve as a word to the
wise: I do my Clojure source-code editing in Emacs (actually Aquamacs, but
the difference is not important for what I am saying here). As any Emacs
user knows, when one has several Emacs frames (windows) in action and is
hurriedly (and maybe also carelessly) moving back and forth among them, he
sometimes starts typing for a change he wants to make in one frame when the
point (cursor) is actually sitting in a frame different from the one in
which he intends to be making the change.  Usually, such a false start can
quickly be caught and corrected, but I suspect that in this case I made such
a false start and didn't fully correct for it.

Your typing *should* be going to the cursor in the currently focused
(generally frontmost) window. If that does not happen with Aquamacs,
then your editor is tripping you up. :) (My own experience is with vi
and various Windows editors. To have multiple vi windows one tends to
make multiple term windows. As long as the terminal emulator handles
focus appropriately vi can't cause problems like this. :))



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


is there a naming convention for the directory with java in it?

2013-05-28 Thread larry google groups
I started a project with "lein new". I had a jar file I needed to include 
in this project (a recommended class from a company that has an API that we 
are using -- it would be pointless for me to re-write their code, so I 
simply grabbed the class they offered and compiled it as a jar). I ended up 
with these top level directories:

resources 
src 
java_src
target 
test

I put the jar file in java_src. I am curious if there is a relatively 
standard name that people use when they include jar files? Anything more 
standard than "java_src"? 

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




idiot question about macros

2013-06-07 Thread larry google groups

I am very stupid and I am having trouble figuring out how to read
this:

(defmacro match-func [& body] `(fn [~'x] (match [~'x] ~@body)))

((match-func [q :guard even?] (+ 1 q) [z] (* 7 z)) 33)
;; 231

What? Why 231?

The article is here:

http://java.dzone.com/articles/my-first-clojure-macro

I especially struggle with the longer version:

(defmacro match-pfunc [& body]
"Create a partial function that does pattern matching."
(let [rewrite (mapcat (fn [x] [(first x) true]) (partition 2 body))]
`(fn ([x#] (match [x#] ~@body))
([x# y#]
(cond
(= :defined? x#)
(match [y#] ~@rewrite)
(= :body x#)
'(~@body))


The article says:

What this gives us is a function than can be invoked with a single
parameter:
(pf 44)
And it can be invoked with 2 parameters:
(pf :defined? 44)


I keep looking at these 2 lines thinking maybe they reveal how
different parameters cause a different action to be triggered, but I
am unable to make sense of it:

`(fn ([x#] (match [x#] ~@body))
([x# y#]

The anonymous fn is simply being returned? Is it returned at compile
time, or run time?



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

2013-09-13 Thread larry google groups

I am stupid and recursion is clearly beyond my intellect. Martin Trojer has 
a great blog post here which I learned a lot from but I don't understand 
why the final example works:

http://martintrojer.github.io/clojure/2013/07/17/non-tailrecursive-functions-in-coreasync/

He offers this as an example of recursively walking a binary search tree:

(defn walk [tree ch]
  (letfn [(walker [t]
(go
 (when t
   (walker (:left t))
   (>! ch (:value t))
   (walker (:right t)]
(go
 (! ch (:value t))
   (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.


What is current "best practice" regarding exceptions?

2015-04-20 Thread larry google groups

I'm curious, how are people in the Clojure community currently dealing with 
exceptions? I have a diverse set of questions on this topic. 

1.) How many have adopted an Erlang "die fast and restart" strategy?

2.) How many use something like Supervisor to spin up new JVMs? If not 
Supervisor, then what?

3.) How many try to catch all exceptions and therefore try to keep the app 
running under all circumstances? 

4.) If you use something like Kafka to log events, do you use the same log 
to track exceptions, or do you track exceptions separately?

5.) How many use a catch/restart library such as Ribol? 

6.) In general, how bad do you expect things to be before you allow the 
software to die, have Nagios send a pager alert to your sysadmin, drag them 
out of bed at 3 AM, and have a human examine the issue and restart things 
manually? 


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


What are favored Redis-backed queues?

2015-04-24 Thread larry google groups
I'm looking at this old post from Github, that lists the features they were 
looking for in a message queue: 


   - Persistence
   - See what's pending
   - Modify pending jobs in-place
   - Tags
   - Priorities
   - Fast pushing and popping
   - See what workers are doing
   - See what workers have done
   - See failed jobs
   - Kill fat workers
   - Kill stale workers
   - Kill workers that are running too long
   - Keep Rails loaded / persistent workers
   - Distributed workers (run them on multiple machines)
   - Workers can watch multiple (or all) tags
   - Don't retry failed jobs
   - Don't "release" failed jobs

https://github.com/blog/542-introducing-resque

They ended up creating Rescue, and using Redis in the background. Lately 
I've been looking at Carmine, but I'm wondering, what are some of the 
queues that people are using with Clojure, in particular, those using 
Redis? (Since the subject is potentially immense, I figure I should limit 
conversation to Redis. I am already using Redis in production, so for me 
anything using Redis is easy to add in.)









-- 
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: Clojure needs a web framework with more momentum

2015-05-03 Thread larry google groups
The industry has been moving against frameworks for 15 years now. The peak 
of the monolithic framework craze was Struts, back in 2000. After that, 
people started craving something less bloated. That's why the whole 
industry was so excited when Rails emerged in 2004. Bruce Eckel summed up 
the sudden change of mood in his essay "The departure of the 
hyper-enthusiasts":

http://www.artima.com/weblogs/viewpost.jsp?thread=141312

But after awhile, people began to feel that even Rails was bloated, which 
lead to the emergence of micro-frameworks like Sinatra. 

And then, continuing with the trend, we've seen the emergence of 
eco-systems, such as Clojure, that allow the trend to go further: Clojure 
supports such high levels composition that frameworks are no longer needed. 
And this is the direction the industry has been moving for the last 15 
years. Clojure is simply out in front. Most languages don't allow this 
level of composition. 




On Saturday, May 2, 2015 at 8:15:54 PM UTC-4, g vim wrote:
>
> On 03/05/2015 00:53, Christopher Small wrote: 
> > I disagree with the premise entirely. I think that the Clojure community 
> > has just done a better job of building smaller, more modular tooling. 
> > And this is frankly something I prefer, and find refreshing in the 
> > Clojure sphere (as compared with my previous Rails webdev experience). 
> > 
> > Note that to put things on the same footing, you'd want to be noting 
> > that Luminus depend on Ring and Compojure, with commit counts 761 and 
> > 865 resp, and contributor counts 73 and 29 resp. 
> > 
> > I'm not saying that Clojure can't improve it's offering in web dev with 
> > added libraries etc, but I wouldn't want to see us move away from the 
> > modularity with which we've built things, because I think it's a win. 
> > 
> > Just my 2 c 
> > 
> > Chris Small 
>
> Most decent web frameworks these days are built from modular components 
> so this distinction is a bit laboured. Rails is built on top of Active* 
> and Rack so the Ring/Compojure distinction is illusory. Laravel is built 
> on top of Symfony components it could be argued that Symfony has played 
> a similar role to Ring/Compojure in the PHP community. 
>
> Clojure's modular approach is great but I just don't see the need to 
> polarise when there's such a strong business case for structured 
> frameworks. If you look at most of the jobs in web development at 
> Indeed.com they're almost exclusively framework-based. Modular is great 
> but it would also be nice to see a few more Clojure jobs advertised. 
>
> gvim 
>
>

-- 
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: Clojure needs a web framework with more momentum

2015-05-03 Thread larry google groups
This can be read in a manner opposite to what you intended: 

> There's one factor missing from this discussion which is framework 
> community. I think there's immense value in the community factor which 
> emerges when a web framework gains a lot of mindshare. From what I've 
> read in this thread there will probably never be anything like RailsConf 
> for a Clojure web framework simply because shared knowledge can only go 
> so far with the library composition approach. 

A personal story: this week I was at a web agency that was discussing how 
to proceed with a new client. The web agency has several engineers who 
mostly work with PHP, and they love the Symfony framework. They had one 
engineer who wanted to start using Rails for their web projects. I was not 
part of their team, but I was invited to speak, so I said that Rails would 
offer them some benefits. 

One of the PHP engineers then asked me "Can you name any advantage that 
Rails has over PHP?" 

I said, "Ruby is more composable than PHP. Since 2005 PHP has been 
influenced by Java and it has developed a somewhat literal style. That 
makes it harder to integrate 3rd party code. Ruby allows a level of runtime 
reflextion and meta-programming that makes it easy to integrate 3rd party 
code. There is a great wealth of gems that allow you to implement all of 
the standard features that you might need. And it takes very little effort 
to integrate those 3rd party gems." 

And the PHP engineer replied: "Are you aware how huge the Symfony community 
is? Are you aware how many plugins there are? There is vast wealth of 
plugins for Symfony." 

And then I said something which he had apparently never realized, and it 
clearly had a big impact on him: "In Ruby, the gems exist at the level of 
the language. In PHP, the plugins exist at the level of the framework. You 
can not use a Symfony plugin with WordPress, nor can you use a WordPress 
plugin with CakePHP. In PHP, ever CMS has its own plugin system. In Ruby, 
there are few gems that are specific to Rails. Most gems can be used in a 
great variety of contexts, because composing code in Ruby is much easier 
than composing code in PHP." 

And that seemed to settle the debate: they would try Ruby. 

But I'll point out, if they had been open to hearing something a bit more 
radical, I could have continued and pointed out that Ruby has it limits, 
and the very fact that something like RailsConf exists suggests that Ruby 
has a limit. In a truly composable language, where all code can be used 
with any code, the community will exist at the level of the language, not 
at the level of any system written in that language.



On Sunday, May 3, 2015 at 5:38:14 AM UTC-4, g vim wrote:
>
> On 03/05/2015 05:24, Sean Corfield wrote: 
> > On Sat, May 2, 2015 at 8:18 PM, Mark Engelberg   
> > > wrote: 
> > 
> > Clojure is great for creating new, disruptive web models, but what's 
> > the easiest path to creating something that can be done trivially 
> > with, say, Drupal or Django? 
> > 
> > 
> > The question tho' is why you'd want to use Clojure for something that is 
> > already trivially solved with free packaged software for widely used 
> > scripting languages where cheap, plentiful developers are falling over 
> > themselves to help... :) 
> > 
> > Clojure doesn't have to be the solution for every problem. It certainly 
> > doesn't need to be the solution for low-value problems... 
>
> Forgive me if that sounds a little elitist. What if I want to do what 
> Django can do but in Clojure? If Clojure is a better option there should 
> be something which can do more than Django. If my only choice is library 
> composition by definition it doesn't do what Django does well, ie. a 
> fully-structured setup out of the box with a predictable, best of breed 
> set of technologies. 
>
> There are many businesses, large and small, who will only go with a 
> well-established web framework with a vibrant community. Sadly, 
> Clojure's preference for protecting its niche means it will never be an 
> option for these opportunities, hence its poor showing in job listings. 
> Do we, as a community, want to be paid for what we do? 
>
> There's one factor missing from this discussion which is framework 
> community. I think there's immense value in the community factor which 
> emerges when a web framework gains a lot of mindshare. From what I've 
> read in this thread there will probably never be anything like RailsConf 
> for a Clojure web framework simply because shared knowledge can only go 
> so far with the library composition approach. 
>
> > Perfection is the enemy of the good (Gustave Flaubert). 
>
> "The whole is greater than the sum of its parts." (Aristotle) 
>
> gvim 
>

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

Re: Clojure needs a web framework with more momentum

2015-05-03 Thread larry google groups

> The web development industry as reflected in job postings at 
> Indeed.co.uk is still dominated by the likes of Rails, Django, Laravel, 
> Zend, Symfony & Spring so I'm not sure how you've concluded that there's 
> been a 15-year trend towards composition. 

That is a good point, though I would also point out that, according to 
Indeed.com, the use of Clojure is also growing. To me, what's important is 
the growth of the Clojure community, rather than the growth of some 
sub-community focused on a particular niche. 

However, I acknowledge you may have a point about the failure of any of the 
Clojure frameworks to take off. It's possible this is another manifestation 
of the Bipolar Programmer problem: 

http://www.lambdassociates.org/blog/bipolar.htm

"Brilliance and failure are so often mixed together and our initial 
reaction is it shouldn't be.   But it happens and it happens a lot.  Why? 
...But brilliance is not enough.  You need application too, because the 
material is harder at university.   So pretty soon our man is getting B+, 
then Bs and then Cs for his assignments.   He experiences alternating 
feelings of failure cutting through his usual self assurance.  He can still 
stay up to 5.00AM and hand in his assignment before the 9.00AM deadline, 
but what he hands in is not so great.

...So BBMs love Lisp.  And the stunning originality of Lisp is reflective 
of the creativity of the BBM; so we have a long list of ideas that 
originated with Lispers - garbage collection, list handling, personal 
computing, windowing and areas in which Lisp people were amongst the 
earliest pioneers.  So we would think, off the cuff, that Lisp should be 
well established, the premiere programming language because hey - its great 
and we were the first guys to do this stuff.

But it isn't and the reasons why not are not in the language, but in the 
community itself, which contains not just the strengths but also the 
weaknesses of the BBM.

One of these is the inability to finish things off properly.  The phrase 
'throw-away design' is absolutely made for the BBM and it comes from the 
Lisp community.   Lisp allows you to just chuck things off so easily, and 
it is easy to take this for granted.  I saw this 10 years ago when looking 
for a GUI to my Lisp (Garnet had just gone West then).  No problem, there 
were 9 different offerings.  The trouble was that none of the 9 were 
properly documented and none were bug free. Basically each person had 
implemented his own solution and it worked for him so that was fine.   This 
is a BBM attitude; it works for me and I understand it.   It is also the 
product of not needing or wanting anybody else's help to do something."





On Sunday, May 3, 2015 at 9:51:15 AM UTC-4, g vim wrote:
>
> On 03/05/2015 14:39, larry google groups wrote: 
> > The industry has been moving against frameworks for 15 years now. The 
> > peak of the monolithic framework craze was Struts, back in 2000. After 
> > that, people started craving something less bloated. That's why the 
> > whole industry was so excited when Rails emerged in 2004. Bruce Eckel 
> > summed up the sudden change of mood in his essay "The departure of the 
> > hyper-enthusiasts": 
> > 
> > http://www.artima.com/weblogs/viewpost.jsp?thread=141312 
> > 
> > But after awhile, people began to feel that even Rails was bloated, 
> > which lead to the emergence of micro-frameworks like Sinatra. 
> > 
> > And then, continuing with the trend, we've seen the emergence of 
> > eco-systems, such as Clojure, that allow the trend to go further: 
> > Clojure supports such high levels composition that frameworks are no 
> > longer needed. And this is the direction the industry has been moving 
> > for the last 15 years. Clojure is simply out in front. Most languages 
> > don't allow this level of composition. 
> > 
>
> The web development industry as reflected in job postings at 
> Indeed.co.uk is still dominated by the likes of Rails, Django, Laravel, 
> Zend, Symfony & Spring so I'm not sure how you've concluded that there's 
> been a 15-year trend towards composition. Ruby and Python have had 
> lightweight composable alternatives for many years but Rails and Django 
> still dominate. I'm not against the composition at all. I just think we 
> need more structured alternatives that we can at least brand and market 
> as well as teach to Clojure beginners. 
>
> gvim 
>

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

Re: Clojure needs a web framework with more momentum

2015-05-04 Thread larry google groups
> And never has this author proven that programmers with bipolar 
personality are 
> programming more LISP then other languages. 

It's a metaphor. The author is not actually diagnosing Lisp programmers 
with bipolar disorder. The metaphor offers an image of a particular kind of 
student who starts stuff but doesn't finish stuff. 




On Sunday, May 3, 2015 at 2:52:22 PM UTC-4, Leon Grapenthin wrote:
>
> No, it isn't. And never has this author proven that programmers with 
> bipolar personality are programming more LISP then other languages. 
>
> Many larger libraries in the Clojure community are well documented and 
> "finished-off properly".
>
> Web frameworks have been tried and not been picked up. Users have chosen 
> the modular compose it yourself approach. Framework authors have simply 
> stopped maintaining what nobody wanted anyway or split them up into smaller 
> pieces. 
>
>
> On Sunday, May 3, 2015 at 8:25:22 PM UTC+2, larry google groups wrote:
>>
>>
>> > The web development industry as reflected in job postings at 
>> > Indeed.co.uk is still dominated by the likes of Rails, Django, 
>> Laravel, 
>> > Zend, Symfony & Spring so I'm not sure how you've concluded that 
>> there's 
>> > been a 15-year trend towards composition. 
>>
>> That is a good point, though I would also point out that, according to 
>> Indeed.com, the use of Clojure is also growing. To me, what's important is 
>> the growth of the Clojure community, rather than the growth of some 
>> sub-community focused on a particular niche. 
>>
>> However, I acknowledge you may have a point about the failure of any of 
>> the Clojure frameworks to take off. It's possible this is another 
>> manifestation of the Bipolar Programmer problem: 
>>
>> http://www.lambdassociates.org/blog/bipolar.htm
>>
>> "Brilliance and failure are so often mixed together and our initial 
>> reaction is it shouldn't be.   But it happens and it happens a lot.  Why? 
>> ...But brilliance is not enough.  You need application too, because the 
>> material is harder at university.   So pretty soon our man is getting B+, 
>> then Bs and then Cs for his assignments.   He experiences alternating 
>> feelings of failure cutting through his usual self assurance.  He can still 
>> stay up to 5.00AM and hand in his assignment before the 9.00AM deadline, 
>> but what he hands in is not so great.
>>
>> ...So BBMs love Lisp.  And the stunning originality of Lisp is reflective 
>> of the creativity of the BBM; so we have a long list of ideas that 
>> originated with Lispers - garbage collection, list handling, personal 
>> computing, windowing and areas in which Lisp people were amongst the 
>> earliest pioneers.  So we would think, off the cuff, that Lisp should be 
>> well established, the premiere programming language because hey - its great 
>> and we were the first guys to do this stuff.
>>
>> But it isn't and the reasons why not are not in the language, but in the 
>> community itself, which contains not just the strengths but also the 
>> weaknesses of the BBM.
>>
>> One of these is the inability to finish things off properly.  The phrase 
>> 'throw-away design' is absolutely made for the BBM and it comes from the 
>> Lisp community.   Lisp allows you to just chuck things off so easily, and 
>> it is easy to take this for granted.  I saw this 10 years ago when looking 
>> for a GUI to my Lisp (Garnet had just gone West then).  No problem, there 
>> were 9 different offerings.  The trouble was that none of the 9 were 
>> properly documented and none were bug free. Basically each person had 
>> implemented his own solution and it worked for him so that was fine.   This 
>> is a BBM attitude; it works for me and I understand it.   It is also the 
>> product of not needing or wanting anybody else's help to do something."
>>
>>
>>
>>
>>
>> On Sunday, May 3, 2015 at 9:51:15 AM UTC-4, g vim wrote:
>>>
>>> On 03/05/2015 14:39, larry google groups wrote: 
>>> > The industry has been moving against frameworks for 15 years now. The 
>>> > peak of the monolithic framework craze was Struts, back in 2000. After 
>>> > that, people started craving something less bloated. That's why the 
>>> > whole industry was so excited when Rails emerged in 2004. Bruce Eckel 
>>> > summed up the sudden change of mood in his essay "The departure of the 
>>> > hyper-enthusiasts": 
>>> > 
>>>

Re: Clojure needs a web framework with more momentum

2015-05-04 Thread larry google groups

> While I agree that g vim's metrics aren't terribly meaningful, the 
conclusion he's arriving at is an important one. 

I think g vim's metrics have some impact with management. Certainly, its 
worth talking about. A few months ago I was talking to the woman at the New 
York Times who overseas the NYT store, and they had decided to go with PHP 
because it had the Magento shopping cart. Personally, I think Magento is an 
abomination, but Clojure would have been a tough sell there since it has no 
shopping cart app on Github. 





On Sunday, May 3, 2015 at 8:03:43 PM UTC-4, James Reeves wrote:
>
> On 4 May 2015 at 00:51, Jason Whitlark > 
> wrote:
>>
>> While I agree that g vim's metrics aren't terribly meaningful, the 
>> conclusion he's arriving at is an important one.  I've heavily used Clojure 
>> in production for years, and there have been a number of times where having 
>> to hand assemble everything cost lots of support from other engineers.  
>> Luminus is an improvement, but doesn't always generate correct code for 
>> specific sets of options, and is tricky to extend.
>>
>
> I don't disagree. Improving code generation was my motivation for writing 
> lein-generate, and my partial motivation for cljfmt.
>
> - 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/d/optout.


Re: Clojure needs a web framework with more momentum

2015-05-04 Thread larry google groups

> Someone earlier in the thread wrote about how Ruby was the abstraction in 
contrast to PHP where libraries 
> were tied to a framework. I've never worked with Rails seriously, but I 
find it hard to believe that libraries 
> such as shopping carts intended for Rails will work out of the box with 
some other framework - is this the
> case? The ones I looked at (admittedly briefly and some time ago) were 
all Rails-specific.

I made that comment earlier. I am curious what gem is specific to Rails? 
Maybe something specific to RailTies? I am imagine you can find a few if 
you try, but I think they are rare. Stuff like ActiveRecord is not specific 
to Rails -- you can use ActiveRecord with Sinatra, or any other Ruby web 
framework. The same goes for Device (authentication) CanCan (authorization) 
and any of the HTML template languages that you can think of (too many to 
list). Middleware is handled by Rack. So you've got an ORM and HTML 
templates and authentication and authorization and all of that is general 
to Ruby, not to Rails. That is in contrast to PHP where the plugins are 
specific to particular frameworks. 

To my way of thinking, Ruby is better than PHP exactly because it allows a 
higher level of composability  and Clojure is better than Ruby because it 
allows a higher level of composability than Ruby. 



On Monday, May 4, 2015 at 5:47:35 AM UTC-4, Colin Fleming wrote:
>
> Note that the shopping cart is just one specific example from my current 
> itch that needs scratching - it's a very common one, but I'm sure there are 
> plenty more reusable component types that people expect these days.
>
> One problem I see with the composition approach (which I'm a huge fan of 
> in general) is the multiplicative complexity. Something like a shopping 
> cart needs access to the persistence layer. In Rails, this is very easy - 
> you use ActiveRecord and you're done because everything else uses 
> ActiveRecord too. However in the Clojure world we have N persistence 
> libraries implementing M persistence strategies - I've never tried to make 
> a reusable component that sits in the "middle" of the stack (i.e. not 
> something that's relatively trivial to make dependency-free like logging), 
> but I can imagine that it's very difficult. And of course, persistence is 
> just one aspect, there must be many more like authentication and so on. A 
> big part of the reason for Ring's success is that it's the only game in 
> town - I'm sure we wouldn't have so much great functionality built on top 
> of it if we had 4 incompatible options to choose from.
>
> Someone earlier in the thread wrote about how Ruby was the abstraction in 
> contrast to PHP where libraries were tied to a framework. I've never worked 
> with Rails seriously, but I find it hard to believe that libraries such as 
> shopping carts intended for Rails will work out of the box with some other 
> framework - is this the case? The ones I looked at (admittedly briefly and 
> some time ago) were all Rails-specific.
>
> On 4 May 2015 at 20:41, Sven Richter > 
> wrote:
>
>> So, what I gather from this discussion are the following points. Clojure 
>> "needs" a "webframework" that is
>>
>> - fully documented
>> - easy for beginners to use
>> - opinionated about the libraries
>> - structured
>> - composable
>> - has something nice like django's admin backend
>> - a vibrant community support
>> - a shopping card (whereas I would see that fit into an external library)
>>
>> I agree that we have almost everything we need in the form of single 
>> libraries. And I think a mix of leiningen templates and plugins is the way 
>> to go here.
>> The reason for the last statement is my experience with django. The admin 
>> UI is awesome and it fullfills 95% of your needs, but for the rest of it to 
>> make it work I had to start hacking my local django source, which is PITA 
>> obv.
>>
>> I would refrain from doing some magic that only works in a specific 
>> context, but instead just generate code that is put into a fixed structure 
>> and works. The advantage is, one can change the code all the time if one 
>> needs to.
>>
>> All in all this is basically the direction I want to go with closp and 
>> closp-crud. The intention is not to have a webframework, but to automatize 
>> steps that need to be done manually otherwise.
>>
>> I am open for everything in that area, as long as it stays in the limits 
>> I stated above, so, if someone wants to join, he is welcome.
>>
>> I would also go the other way around and put efforts into someone elses 
>> project, if that makes sense.
>>
>> Am Montag, 4. Mai 2015 07:43:43 UTC+2 schrieb puzzler:
>>
>>> On Sat, May 2, 2015 at 11:12 PM, Sven Richter  
>>> wrote:
>>>
 Reading through all the discussion I don't get which features you are 
 actually missing. I love luminus and did a lot with it, however, for me it 
 was missing some standard stuff, that's why I put together closp, which is 
 just another leinin

Re: Clojure needs a web framework with more momentum

2015-05-04 Thread larry google groups
> Very interesting discussion going on here. As a beginner, what I'd like 
to see is not something 
> like Django or Rails, but something like Flask.

Flask started off as a sort of joke -- a few Python programmers, responding 
to criticism of bloat in Django, said it should be possible to create a 
single file web app. And they succeeded. 

You can certainly create a single-file web app in Clojure, and I think 
there are several examples on the web, that are very much comparable to the 
simple examples given for Flask. But, again, I agree with those above who 
suggested that maybe this should be offered as a lein template. 




On Monday, May 4, 2015 at 6:06:46 AM UTC-4, John Louis Del Rosario wrote:
>
> Very interesting discussion going on here. As a beginner, what I'd like to 
> see is not something like Django or Rails, but something like Flask.
> Where someone can just (require 'someframework) and it works. Maybe it 
> could have thin wrappers over compojure, etc., since it will need to be 
> opinionated anyway. It's still very simple, but takes away a lot of the 
> guesswork and the distributed docs across multiple projects problem.
>
> Additional features can be done as libraries then, but specific for 
> `someframework`, like what Flask has. e.g. `someframework-sessions`, etc.
>
> Just my 2c.
>
> On Sunday, May 3, 2015 at 4:43:53 AM UTC+8, g vim wrote:
>>
>> I recently did some research into web frameworks on Github. Here's what 
>> I found: 
>>
>>
>> FRAMEWORK   LANG  CONTRIBUTORS COMMITS 
>>
>> LuminusClojure28678 
>> CaribouClojure 2275 
>>
>> BeegoGolang991522 
>>
>> PhoenixElixir  1241949 
>>
>> YesodHaskell   1303722 
>>
>> LaravelPHP2684421 
>>
>> PlayScala   4176085 
>>
>> SymfonyPHP113020914 
>>
>> RailsRuby   269151000 
>>
>>
>> One could conclude from this that the Clojure community isn't that 
>> interested in web development but the last Clojure survey suggests 
>> otherwise. Clojure's library composition approach to everything only 
>> goes so far with large web applications, as Aaron Bedra reminded us in 
>> March last year: www.youtube.com/watch?v=CBL59w7fXw4 . Less manpower 
>> means less momentum and more bugs. Furthermore, I have a hunch that 
>> Clojure's poor adoption as indicated by Indeed.com maybe due to this 
>> immaturity in the web framework sphere. Why is it that Elixir, with a 
>> much smaller community and lifespan than Clojure's, has managed to put 4 
>> times as much mindshare into its main web framework when its module 
>> output, as measured by modulecounts.com, is a tiny fraction of 
>> Clojure's? 
>>
>> gvim 
>>
>>
>>
>>
>>

-- 
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: Clojure needs a web framework with more momentum

2015-05-04 Thread larry google groups
> I've taken a couple of long lived Rails apps from Rails 1 to Rails 4 and 
while there have been breaking changes with 
> each major version change (and some minor versions) in general it's 
pretty easy to keep up with the latest 
> versions and there are copious docs (even whole ebooks in some cases) to 
walk developers through the changes.

Composable libraries instead of plugins avoids the biggest problems that 
Rails faces. In my experience, the toughest issue with upgrading old Rails 
apps is upgrading the plugins. I recall last year I was given the task of 
upgrading an old install of Redmine. I struggled with it for 2 days -- the 
app itself was easy to upgrade, but all the old plugins broke. I offered to 
fix them all by hand, but I estimated that would take me a week or two, at 
which point management decided that the problem was no longer worth it, so 
they decided to live with the old version of Redmine until such time as the 
whole thing could be replaced entirely. 

The world of Rails, and the world of Ruby, has evolved, and nowadays 
plugins are just gems that follow some conventions. Which is to  say, Rails 
has been moving in the direction that Clojure is already in. But Clojure is 
out in front on this issue. In the Clojure eco-system, if you use the word 
"plugin" you are probably talking about lein, or maybe Stuart Sierra's 
Component system. The conversation is happening at higher level than in the 
Ruby world. 

I think it is a sign of failure when you have to do what we did with 
Redmine -- give up any hope of upgrading it and instead wait till you can 
replace it entirely. At least so far, I have not see than come up in any 
Clojure project I've worked on, though I acknowledge Clojure projects don't 
have the age of old Rails projects. 

If, 10 years from now, Clojure has the reputation that upgrading rarely 
hits the "we must replace this entirely" problem, then I think we can say, 
in absolute terms, that Clojure is superior than Ruby. And this would also 
be true in the specific category of "web frameworks". 







On Monday, May 4, 2015 at 8:09:35 AM UTC-4, Sean Johnson wrote:
>
>
>
> On Monday, May 4, 2015 at 4:41:02 AM UTC-4, Sven Richter wrote:
>
> All in all this is basically the direction I want to go with closp and 
>> closp-crud. The intention is not to have a webframework, but to automatize 
>> steps that need to be done manually otherwise.
>>
>
> One potential problem with this "web framework" as app template approach 
> is upgrade-ability.  When 2.0 of your "framework" comes out, what happens 
> to an app generated from 1.0 that wants to benefit from the new 
> capabilities?
>
> It's not a showstopper to the approach. It's just something to think hard 
> about. I've taken a couple of long lived Rails apps from Rails 1 to Rails 4 
> and while there have been breaking changes with each major version change 
> (and some minor versions) in general it's pretty easy to keep up with the 
> latest versions and there are copious docs (even whole ebooks in some 
> cases) to walk developers through the changes.
>
> Cheers,
> 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: Clojure needs a web framework with more momentum

2015-05-04 Thread larry google groups
> I read several comments about how easy it is to upgrade Rails. 
> Either things have been improving at the speed of light or I am 
> a complete idiot. My last upgrades from 2.x to 2.y have been 
> nightmares, dependency hell multiplied by an unknown factor 
> above 100... 


I strongly agree. I think of upgrading as the major pain point in the Rail 
eco-system. It has gotten better, but as recently as last week I was trying 
to upgrade a gem and ran into version conflicts. Search StackOverflow for 
Bundler error messages and you realize this is still a huge point of pain 
-- there are thousands of people struggling to deal with cryptic version 
conflict errors, and unable to get Bundler to resolve the problem for them. 





On Monday, May 4, 2015 at 10:42:15 AM UTC-4, Luc wrote:
>
> +1 
>
> This exactly the kind of exercises that needs to done as part of a 
> product design. New potential needs have to be foreseen at this 
> stage, not 18 months after a first release. 
>
> This is why I hate frameworks, they assume some of these 
> decisions and it's not always stated clearly. Someone has to 
> discover the sad effects and if you are not lucky, you're the 'king of the 
> farce'. 
>
> They lure you in a trap pampered with 'easy', 'obvious'... Until 
> you have a need that cannot be met along the way. 
>
> I read several comments about how easy it is to upgrade Rails. 
>
> Either things have been improving at the speed of light or I am 
> a complete idiot. My last upgrades from 2.x to 2.y have been 
> nightmares, dependency hell multiplied by an unknown factor 
> above 100... 
>
> I would rather deal with an explicit dependency graph than 
> work with magic stuff that eventually breaks in obscure ways 
> after an upgrade and requires mods in remote places in foreign code. 
>
> Luc P. 
>
> > The thing that bugs me the most about these sort of conversations about 
> > "best practices" is that they often present a set of solutions without 
> > first analyzing the problem at hand. 
> > 
> > If I came to this mailing list and asked "I want to write a websever in 
> > Clojure..what should I use?". The response would most likely be Ring + 
> > Compojure. Okay, not bad options, but that recommendation has been given 
> > with absolutely no analysis of what I'm trying to accomplish. What if I 
> > need async? What if I need web sockets? What sort of connection load am 
> I 
> > expecting? Will my system handle mostly persistent connections (like 
> > websockets or SSE), or will it be more canned (and cacheable) data? If 
> > someone recommends Ring to me, I may be pigeonholed into some system 
> I'll 
> > have to refactor later. Perhaps the best option is Aleph or Pedestal. 
> > 
> > That's the real issue with canned responses like rails tutorial. They 
> > assume my needs match your needs and match the needs of most people. 
> That's 
> > just not the best way to go about doing software development. And it's a 
> > problem I've seen in so many areas of computing. 
> > 
> > I've lost countless hundreds of hours of my life to frameworks that 
> default 
> > to bulky serialization formats (like XML or JSON), or frameworks that 
> > assume LAN connections to the servers, or frameworks that assume I won't 
> be 
> > using multi-threading, or frameworks that assume I won't try to load 10k 
> > rows on a single page, or frameworks that assume any number of things. 
> The 
> > thing I love the most about the Clojure community is that, more than any 
> > other community I've been a part of, they try to ask you to think before 
> > you jump. 
> > 
> > So what I would recommend is more of a set of guidelines, and matrices. 
> > List all the frameworks/libraries on one axis, and features on another, 
> and 
> > start commenting. Make a page like this: ( 
> > http://en.wikipedia.org/wiki/Comparison_of_video_container_formats) 
> > 
> > Mention that Ring is well supported by the community, but doesn't work 
> well 
> > with fully async servers, mention that Aleph does all the async you 
> need, 
> > but is a bit non-standard. Mention that data.json is pure Clojure, but 
> > cheshire is most likely faster. 
> > 
> > Just present the options, and let the users make up their own minds. You 
> > don't understand the needs of all of your users. So don't try to solve 
> > their problems, instead present them with options and let them make up 
> > their own minds.  I guarantee you that whatever tech you recommend to 
> > someone, the won't like some aspect of it,  so better to present them 
> with 
> > all the options and let them choose, then they can only blame themselves 
> if 
> > it doesn't work out exactly like they expected. 
> > 
> > 
> > 
> > On Mon, May 4, 2015 at 7:34 AM, Ernie de Feria  > 
> > wrote: 
> > 
> > > I would like to echo the sentiment expressed by several posters in 
> this 
> > > thread, but with a slight twist. A few years back I picked up Ruby and 
> Ruby 
> > > on Rails as the language/framework to create 

Re: Clojure needs a web framework with more momentum

2015-05-04 Thread larry google groups

> My guess is that over the next 2-3 years we will see some clojure 
frameworks emerge but 
> they will not be like "traditional" frameworks.  

Or the space for "web framework" will always default to Rails. Clojure 
certainly has some great frameworks in other areas, such as distributed 
data processing: 

Avout

tessers

Onyx

Storm

Pulsar

Quassar

(Some of these are more Java than Clojure, but Java interop is one of 
Clojure's strengths.)





On Monday, May 4, 2015 at 3:00:54 PM UTC-4, Gregg Reynolds wrote:
>
>
> On May 4, 2015 7:16 AM, "Eric MacAdie" > 
> wrote:
> >
> > I think what Clojure needs is a default. It doesn't matter if it is a 
> "web framework" like Rails, or "libraries strung together" like Luminus.
> >
>
> What Clojure needs is, well nothing. What the market MAY need is an 
> entrepreneur who will produce the framework the OP craves.  No takers so 
> far.  Conclusion: not a genuine unmet need.   But in the long run simple 
> economics say the Clojure approach will win.  You can't make your product 
> stand out by using the same framework everybody else uses.  The inevitable 
> trend, driven by basic economics, is toward bespoke stuff, which is where 
> Clojure excels.  My guess is that over the next 2-3 years we will see some 
> clojure frameworks emerge but they will not be like "traditional" 
> frameworks.  They'll be infinitely and easily customizable because they 
> wont force choices-they'll just make the easy stuff not only easy but 
> flexible. My 2 cents.
>
> > When a Ruby newbie asks how to make a web app, the default answer is to 
> look at Rails. In Python, the default answer is Django. Compared to that, 
> the default answer in Clojure to do it yourself can sound like "go jump off 
> a cliff".  
> >
> > = Eric MacAdie
> >
> >
> > On Mon, May 4, 2015 at 7:09 AM, Sean Johnson  > wrote:
> >>
> >>
> >>
> >> On Monday, May 4, 2015 at 4:41:02 AM UTC-4, Sven Richter wrote:
> >>
> >>> All in all this is basically the direction I want to go with closp and 
> closp-crud. The intention is not to have a webframework, but to automatize 
> steps that need to be done manually otherwise.
> >>
> >>
> >> One potential problem with this "web framework" as app template 
> approach is upgrade-ability.  When 2.0 of your "framework" comes out, what 
> happens to an app generated from 1.0 that wants to benefit from the new 
> capabilities?
> >>
> >> It's not a showstopper to the approach. It's just something to think 
> hard about. I've taken a couple of long lived Rails apps from Rails 1 to 
> Rails 4 and while there have been breaking changes with each major version 
> change (and some minor versions) in general it's pretty easy to keep up 
> with the latest versions and there are copious docs (even whole ebooks in 
> some cases) to walk developers through the changes.
> >>
> >> Cheers,
> >> Sean
> >>
> >> -- 
> >> You received this message because you are subscribed to the Google
> >> Groups "Clojure" group.
> >> To post to this group, send email to clo...@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+u...@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+u...@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 clo...@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+u...@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+u...@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...@googlegroup

What is "best practice" regarding transducers

2015-05-06 Thread larry google groups
I would like to write a detailed blog post about how developers are 
actually using transducers. If you have a public project on Github that is 
using transducers, would you please point me to it? I would like to see 
what you did. 

If you are not using transducers, but you plan to in the near future, I 
would be curious to see the code where you think they could help you.

-- 
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: Clojure needs a web framework with more momentum

2015-05-06 Thread larry google groups
> Maybe I don't entirely understand what a web framework is, but it seems 
to me 
> like Immutant is an example of something that might fit into a lot of the 
buckets. 

I agree. Perhaps people feel that it lacks the auto-generation of 
scaffolding for CRUD? Though I imagine that would be easy to fix. 




On Tuesday, May 5, 2015 at 7:29:28 PM UTC-4, Surgo wrote:
>
> Maybe I don't entirely understand what a web framework is, but it seems to 
> me like Immutant is an example of something that might fit into a lot of 
> the buckets. Could someone explain how that isn't the case?
>
> Thanks,
> -- Morgon
>

-- 
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: Clojure needs a web framework with more momentum

2015-05-06 Thread larry google groups
>Also, most of the time you do not need any complex "framework" to build a 
basic webservice with Clojure. 

True. Also, what is a basic web service? I have a friend who just got done 
with the 12 week crash-course in Rails that is offered by DevBootcamp in 
New York City. In 12 weeks he had to learn: 

what is an http header?

what is a request?

what is a response?

what is Unix?

what is a terminal? 

basic terminal tools: cd, find, grep, cat, less, |, >, <, sudo, chmod

what is a "port" and how does it work with IP addresses?

what is DNS?

what is an application server? 

what is a web server? 

how to set up a reverse proxy

Javascript

Ruby

gems

Rails

Rake commands: db:migrate, db:load, 'rake routes' etc,

ActiveRecord

SQL

MySql

foreign key relationships

Javascript

pre-processors

HTML template languages

etc, etc, etc,

You get the idea. There is a lot to know. The only language that makes it 
really easy to get going on the web is PHP. If the question is "How can 
Clojure be as simple as PHP to get started with?" then I think that is an 
interesting question, and we could work toward that as a community -- there 
might be some defaults that eventually let Lisp demonstrate its power to 
simplify things. But making things as easy as PHP is a difficult challenge. 
Making things as easy as Rails should be easy, because Rails is not 
especially easy for beginners. 





On Wednesday, May 6, 2015 at 9:20:58 AM UTC-4, Stanislav Yurin wrote:
>
> A bit strange approach. Where are ring, compojure, or maybe .. om?
>
> Also, most of the time you do not need any complex "framework" to build a 
> basic webservice with Clojure. 
> Say, Luminus and Caribou are too complex for me, hence too restrictive.
> After writing sufficient amount of fairly good Clojure code, super rapid 
> web-service mocking skills come to you as a bonus.
>
> On Saturday, May 2, 2015 at 11:43:53 PM UTC+3, g vim wrote:
>>
>> I recently did some research into web frameworks on Github. Here's what 
>> I found: 
>>
>>
>> FRAMEWORK   LANG  CONTRIBUTORS COMMITS 
>>
>> LuminusClojure28678 
>> CaribouClojure 2275 
>>
>> BeegoGolang991522 
>>
>> PhoenixElixir  1241949 
>>
>> YesodHaskell   1303722 
>>
>> LaravelPHP2684421 
>>
>> PlayScala   4176085 
>>
>> SymfonyPHP113020914 
>>
>> RailsRuby   269151000 
>>
>>
>> One could conclude from this that the Clojure community isn't that 
>> interested in web development but the last Clojure survey suggests 
>> otherwise. Clojure's library composition approach to everything only 
>> goes so far with large web applications, as Aaron Bedra reminded us in 
>> March last year: www.youtube.com/watch?v=CBL59w7fXw4 . Less manpower 
>> means less momentum and more bugs. Furthermore, I have a hunch that 
>> Clojure's poor adoption as indicated by Indeed.com maybe due to this 
>> immaturity in the web framework sphere. Why is it that Elixir, with a 
>> much smaller community and lifespan than Clojure's, has managed to put 4 
>> times as much mindshare into its main web framework when its module 
>> output, as measured by modulecounts.com, is a tiny fraction of 
>> Clojure's? 
>>
>> gvim 
>>
>>
>>
>>
>>

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


What is a real example of the Observer pattern?

2015-05-06 Thread larry google groups
I am looking here: 

https://strange-loop-2012-notes.readthedocs.org/en/latest/monday/functional-design-patterns.html

I read: 

Observer Pattern 

   
   - Register an observer with a stateful function

The observer could take the old and new state, along with either the delta, 
the triggering event, or the container.

*Can anyone point to something on Github that shows an example of this? *





-- 
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: Clojure needs a web framework with more momentum

2015-05-06 Thread larry google groups
This is certainly true:

"Docs are about empathy, which means discussions should show empathy."

I am not sure what you mean by "That response does not respect people’s 
limited time." I think you mean that Pull Requests are often a waste of 
time, because you can not be certain if the Pull Request will be accepted? 
And some Pull Requests linger for months, or they are never accepted but no 
reason is given for their rejection? I'm curious if you feel there are any 
restrictions that should be put on a documentation site? 



On Wednesday, May 6, 2015 at 7:32:28 PM UTC-4, Tj Gabbour wrote:
>
>
> On Wednesday, May 6, 2015 at 11:12:58 PM UTC+2, Andy Fingerhut wrote:
>>
>> Maybe you are not aware of the history, but clojure-doc.org exists 
>> specifically because someone who spoke out loudly and repeatedly against 
>> CAs took the time to create it, and it _only_ requires a Github account and 
>> creating a pull request.
>>
>
>  That response does not respect people’s limited time. Examples from my 
> own brief experience: 
>
>- Had to run some Ruby server… the instructions of which are currently 
>in a dead link 
>
> .
>  
>
>- Had to fix a problem 
> with that Ruby 
>server’s markdown lib. 
>- Weekly+ releases were jarring when I was used to rapid release 
>cycles. 
>
>  You’re advocating a course of action whose predictable effect is to eat 
> up unexpected hours of helpful people’s time. Probably triggering Impostor 
> Syndrome in half of them because it’s supposed to be raly easy… 
>
> People need to make rational decisions on time allocation. They should be 
> cautioned that clojure-doc.org vs clojuredocs.org is a highly confusing 
> situation, which will impact the effectiveness of their efforts. Docs are 
> about empathy, which means discussions should show empathy. 
>
> This whole discussion is such a headache… With all the attempted shaming 
> for not contributing, when many of us spend massive amounts of time 
> contributing, and are merely trying to assess pitfalls from the morass of 
> half-truths… 
>   
>

-- 
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: Clojure needs a web framework with more momentum

2015-05-07 Thread larry google groups
I assume most people here would agree with this: 

"Nothing is merely a pull request; it is someone's valuable time spent in 
contemplation and action."

At the same time, I assume most people who would use Clojure will also know 
something about Git, and I think this applies even to fairly new 
programmers (though not total beginners, and, as I said before, if the 
question is "How do we make Clojure as easy as PHP?" I think it is an 
interesting challenge, and one we are far from having an answer for). 

I am uncertain what restrictions might be appropriate for a documentation 
site. As you say: "I hear PHP suffered from misleading and messy community 
docs… though it was very useful for my (basic) purposes."

I suppose a good answer would combine the openness of a wiki with some kind 
of voting so that visitors could see which edits were judged to be the best 
-- something like StackOverflow. 

Failing that, we could point people to the pull requests on Github, and 
tell them that there is important information in the pull requests, which 
might sound messy, but I don't think it would be any more messy that the messy 
community docs that you say PHP had. 

--- lawrence
 





On Thursday, May 7, 2015 at 5:48:11 AM UTC-4, Tj Gabbour wrote:
>
>  First of all, I apologize to the group for any unfriendliness in my 
> response. (Which may be poisonous to this group’s culture, I don’t know. 
> Unfortunately, many old frustrations of mine were triggered, when I felt my 
> question was given an uncharitable interpretation.) 
>
> The term “pull request” hides a lot of complexity. (Some point out 
> 
>  
> it means “Go fuck yourself.”) Nothing is merely a pull request; it is 
> someone's valuable time spent in contemplation and action. 
>
>  If we were in a team, here’s some things we might discuss: 
>
>- How to support each other? (Given varying 
>skills/confidence/energy/power.) 
>- What is our ultimate goal? (“Documentation” almost never is one. 
>It’s just a tactic.) 
>- What is our audience? (Why do we wish to serve them, and how?) 
>- What is our process for improving quality/effectiveness? 
>(After-action reviews, building institutional knowledge…) 
>- Who are external partners, and how do they think? (We’ve mentioned 
>Clojurewerkz and The Clojure.org 14.) 
>
>
>  So when we’re evaluating contributing to clojure-docs.org: 
>
>- Should we add metrics to show us how many people read 
>clojure-docs.org, as a first step to gauging effectiveness? 
>- What do you think about the content there, and how would you make it 
>far better? (Pictures? Examples? Literary structure?) 
>
>
>  When we’re evaluating contributing to clojure.org: 
>
>- Examples of our intended audience, and what problems do they have? 
>- How to best work with the strengths of The Clojure.org 14’s 
>conservativism? 
>- Clojure’s uses are diverse; how do we represent its core? Might it 
>be entirely appropriate to have a sparse site, more or less like it is 
> now? 
>Because the real entry-points should be around emerging clusters like 
>React.js libs? 
>
>
>  These may seem like lots of things to think about, but so is writing 100 
> good lines of debugged code. 
>
> *are any restrictions that should be put on a documentation site?*
>>
>>
> Yes, depending on what you want to avoid. 
>
> For example, I hear PHP suffered from misleading and messy community docs… 
> though it was very useful for my (basic) purposes. 
>
> But once we agree there need to be restrictions, what can we do to 
> mitigate the downsides? For example, raising barriers to entry can lead to 
> intimidation. But you can mitigate it by being supportive and offering 
> mentoring. Or simply being proactively honest and apologetic about it. 
>
> I hope I didn't misunderstand your points?
>  

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


how do I clojure.string/replace regex characters? Escaping gives me StringIndexOutOfBoundsException

2014-08-04 Thread larry google groups
I'm working on a website with a frontender who asked to be able to save 
JSON maps that contain field names such as: 

"$$hashKey" : "00C"

The dollar signs are a violation of MongoDB limits on field names, so i 
need to convert to something else and then convert back. So I thought I 
would convert to * or !. Converting is no problem, but converting back is 
not working. I walk the deeply nested JSON objects with: 

(defn walk-deep-structure [next-item function-to-transform-values]
  (walk/postwalk
   (fn [%]
 (if (and (vector? %) (= (count %) 2) (keyword? (first %)))
   [(function-to-transform-values %) (second %)]
   %))
   next-item))

which I call like: 

results (walk-deep-structure @future-data-return (fn [%] 
(st/replace (name (first %)) #"\*" "$")))]

which doesn't work. 

I switch to the repl to test this:

=> (def f  (fn [%] (st/replace (name (first %)) #"!" "$")))

=> (f [:!!username "michael"])

 StringIndexOutOfBoundsException String index out of range: 1 
 java.lang.String.charAt (String.java:695)

or: 

=>  (def f  (fn [%] (st/replace (name (first %)) #"\*" "$")))

=> (f [:**username "michael"])

 StringIndexOutOfBoundsException String index out of range: 1 
 java.lang.String.charAt (String.java:695)

What am I doing wrong? 

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


Can I compare ::logging from one namespace with ::logging from another?

2014-08-09 Thread larry google groups
Please forgive this stupid question, but I'm still trying to understand 
exactly what the double "::" means. I have read that I can use (derive) to 
establish a hierarchy and I can imagine how this would be useful for things 
like throwing errors and catching them and logging, but I've also read that 
"::" adds the namespace to the symbol, so I would assume that I can not 
match ::logging from one namespace with ::logging from another? 

I'm thinking of this especially in my use of Slingshot, where I was 
thinking of doing something like: 

(throw+ {:type ::database-problem :message "something wrong in the database 
query"})

and then at a higher level in my code I was going to catch it with 
something like: 

(derive  ::database-problem ::logging)

and then using Dire: 

(dire/with-handler! #'database/remove-this-item
  [:type ::logging]
  (fn [e & args]
(timbre/log (str " database/remove-this-item: The time : " 
(dates/current-time-as-string) ( str e

but conceptually I am having trouble understanding how ::logging in one 
namespace can match ::logging in another namespace. Perhaps I should just 
use normal keywords? 


-- 
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: Can I compare ::logging from one namespace with ::logging from another?

2014-08-09 Thread larry google groups
Thank you for the responses. However, when I look here:

http://clojure.org/multimethods

I see that it says:

"You can define hierarchical relationships with (derive child parent). 
Child and parent can be either symbols or keywords, and must be 
namespace-qualified"

Is there any way I can establish a hierarchical relationship without it 
being name-spaced qualified? I would like to be able to (slingshot/throw+ 
{:type some-symbol}) and have this be caught in a different namespace, but 
I need a way to match the some-symbol, and I would ideally like it if 
some-symbol 
might be part of a hierarchy, such that I'm matching again some-symbol's 
parent. 

Is that possible? 

I guess I could hard-code all of the namespaces, such that the symbols are 
all:

 some-namespace/some-symbol 

but that does great reduce the flexibility of the system.


 



On Saturday, August 9, 2014 3:30:33 PM UTC-4, James Reeves wrote:
>
> Jozef is correct, but to give some examples:
>
> (ns example.core
>   (:require [example.other :as other]))
>
> (= ::foo :example.core/foo)
> (= ::other/foo :example.other/foo)
>
> (not= :foo :example.core/foo)
> (not= :example.core/foo :example.other/foo)
> (not= :other/foo ::other/foo)
>
> - James
>
>
>
> On 9 August 2014 19:14, Jozef Wagner > 
> wrote:
>
>> Keep in mind that :: is just a syntax sugar that is processed by the 
>> reader, before the compiler kicks in. ::foo is a shorthand for 
>> :your.current.ns/foo. Its purpose is to make it easy to create keywords 
>> that do not clash with other ones. 
>>
>> Keywords are equal (and identical) only when both of their namespaces and 
>> names are equal. :ns1/foo is thus not equal to :ns2/foo, nor to just :foo. 
>> :: 
>> is used in cases where you want to exploit this important property of 
>> keywords, so that your keyword won't e.g. clash with other keywords in a 
>> collection, contents of which you don't know.
>>
>> Jozef
>>
>>
>> On Saturday, August 9, 2014 7:46:45 PM UTC+2, larry google groups wrote:
>>>
>>> Please forgive this stupid question, but I'm still trying to understand 
>>> exactly what the double "::" means. I have read that I can use (derive) to 
>>> establish a hierarchy and I can imagine how this would be useful for things 
>>> like throwing errors and catching them and logging, but I've also read that 
>>> "::" adds the namespace to the symbol, so I would assume that I can not 
>>> match ::logging from one namespace with ::logging from another? 
>>>
>>> I'm thinking of this especially in my use of Slingshot, where I was 
>>> thinking of doing something like: 
>>>
>>> (throw+ {:type ::database-problem :message "something wrong in the 
>>> database query"})
>>>
>>> and then at a higher level in my code I was going to catch it with 
>>> something like: 
>>>
>>> (derive  ::database-problem ::logging)
>>>
>>> and then using Dire: 
>>>  
>>> (dire/with-handler! #'database/remove-this-item
>>>   [:type ::logging]
>>>   (fn [e & args]
>>> (timbre/log (str " database/remove-this-item: The time : " 
>>> (dates/current-time-as-string) ( str e
>>>
>>> but conceptually I am having trouble understanding how ::logging in one 
>>> namespace can match ::logging in another namespace. Perhaps I should just 
>>> use normal keywords? 
>>>
>>>
>>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@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: Can I compare ::logging from one namespace with ::logging from another?

2014-08-09 Thread larry google groups

> You can however make up some namespace and use it throughout your code, 
so 
> instead of ::foo, you'll use :my-ns/foo. This namespace don't have to 
> the current or even a real one.

Interesting. I had no idea. Thank you for that tip.



On Saturday, August 9, 2014 4:02:36 PM UTC-4, Jozef Wagner wrote:
>
> If you want keywords to participate in a multimethod hierarchy, you must 
> qualify them. 
>
> You can however make up some namespace and use it throughout your code, so 
> instead of 
> ::foo, you'll use :my-ns/foo. This namespace don't have to the current or 
> even a real one.
>
> Jozef
>
> On Saturday, August 9, 2014 9:49:58 PM UTC+2, larry google groups wrote:
>>
>> Thank you for the responses. However, when I look here:
>>
>> http://clojure.org/multimethods
>>
>> I see that it says:
>>
>> "You can define hierarchical relationships with (derive child parent). 
>> Child and parent can be either symbols or keywords, and must be 
>> namespace-qualified"
>>
>> Is there any way I can establish a hierarchical relationship without it 
>> being name-spaced qualified? I would like to be able to (slingshot/throw+ 
>> {:type some-symbol}) and have this be caught in a different namespace, but 
>> I need a way to match the some-symbol, and I would ideally like it if 
>> some-symbol 
>> might be part of a hierarchy, such that I'm matching again some-symbol's 
>> parent. 
>>
>> Is that possible? 
>>
>> I guess I could hard-code all of the namespaces, such that the symbols 
>> are all:
>>
>>  some-namespace/some-symbol 
>>
>> but that does great reduce the flexibility of the system.
>>
>>
>>  
>>
>>
>>
>> On Saturday, August 9, 2014 3:30:33 PM UTC-4, James Reeves wrote:
>>>
>>> Jozef is correct, but to give some examples:
>>>
>>> (ns example.core
>>>   (:require [example.other :as other]))
>>>
>>> (= ::foo :example.core/foo)
>>> (= ::other/foo :example.other/foo)
>>>
>>> (not= :foo :example.core/foo)
>>> (not= :example.core/foo :example.other/foo)
>>> (not= :other/foo ::other/foo)
>>>
>>> - James
>>>
>>>
>>>
>>> On 9 August 2014 19:14, Jozef Wagner  wrote:
>>>
>>>> Keep in mind that :: is just a syntax sugar that is processed by the 
>>>> reader, before the compiler kicks in. ::foo is a shorthand for 
>>>> :your.current.ns/foo. Its purpose is to make it easy to create keywords 
>>>> that do not clash with other ones. 
>>>>
>>>> Keywords are equal (and identical) only when both of their namespaces 
>>>> and names are equal. :ns1/foo is thus not equal to :ns2/foo, nor to just 
>>>> :foo. :: is used in cases where you want to exploit this important 
>>>> property of keywords, so that your keyword won't e.g. clash with other 
>>>> keywords in a collection, contents of which you don't know.
>>>>
>>>> Jozef
>>>>
>>>>
>>>> On Saturday, August 9, 2014 7:46:45 PM UTC+2, larry google groups wrote:
>>>>>
>>>>> Please forgive this stupid question, but I'm still trying to 
>>>>> understand exactly what the double "::" means. I have read that I can use 
>>>>> (derive) to establish a hierarchy and I can imagine how this would be 
>>>>> useful for things like throwing errors and catching them and logging, but 
>>>>> I've also read that "::" adds the namespace to the symbol, so I would 
>>>>> assume that I can not match ::logging from one namespace with ::logging 
>>>>> from another? 
>>>>>
>>>>> I'm thinking of this especially in my use of Slingshot, where I was 
>>>>> thinking of doing something like: 
>>>>>
>>>>> (throw+ {:type ::database-problem :message "something wrong in the 
>>>>> database query"})
>>>>>
>>>>> and then at a higher level in my code I was going to catch it with 
>>>>> something like: 
>>>>>
>>>>> (derive  ::database-problem ::logging)
>>>>>
>>>>> and then using Dire: 
>>>>>  
>>>>> (dire/with-handler! #'database/remove-this-item
>>>>>   [:type ::logging]
>>>>>   (fn [e & args]
>>>>> (timbre/log (str " database/remove

Re: Can I compare ::logging from one namespace with ::logging from another?

2014-08-09 Thread larry google groups

> Keywords hierarchies need to be namespace qualified, but you can require 
> namespaces and use the alias, as I demonstrated in my earlier example.

I wasn't thinking clearly about what this meant, but now I see what you 
mean. I could potentially have all of my (derive) statements in one 
namespace, define the keywords there, and then any namespace that will use 
those keywords can require that namespace and use those keywords. Thank you 
for your help.




On Saturday, August 9, 2014 4:02:59 PM UTC-4, James Reeves wrote:
>
> Keywords hierarchies need to be namespace qualified, but you can require 
> namespaces and use the alias, as I demonstrated in my earlier example.
>
> To give a further example, suppose you have a namespace like:
>
> (ns example.other)
>
> (derive ::dog ::animal)
> (derive ::cat ::animal)
>
> (defmulti speak identity)
>
> If you require this namespace, you can use the alias instead of the fully 
> qualified name in keywords:
>
> (ns example.core
>   (require [example.other :as o]))
>
> (defmethod o/speak ::o/dog [_] "bark")
>     (defmethod o/speak ::o/cat [_] "meow")
>
> - James
>
>
> On 9 August 2014 20:49, larry google groups  > wrote:
>
>> Thank you for the responses. However, when I look here:
>>
>> http://clojure.org/multimethods
>>
>> I see that it says:
>>
>> "You can define hierarchical relationships with (derive child parent). 
>> Child and parent can be either symbols or keywords, and must be 
>> namespace-qualified"
>>
>> Is there any way I can establish a hierarchical relationship without it 
>> being name-spaced qualified? I would like to be able to (slingshot/throw+ 
>> {:type some-symbol}) and have this be caught in a different namespace, but 
>> I need a way to match the some-symbol, and I would ideally like it if 
>> some-symbol 
>> might be part of a hierarchy, such that I'm matching again some-symbol's 
>> parent. 
>>
>> Is that possible? 
>>
>> I guess I could hard-code all of the namespaces, such that the symbols 
>> are all:
>>
>>  some-namespace/some-symbol 
>>
>> but that does great reduce the flexibility of the system.
>>
>>
>>  
>>
>>
>>
>> On Saturday, August 9, 2014 3:30:33 PM UTC-4, James Reeves wrote:
>>
>>> Jozef is correct, but to give some examples:
>>>
>>> (ns example.core
>>>   (:require [example.other :as other]))
>>>
>>> (= ::foo :example.core/foo)
>>> (= ::other/foo :example.other/foo)
>>>
>>> (not= :foo :example.core/foo)
>>> (not= :example.core/foo :example.other/foo)
>>> (not= :other/foo ::other/foo)
>>>
>>> - James
>>>
>>>
>>>
>>> On 9 August 2014 19:14, Jozef Wagner  wrote:
>>>
>>>>  Keep in mind that :: is just a syntax sugar that is processed by the 
>>>> reader, before the compiler kicks in. ::foo is a shorthand for 
>>>> :your.current.ns/foo. Its purpose is to make it easy to create keywords 
>>>> that do not clash with other ones. 
>>>>
>>>> Keywords are equal (and identical) only when both of their namespaces 
>>>> and names are equal. :ns1/foo is thus not equal to :ns2/foo, nor to just 
>>>> :foo. :: is used in cases where you want to exploit this important 
>>>> property of keywords, so that your keyword won't e.g. clash with other 
>>>> keywords in a collection, contents of which you don't know.
>>>>
>>>> Jozef
>>>>
>>>>
>>>> On Saturday, August 9, 2014 7:46:45 PM UTC+2, larry google groups wrote:
>>>>>
>>>>> Please forgive this stupid question, but I'm still trying to 
>>>>> understand exactly what the double "::" means. I have read that I can use 
>>>>> (derive) to establish a hierarchy and I can imagine how this would be 
>>>>> useful for things like throwing errors and catching them and logging, but 
>>>>> I've also read that "::" adds the namespace to the symbol, so I would 
>>>>> assume that I can not match ::logging from one namespace with ::logging 
>>>>> from another? 
>>>>>
>>>>> I'm thinking of this especially in my use of Slingshot, where I was 
>>>>> thinking of doing something like: 
>>>>>
>>>>> (throw+ {:type ::database-problem :message "something wrong in the 
>>>

  1   2   3   4   5   >