REPL Namespace Display

2008-12-18 Thread brian

Hope this is the appropriate place for this... anyway, very trivial
issue.  I was playing around in an effort to begin to understand the
ns fns & managed to get the current/active ns & REPL displayed ns out
of synch via the following:

user> *ns*
#
user> (in-ns 'howdy)
#
howdy> (clojure.core/refer 'clojure.core)
nil
howdy> *ns*
#
howdy> (remove-ns 'howdy)
#
howdy> *ns*
#
howdy>
howdy> (in-ns 'user)
#
howdy>

Switching to another ns corrects it.

BTW l'm really looking forward to digging into this language as a long
time Java wanna-be Lispy programmer (so thx Rich)

-Brian

--~--~-~--~~~---~--~~
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: REPL Namespace Display

2008-12-18 Thread brian

That's correct.  And I couldn't reproduce with the java
clojure.lang.Repl either.  Guess I was thinking it was just a pass
through...  I'm an emacs & slime noob too ;)

-Brian

On Dec 18, 6:00 pm, Chouser  wrote:
> On Thu, Dec 18, 2008 at 6:02 PM, brian  wrote:
>
> > Hope this is the appropriate place for this... anyway, very trivial
> > issue.  I was playing around in an effort to begin to understand the
> > ns fns & managed to get the current/active ns & REPL displayed ns out
> > of synch via the following:
>
> > user> *ns*
> > #
> > user> (in-ns 'howdy)
> > #
> > howdy> (clojure.core/refer 'clojure.core)
> > nil
> > howdy> *ns*
> > #
> > howdy> (remove-ns 'howdy)
> > #
> > howdy> *ns*
> > #
> > howdy>
> > howdy> (in-ns 'user)
> > #
> > howdy>
>
> > Switching to another ns corrects it.
>
> We now have several Repls, and each acts slightly differently.  I
> couldn't reproduce this with clojure.lang.Repl.  I'm guessing from
> your prompt that you're using emacs/slime.  Is that correct?
>
> --Chouser
--~--~-~--~~~---~--~~
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: Is knowing Java a prerequisite for using Clojure?

2009-09-17 Thread Brian
As a Java programmer coming to Clojure I would be very interested in the
intended application.  How you approach that from a Clojure perspective is
what I'm interested in.  I've programmed in Lisp in the distant past
(Symbolics Lisp machines) and still have very found memories of that
environment.  Having programmed in C -> C++ -> Java since then ... well I
just miss the edit run test cycle that was so natural with those Lisp
machines.

My own concern is falling back on what I know best and using Java semantics
when they are not appropriate.

With the excellent Bruce Eckel recommendation and your background you might
be able to get by with going directly to the java language specification (
http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html).

Brian F.

On Thu, Sep 17, 2009 at 10:59 AM, Terrance Davis
wrote:

>
> I'll add my two cents.
>
> You sound like you already program, so basic Java knowledge is useful
> with Clojure, but not necessary. You can pick up what you need to know
> as you learn Clojure. You will find hooks into Java are a lot more
> pleasant than interfacing with C and C++. I'm saying that one from
> experience.
>
> As for first books on Java,  Look for Bruce Eckel's "Thinking in
> Java" That is absolutely the best book currently available for Java. It
> is more written for beginner programmers, but would likely work for a
> more experienced programmer, too.
>
> -Terrance
>
> Hugh Aguilar wrote:
> > Thanks for the encouragement. I've already got the book.
> >
> > I suppose eventually I will have to learn Java. I have been putting it
> > off because I hear a lot of Java-bashing from programmers, and have
> > also noted that this is generally the impetus for the development of
> > languages such as Clojure and Scala and the dozens of others. On the
> > other hand, Java can't be any more difficult than C or C++ that I
> > already know. With languages such as Factor or Python I am relying on
> > the bindings to C and C++ programs, so with Clojure I would be relying
> > on the bindings to Java programs, which might be an improvement.
> >
> > Can you recommend a book or online resource for learning what I need
> > to know about Java? I saw the book "Learning Java" with the tigers on
> > the cover and it looked pretty good, but also pretty extensive ---
> > quite a lot to digest there, which might be why they put a large meat-
> > eater on the cover.
> >
> > If anybody is interested, I can tell you what my intended application
> > for Clojure is, and you can tell me about how you would go about such
> > a project. I will just be writing toy programs initially, but I do
> > actually have a specific purpose for Clojure in mind.
> >
> > On Sep 16, 11:34 pm, Krukow  wrote:
> >
>

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

2009-09-18 Thread Brian
I thought the question was looking for the Clojure equivalent to Ruby on
Rails (i.e.  Conjure ).

On Fri, Sep 18, 2009 at 9:54 AM, David Nolen  wrote:

> What do you mean by development frameworks? IDE support?
> On Fri, Sep 18, 2009 at 8:08 AM, demet8  wrote:
>
>>
>> Im new to Clojure. Are there any development frameworks for clojure
>> worth noting yet?
>>
>>

--~--~-~--~~~---~--~~
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: Funding Clojure 2010

2009-12-17 Thread brian
I have  looked at hundreds of languages and flavors  more as a kind
of hobby these days. I know these comments are getting a  bit
tedious by now, but what I think clojure needs is higher visibility.
Right now only a handful of people know about it. The thought
occurred to me while I was installing another open source language
system today, I (but have only dabbled in clojure a bit so far), was
that they had a visually appealing website. Visual signals send a
strong message. This particular one has a lucious red strawberry 
(hint hint) motif, simple, clean, and appealing, and kind of
lightens up a  drab subject, makes it almost.. well I won't get into
it.  I'm coming at this as a bit of an outsider as have not been a
programmer in a long time since I got involved with start-ups. So
anyways, my point is, if you're looking for mass appeal, eveything
is pretty web-based packaging these days. Forget even the CD idea,
thats old, even for an old guy like me (I don't even have a CD drive
on my computer anymore !). Also a windows installer, and no asking
the user to compile things, make it as shrink wrapped as possible,
with a good online tutorial, and chat  help all bundled together in
a quick install.

Brian




Rich Hickey wrote:
> Funding Clojure 2010
>
> Background
> --
>
> It is important when using open source software that you consider who
> is paying for it, because someone is. There is no such thing as free
> software.
>
> Sometimes open source software is developed under a license with
> undesirable properties (e.g. the GPL), such that people are willing to
> pay for a (proprietary) version of it that is not subject to that
> license. Both Monty Widenius [1] and Richard Stallman [2] have argued
> for the necessity of such a mechanism to fund open source software,
> lest there be insufficient resources for its development. Clojure
> doesn't use the GPL, thus conveying more freedom to its users, but
> precluding me from funding it via dual licensing.
>
> Some companies develop technology as a component of a proprietary
> product or service, absorbing it as a necessary expense, only to
> decide that it is not a core, unique, or advantage-bearing business
> function. They can reduce their costs in ongoing development by open
> sourcing it, deriving benefit from community contributions and letting
> them focus on their core business [3]. It is important to note that
> the bulk of the costs are often in the original development, and are
> paid for by the proprietary product or service. That is not the case
> for Clojure.
>
> Some open source is the product of academic research, and is funded by
> the academic institution and/or research grants [4]. That is not the
> case for Clojure.
>
> Some open source software is (partially) funded by proprietary
> support. It is important to note that often the support income does
> not in fact make it to the people who create the software. Such income
> models work best for support sold to conservative enterprises [5].
> That is not the case for Clojure.
>
> Some companies 'fund' open source software by dedicating some of their
> employees' time, or making investments, in its development. There must
> be some business value to the company for doing so (e.g. it helps them
> sell hardware [6]), and thus is ultimately paid for by their
> proprietary products/services. That is not the case for Clojure.
>
> There *are* companies that make software themselves, whose consumers
> see a value in it and willingly pay to obtain that value. The money
> produced by this process pays the salaries of the people who are
> dedicated to making it, and some profit besides. It's called
> "proprietary software". People pay for proprietary software because
> they have to, but otherwise the scenario is very similar to open
> source - people make software, consumers get value from it. In fact,
> we often get a lot less with proprietary software - vendor lock-in, no
> source etc. Most alarmingly, this is the only model that associates
> value with software itself, and therefore with the people who make it.
>
> Why don't people pay for open source software? Primarily, because they
> don't *have to*. I think also, partially, it is because open source
> software often doesn't have a price tag. I think it should. I'd like
> to pay for open source, and know the money is going to those who
> create it. I'd like companies to *expect* to pay for it. I'd like to
> see people make a living (and even profit!) directly making open
> source, not as a side effect of some other proprietary process, to
> dedicate themselves to it, and not have it be hobb

newbie clojure/eclipse question

2010-01-03 Thread brian
Hi all,

I installed counterclockwise 0.43 in eclipse following the website 
instructions precisely . Everything seems fine, I  created a simple 
clojure  project, when I run it, I get:

Could not locate Clojure resource on classpath: x.clj

where x.clj is the file I am running (as REPL )

I looked in the run configuration,and x is in the default classpath.

thanks

Brian



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


newbie swank clojure emacs

2010-01-10 Thread brian


Hi,

I'm trying to follow the directions at:

http://riddell.us/tutorial/slime_swank/slime_swank.html

I'm doing this under cygwin.

I think I did everything correctly, but it seems not to find the 
clojure.jar file although I have it and the clojure-contrib.jar in my 
home directory as configured in the my .emacs file. I am using emacs 23.

I also have the clojure jar's  in my classpath.

this is my .emacs :

;; clojure-mode
(add-to-list 'load-path "~/.emacs.d/elpa/clojure-mode-1.6")
(require 'clojure-mode)

;; swank-clojure
(add-to-list 'load-path "~/opt/swank-clojure/src/emacs")
(add-to-list 'load-path "~/.emacs.d/elpa/swank-clojure-1.1.0")

(setq swank-clojure-jar-path "~/clojure.jar"
 swank-clojure-extra-classpaths (list
 "~/opt/swank-clojure/src/main/clojure"
 "~/clojure-contrib.jar"))

(require 'swank-clojure-autoload)

;; slime
(eval-after-load "slime"
 '(progn (slime-setup '(slime-repl

(add-to-list 'load-path "~/opt/slime")
(require 'slime)
(slime-setup)





this is the error when I call slime





(require 'swank.swank)

(swank.swank/ignore-protocol-version "2010-01-06")

(do (.. java.net.InetAddress getLocalHost getHostAddress) 
nil)(swank.swank/start-server 
"/cygdrive/c/DOCUME~1/brian/LOCALS~1/Temp/slime.2848" :encoding 
"iso-latin-1-unix")


java.lang.NoClassDefFoundError: clojure/main
Caused by: java.lang.ClassNotFoundException: clojure.main
   at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: clojure.main.  Program will exit.
Exception in thread "main"
Process inferior-lisp exited abnormally with code 1

Thanks
Brian


-- 
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: newbie swank clojure emacs

2010-01-11 Thread brian

Thanks for this, this is very cool indeed!

Eric Lavigne wrote:

Since you are using Windows, you may find Clojure Box easier to install.

http://clojure.bighugh.com/

I followed the riddell.us/.../slime_swank.html tutorial yesterday, and
can confirm that it works well for Ubuntu.


On Sun, Jan 10, 2010 at 5:58 AM, brian  wrote:
  

Hi,

I'm trying to follow the directions at:

http://riddell.us/tutorial/slime_swank/slime_swank.html

I'm doing this under cygwin.

I think I did everything correctly, but it seems not to find the clojure.jar
file although I have it and the clojure-contrib.jar in my home directory as
configured in the my .emacs file. I am using emacs 23.
I also have the clojure jar's  in my classpath.

this is my .emacs :

;; clojure-mode
(add-to-list 'load-path "~/.emacs.d/elpa/clojure-mode-1.6")
(require 'clojure-mode)

;; swank-clojure
(add-to-list 'load-path "~/opt/swank-clojure/src/emacs")
(add-to-list 'load-path "~/.emacs.d/elpa/swank-clojure-1.1.0")

(setq swank-clojure-jar-path "~/clojure.jar"
swank-clojure-extra-classpaths (list
"~/opt/swank-clojure/src/main/clojure"
"~/clojure-contrib.jar"))

(require 'swank-clojure-autoload)

;; slime
(eval-after-load "slime"
 '(progn (slime-setup '(slime-repl

(add-to-list 'load-path "~/opt/slime")
(require 'slime)
(slime-setup)





this is the error when I call slime





(require 'swank.swank)

(swank.swank/ignore-protocol-version "2010-01-06")

(do (.. java.net.InetAddress getLocalHost getHostAddress)
nil)(swank.swank/start-server
"/cygdrive/c/DOCUME~1/brian/LOCALS~1/Temp/slime.2848" :encoding
"iso-latin-1-unix")

java.lang.NoClassDefFoundError: clojure/main
Caused by: java.lang.ClassNotFoundException: clojure.main
  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: clojure.main.  Program will exit.
Exception in thread "main"
Process inferior-lisp exited abnormally with code 1

Thanks
Brian



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

clojure box "value as variable is void ?"

2010-01-11 Thread brian

Hi all,

I just installed Clojure Box, for me, marvelous! Everything works as 
described except one small problem though, following these directions 
from the readme.rtf:


"

You can also add jars or source directories from custom locations by 
adding them to your classpath in in your .emacs. To make 
c:/dev/project/src/a.clj and everything in c:/dev/my-lib.jar available, 
put this:


(setq swank-clojure-classpath

(list “c:/dev/project/src” “c:/dev/my-lib.jar”))

"

well, this is (all )my .emacs file, cut and pasted from that file:


(setq swank-clojure-classpath

(list “c:/dev/project/src” “c:/dev/my-lib.jar”))



and I get this error when I bring clojure box up:

Warning (initialization): An error occurred while loading `c:/Documents 
and Settings/brian/.emacs':


Symbol's value as variable is void: “c:/dev/project/src”


of course, these aren't my real paths, but I wanted to try this cut and 
paste to see if that was the problem.


Thanks!
Brian



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

trying to call jar files in clojure box

2010-01-12 Thread brian

Hi,

I am not sure if this is a Clojure Box problem or a compojure problem 
but in an attempt to try calling external jars files in clojure box,and 
wanting to try compojure, to eliminate any possible path problems, I've 
put compojure and all dependancies in the Clojure Box/lib  directory.


When I try to run

(use 'compojure)

   (defroutes my-app
 (GET "/"
   (html [:h1 "Hello World"]))
 (ANY "*"
   (page-not-found)))

   (run-server {:port 8080}
 "/*" (servlet my-app))


java.lang.Exception: Unable to resolve symbol: defroutes in this context 
(NO_SOURCE_FILE:1)

 [Thrown class clojure.lang.Compiler$CompilerException]

I get the same problem when I setq in my .emacs.


Thanks
Brian

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

classpath in clojure box

2010-01-12 Thread brian

Hi all,


I put the example code from Programming Clojure book
here:

C:\shcloj-code\code\examples

I verified that "introduction.clj"  is there.

This is cut and pasted from my .emacs file located in c:\program files\brian


(setq swank-clojure-classpath
(list "c:\shcloj-code\code\examples"))
 


but when I enter (require 'introduction)

I get this:

java.io.FileNotFoundException: Could not locate introduction__init.class 
or introduction.clj on classpath:  (NO_SOURCE_FILE:0)

 [Thrown class clojure.lang.Compiler$CompilerException]

Restarts:
0: [ABORT] Return to SLIME's top level.
1: [CAUSE] Throw cause of this exception

Backtrace:
 0: clojure.lang.Compiler.eval(Compiler.java:4543)
 1: clojure.core$eval__3990.invoke(core.clj:1728)
--more--

-- 
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: classpath in clojure box

2010-01-13 Thread brian

Shawn Hoover wrote:


On Tue, Jan 12, 2010 at 10:05 PM, brian <mailto:brw...@gmail.com>> wrote:


Hi all,


I put the example code from Programming Clojure book
here:

C:\shcloj-code\code\examples

I verified that "introduction.clj"  is there.

This is cut and pasted from my .emacs file located in c:\program
files\brian


(setq swank-clojure-classpath
   (list "c:\shcloj-code\code\examples")


Assuming that your HOME environment variable is set to c:\program 
files\brian


yes


and your .emacs is actually being loaded (I mention that because 
normally .emacs is under your Documents and Settings or Users directory,

c:\program files\brian

its here and i double checked it is the one i'm actually editing


but it should respect %HOME%), I think the problem is the \ in your 
classpath need to be escaped. Try converting them to / or \\.



tried both, they don't work

user> (require 'introduction)
nil

user> (use 'introduction)
; Evaluation aborted.


java.lang.Exception: namespace 'introduction' not found (NO_SOURCE_FILE:0)
 [Thrown class clojure.lang.Compiler$CompilerException]

Restarts:
0: [ABORT] Return to SLIME's top level.
1: [CAUSE] Throw cause of this exception

Backtrace:
 0: clojure.lang.Compiler.eval(Compiler.java:4543)
 1: clojure.core$eval__3990.invoke(core.clj:1728)



Shawn


-- 
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: classpath in clojure box

2010-01-13 Thread brian


I was wondering if this is the right statement for setting the external  
classpath?


setq swank-clojure-classpath



Shawn Hoover wrote:


On Tue, Jan 12, 2010 at 10:05 PM, brian <mailto:brw...@gmail.com>> wrote:


Hi all,


I put the example code from Programming Clojure book
here:

C:\shcloj-code\code\examples

I verified that "introduction.clj"  is there.

This is cut and pasted from my .emacs file located in c:\program
files\brian


(setq swank-clojure-classpath
   (list "c:\shcloj-code\code\examples")


Assuming that your HOME environment variable is set to c:\program 
files\brian and your .emacs is actually being loaded (I mention that 
because normally .emacs is under your Documents and Settings or Users 
directory, but it should respect %HOME%), I think the problem is the \ 
in your classpath need to be escaped. Try converting them to / or \\.


Shawn


-- 
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: classpath in clojure box

2010-01-14 Thread brian

Shawn Hoover wrote:


On Wed, Jan 13, 2010 at 8:38 PM, brian <mailto:brw...@gmail.com>> wrote:



I was wondering if this is the right statement for setting the
external  classpath?

setq swank-clojure-classpath


Another way is to use M-x swank-clojure-project. You enter a directory 
and it automatically adds that directory/src to the classpath. You 
could drop all of the shcloj-code\code into, say,

this didn't work

c:\projects\shcloj\src. M-x swank-clojure-project and at the prompt 
c:\projects\shcloj. Then try (require 'examples.introduction).


If that doesn't work, check the value of swank-clojure-classpath after 
the REPL starts: C-h v swank-clojure-classpath. Make sure it looks 
good and then fire up SysInternals ProcMon and filter on *.clj and see 
where the system is really looking.

Shawn,

The above didn't work, but apparently it doesn't pick up my .emacs file, 
which has


(setq swank-clojure-classpath
(list "c:/shcloj-code/code/examples"))

itknows where home is, when it boots up, the default is my home dir, 
where .emacs is



when i do C-h v

swank-clojure-classpath is a variable defined in `swank-clojure.el'.
Its value is
("c:/Program Files/Clojure Box/emacs/site-lisp/../../swank-clojure/src" 
"c:/shcloj-code/code/examples" "c:/Program Files/Clojure 
Box/lib/clojure-contrib.jar" "c:/Program Files/Clojure 
Box/lib/clojure.jar" "c:/Program Files/Clojure 
Box/lib/commons-codec-1.3.jar" "c:/Program Files/Clojure 
Box/lib/commons-fileupload-1.2.1.jar" "c:/Program Files/Clojure 
Box/lib/commons-io-1.4.jar" "c:/Program Files/Clojure 
Box/lib/compojure.jar" "c:/Program Files/Clojure 
Box/lib/grizzly-http-servlet-1.9.10.jar" "c:/Program Files/Clojure 
Box/lib/grizzly-http-webserver-1.9.10.jar" "c:/Program Files/Clojure 
Box/lib/jetty-6.1.15.jar" "c:/Program Files/Clojure 
Box/lib/jetty-util-6.1.15.jar" "c:/Program Files/Clojure 
Box/lib/servlet-api-2.5-20081211.jar")


-- 
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: classpath in clojure box

2010-01-14 Thread brian

Michael Wood wrote:

2010/1/14 brian :
  

Shawn Hoover wrote:


On Wed, Jan 13, 2010 at 8:38 PM, brian mailto:brw...@gmail.com>> wrote:


   I was wondering if this is the right statement for setting the
   external  classpath?

   setq swank-clojure-classpath


Another way is to use M-x swank-clojure-project. You enter a directory and
it automatically adds that directory/src to the classpath. You could drop
all of the shcloj-code\code into, say,
  

this didn't work



c:\projects\shcloj\src. M-x swank-clojure-project and at the prompt
c:\projects\shcloj. Then try (require 'examples.introduction).
  


Just a thought:

Add "c:/shcloj-code/code" (without the "examples") to your classpath
and then (use 'examples.introduction) as mentioned by Sean above.

I haven't tried this myself or looked at the code, but I suspect
that's what the problem is.

  


gee, i thought that would work, but nope


If that doesn't work, check the value of swank-clojure-classpath after the
REPL starts: C-h v swank-clojure-classpath. Make sure it looks good and then
fire up SysInternals ProcMon and filter on *.clj and see where the system is
really looking.
  

Shawn,

The above didn't work, but apparently it doesn't pick up my .emacs file,
which has

(setq swank-clojure-classpath
   (list "c:/shcloj-code/code/examples"))

itknows where home is, when it boots up, the default is my home dir, where
.emacs is


when i do C-h v

swank-clojure-classpath is a variable defined in `swank-clojure.el'.
Its value is
("c:/Program Files/Clojure Box/emacs/site-lisp/../../swank-clojure/src"
"c:/shcloj-code/code/examples" "c:/Program Files/Clojure
Box/lib/clojure-contrib.jar" "c:/Program Files/Clojure Box/lib/clojure.jar"
"c:/Program Files/Clojure Box/lib/commons-codec-1.3.jar" "c:/Program
Files/Clojure Box/lib/commons-fileupload-1.2.1.jar" "c:/Program
Files/Clojure Box/lib/commons-io-1.4.jar" "c:/Program Files/Clojure
Box/lib/compojure.jar" "c:/Program Files/Clojure
Box/lib/grizzly-http-servlet-1.9.10.jar" "c:/Program Files/Clojure
Box/lib/grizzly-http-webserver-1.9.10.jar" "c:/Program Files/Clojure
Box/lib/jetty-6.1.15.jar" "c:/Program Files/Clojure
Box/lib/jetty-util-6.1.15.jar" "c:/Program Files/Clojure
Box/lib/servlet-api-2.5-20081211.jar")



  


-- 
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: classpath in clojure box

2010-01-14 Thread brian

Michael Wood wrote:

2010/1/14 brian :
  

Shawn Hoover wrote:


On Wed, Jan 13, 2010 at 8:38 PM, brian mailto:brw...@gmail.com>> wrote:


   I was wondering if this is the right statement for setting the
   external  classpath?

   setq swank-clojure-classpath


Another way is to use M-x swank-clojure-project. You enter a directory and
it automatically adds that directory/src to the classpath. You could drop
all of the shcloj-code\code into, say,
  

this didn't work



c:\projects\shcloj\src. M-x swank-clojure-project and at the prompt
c:\projects\shcloj. Then try (require 'examples.introduction).
  


Just a thought:

Add "c:/shcloj-code/code" (without the "examples") to your classpath
and then (use 'examples.introduction) as mentioned by Sean above.

I haven't tried this myself or looked at the code, but I suspect
that's what the problem is.

  

I take that back,it did! hurray!

here I called (take 10 fibs) and worked , instead of  "(take 10 
introduction.fibs)" which is what the book says



If that doesn't work, check the value of swank-clojure-classpath after the
REPL starts: C-h v swank-clojure-classpath. Make sure it looks good and then
fire up SysInternals ProcMon and filter on *.clj and see where the system is
really looking.
  

Shawn,

The above didn't work, but apparently it doesn't pick up my .emacs file,
which has

(setq swank-clojure-classpath
   (list "c:/shcloj-code/code/examples"))

itknows where home is, when it boots up, the default is my home dir, where
.emacs is


when i do C-h v

swank-clojure-classpath is a variable defined in `swank-clojure.el'.
Its value is
("c:/Program Files/Clojure Box/emacs/site-lisp/../../swank-clojure/src"
"c:/shcloj-code/code/examples" "c:/Program Files/Clojure
Box/lib/clojure-contrib.jar" "c:/Program Files/Clojure Box/lib/clojure.jar"
"c:/Program Files/Clojure Box/lib/commons-codec-1.3.jar" "c:/Program
Files/Clojure Box/lib/commons-fileupload-1.2.1.jar" "c:/Program
Files/Clojure Box/lib/commons-io-1.4.jar" "c:/Program Files/Clojure
Box/lib/compojure.jar" "c:/Program Files/Clojure
Box/lib/grizzly-http-servlet-1.9.10.jar" "c:/Program Files/Clojure
Box/lib/grizzly-http-webserver-1.9.10.jar" "c:/Program Files/Clojure
Box/lib/jetty-6.1.15.jar" "c:/Program Files/Clojure
Box/lib/jetty-util-6.1.15.jar" "c:/Program Files/Clojure
Box/lib/servlet-api-2.5-20081211.jar")



  


-- 
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: [ANN] units.clj - unit conversion functions without repeating yourself

2010-01-14 Thread Brian
This is more java related but there is a java library and application (
http://futureboy.us/frinkdocs/) that provides a set of very powerful unit
conversion tools.


On Thu, Jan 14, 2010 at 10:49 AM, Scott Jaderholm wrote:

> Hi,
>
> I created a library that provides unit conversion functions[1] for
> several common units and allows you to define new units conversions
> with a single equation.
>
> The library does a few interesting things automatically:
>
> First, if you define inches-to-feet, it will create feet-to-inches for you.
> Second, if you define inches-to-feet and feet-to-meters, it will
> create inches-to-meters and meters-to-inches for you.
> Third, it will create the equivalent square and cubic functions as well.
>
> So for inches, feet, yards, meters, centimeters, millimeters, miles,
> and kilometers, if you specify 7 equations this library will define
> 168 conversion functions for you (56 each for length, area, and
> volume).
>
> The code is at http://gist.github.com/276662#file_units.clj
>
> I'd love to receive feedback.
>
> Thanks,
> Scott
>
> Notes
> [1] For a reliable alternative, see JScience.org
>
> --
> 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: classpath in clojure box

2010-01-15 Thread brian

ok i see it

Brian

Shawn Hoover wrote:


On Thu, Jan 14, 2010 at 3:17 AM, brian <mailto:brw...@gmail.com>> wrote:


The above didn't work, but apparently it doesn't pick up my .emacs
file, which has

(setq swank-clojure-classpath
   (list "c:/shcloj-code/code/examples"))

itknows where home is, when it boots up, the default is my home
dir, where .emacs is


when i do C-h v

swank-clojure-classpath is a variable defined in `swank-clojure.el'.
Its value is
("c:/Program Files/Clojure
Box/emacs/site-lisp/../../swank-clojure/src"
"c:/shcloj-code/code/examples" "c:/Program Files/Clojure
Box/lib/clojure-contrib.jar" "c:/Program Files/Clojure
Box/lib/clojure.jar" "c:/Program Files/Clojure
Box/lib/commons-codec-1.3.jar" "c:/Program Files/Clojure
Box/lib/commons-fileupload-1.2.1.jar" "c:/Program Files/Clojure
Box/lib/commons-io-1.4.jar" "c:/Program Files/Clojure
Box/lib/compojure.jar" "c:/Program Files/Clojure
Box/lib/grizzly-http-servlet-1.9.10.jar" "c:/Program Files/Clojure
Box/lib/grizzly-http-webserver-1.9.10.jar" "c:/Program
Files/Clojure Box/lib/jetty-6.1.15.jar" "c:/Program Files/Clojure
Box/lib/jetty-util-6.1.15.jar" "c:/Program Files/Clojure
Box/lib/servlet-api-2.5-20081211.jar")


Actually it's there, buried between the swank-clojure/src and 
clojure-contrib.jar. It's Clojure Box's fault on the ordering, but it 
would only matter if you were trying to put your own version of 
swank-clojure on 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

Microsoft drops Software Transactional Memory

2010-05-14 Thread Brian
Not directly related to Clojure but I thought this would be of interest to
folks:
http://www.infoq.com/news/2010/05/STM-Dropped

http://www.reddit.com/r/programming/comments/c4367/microsofts_experiments_with_software/

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

2018-04-05 Thread Brian
I'm interested.

For my own uses I would be curious to see how difficult it would be to
update (degrade? retrograde? :) ) to 3.5/Pathfinder.


On Thu, Apr 5, 2018 at 11:04 AM, Davide Taviani  wrote:

> Hey!
> I'm a DM, a user of OrcPub2 and a full-time clojure + cljs developer (for
> data science stuff).
> I'm definitely interested, let me know!
> Also, I play with another colleague, so there's definitely a few more D&D
> + Clojure nerds out there.
>
> Davide
>
>
> On Tuesday, March 27, 2018 at 11:12:25 PM UTC+3, Larry Christensen wrote:
>>
>> I have a Dungeons & Dragons app built in Clojure and ClojureScript. With The
>> Original OrcPub  and The New OrcPub
>>  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.
>

-- 
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: Reviewers needed for new Clojure book!

2015-08-25 Thread Brian
A bit late to the party but please include me in the list of possible
reviews.
thanks,
BDF.


On Tue, Aug 25, 2015 at 12:06 AM, Akhil Wali 
wrote:

> Thank you everyone for the great response!
> I'll notify Packt and they shall contact anyone who is shortlisted as a
> reviwer.
>
>
> On Monday, August 24, 2015 at 12:16:06 PM UTC+5:30, Akhil Wali wrote:
>>
>> If anyone is interested in being a reviewer for a new book "*Mastering
>> Clojure*" by Packt Publishing, please let me know.
>> Reviewers will be entitled to a 6 montn subscription of PacktLib
>> .
>>
>> Here's the list of topics covered in this title.
>>
>>-
>>- Working with Sequences and Types
>>- Orchestrating Concurrency and Parallelism
>>- Parallelization using Reducers
>>- Writing Macros
>>- Composing Transducers
>>- Using Functors and Monads
>>- Programming with Logic
>>- Asynchronous Programming
>>- Reactive Programming
>>- Working with Tests
>>- Troubleshooting and Best Practices
>>
>>
>> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Help with idiomatic clojure.

2015-11-12 Thread Brian
Thanks Colin, Thanks Erik
Exactly what I was looking for.

I've updated the gist with Colin's suggestion and a bit of destructuring.
If this project gets any bigger I will definitely look at vlad
<https://github.com/logaan/vlad> and Prismatic Schema
<https://github.com/Prismatic/schema>.

BDF.

On Thu, Nov 12, 2015 at 12:02 PM, Erik Assum  wrote:

> There is also https://github.com/logaan/vlad which helps with validation.
>
> Erik.
> --
> i farta
>
> Den 12. nov. 2015 kl. 17.12 skrev Colin Yates :
>
> A nicer equivalent form would be:
>
> (cond-> []
>   this-error? (conj “It failed with this error”)
>   that-error? (conj “It failed with that error”))
>
> However, purely for validation there are a few utilities out there
> already. Checkout the ‘Validation’ section on
> http://www.clojure-toolbox.com
>
> Also, in terms of enforcing contracts - Prismatic Schema is highly
> recommended but hard to ‘englishify’ the errors. Failures are considered
> API failures rather than happy-case failures.
>
> On 12 Nov 2015, at 16:09, Brian Forester  wrote:
>
> I'm writing a very small REST application in clojure using compojure and 
> ring.  One problem is that I don't have anyone who can review my work or 
> provide feedback.
>
>
> I've written a small function to validate a simple JSON request.  I'm 
> validating the three values that are in the post and collecting the errors 
> for return.
>
> The core mechanic I've used
>
>  (swap! errors str "'grepString' must not be null or empty.\n"))
>
> does not seem to be a very idiomatic clojure way to solve this simple problem.
>
>
> https://gist.github.com/BDF/8e61daf8fe8b602a248a
>
>
> Any feedback is appreciated.
>
> BDF.
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: Help with idiomatic clojure.

2015-11-13 Thread Brian
I think I like 'seq' better than 'empty?'.I'm sure my opinions will
firm up after writing some more clojure.

> Also, in no-errors branch you probably want to return status: 200?
I  picked the function where I knew there was a better way.   This
validation function is called from this bit code.
(POST "/usagelog" req
   (let [errors (validate-request req)]
  (if (seq errors)
 errors
 (ring.util.response/response (grep-log-and-response req)))
   )
)


On Thu, Nov 12, 2015 at 4:08 PM, Colin Yates  wrote:

> One other minor point (if (seq some-sequence) true false) is preferred by
> some (I won’t say more idiomatic) than (if (empty? some-sequence) true
> false). Also, in no-errors branch you probably want to return status: 200?
>
>
> On 12 Nov 2015, at 19:44, Brian  wrote:
>
> Thanks Colin, Thanks Erik
> Exactly what I was looking for.
>
> I've updated the gist with Colin's suggestion and a bit of destructuring.
> If this project gets any bigger I will definitely look at vlad
> <https://github.com/logaan/vlad> and Prismatic Schema
> <https://github.com/Prismatic/schema>.
>
> BDF.
>
> On Thu, Nov 12, 2015 at 12:02 PM, Erik Assum  wrote:
>
>> There is also https://github.com/logaan/vlad which helps with
>> validation.
>>
>> Erik.
>> --
>> i farta
>>
>> Den 12. nov. 2015 kl. 17.12 skrev Colin Yates :
>>
>> A nicer equivalent form would be:
>>
>> (cond-> []
>>   this-error? (conj “It failed with this error”)
>>   that-error? (conj “It failed with that error”))
>>
>> However, purely for validation there are a few utilities out there
>> already. Checkout the ‘Validation’ section on
>> http://www.clojure-toolbox.com
>>
>> Also, in terms of enforcing contracts - Prismatic Schema is highly
>> recommended but hard to ‘englishify’ the errors. Failures are considered
>> API failures rather than happy-case failures.
>>
>> On 12 Nov 2015, at 16:09, Brian Forester 
>> wrote:
>>
>> I'm writing a very small REST application in clojure using compojure and 
>> ring.  One problem is that I don't have anyone who can review my work or 
>> provide feedback.
>>
>>
>> I've written a small function to validate a simple JSON request.  I'm 
>> validating the three values that are in the post and collecting the errors 
>> for return.
>>
>> The core mechanic I've used
>>
>>  (swap! errors str "'grepString' must not be null or empty.\n"))
>>
>> does not seem to be a very idiomatic clojure way to solve this simple 
>> problem.
>>
>>
>> https://gist.github.com/BDF/8e61daf8fe8b602a248a
>>
>>
>> Any feedback is appreciated.
>>
>> BDF.
>>
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to c

Re: Anyone on Google+ yet?

2011-07-14 Thread Brian
https://plus.google.com/100763770877733610336/posts


On Thu, Jul 14, 2011 at 3:15 PM, Jonathan Cardoso
wrote:

> https://plus.google.com/115729535012467854741
>
>  --
> 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: ClojureScript Presentation - video

2011-07-23 Thread Brian
Here ya go:
http://blip.tv/clojure/rich-hickey-unveils-clojurescript-5399498

Brian


On Jul 21, 1:09 am, Harrison Maseko  wrote:
> Hi all,
> I did not watch the live cast of Rich's presentation on ClojureScript.
> Could someone please point me to a video or audio recording of the
> presentation if there's one somewhere on the Web?
> Thanks,
> -h.

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


Meaningless Poll Time: Which JVM Language Is On Top?

2012-02-23 Thread Brian
http://java.dzone.com/polls/which-jvm-language-top-0

-- 
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-30 Thread Brian
Please sign me up for:

* ClojureScript
* core.logic / minikanren
* Go
* Jamming with Overtone
* The web and Clojure

On Oct 30, 6:10 am, Krukow  wrote:
> On Oct 25, 5:11 pm, Fogus  wrote:
>
> > This should be epic.
>
> Indeed. Please sign me up for:
>
> * ClojureScript
> * Pallet

-- 
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: randomize a collection?

2008-12-02 Thread Brian Doyle
Seems like shuffle should be part of the core or in the contrib.  Is there a
reason why it's not?

On Mon, Dec 1, 2008 at 9:55 PM, Timothy Pratley <[EMAIL PROTECTED]>wrote:

>
>
> http://groups.google.com/group/clojure/browse_thread/thread/180842eb58c58370/0e19ab338452c64f?lnk=gst&q=shuffle#0e19ab338452c64f
> The recommendation was to use java.util.Collections/shuffle and an
> example was given:
>
> (defn shuffle [coll]
>  (let [l (java.util.ArrayList. coll)]
>(java.util.Collections/shuffle l)
>(seq l)))
>
> user=> (shuffle [1 2 3 4 5])
> (4 2 1 5 3)
>
> On Dec 2, 3:28 pm, "Brian Doyle" <[EMAIL PROTECTED]> wrote:
> > Is there a function that takes a collection and randomizes, or shuffles,
> the
> > items?
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: A try on condp (was: Re: proposal: match multimethod)

2008-12-03 Thread Brian Doyle
Can you include an example usage of this function?  Thanks.

On Wed, Dec 3, 2008 at 12:51 PM, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote:

> Hi Stuart and Rich,
>
> Am 03.12.2008 um 19:00 schrieb Stuart Sierra:
>
>> I'm pretty sure I don't like the sound of that at all. We had a nice
>>> discussion about fcase/condf, which I'd like to get in, here:
>>>
>>> http://groups.google.com/group/clojure/browse_frm/thread/dee910bef629...
>>>
>>
>> And I haven't forgotten about that, just haven't had time to work on
>> it.  Anyone else who wants to tackle it is welcome.
>>
>
> How about the following:
>
> (defmacro condp
>  "condp compares the given needle with the first clause using the given
>  predicate. In case the predicate returns true the second clause is
>  returned. Otherwise condp goes on with the rest of the clauses. In
>  case there is an odd number of clauses the last one will be returned
>  if no preceding clause matched. If no default clause is given an
>  exception is thrown. The predicate is called with needle as first
>  argument and the first clause as second argument."
>  [pred needle & clauses]
>  (let [c(count clauses)
>par  (rem c 2)
>cls  (take (if (zero? par) c (dec c)) clauses)
>cls  (mapcat (fn [[x c]] `[(~xprd ~xndl ~x) ~c]) (partition 2 cls))
>xndl (gensym "condp_needle__")
>xprd (gensym "condp_predicate__")
>lst  (if (zero? par)
>   `(throw (Exception. (str "No condp clause matched for: "
>(prn-str ~xndl
>   (last clauses))]
>`(let [~xprd ~pred
>   ~xndl ~needle]
>   (cond
> [EMAIL PROTECTED]
> :else ~lst
>
> I mulled about the (x _) syntax, but to be honest: I think #() is
> perfectly sufficient. We would need to quote all the contents to
> prevent multiple evaluation, but then we have to recurse and check
> for _ vs. non-_...
>
> I expect the predicate to be a function of two arguments with the first
> being the needle and the second being the clause, we compare to.
> Predicates where order doesn't matter or the order agrees may be simply
> used. Others or more complicated expressions can be wrapped in a #().
> Here we still have a problem for #(pred (complicated-computation) %2
> %1)
>
> In case the number of clauses is even, and no clause matched the
> predicate, we throw an exception. In case the number of clauses is
> odd, we return the last one as default. I think adding a simple nil
> is tolerable, making the "I ignore a failed run" explicit.
>
> What do you think?
>
> 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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Bug: recur won't work in tail position within cond

2008-12-03 Thread Brian Doyle
This seems to work for me:

(defn sub-til-0 [n]
(cond
  (zero? n) 0
  :else (recur (dec 1

I'm not sure what those extra ['s are for in your example.

On Wed, Dec 3, 2008 at 9:39 PM, puzzler <[EMAIL PROTECTED]> wrote:

>
> (defn sub-til-0 [n]
>  (if (zero? n) 0 (recur (dec 1
>
> works but the equivalent
>
> (defn sub-til-0 [n]
>  (cond
>   [(zero? n) 0]
>   [:else (recur (dec 1))]))
>
> does not.
>
> Recursion is already limited enough in Clojure...  give us recur in
> tail position within cond!  :)
>
> Thanks,
>
> Mark
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



unsupported binding form for cond-let

2008-12-05 Thread Brian Doyle
I started to play with cond-let in the contrib.cond package and got an
unexpected error:

user=> (cond-let [x (zero? 0)] (println "hello world"))
java.lang.Exception: Unsupported binding form: (zero? 0) (NO_SOURCE_FILE:11)

user=> (cond-let x (zero? 0) (println "hello world"))
hello world

Maybe it was overlooked when making the binding forms more
consistent?   Like:

user=> (when-let [x (zero? 0)] (println "hello world"))
hello world

user=> (if-let [x true] (println "hello world"))
hello world

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: why can't I set! stuff in user.clj?

2008-12-09 Thread Brian Doyle
Stuart,

I have a ~/.cljrc file that has this stuff in there and in my bash (clj)
script to start clojure I do:

$JAVA -cp $CLOJURE_JARS clojure.lang.Repl ~/.cljrc

On Tue, Dec 9, 2008 at 1:12 PM, Stuart Halloway
<[EMAIL PROTECTED]>wrote:

>
> Why can't I call set! in user.clj? (And what is the idiomatic way to
> do what I want here?)
>
> (set! *print-length* 103)
> -> Exception in thread "main" java.lang.ExceptionInInitializerError
>at clojure.lang.Repl.(Repl.java:23)
> Caused by: java.lang.RuntimeException: java.lang.IllegalStateException:
> Can't change/establish root binding of: *print-length* with set
>
> Thanks,
> Stuart
>
>
>
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: why can't I set! stuff in user.clj?

2008-12-09 Thread Brian Doyle
Steve,

Could you post your bash shell script that starts Clojure?   I would like to
see what you have concerning the new options that can be passed to the
updated clojure.jar.  Thanks.

On Tue, Dec 9, 2008 at 1:59 PM, Stephen C. Gilardi <[EMAIL PROTECTED]> wrote:

> user.clj is loaded before thread-local bindings are established. I see
> you're using Repl.java. You can see the call to pushThreadBindings there to
> see how it works. user.clj allows you to set up the user namespace, but not
> set! most vars.
> With the repl in clojure.main, you can include an init file on your
> "java..." command line using the "-i" option. It will be loaded after those
> bindings have been established. We do not have anything like a
> "repl-init.clj" file that's auto-loaded if it exists to accomplish these
> kinds of settings. It might be a good idea to have one, loaded from
> classpath, with a suitable name.
>
> More complete solutions to this initialization task (.e.g., for the bash
> shell) look in a few places for init files. That's something to consider as
> well.
>
> --Steve
>
> On Dec 9, 2008, at 3:12 PM, Stuart Halloway wrote:
>
>
> Why can't I call set! in user.clj? (And what is the idiomatic way to
> do what I want here?)
>
> (set! *print-length* 103)
> -> Exception in thread "main" java.lang.ExceptionInInitializerError
> at clojure.lang.Repl.(Repl.java:23)
> Caused by: java.lang.RuntimeException: java.lang.IllegalStateException:
> Can't change/establish root binding of: *print-length* with set
>
> Thanks,
> Stuart
>
>
>
>
>
> >
>
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Learning Clojure

2008-12-10 Thread Brian W

I've created a new Clojure intro at 
http://en.wikibooks.org/wiki/Learning_Clojure.
While Rich's screencasts and reference docs are great, they don't
always lay things out in a digestible order. My intro is meant as a
sequential tour through the essential concepts, not a practical
tutorial. In particular, my examples are deliberately cursory and
abstract, and my API coverage is very minimal.

I'm sure the text has some rough spots because at times I went ahead
and speculated about points I'm not 100% about. For instance, the way
I described the evaluation rules coherently explains how ((foo) bar)
is evaluated, but I'm not sure the rules I described are how Clojure
actually works. The text is also a bit out of date already, e.g. I
don't mention AOT or Atoms. So please read through the text and
correct or excise any gaffes, or please comment on deficiencies here
or the book's talk page.

One thing I'd like to add is a discussion about how to imitate
traditional single- or multiple-inheritance using multimethods,
including basics like how to organize such code into files and
namespaces, but I'm not clear on how this should be done myself.

Another issue I had is we don't have a good blanket term for Vars,
Refs, Agents, and Atoms. Rich sometimes calls them "reference types",
but that term already has a different meaning in Java. I considered
"meta-references", but then I realized that, say, the symbol pointing
to a Var is a meta-reference---a reference pointing to a reference---
not the Var itself. I've settled for now on "reference object" and
"reference object type", but these are confusingly close to "reference
type".
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Learning Clojure

2008-12-10 Thread Brian Will

A Java reference type is basically any type allocated on the heap. The
four Clojure reference types are particular Java reference types. My
complaint is this is exactly the sort of weirdness that causes
learners to scratch their heads. Not the biggest issue, sure, but this
sort of thing is nice to avoid when possible.

While we're at it, aren't "Var" and "Ref" backwards? Currently, Refs
are the things that get mutated in the normal course of a program
while a Var is just a top-level holder which is rarely changed.
Shouldn't the thing which is variable be the "Var" and the
(relatively) fixed thing be the "Ref"? The root problem here, though,
either way, is that "var" vs. "ref" makes a dubious semantic
distinction between already overloaded general-use terms. Sadly, you
see this a lot in naming because good naming is very often /freaking
hard/.

Again, not a big deal by itself, but if you never fix these mistakes,
they just build and build until a whole bunch of names in your system
become impenetrably meaningless to newcomers, like car and cdr, making
the whole system needlessly hard to learn.

I understand, though, that I'm uniquely obsessed with ease of
learning. One thing I find very exciting about Clojure--and something
which very few have noted--is that Clojure is a considerably easier
Lisp to learn: easier than CL, certainly, but also even easier than
Scheme. Hence my introduction: I wanted to distill that simple essence
into something sequentially readable and easily digestible. While the
language is still open for amendment, I hope Clojure takes some
measures to preserve and optimize ease of learning. Ease of learning
is a big part of what will give Clojure a chance that other Lisps
never had to see wide adoption.

On Dec 10, 12:03 pm, "J. McConnell" <[EMAIL PROTECTED]> wrote:
> On Wed, Dec 10, 2008 at 1:27 PM, Brian W <[EMAIL PROTECTED]> wrote:
>
> > Another issue I had is we don't have a good blanket term for Vars,
> > Refs, Agents, and Atoms. Rich sometimes calls them "reference types",
> > but that term already has a different meaning in Java. I considered
> > "meta-references", but then I realized that, say, the symbol pointing
> > to a Var is a meta-reference---a reference pointing to a reference---
> > not the Var itself. I've settled for now on "reference object" and
> > "reference object type", but these are confusingly close to "reference
> > type".
>
> I would say to stick with "reference types" and just explain what is
> meant by the term. I have a feeling that introducing new, undefined
> terms will just confuse things more. In fact, it seems to me that both
> Java and Clojure have a pretty similar definition for the term. More
> or less, a reference type is a type whose value is a reference to a
> data structure on the heap. I think that by taking a sentence or two
> to point out the similarities and differences between the ways Java
> and Clojure use the term, any confusion will be greatly reduced.
>
> Regards,
>
> - J.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Not understanding the proper use of map

2008-12-10 Thread Brian Carper

On Dec 10, 12:07 pm, "Michael Wood" <[EMAIL PROTECTED]> wrote:
> OK, I think I know why this happens.  It's treating the '+ as the key
> for a map, and using the second integer as the default value.  I'm not
> sure why it treats an integer as a map, though:
>

Wow, that's a bit of a gotcha.  It's not treating the integer as a map
though, get's default behavior is to return nil if the thing it's get-
ing from isn't some kind of collection.  (Which is also a bit of a
gotcha, I think.)

user> ('a (fn []))
nil
user> ('a (Object.))
nil
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Learning Clojure

2008-12-10 Thread Brian Will

Thanks for explaining the origin of "var" and "ref". An important
thing you should do for learners is to explain their origin of odd/
cryptic names because that makes them much easier to remember. For
example, no text on C I've ever read explains the meaning of standard
library function names, like printf and sprintf, but the name and
purpose of those functions are far easier to remember if someone
simply tells you 'f' stands for 'formatted' and 's' stands for
'string'.

I should move the bits on Ref, Agent, and Atom towards the end. Vars
have to be introduced before I can discuss namespaces, but the thread-
local binding aspect of Vars can be deferred to later.

btw, you'll see a few notes I left in the text in square brackets
where I wasn't sure on some point. If someone could address those
questions, I'd appreciate it.

--Brian Will
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Learning Clojure

2008-12-10 Thread Brian Will

Tim:

Rich talks about destructuring in the part about "let" on the "special
forms" page.

The discussion of functions and basic syntax is deliberately delayed
because of dependencies, e.g. evaluation can't really be understood
without understanding the reader, and explaining the reader involves
talking about lists, vectors, maps, and other types. Besides, I think
a data-to-code approach is especially appropriate in Lisp.

The decision to use cursory, abstract examples is deliberate. When
you're trying to demonstrate how a language mechanism actually works,
it's distracting when the code example is meant to actually do
something because it makes the reader untangle the what from the how.
With foo-bar code, the reader can focus on what exactly is happening
in the code without reference to any goal.

The other reason the text is example poor is that I deliberately avoid
introducing syntax before semantics. Syntax is a lot of meaningless
ascii jumble until you're familiar with the concepts being expressed.

Of course, concrete examples should soon follow once the concepts are
laid out, but I'm terrible and coming up with such examples. If you
have any examples to add, please add them yourself (it is a wiki
page). Something I don't like about examples--particularly long,
practical examples--is that they fill up the text, segregating the
core information into little chunks that are hard to browse. So
instead of putting such examples in the main text, perhaps they can go
on their own page where the main text simply links to them. Readers
can decide for themselves if they need to see more context about a
topic.

Really, though, like with any expository writing, what are needed are
guinea pigs to actually read the damn thing. Hopefully keeping the
whole text reasonably short will encourage volunteers.

Thanks for your feedback.

--Brian Will
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Re: Learning Clojure

2008-12-11 Thread Brian Will

Tim, just go ahead and make any changes you like. If I don't like
them, I can always revert ;) Actually, I'm sure anything you add we
can find a place for, but like I said, that would likely be a separate
example page in most cases.

Thanks, Randall, I mention keywords-as-functions where I talk about
collection functions, but I forgot maps-as-functions.

Perhaps future discussion of the text should move to the talk page on
the wiki. This thread's getting pretty long.
--~--~-~--~~~---~--~~
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: Java interop question

2008-12-11 Thread Brian Doyle
This article has a good example using the proxy function.

http://gnuvince.wordpress.com/2008/11/18/fetching-web-comics-with-clojure-part-2/

On Thu, Dec 11, 2008 at 1:22 PM, Randall R Schulz  wrote:

>
> On Thursday 11 December 2008 11:31, Mark Engelberg wrote:
> > I understand how Clojure lets you consume Java objects, and pass
> > Clojure objects to Java programs.
> >
> > However, it is not uncommon for Java libraries to be designed in such
> > a way that you need to create a subclass of something in the library
> > in order to make use of the library.  I don't understand whether this
> > is possible in Clojure.
>
> It's not only possible, but quite straightforward. The basic thing
> you're looking for is (proxy ...). In some cases, you may need
> (gen-class). Check them out. They'll get you everything you need for
> working with white-box frameworks.
>
> (I'll check out Geocode/J as soon as I get Firefox back up. It just
> crashed and I keep 9 windows and over 80 tabs open, so starting it up
> is pretty slow...)
>
>
> > ...
> >
> > Thanks,
> >
> > Mark
>
>
> Randall Schulz
>
> >
>

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



iteration idioms

2008-12-12 Thread Brian Will

A very large chunk of iteration is done for the sake of producing a
new collection based on an existing collection, hence functional
constructs like list comprehensions and map. However, I'm not sure
about how to functionally handle cases of iteration which seem to
require:

1) keeping around values from previous iterations
2) producing a collection of more values than exist in the original
(or sometimes fewer values, though such cases usually require just
straight forward filtering)

For (1), it seems you generally resort to some kind of recursion with
loop/recur. Say we wish to find the max value in a list (without using
'max'):

 (def foo [35 -7 8 2 100 56])
 (loop [max (first foo)
   nums (rest foo)]
 (if (nil? nums)
 max
 (recur
(if (> (first nums) max) (first nums) max)
(rest nums

For (2), say I want to insert 3 before every item less than or equal
to 5 in a seq:

  (def bar [24 6 5 5 7 5 8 2])
  (defn prepend3 [s val] (if (<= val 5) (concat s [3 val]) (concat s
[val])))
  (loop [old (rest bar)
new (prepend3 [] (first bar))]
  (if (nil? old)
  new
  (recur (rest old) (prepend3 new (first old)

  user=> (24 6 3 5 3 5 7 3 5 3 2)

Again, hardly elegant. Maybe there's a cleaner way to use loop in
these cases, or maybe I'm just forgetting some function(s) to use.
Hopefully someone can demonstrate better idioms to handle these common
cases.

--Brian Will
--~--~-~--~~~---~--~~
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: iteration idioms

2008-12-12 Thread Brian Will

Thanks, Mark.

I don't suppose (reduce into ...) is a common enough idiom that it
deserves its own function? Perhaps (into x) should do (reduce into x),
e.g. (into [[3 5] [6 7]]) => [3 5 6 7]. This makes sense to me, but
maybe it's too semantically different from (into x y). If not, though,
you could do the same with concat.

On Dec 12, 3:10 pm, Mark Fredrickson 
wrote:
> > For (1), it seems you generally resort to some kind of recursion with
> > loop/recur. Say we wish to find the max value in a list (without using
> > 'max'):
>
> I can do this with reduce:
> user=> (defn my-max [lst] (reduce (fn [x a] (if (> x a) x a)) (first  
> lst) (rest lst)))
> #'user/my-max
> user=> (my-max '(2 4 12 3 4))
> 12
>
> For more complex data that you need to bring along, use a list or map.
>
> > For (2), say I want to insert 3 before every item less than or equal
> > to 5 in a seq:
>
> Again reduce to the rescue:
>
> (reduce into (map (fn [i] (if (<= i 5) [3 i] [i])) [24 6 5 5 7 5 8 2]))
>
> This is still O(n) - though it needs to iterate the vector twice. The  
> second version shows off Clojure's nice improvement to reduce (vis-a-
> vis fold in Scheme): grabbing the first item from the head of the list/
> vec/seq. The down side is I can't write multi-sequence reduce calls  
> like Scheme, but c'est la vie.
>
> I could write O(n) versions with continuations in Scheme, but I think  
> loop/recur would be required in Clojure.
>
> Cheers,
> -Mark
--~--~-~--~~~---~--~~
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: Gorilla: Release of Version 1.1.0

2008-12-13 Thread Brian Doyle
I'm sure I'm doing something stupid but I can't start up gorilla.

Exception in thread "main" java.lang.NoClassDefFoundError: de/kotka/gorilla
Caused by: java.lang.ClassNotFoundException: de.kotka.gorilla
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

Here is my script:

java -cp ~/share/clojure.jar:~/share/clojure-contrib.jar:~/share/gorilla.jar
de.kotka.gorilla

Gorilla is in my path:

$ ls ~/share/gorilla.jar
/home/bdoyle/share/gorilla.jar

No clue what is going on.

On Sat, Dec 13, 2008 at 8:10 AM, Meikel Brandmeyer  wrote:

> Hi,
>
> Am 13.12.2008 um 15:07 schrieb Randall R Schulz:
>
>> I installed a couple of new packages on my 10.3 box and
>> now "vim --version" reports +ruby, so I guess I can at least give it a
>> try there (that's not my primary box, though it is the faster one).
>>
>
> Unfortunately, vim by itself cannot do, what I need.
> There emacs is really better with its elisp. The Ruby
> interface is - well - also not very satisfactory, but it
> gets the job done. But one has to pass everything
> around as strings *ugh*, since the is no basic glue
> between Vim and the Ruby side. So it's currently a
> total mess. I'll try to clean that up for the next release
>
> 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
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: Gorilla: Release of Version 1.1.0

2008-12-13 Thread Brian Doyle
Thanks Meikel, removing the ~'s worked.  Oh and thanks for vimclojure and
gorilla!

On Sat, Dec 13, 2008 at 9:28 AM, Meikel Brandmeyer  wrote:

> Hi,
>
> Am 13.12.2008 um 17:17 schrieb Brian Doyle:
>
>  Here is my script:
>>
>> java -cp
>> ~/share/clojure.jar:~/share/clojure-contrib.jar:~/share/gorilla.jar
>> de.kotka.gorilla
>>
>
> I can reproduce the issue. The ~ is a shellish feature
> from Unix. It is only expanded at the start of a word.
> So the first ~ in your -cp argument is probably expanded
> while the others are not. Hence it doesn't find the
> gorilla.jar, since the JVM sees ~/share/gorilla.jar.
> When opening this "file", the system says: "Dunno.
> Never heard that name." So the class is not found.
> Convert all ~ in your classpath to absolute (or relative)
> paths and it works.
>
> 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
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: Updated 'show' and 'source'

2008-12-15 Thread Brian Doyle
This is great stuff.  Thanks Chouser!

On Fri, Dec 12, 2008 at 10:37 PM, Chouser  wrote:

>
> I've added updated versions of 'show' and 'source' to a new lib named
> clojure.contrib.repl-utils
>
> 'show' is for exploring classes at the REPL.  What's new is that it
> now displays the modifiers of the class and the parameter types for
> each method.
>
> 'source' tries to display the Clojure source for any Var.  It now
> sports more robust logic for finding the source file and determining
> the end of the Var's definition.
>
> user=> (show 1/2)
> ===  public clojure.lang.Ratio  ===
> [ 0]  (BigInteger,BigInteger)
> [ 1] denominator : BigInteger
> [ 2] numerator : BigInteger
> [ 3] byteValue : byte ()
> [ 4] compareTo : int (Object)
> [ 5] doubleValue : double ()
> [ 6] equals : boolean (Object)
> [ 7] floatValue : float ()
> [ 8] getClass : Class ()
> [ 9] hashCode : int ()
> [10] intValue : int ()
> [11] longValue : long ()
> [12] notify : void ()
> [13] notifyAll : void ()
> [14] shortValue : short ()
> [15] toString : String ()
> [16] wait : void ()
> [17] wait : void (long)
> [18] wait : void (long,int)
>
> Note that 'show' takes instances or classes.  Members are sorted by
> kind: static fields, static methods, constructors, instance fields,
> instance methods.  Note that parameter package names and method
> modifiers are not displayed for brevity.  For complete details on a
> member, append its number to the call:
>
> user=> (show 1/2 3)
> #
>
> This actually returns the method itself, and so can be used to
> construct more complex introspection expressions:
>
> user=> (show (.getType (show 1/2 1)))
> ===  public java.math.BigInteger  ===
> [ 0] static ONE : BigInteger
> [ 1] static TEN : BigInteger
> [ 2] static ZERO : BigInteger
> ...etc...
>
> Use of 'source' couldn't be simpler:
> user=> (source filter)
> (defn filter
>  "Returns a lazy seq of the items in coll for which
>  (pred item) returns true. pred must be free of side-effects."
>  [pred coll]
>(when (seq coll)
>  (if (pred (first coll))
>(lazy-cons (first coll) (filter pred (rest coll)))
>(recur pred (rest coll)
> nil
>
> user=> (source clojure.zip/node)
> (defn node
>  "Returns the node at loc"
>  [loc] (loc 0))
> nil
>
> --Chouser
>
> >
>

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



calling use with a seq of strings

2008-12-15 Thread Brian Doyle
I have a seq of strings that are namespaces like,
("clojure.contrib.str-utils", "clojure.contrib.duck-streams").
I wanted to call the use function on this seq.   I can't seem to do that
though.   Any way I can do this or
is this just a bad idea?   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
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: calling use with a seq of strings

2008-12-15 Thread Brian Doyle
I didn't know about the symbol function.  Thanks!  I just want to call use
on all
of the namespaces in the clojure.contrib jar when starting the repl and this
will
work nicely!

On Mon, Dec 15, 2008 at 1:59 PM, Stuart Sierra
wrote:

>
> You can do this:
> (apply use (map symbol (list "clojure.contrib.str-utils"
> "clojure.contrib.duck-streams")))
> -Stuart Sierra
>
> On Dec 15, 3:51 pm, "Brian Doyle"  wrote:
> > I have a seq of strings that are namespaces like,
> > ("clojure.contrib.str-utils", "clojure.contrib.duck-streams").
> > I wanted to call the use function on this seq.   I can't seem to do that
> > though.   Any way I can do this or
> > is this just a bad idea?   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
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
-~--~~~~--~~--~--~---



possible bug with seq and Enumeration?

2008-12-15 Thread Brian Doyle
According to the docs the seq function should be able to take an
enumeration,
but here is what I see:

user=> (seq (.elements (doto (java.util.Vector.) (.add "hello") (.add
"world"
java.lang.IllegalArgumentException: Don't know how to create ISeq
from:  (NO_SOURCE_FILE:0)

SVN 1160, 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
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: possible bug with seq and Enumeration?

2008-12-15 Thread Brian Doyle
Using enumeration-seq does the trick!  Thanks.

user=> (enumeration-seq (.entries (java.util.zip.ZipFile. "")))

On Mon, Dec 15, 2008 at 5:14 PM, Rich Hickey  wrote:

>
>
>
> On Dec 15, 6:01 pm, "Brian Doyle"  wrote:
> > According to the docs the seq function should be able to take an
> > enumeration,
> > but here is what I see:
> >
> > user=> (seq (.elements (doto (java.util.Vector.) (.add "hello") (.add
> > "world"
> > java.lang.IllegalArgumentException: Don't know how to create ISeq
> > from:  (NO_SOURCE_FILE:0)
> >
>
> If you really want to create a seq on an Enumeration you have to use
> enumeration-seq. But there is no need to explicitly obtain
> enumerations/iterators for Collections (and Vector implements
> Collection):
>
> (seq (doto (java.util.Vector.) (.add "hello") (.add "world")))
> -> ("hello" "world")
>
> Note also that Collections have constructors from Collections, and
> Clojure vectors are Collections:
>
> (seq (java.util.Vector. ["hello" "world"]))
> -> ("hello" "world")
>
> Rich
>
> >
>

--~--~-~--~~~---~--~~
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: understanding quoting

2008-12-15 Thread Brian Doyle
On Mon, Dec 15, 2008 at 9:43 PM, Daniel Eklund  wrote:

>
> > Looks like an if then else version of the map lookup??
> > ie: (if (%1 %2) (%1 %2) %3)
> > Is this a special feature of maps in general, such that you can look
> > up a key but return something else if it doesn't exist?
> > I hadn't come across it yet, but it sounds useful :)
>
> This is exactly right (I just confirmed it for myself).  I looked up
> the java code for Keyword.java and Symbol.java both of which implement
> IFn  (those things that can be put in the function position).  The
> single and double arity invoke() merely delegate to 'get'.  And voila:
>

How did you know that it delegates to 'get'?


>
> user> (doc get)
> -
> clojure.core/get
> ([map key] [map key not-found])
>  Returns the value mapped to key, not-found or nil if key not
> present.
>
> The last parameter is definitely for those situations where 'if not
> found, use this'
>
> I think I _finally_ understand the statement, "keywords and symbols
> are functions of maps".
>
> So, the original poster's observation about ('+ '1 '2) returning '2
> makes more sense when you consider that it turns into this:
>
> (get '1 '+ '2)
>
> or "get from the hashmap ( '1 ) the value stored at key ( '+ ) and if
> nil is returned, return ( '2 ) instead"
>
> (get '1 '+) returns nil as '1 is not even a map.
>
>
> >
>

--~--~-~--~~~---~--~~
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: doall and dorun

2008-12-15 Thread Brian Doyle
I'll take a crack at this.  It may appear that the doall and dorun return
something
different with subsequent calls but they don't actually.   The doall always
returns
the sequence (1 2) and dorun always returns nil.

The first time (doall x) is called the for loop executes and prints 1 2 (a
side effect
and is not returned from the for loop) and then returns the seq.  The second
time
it's called x is already assigned the seq and just returns it. It does not
execute
the for loop again.

The dorun call is similar, but instead of returning the seq of the for loop,
it always
returns nil.  According to the api docs, dorun is used to force side
effects.

On Mon, Dec 15, 2008 at 9:19 PM, wubbie  wrote:

>
> Hello,
>
> doall and dorun returns different results from seond run on...
> e.g.
> user=> (def x (for [i (range 1 3)] (do (println i) i)))
> #'user/x
> user=> (doall x)
> 1
> 2
> (1 2)
> user=> (doall x)
> (1 2)
> user=> (doall x)
> (1 2)
> user=>
>
> user=> (def x (for [i (range 1 3)] (do (println i) i)))
> #'user/x
> user=> (dorun x)
> 1
> 2
> nil
> user=> (dorun x)
> nil
> user=> (dorun x)
> nil
> user=>
>
>
> What's the explanation for that?
>
> thanks
> sun
>
>
>
> >
>

--~--~-~--~~~---~--~~
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: running Gorilla

2008-12-18 Thread Brian Doyle
LocalLeader usually means \

On Thu, Dec 18, 2008 at 3:36 PM, Mark Volkmann wrote:

>
> On Thu, Dec 18, 2008 at 4:10 PM, Meikel Brandmeyer  wrote:
> > Hi,
> >
> > Am 18.12.2008 um 23:06 schrieb Mark Volkmann:
> >>
> >> Error detected while processing /Users/Mark/.vim/plugin/gorilla.vim:
> >> line  558:
> >> LoadError: /usr/local/lib/ruby/1.8/i686-darwin9.3.0/socket.bundle:
> >> dlopen(/usr/local/lib/ruby/1.8/i686-darwin9.3.0/socket.bundle, 9):
> >> Symbol not found: _rb_eStandardError
> >> Press ENTER or type command to continue
> >>
> >> I don't know what to make of this.
> >> BTW, I have Ruby 1.8.7.
> >
> > To be honest: I never compiled vim with Ruby support.
> > So I don't know, what shadows may lurk on this path.
> >
> > Your error messages hint that you a running on a Mac.
> > If that is the case, try MacVim. It is ruby enabled and
> > works with the standard ruby of Mac Os out of the box.
>
> Okay, I'm using MacVim now and I have a gorilla server running. What
> are the keystrokes to open a REPL buffer? The documentation says
> sr. I don't know what LocalLeader means. Is that just a
> colon?
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
> >
>

--~--~-~--~~~---~--~~
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: for FAQ: what are use/require/import/refer?

2008-12-20 Thread Brian Doyle
This would make an excellent FAQ question and answer!

On Sat, Dec 20, 2008 at 9:53 AM, Stuart Sierra
wrote:

>
> This might make a good FAQ question:
>
> On Dec 20, 11:25 am, chris  wrote:
> > I am unclear as to the difference between refer, import use, and require.
>
> Hi Chris,
>
> require: Load a Clojure library from a file on classpath.  Use this
> when you want to load a library, but leave it in its own namespace.
>
> refer: Bring public symbols from one namespace into the current
> namespace.  Use this when a library has already been loaded (example:
> clojure.set) but you want to use its public symbols without a
> namespace qualifier.
>
> import: Copy Java class names into current namespace.  Use this when
> you want to use a Java class without typing the full package name.
>
> use: Combination of require and refer.  Use this when you want to load
> a library AND use its symbols without a namespace qualifier.
>
> All four are available as keyword arguments to "ns", which is the
> preferred way to use them:
>
> (ns foo.bar
>  (:use my.little.lib)
>  (:require clojure.contrib.duck-streams)
>  (:import (java.io File InputStream))
>  (:refer clojure.set))
>
> ":require" also allows aliasing, like this:
> (ns foo.bar
>  (:require [clojure.set :as set]))
>
> Now you can write the symbol "clojure.set/union" as "set/union".
>
> -Stuart Sierra
> >
>

--~--~-~--~~~---~--~~
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: multiple sets on one item - is this a good idea?

2008-12-20 Thread Brian Doyle
Instead of require call use and should get you what you want.

On Dec 20, 2008 9:15 AM, "chris"  wrote:


That helped, thanks Christophe.

I have one more problem:

I put it in a util file, under a util namespace:

(ns lambinator.util)

(defmacro sets! [vars & rest] `(do ~@(map (fn [flds] `(set! (. ~vars ~(first
flds)) ~(second flds...
Now I want to use it outside that namespace.  It seems that I have to
do two things when I load from a jar...

(require 'lambinator.util)

(lambinator.util/sets! c fill GridBagConstraints/VERTICAL weightx 1.5)

How do I use the function/macro outside the namespace it was created
in without prefixing it with lambinator.util?  Import, require don't
seem to do what I want...

Chris

On Dec 20, 12:28 am, Christophe Grand  wrote: > chris
a écrit : > > > Hello,...

--~--~-~--~~~---~--~~
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: SPARQL DSL - a humble request for review and guidance

2008-12-21 Thread Brian Sletten

Adam, I just joined the list, but I am very interested in working with  
you on the SPARQL DSL. Let me catch up on what you've written and  
we'll muddle through it together.

Glad to see there are other Clojure-loving SemWeb nerds around here. :)

--~--~-~--~~~---~--~~
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: How to encapsulate local state in closures

2008-12-21 Thread Brian Doyle
I haven't been following the new atom stuff, so I was wondering why atom
would be best in this
situation, vs a ref?  Thanks.

On Sun, Dec 21, 2008 at 1:03 PM, Parth Malwankar
wrote:

>
>
>
> On Dec 21, 11:47 pm, chris  wrote:
> > I would like to be able to encapsulate local state in a closure.
> > Specifically, I would like a function that returns an incrementing
> > integer, thus:
> > (test_func)
> > 1
> > (test_func)
> > 2
> > What is the best way to go about this?  With local bindings is failing
> > and I can't figure just why...
> >
>
> One way to do this would be to use atom.
>
> (defn mk-counter [start]
>  (let [n (atom start)]
>(fn [] (swap! n inc
>
> (def counter (mk-counter 0))
>
> user=> (counter)
> 1
> user=> (counter)
> 2
> user=> (counter)
> 3
>
> Parth
> > (def test_closure
> >(with-local-vars [one 1]
> >  (fn [] (var-get one
> > #'user/test_closure
> > user> (test_closure)
> > ; Evaluation aborted.
> > The var is null when I call the closure.
> >
> > Thanks,
> > Chris
> >
>

--~--~-~--~~~---~--~~
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: Exercise: how to print multiplication table?

2008-12-22 Thread Brian Doyle
2008/12/22 J. McConnell 

> On Mon, Dec 22, 2008 at 10:23 AM, Piotr 'Qertoip' Włodarek
>  wrote:
> >
> > Being new to Clojure, to Lisp and to functional programming in
> > general, I have some trouble wraping my head around it.
> >
> > As the first exercice, I would like to print multiplication table of
> > specified order, like:
> > (print-multiplication-table 3)
> >  1  2  3
> >  2  4  6
> >  3  6  9
> >
> > I came that far:
> >
> > (defn multiplication-row [n k]
> >(map (partial * k) (range 1 (inc n
> >
> > (defn multiplication-table [n]
> >(map (partial multiplication-row n) (range 1 (inc n
> >
> > (println (multiplication-table 3)); => ((1 2 3) (2 4 6) (3 6 9))
> >
> > Now, how to pretty print this?
> >
> > This does not work - prints nothing - why?:
> > (defn pretty-print-row [row]
> >  (map print row))
>
> The problem is that you are using map in two different ways here. In
> the multiplication-row and multiplication-table functions you are
> using it correctly as a function that applies a given function to all
> of the values in a collection, returning the results in a new
> collection. In the pretty-printing function you do not care about the
> results like you did in the above two functions, you care about the
> side-effects. For this, you can use doseq:
>
> 1:1 user=> (defn multiplication-row [n k]
>   (map (partial * k) (range 1 (inc n
> #'user/multiplication-row
> 1:3 user=> (defn multiplication-table [n]
>   (map (partial multiplication-row n) (range 1 (inc n
> #'user/multiplication-table
> 1:5 user=> (defn pretty-print-row [row]
>  (doseq [v row] (print v \space)) (print \newline))
> #'user/pretty-print-row
> 1:7 user=> (defn print-multiplication-table [n]
>  (doseq [row (multiplication-table n)] (pretty-print-row row)))
> #'user/print-multiplication-table
> 1:9 user=> (print-multiplication-table 3)
> 1  2  3
> 2  4  6
> 3  6  9
> nil
> 1:10 user=> (print-multiplication-table 5)
> 1  2  3  4  5
> 2  4  6  8  10
> 3  6  9  12  15
> 4  8  12  16  20
> 5  10  15  20  25
> nil
>
> HTH,
>
> - J.
>

This is off topic from the original questions, but are the 1:#'s in your
REPL line numbers?
If so, what did you do to get those?   Also if those are line numbers how
come only odd
numbers are printed?  What does the '1:' stand for?   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
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
-~--~~~~--~~--~--~---



ns references clarification

2008-12-22 Thread Brian Doyle
It would appear that using (:import ...) and (import ...)
with the ns function work the same (svn rev 1172.)

1:1 user=> (ns blah (import (java.net URL)))
nil
1:2 blah=> (URL. "http://www.clojure.org";)
#http://www.clojure.org>

and

1:1 user=> (ns blah2 (:import (java.net URL)))
nil
1:2 blah2=> (URL. "http://www.clojure.org";)
#http://www.clojure.org>

Is this true and if so does it work for all of the other types
of references as well?

--~--~-~--~~~---~--~~
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: Some code review for clj-record?

2008-12-28 Thread Brian Doyle
Having used Rails myself I wanted to check this out and play with it.   I'm
having some
trouble just loading the clj_record/core.clj file though:

1:1 user=> (load-file "clj_record/core.clj")
java.lang.Exception: Unable to resolve symbol: db in this context
(core.clj:19)

I'm sure it's something I'm doing wrong but I do have derby.jar on my
classpath.  Thanks.


On Sat, Dec 27, 2008 at 1:48 PM, John D. Hume wrote:

>
> Hi all,
> As a learning exercise, I've started working on a sort of clojure
> clone of ActiveRecord (from Rails). You can see it here:
> http://github.com/duelinmarkers/clj-record/tree/master
>
> The model used in the tests is defined in files here:
>
> http://github.com/duelinmarkers/clj-record/tree/master/clj_record/test/model
>
> And the tests most worth reading are:
>
> http://github.com/duelinmarkers/clj-record/tree/master/clj_record/test/core-test.clj
>
> http://github.com/duelinmarkers/clj-record/tree/master/clj_record/test/associations-test.clj
>
> I'd be interested in any feedback about issues you see, idioms I could
> be using that I'm not, suggestions on testing approach, or other
> comments or questions.
>
> One style question I'm particularly interested in is what people think
> the model setup should look like. Currently I've got it implemented to
> allow a minimum of punctuation:
>
> (cljrec/init-model
>  (has-many products))
>
> But is it bad form to use the fact that macros don't evaluate
> arguments to allow all those naked symbols? For consistency with ns it
> seems it would be preferable to make has-many a keyword:
>
> (cljrec/init-model
>  (:has-many products))
>
> (There actually is a has-many method that gets invoked by init-model,
> but that's an implementation detail.)
>
> My gut says the least confusing approach for a user would be this.
>
> (cljrec/init-model
>  (:has-many :products))
>
> ... but something seems weird to me about both :has-many and :products
> being keywords, where :has-many is a magic keyword and :products is a
> name being introduced. (Note it doesn't define a var called 'products
> but does create 'find-products and 'destroy-products functions.)
>
> Note that I'm using clojure.contrib.sql and not worrying about the
> constantly opening and closing connections. Obviously I'd need some
> way of wrapping a single db transaction around a bunch of expressions
> to make this a generally useful library. But that's not the point
> right now.
>
> Thanks.
> -hume.
> --
> http://elhumidor.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: making code readable

2008-12-29 Thread Brian Doyle
Looking at this code the uppercase variables stands out.
This isn't idiomatic is it?

(def GRID_SIZE 10)
(def HEIGHT 600)
(def MARGIN 50)


On Mon, Dec 29, 2008 at 12:19 PM, Mark Volkmann
wrote:

>
> On Mon, Dec 29, 2008 at 11:11 AM, lpetit  wrote:
> >
> > You should consider using docstrings for documenting functions
>
> Good suggestion. I've changed my code to do that. I also noticed that
> I had forgotten to replace special characters with built-in entities
> in my HTML, so that is fixed now. The new version is at
> http://www.ociweb.com/mark/programming/ClojureSnake.html. What else
> would you do different in this code? Do you think it still contains
> too many comments?
>
> > On 29 déc, 16:45, "Mark Volkmann"  wrote:
> >> On Mon, Dec 29, 2008 at 5:44 AM, Mark Volkmann
> >>
> >>
> >>
> >>  wrote:
> >> > I would like to produce a version of the snake code that could serve
> >> > as an example of the kind of code that the Clojure community thinks is
> >> > "good". Unless it's part of an exercise to produce the shortest code
> >> > possible, I think we should always write Clojure code with a goal of
> >> > making it as easy as possible for others to read, while not attempting
> >> > to serve as a Clojure tutorial. Again, my goal here is to get more
> >> > developers to give Clojure a shot.
> >>
> >> > My challenge to everyone on the list is to start with any version of
> >> > the snake code you've seen and make it as readable as *you* think it
> >> > should be by doing things like renaming variables and functions,
> >> > adding comments and changing indentation. I'd really like to see what
> >> > *you* think is the best way to write this code. The lessons learned
> >> > from this exercise could then be applied to other code we write in the
> >> > future.
> >>
> >> Okay, I took the challenge and produced a modified version of my
> >> earlier code where I removed what I considered to be redundant
> >> comments and did a little more renaming. You can see it athttp://
> www.ociweb.com/mark/programming/ClojureSnake.html. Feedback is
> >> welcomed!
> >>
> >> I also started documenting some Clojure coding guidelines aimed at
> >> making code more readable athttp://
> www.ociweb.com/mark/programming/ClojureCodingGuidelines.html
> >> and would appreciate feedback on these. I expect there will be cases
> >> where not following these is justified, which is why I refer to them
> >> as guidelines instead of rules.
> >>
> >> --
> >> R. Mark Volkmann
> >> Object Computing, Inc.
> > >
> >
>
>
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
> >
>

--~--~-~--~~~---~--~~
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: Some code review for clj-record?

2008-12-29 Thread Brian Doyle
That seems to be working better now John.   I looked over most of the code
and it seems
like a good start.  I'm no expert when it comes to functional programming or
Clojure,
so I'm not sure how to critic the code exactly.   If I was doing the porting
I would prolly
do it in very OO way, since that's what I'm used to, and that would not be
correct.

I noticed that in the init-model macro you are creating a 'defn table []
...' function in the
model namespace and was wondering why you didn't just make it a def instead,
since
it doesn't take any args?

I have an idea for you with the callbacks like, before-create, after-create,
etc.  In the
all-models-metadata in the core.clj you could store the namespace in the
hash
associated with the model-name on setup.   Then in the create function
defined in
the core.clj you could call the before-create function defined in the model
something
like:

(let-if [bc ('before-create (ns-publics )] (bc
attributes#))

That was just an idea I had, but there could be a better way to do it that's
for sure!
Of course it's prolly a bit more complex than that since you the
before-create function
could alter the attributes#, but you get the idea of discovering and calling
the
appropriate callback function in the model namespace.

On Sun, Dec 28, 2008 at 9:49 PM, John D. Hume wrote:

>
> Ok, please pull the latest and try again.
> git clone git://github.com/duelinmarkers/clj-record.git
>
> The problem was due to something I've seen a couple other messages
> about: When running a file as a script, it starts out in the
> clojure.core namespace. I was doing (def db {...}) before any (ns ...)
> so the db var lived in clojure.core, which made it conveniently (but
> sloppily) visible everywhere. Loading from the REPL, however, it was
> landing in the user namespace. I've now put it in a config namespace
> and required config from the two places that need it.
>
> Thanks for looking.
> -hume.
>
> On Sun, Dec 28, 2008 at 11:27 PM, John D. Hume 
> wrote:
> > The db configuration isn't reasonable at the moment. You can run
> > clj_record/test/main.clj as a script but not load it from the REPL.
> > Let me see if I can get it to work both ways and push an update.
> >
> > On Sun, Dec 28, 2008 at 6:28 PM, Brian Doyle 
> wrote:
> >> Having used Rails myself I wanted to check this out and play with it.
> I'm
> >> having some
> >> trouble just loading the clj_record/core.clj file though:
> >>
> >> 1:1 user=> (load-file "clj_record/core.clj")
> >> java.lang.Exception: Unable to resolve symbol: db in this context
> >> (core.clj:19)
> >>
> >> I'm sure it's something I'm doing wrong but I do have derby.jar on my
> >> classpath.  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
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: Some code review for clj-record?

2008-12-30 Thread Brian Doyle
I see what you are doing with the validations and defining them in the
init-modelcall.
I think that's a good idea actually and like it better than my solution to
putting the
callbacks in the model namespace.

A couple of small things that I noticed when starting to play around with
clj-record.  In your
example you have:

(ns com.example.user)
  (clj-record.core/init-model)

but when I do that I get the error:

java.lang.ClassNotFoundException: clj-record.core

When I add a require it clears it up like:

(ns com.example.user
  (:require [clj-record.core :as cr.core]))
   (cr.core/init-model)

I know this is picky, but in your clj-record.core/init-model function you
have:

(first (reverse (re-split #"\." (name (ns-name *ns*)

and could be changed to:

(last (re-split #"\." (name (ns-name *ns*

I look forward to seeing clj-record progress.   Thanks John.

On Mon, Dec 29, 2008 at 10:20 PM, John D. Hume wrote:

>
> On Mon, Dec 29, 2008 at 7:15 PM, Brian Doyle 
> wrote:
> > I noticed that in the init-model macro you are creating a 'defn table []
> > ...' function in the
> > model namespace and was wondering why you didn't just make it a def
> instead,
> > since
> > it doesn't take any args?
>
> That didn't occur to me. I do like the idea of all the functionality
> being available directly on clj-record.core with model name as a first
> argument in addition to being defined in the model namespace, so I
> guess that's one reason. But the inference of table name from model
> name should only be the default, so maybe it would be better to just
> def it there and let clj-record.core look it up there if needed,
> somewhat as you recommended doing for callbacks...
>
> > I have an idea for you with the callbacks like, before-create,
> after-create,
> > etc.  In the
> > all-models-metadata in the core.clj you could store the namespace in the
> > hash
> > associated with the model-name on setup.   Then in the create function
> > defined in
> > the core.clj you could call the before-create function defined in the
> model
> > something
> > like:
> >
> > (let-if [bc ('before-create (ns-publics )] (bc
> > attributes#))
>
> That's interesting. It's basically the opposite of the way I did the
> validation stuff, where you pass in validation functions and those get
> stored away in metadata and aren't directly accessible. (Here
> "metadata" is not used in the clojure.org/metadata sense of the word.
> I've thought about using clojure metadata to store model info, but I
> don't know what symbol or collection I'd attach it to.) I think I
> prefer the validation approach, because those functions have a certain
> job to do and shouldn't be sitting there cluttering the model
> namespace. (On the other hand, it is awfully convenient to be able to
> test those functions directly.)
>
> Thanks again for looking. If you or anyone else has further comments,
> I'd like to hear them.
> git clone git://github.com/duelinmarkers/clj-record.git
>
> -hume.
>
> --
> http://elhumidor.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: Understanding how to use namespaces

2008-12-30 Thread Brian Doyle
On Tue, Dec 30, 2008 at 11:25 PM, Mark Engelberg
wrote:

>
> Thanks, that helps dramatically.  It took me a while to figure out how
> to edit the SLIME startup to include my clojure files directory in the
> classpath, but I got it working.
>
> So it seems like you have to make sure the namespace always matches
> the file.  That means if you change the name of the file, you've got
> to remember to change the namespace declaration as well, right?  Is
> there any way to require/use a file that has no namespace specified at
> the top?
>
> In Clojure Box, is there any way to make the REPL automatically "use"
> whatever namespaces are in the files you are actively working on?
>

I don't know anything about SLIME or Clojure Box, but I wrote a little
Clojure script
that is called when I start the REPL that calls 'use' on most of the
namespaces in the
Clojure contrib jar.   You can see the code here:

http://github.com/heyZeus/clojure-stuff/tree/master/repl-init.clj


>
> >
>

--~--~-~--~~~---~--~~
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: Some code review for clj-record?

2009-01-02 Thread Brian Doyle
John,

I was looking around at your tests just to get a feel for using the test-is
stuff in the contrib library.  I noticed that when I ran main.clj it would
run
not only the tests in clj-record, but all of the tests in the
clojure.contrib
as well.  I was curious so I attempted to figure out what was going on
and what to do to only run the tests in clj-record.test.*.

I changed the end of the clj-record/test/main.clj script to this:

main.clj >>>>
(def files ["core-test" "validation-test" "associations-test"])

(doseq [file files]
   (load file))

(def base-ns (re-find #"^\w*.*\." (str *ns*)))

(apply test-is/run-tests (map #(symbol (str base-ns %)) files))
main.clj <<<<

I also had to change the ns function in the associations-test.clj file
to match the name of the file.   The word 'associations' in the namespace
was just misspelled.

On Wed, Dec 31, 2008 at 9:39 AM, John D. Hume wrote:

>
> Hi Brian,
>
> On Tue, Dec 30, 2008 at 11:41 AM, Brian Doyle 
> wrote:
> > (ns com.example.user)
> >   (clj-record.core/init-model)
> >
> > but when I do that I get the error:
> >
> > java.lang.ClassNotFoundException: clj-record.core
> ...
> > (first (reverse (re-split #"\." (name (ns-name *ns*)
> >
> > and could be changed to:
> >
> > (last (re-split #"\." (name (ns-name *ns*
>
> Those changes have been incorporated, along with stuff in the README
> about validation.
>
> I'm confused as to how I ended up with (first (reverse ...)) since I
> remember looking at the doc for (last seq), but anyway, it's there
> now.
>
> -hume.
> --
> http://elhumidor.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: literate snake

2009-01-03 Thread Brian Will

The problem with the snake running off the edge simply is a flaw in
your logic here:

(defn verify-direction
  "Gets the current snake direction or
   a new one if a board edge was reached."
  []
  (let [direction (@snake :direction)
head (snake-head)
x (head :x)
y (head :y)]
(cond
  (and (= direction :right) (= x (- *board-width* 1))) :down
  (and (= direction :down) (= y (- *board-height* 1))) :left
  (and (= direction :left) (= x 0)) :up
  (and (= direction :up) (= y 0)) :right
  true direction)))

Each case of the cond here is flawed. For example, when the snake is
heading right and already on the bottom, he's going to turn down,
which is off the board.

I suggest splitting each direction case into two cases such that the
snake goes in the direction where there's more room to travel:

 (defn verify-direction
  "Gets the current snake direction or
   a new one if a board edge was reached."
  []
  (let [direction (@snake :direction)
head (snake-head)
x (head :x)
y (head :y)
left (= x 0)
right (= x (- *board-width* 1))
top (= y 0)
bottom (= y (- *board-height* 1))
left-half (< x (/ *board-width* 2))
right-half (>= x (/ *board-width* 2))
top-half (< y (/ *board-height* 2))
bottom-half (>= y (/ *board-height* 2))]
(cond
  (and (= direction :right) right top-half) :down
  (and (= direction :right) right bottom-half) :up
  (and (= direction :down) bottom left-half) :right
  (and (= direction :down) bottom right-half) :left
  (and (= direction :left) left top-half) :down
  (and (= direction :left) left bottom-half) :up
  (and (= direction :up) top left-half) :right
  (and (= direction :up) top right-half) :left
  true direction)))

--Brian Will

On Jan 2, 11:07 am, "Mark Volkmann"  wrote:
> I've written a new version of the snake program that uses a more
> literate style and therefore, to my eyes, calls for far fewer
> comments. I think this code is very readable. Check it out 
> athttp://www.ociweb.com/mark/programming/ClojureLiterateSnake.html.
> Feedback is welcomed!
>
> The most controversial thing about this code is probably my use of def
> to change the state of the snake and the apple. It's not yet clear to
> me that using atoms is needed here, but I need to think about that
> more.
>
> This version has some features that weren't in the original such as:
> - automatically turning the snake in the clockwise direction when aboardedge 
> is reached
> - changing the color of the snake to black when it overlaps itself
> - announcing a win when the length of the snake reaches 10
> - automatically restarting the game after an overlap or a win
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
--~--~-~--~~~---~--~~
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: literate snake

2009-01-03 Thread Brian Will

My way was a little verbose, but you could do:

(defn verify-direction
  "Gets the current snake direction or
   a new one if a board edge was reached."
  []
  (let [direction (@snake :direction)
head (snake-head)
x (head :x)
y (head :y)
at-left (= x 0)
at-right (= x (- *board-width* 1))
at-top (= y 0)
at-bottom (= y (- *board-height* 1))
left-half (< x (/ *board-width* 2))
top-half (< y (/ *board-height* 2))]
(cond
  (and (= direction :right) at-right) (if top-half :down :up)
  (and (= direction :down) at-bottom) (if left-half :right :left)
  (and (= direction :left) at-left) (if top-half :down :up)
  (and (= direction :up) at-top) (if left-half :right :left)
  true direction)))

On Jan 3, 9:28 am, "Mark Volkmann"  wrote:
> On Sat, Jan 3, 2009 at 3:03 AM, Brian Will  
> wrote:
>
> > The problem with the snake running off the edge simply is a flaw in
> > your logic here:
>
> > (defn verify-direction
> >  "Gets the current snake direction or
> >   a new one if a board edge was reached."
> >  []
> >  (let [direction (@snake :direction)
> >        head (snake-head)
> >        x (head :x)
> >        y (head :y)]
> >    (cond
> >      (and (= direction :right) (= x (- *board-width* 1))) :down
> >      (and (= direction :down) (= y (- *board-height* 1))) :left
> >      (and (= direction :left) (= x 0)) :up
> >      (and (= direction :up) (= y 0)) :right
> >      true direction)))
>
> > Each case of the cond here is flawed. For example, when the snake is
> > heading right and already on the bottom, he's going to turn down,
> > which is off the board.
>
> > I suggest splitting each direction case into two cases such that the
> > snake goes in the direction where there's more room to travel:
>
> >  (defn verify-direction
> >  "Gets the current snake direction or
> >   a new one if a board edge was reached."
> >  []
> >  (let [direction (@snake :direction)
> >        head (snake-head)
> >        x (head :x)
> >        y (head :y)
> >        left (= x 0)
> >        right (= x (- *board-width* 1))
> >        top (= y 0)
> >        bottom (= y (- *board-height* 1))
> >        left-half (< x (/ *board-width* 2))
> >        right-half (>= x (/ *board-width* 2))
> >        top-half (< y (/ *board-height* 2))
> >        bottom-half (>= y (/ *board-height* 2))]
> >    (cond
> >      (and (= direction :right) right top-half) :down
> >      (and (= direction :right) right bottom-half) :up
> >      (and (= direction :down) bottom left-half) :right
> >      (and (= direction :down) bottom right-half) :left
> >      (and (= direction :left) left top-half) :down
> >      (and (= direction :left) left bottom-half) :up
> >      (and (= direction :up) top left-half) :right
> >      (and (= direction :up) top right-half) :left
> >      true direction)))
>
> Thanks Brian! I ended up doing something similar that required a
> little less code. Here's what I did.
>
>   (let [direction (@snake :direction)
>         head (snake-head)
>         x (head :x)
>         y (head :y)
>         at-left (= x 0)
>         at-right (= x (- *board-width* 1))
>         at-top (= y 0)
>         at-bottom (= y (- *board-height* 1))]
>     (cond
>       (and (= direction :up) at-top) (if at-right :left :right)
>       (and (= direction :right) at-right) (if at-bottom :up :down)
>       (and (= direction :down) at-bottom) (if at-left :right :left)
>       (and (= direction :left) at-left) (if at-top :down :up)
>       true direction)))
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
--~--~-~--~~~---~--~~
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: meaning and pronunciation of Clojure

2009-01-03 Thread Brian Will

Yes. Pronounced "closure" as if the "j" is French.

On Jan 3, 1:06 pm, "Mark Volkmann"  wrote:
> I assume that the name "Clojure" is taken from the word "closure",
> replacing the "s" with a "j" for Java. I've never seen that in writing
> though and my curiosity compels me to have this verified. Is that
> right?
>
> Also, is it pronounced it is spelled or is it pronounced the same as
> "closure"? I did find a post that said it's pronounced like "closure",
> but I've always pronounced it the way it is spelled.
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
--~--~-~--~~~---~--~~
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: automatic concurrency

2009-01-03 Thread Brian Will

Clojure doesn't start any threads you don't tell it to.

In Haskell, there's a strict compile-time distinction between pure
functions and impure functions, so Haskell always knows which
functions can be run concurrently without issue. Actually running
stuff concurrently without explicit direction from the programmer,
however, is another matter. The implementations of Haskell that do
this are experimental and not widely used.

http://en.wikipedia.org/wiki/Automatic_parallelization

--Brian Will

On Jan 3, 12:20 pm, "Mark Volkmann"  wrote:
> One of the stated benefits of functional programming I've seen is that
> the compiler of a functional language can analyze code and determine
> statements within a function 
that can safely be run concurrently. As
> far as I know Clojure doesn't yet do this. Correct?
>
> Which functional programming languages, if any, do this?
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
--~--~-~--~~~---~--~~
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: automatic concurrency

2009-01-03 Thread Brian Will

> Remember that "parallel" and "concurrent" are two different things.
> "Concurrent" is something you deal with all the time if you are
> writing GUI apps:  there are different threads and they interact in
> some possibly unpredictable way.  You can have concurrency on a single-
> core machine.  "Parallel" means multiple CPUs working together for
> _performance_, i.e., to run faster.

I'm not sure this distinction is widely accepted. The term "parallel",
as I've heard it used, means simultaneous computation, which is one
kind of concurrency.

It's also worth pointing out that event-drive concurrency, e.g. GUI
stuff, is really just about optimization too. If we had an infinitely
fast machine, we'd probably simply always do everything interactive/
real-time in a game loop. (We'd still probably write event-driven
code, but it would all involve just one thread, much like Javascript
events work in the browser now.)

> The article looks out-of-date and inaccurate, alas...

Yeah, I got this impression as well. I coulda sworn it was better the
last time I looked at it.

--Brian Will
On Jan 3, 6:51 pm, "Mark H."  wrote:
> On Jan 3, 12:20 pm, "Mark Volkmann"  wrote:
>
> > One of the stated benefits of functional programming I've seen is that
> > the compiler of a functional language can analyze code and determine
> > statements within a function 
that can safely be run concurrently. As
> > far as I know Clojure doesn't yet do this. Correct?
>
> Clojure does not automatically exploit thread parallelism for
> performance.  However, the JVM implementation quite probably exploits
> instruction-level parallelism and may also have a parallel and/or
> concurrent garbage collector.  (Parallel CG means exploiting
> parallelism to make the GC itself run faster; concurrent GC means a
> garbage collection doesn't "stop the world.")
>
> > Which functional programming languages, if any, do this?
>
> SISAL and NESL are the two most prominent examples in my mind.  The
> reason why not a lot of functional programming languages did this was
> because previously, "parallel" was something only HPC folks worried
> about, and HPC folks didn't want to switch to functional languages for
> various reasons, partly cultural and partly practical.  (SISAL was one
> attempt to get them to switch and it didn't work, despite its compiler
> being fairly successful at automatic parallelization.)
>
> Now your laptop is parallel because of the Power Wall and ordinary
> mortal coders are being asked to write parallel code.  (The best HPC
> coders are the sort that can find bottlenecks by passing their hand
> over the CPU die and grokking where the bits go.)  It's enough of a
> paradigm shift and the number of affected programmers is large enough
> that people are considering new programming language solutions.
>
> Remember that "parallel" and "concurrent" are two different things.
> "Concurrent" is something you deal with all the time if you are
> writing GUI apps:  there are different threads and they interact in
> some possibly unpredictable way.  You can have concurrency on a single-
> core machine.  "Parallel" means multiple CPUs working together for
> _performance_, i.e., to run faster.  Clojure has a lot of tools to
> solve concurrency problems.  I think of it as a language designed for
> that goal.  There are also tools in Clojure (like pmap) to exploit
> parallelism, but the concurrency tools are more developed.
>
> mfh
--~--~-~--~~~---~--~~
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: Some code review for clj-record?

2009-01-04 Thread Brian Doyle
Looks good.  I didn't know about the *file* var.

On Sun, Jan 4, 2009 at 11:22 AM, John D. Hume wrote:

>
> Brian,
> I incorporated your changes and then made changes to load and run all
> clj_record/test/*-test.clj files. Thanks again.
> -hume.
>
> >
>

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



finding all vars starting with *

2009-01-04 Thread Brian Doyle
Today I found out about the var *file*.  I looked it up *file* on
clojure.com/api and couldn't find anything.
Is there some place where all of these vars are defined?   Is there some way
programatically I can find
them all?  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
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: Some code review for clj-record?

2009-01-04 Thread Brian Doyle
John,

I was looking at the validates method and I had a thought I'd bounce off
you.  Instead of
just returning a hash of errors what about returning the record with the
errors hash in
the metadata?   That way you just have the data and the errors in one
"object" similar
to an ActiveRecord model.

On Sun, Jan 4, 2009 at 2:22 PM, Brian Doyle  wrote:

> Looks good.  I didn't know about the *file* var.
>
> On Sun, Jan 4, 2009 at 11:22 AM, John D. Hume wrote:
>
>>
>> Brian,
>> I incorporated your changes and then made changes to load and run all
>> clj_record/test/*-test.clj files. Thanks again.
>> -hume.
>>
>> >>
>>
>

--~--~-~--~~~---~--~~
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: Very noob file reading and printing question

2009-01-06 Thread Brian Doyle
On Tue, Jan 6, 2009 at 4:47 PM, Tom Ayerst  wrote:

> Its not the println, nor getting a reader (duckstreams is fine, I can do
> that). Its the converting it to a seq and stepping through it printing each
> element (which should be a line). Its the loopy, steppy bit, just for a side
> effect; that I am messing up.
>
> Cheers
>
> Tom


I've done this type of thing and it worked great for me.

   (with-open [r (clojure.contrib.duck-streams/reader "filename.txt")]
   (doseq [line (line-seq r)]
   ; do stuff with the line here
  ))

Basically you'll want to use the line-seq function.  Hopefully that helps.


> 2009/1/6 Mark Volkmann 
>
>
>> On Tue, Jan 6, 2009 at 5:26 PM, Tom Ayerst  wrote:
>> > Hi,
>> >
>> > How do I read and print a text file?  I can read it, its the printing
>> that
>> > is the problem, I feel it should be obvious but I keep tripping myself
>> up.
>> > (The context is I need to extract data line by line, translate the line
>> > format and save it for a legacy app)
>>
>> Do you just need to print to stdout?
>> The println function does that. It puts a space between the output of
>> each of its arguments. If you don't want that you can use the str
>> function to concatenate a bunch of string values together.
>> If you need something fancier, don't forget that you can access
>> everything in java.io from Clojure.
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>>
>>
>>
>
> >
>

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



writing bytes to a file

2009-01-07 Thread Brian Doyle
I couldn't find anything in core or contrib that wrote out
bytes to a file so I wrote something to do it.   Is this
functionality already implemented and I just couldn't find
it?   If there isn't anything already, would this be something
good to put in contrib somewhere?  Thanks.

   (defn write-bytes
 "Writes the bytes from the in-stream to the given filename."
 [#^java.io.InputStream in-stream #^String filename]
 (with-open [out-stream (new FileOutputStream filename)]
   (let [buffer (make-array (Byte/TYPE) 4096)]
 (loop [bytes (.read in-stream buffer)]
   (if (not (neg? bytes))
 (do
   (.write out-stream buffer 0 bytes)
   (recur (.read in-stream buffer

--~--~-~--~~~---~--~~
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: writing bytes to a file

2009-01-07 Thread Brian Doyle
Looks like spit is for printing just text.

On Wed, Jan 7, 2009 at 12:20 PM, Paul Barry  wrote:

> clojure.contrib.duck_streams/spit?
>
>
> On Wed, Jan 7, 2009 at 2:14 PM, Brian Doyle  wrote:
>
>> I couldn't find anything in core or contrib that wrote out
>> bytes to a file so I wrote something to do it.   Is this
>> functionality already implemented and I just couldn't find
>> it?   If there isn't anything already, would this be something
>> good to put in contrib somewhere?  Thanks.
>>
>>(defn write-bytes
>>  "Writes the bytes from the in-stream to the given filename."
>>  [#^java.io.InputStream in-stream #^String filename]
>>  (with-open [out-stream (new FileOutputStream filename)]
>>(let [buffer (make-array (Byte/TYPE) 4096)]
>>  (loop [bytes (.read in-stream buffer)]
>>(if (not (neg? bytes))
>>  (do
>>(.write out-stream buffer 0 bytes)
>>(recur (.read in-stream buffer
>>
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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: writing bytes to a file

2009-01-08 Thread Brian Doyle
I incorporated most of James ideas but I don't like the name pipe-stream.

(defn write-stream
"Writes the data from the istream to the ostream."
([#^java.io.InputStream istream #^java.io.OutputStream ostream #^Integer
buffer-size]
  (let [buffer (make-array (Byte/TYPE) buffer-size)]
(loop [bytes (.read istream buffer)]
  (when (pos? bytes)
(.write ostream buffer 0 bytes)
(recur (.read istream buffer))
([#^java.io.InputStream istream #^java.io.OutputStream ostream]
  (write-stream istream ostream 4096)))

 (defn write-stream-to-file
"Writes the data from the istream to the file."
([#^java.io.InputStream istream #^String filename #^Integer buffer-size]
  (with-open [ostream (new FileOutputStream filename)]
(write-stream istream ostream buffer-size)))
([#^java.io.InputStream istream #^String filename]
  (write-stream-to-file istream filename 4096)))


On Thu, Jan 8, 2009 at 2:28 AM, James Reeves wrote:

>
> On Jan 7, 7:14 pm, "Brian Doyle"  wrote:
> >(defn write-bytes
> >  "Writes the bytes from the in-stream to the given filename."
> >  [#^java.io.InputStream in-stream #^String filename]
> >  (with-open [out-stream (new FileOutputStream filename)]
> >(let [buffer (make-array (Byte/TYPE) 4096)]
> >  (loop [bytes (.read in-stream buffer)]
> >(if (not (neg? bytes))
> >  (do
> >(.write out-stream buffer 0 bytes)
> >(recur (.read in-stream buffer
>
> Might I suggest that write-bytes be renamed write-stream, or even spit-
> stream? Also it would be useful if it was divided into two functions:
>
> (defn pipe-stream
>  "Pipe the contents of an InputStream into an OutputStream."
>  ([in out]
>(pipe-stream in out 4096))
>  ([#^InputStream in #^OutputStream out bufsize]
>(let [buffer (make-array Byte/TYPE bufsize)]
>  (loop [len (.read in buffer)]
>(when (pos? len)
>  (.write out buffer 0 len)
>  (recur (.read in buffer)))
>
> (def write-stream
>  "Write the contents of an InputStream to a file."
>  [in filename]
>  (pipe-stream in (new FileOutputStream filename)))
>
> - 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
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: writing bytes to a file

2009-01-08 Thread Brian Doyle
On Thu, Jan 8, 2009 at 11:34 AM, James Reeves wrote:

>
> On Jan 8, 5:05 pm, "Brian Doyle"  wrote:
> > I incorporated most of James ideas but I don't like the name pipe-stream.
>
> Then wouldn't copy-stream be better? write-stream isn't specific
> enough, IMO.
>

Sure, write-stream works for me.


>
> Also, I don't think there's a huge amount of gain to be had from an
> Integer type hint in this case, since it's only used once, or for two
> sets of type hints for the same function.


Agreed.  I had hinted on the other params and just thought I'd do it for
the Integer type as well.


>
>
> - 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
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: writing bytes to a file

2009-01-08 Thread Brian Doyle
On Thu, Jan 8, 2009 at 12:36 PM, Brian Doyle  wrote:

>
>
> On Thu, Jan 8, 2009 at 11:34 AM, James Reeves 
> wrote:
>
>>
>> On Jan 8, 5:05 pm, "Brian Doyle"  wrote:
>> > I incorporated most of James ideas but I don't like the name
>> pipe-stream.
>>
>> Then wouldn't copy-stream be better? write-stream isn't specific
>> enough, IMO.
>>
>
> Sure, write-stream works for me.
>

Sorry, I meant that copy-stream works for me.  It's been a long day already
:(


>
>
>
>>
>> Also, I don't think there's a huge amount of gain to be had from an
>> Integer type hint in this case, since it's only used once, or for two
>> sets of type hints for the same function.
>
>
> Agreed.  I had hinted on the other params and just thought I'd do it for
> the Integer type as well.
>
>
>>
>>
>> - 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
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 find all files ending with .clj, for example

2009-01-08 Thread Brian Doyle
Here's one of many ways to do this:

(filter #(.endsWith (.getName %1) ".clj" ) (file-seq (java.io.File. ".")))


On Thu, Jan 8, 2009 at 5:48 PM, wubbie  wrote:

>
> Hi all,
>
> I can use file-seq
> (file-seq (File. "."))
> But how can I filter out all files ending with .clj?
> Do we use re-find, re-seq etc?
>
> thanks
> sun
>
> >
>

--~--~-~--~~~---~--~~
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: How can I find all files ending with .clj, for example

2009-01-08 Thread Brian Doyle
This works:

(filter #(re-find #"\.clj$" (str %)) (file-seq(java.io.File. ".")))

On Thu, Jan 8, 2009 at 7:16 PM, wubbie  wrote:

>
> I tried
>
>  (filter #(re-find #"\.clj$" %) (seq (file-seq(java.io.File. "."
> -> java.lang.ClassCastException: java.io.File cannot be cast to
> java.lang.CharSequence (NO_SOURCE_FILE:0)
>
>
> On Jan 8, 9:06 pm, Achim Passen  wrote:
> > On 9 Jan., 03:03, Achim Passen  wrote:
> >
> > > (filter #(re-find #".clj$" %) … )
> >
> > correction:
> > (filter #(re-find #"\.clj$" %) … )
> >
>

--~--~-~--~~~---~--~~
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: Setting a value inside a map of map of maps...

2009-01-11 Thread Brian Doyle
I think you can just use the update-in function like:

1:1 user=> (def m {:a {:b {:c {:d 3)
#'user/m

1:2 user=> (update-in m [:a :b :c :d] - 5)
{:a {:b {:c {:d -2


On Sun, Jan 11, 2009 at 11:08 AM, CuppoJava wrote:

>
> Hi,
> I'm just wondering if there's a clever way of creating a new map from
> an existing map of map of maps.. with a key deep inside altered.
>
> ie. given this map: {:a {:b {:c {:d 3
>
> i want to create a new map, with the value at :d increased by 5.
>
> I wrote a macro to do this, but it's quite ugly.
>
> Thanks for the tip
>  -Patrick
>
> --
> In case this helps at all, this is the macro that I wrote.
> Usage: (set_map mymap [:a :b :c :d] (+ it 5))
>
> (defmacro -set_map [mymap mykeys expr]
>  (let [syms (take (dec (count mykeys))
>   (repeatedly gensym))
>bindings (interleave
>  (concat syms ['it])
>  (map list
>   mykeys
>   (concat [mymap] syms)))]
>`(let [...@bindings]
>   ~((fn assoc_fn [maps keys expr]
>   (if (empty? keys)
> expr
> `(assoc ~(first maps) ~(first keys)
> ~(assoc_fn (rest maps) (rest keys) expr
> (concat [mymap] syms) mykeys expr
>
> (defmacro set_map [map keys expr]
>  `(let [map# ~map]
> (-set_map map# ~keys ~expr)))
> >
>

--~--~-~--~~~---~--~~
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: How to create and read from a stream of random characters?

2009-01-12 Thread Brian Doyle
Chouser's solution works well, but I found that you can end up
with an empty string sometimes or never getting the maxlength
that you passed in.

1:2 user=> (take 3 (seq-of-rand-strings 10))
("ngene" "" "dwlbzndqx")

I added an inc before calling the take and that clears things up.

(defn seq-of-rand-strings [maxlength]
(repeatedly (fn []
   (apply str (take (inc (rand-int maxlength))
 (repeatedly #(char (+ (int \a) (rand-int
26)

On Mon, Jan 12, 2009 at 1:38 AM, GS  wrote:

>
>
> > (defn seq-of-rand-strings [maxlength]
> >   (repeatedly (fn []
> > (apply str (take (rand-int maxlength)
> >  (repeatedly #(char (+ (int \a) (rand-int 26)
> >
> > user=> (take 3 (seq-of-rand-strings 10))
> > ("kae" "xwuwyp" "xa")
>
> Thanks Chouser.  I learned some useful and interesting things from
> your reply.  I was unaware of 'char and 'repeatedly.
>
> Gavin
> >
>

--~--~-~--~~~---~--~~
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: *1 *2 isn't working properly

2009-01-14 Thread Brian Doyle
Here's an example of *1 *2 *3

1:1 user=> (str "gavin")
"gavin"
1:2 user=> (str "teri")
"teri"
1:3 user=> (str "brian")
"brian"
1:4 user=> (str-join " " [*1 *2 *3])
"brian teri gavin"


On Wed, Jan 14, 2009 at 2:29 AM, Stephen C. Gilardi wrote:

>
> By the time you evaluated *2, the second most recent result was what
> it showed you. All top level evaluations count.
>
> In short, you were Heisenberged.
>
> --Steve
>
> On Jan 14, 2009, at 3:59 AM, HB  wrote:
>
> >
> > Hey,
> > I'm trying to run my first Clojure example
> >
> > user=> (defn hello [name] (str "Cool! " name))
> > #'user/hello
> > user=> (hello "Google")
> > "Cool! Google"
> > user=> (hello "Wicket")
> > "Cool! Wicket"
> > user=> (str *1)
> > "Cool! Wicket"
> > user=> (str *2)
> > "Cool! Wicket"
> >
> > Isn't (str *2) supposed to return "Cool! Google" ?
> > Environment:
> > Clojure20081217
> > Ubuntu 8.04
> >
> > 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
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: QT Jambi and the Repl

2009-01-16 Thread Brian Carper

On Jan 16, 5:38 pm, levand  wrote:
> Has anyone here had success in using Clojure with QT Jambi?
>
> I'm currently experimenting with porting my app from Swing to QT, and
> although Jambi might well be the theoretically superior framework, it
> seems like Swing is a lot easier to use with Clojure.
>
> The issue I'm currently running into is that you can't call any
> methods on QT gui objects unless you're in the same thread they were
> created in. But that can't be the Repl thread, because
> QApplication.exec() basically sets up an event loop and takes control
> of whatever thread you start it in.
>
> So, it looks like I can't do any of that cool interactive gui
> development that I fell in love with in Rich's presentations, and have
> continued to love using myself.
>
> Am I missing something? I thought I'd give QT a try, since everyone
> seems to rave about it, but so far, in most ways, Swing seems easier
> to use and more powerful. But maybe I'm just not familiar enough with
> Jambi.
>
> Many thanks,
> -Luke

I have had some success writing a little app[1] in Qt Jambi in
Clojure, for what it's worth.  You can use QCoreApplication/
invokeLater or invokeAndWait to mess with Qt objects from different
threads.

I have managed to segfault the JVM while poking a running Qt Jambi app
from a REPL.  I also had some problems with memory leaks [2] for a
time.  It's not as stable and solid as Swing.  It works though, and Qt
is a nice framework to work with.

[1]: http://github.com/briancarper/bcc-clojure/tree/master
[2]: Most likely this issue: 
http://www.mail-archive.com/qt-jambi-inter...@trolltech.com/msg00592.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
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: Unexpected binding behavior

2009-01-20 Thread Brian Carper

On Jan 20, 10:06 am, "Hugh Winkler"  wrote:
> Inside FP, outside FP, all I want is no surprises.

I agree, this is confusing for new users.  Especially given the
counter-intuitive (for a new person) way the REPL forces evaluation of
everything, making everything seem to be eager when it's not.  This
aspect of Clojure is very different from most languages, including
other Lisps, and the kinds of errors it can produce are often silent
and hard to figure out.

Some documentation loudly proclaiming the laziness of map and friends,
the importance of dorun/doall/doseq, and the potential pitfalls of
laziness would be helpful.  Perhaps as an FAQ entry if nothing else?
--~--~-~--~~~---~--~~
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: symbols, vars and namespaces

2009-01-27 Thread Brian Doyle
On Tue, Jan 27, 2009 at 7:43 AM, Chouser  wrote:

>
> On Tue, Jan 27, 2009 at 8:51 AM, Mark Volkmann
>  wrote:
> >
> > Are these statements correct? Actually, I know some are correct
> > because I just looked though the source. Hopefully others that haven't
> > will find this interesting.
> >
> > Symbol objects have a String name and a String namespace name, but no
> value.
> > Var objects have references to a Symbol object, a Namespace object and
> > an Object object which is its "root value".
> > Namespace objects have a reference to a Map that holds associations
> > between Symbol objects and Var objects.
> > In Clojure, the term "interning" typically refers to adding a
> > Symbol-to-Var mapping to a Namespace.
>
> Those all sound right to me, with the (very minor) caveat that
> Namespaces also have a aliases map.
>
> > Why don't Symbol objects have a reference to a Namespace object
> > instead of a String that is a Namespace name?
>
> The namespace part of a symbol doesn't have to refer to any existing
> namespace.  This is useful for example when using the symbol as its
> own value.
>
> user=> (namespace 'foo/bar)
> "foo"
>
> The namespace part can even be 'nil', which is probably the most
> common case for symbols created by the reader:
>
> user=> (def expr (read (java.io.PushbackReader. (java.io.StringReader.
> "(+ 1 2)"
> user=> (first expr)
> +
> user=> (namespace (first expr))
> nil


This nil namespace seems a bit odd.  Wasn't expr created in the user
namespace?


>
> Or even just:
>
> user=> (namespace 'zipmap)
> nil
>
> --Chouser
>
> >
>

--~--~-~--~~~---~--~~
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: Denver/Boulder Clojure users

2009-02-05 Thread Brian Doyle
I live in southeast Denver and have been doing some Clojure on my own for a
few months now.

On Thu, Feb 5, 2009 at 12:39 PM, chris  wrote:

>
> Are there any existing clojure users in the Denver/Boulder area (other
> than me)?.
>
> Chris
> >
>

--~--~-~--~~~---~--~~
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: why fn key doesn't do what I want?

2009-02-14 Thread Brian Doyle
On Sat, Feb 14, 2009 at 2:24 PM, wubbie  wrote:

>
> Hi,
>
> a quick question:
>
> user=> (keys {:a 1 :b 2})
> (:a :b)
>
> But
> user=> (key {:a 1})
> java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot
> be cast to java.util.Map$Entry (NO_SOURCE_FILE:0)
>
> I see defn key in core.clj, though.
> What can be the correct usage of fn key, then?
>

Here is the correct usage of fn key:

1:1 user=> (key (first {:a 1}))
:a

Key only accepts a map entry and not a Map object.


> thanks in advance,
> -sun
>
> >
>

--~--~-~--~~~---~--~~
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: Newbie: Separating and grouping the elements in a bunch of vectors

2009-02-15 Thread Brian Doyle
>From the original question it looked like there was a vector of unknown
length of vectors

[[a0 a1 a2] [b0 b1 b2] ...]

So my solution is something like:

1:12 user=> (def vecs [[:a0 :a1 :a2] [:b0 :b1 :b2]])
#'user/vecs
1:13 user=> (partition (count vecs) (interleave (flatten vecs)))
((:a0 :a1) (:a2 :b0) (:b1 :b2))

This doesn't return a sequence of vectors and just a sequence of sequences.
I'm sure it can be done, but it's not clear to me if you have a vector of
vectors
how Stuart's solution would work:

1:15 user=> (map vector vecs)
([[:a0 :a1 :a2]] [[:b0 :b1 :b2]])


On Sun, Feb 15, 2009 at 7:54 PM, David Nolen  wrote:

> Of course ;) Keep forgetting the obvious things.
>
>
> On Sun, Feb 15, 2009 at 9:36 PM, Stuart Halloway <
> stuart.hallo...@gmail.com> wrote:
>
>>
>> (map vector [1 2 3] ['a 'b 'c] ["cat" "dog" "bird"])
>> -> ([1 a "cat"] [2 b "dog"] [3 c "bird"])
>>
>> > Actually something closer to your exact expression is this:
>> >
>> > (apply (partial map (fn [& rest] (apply vector rest))) [[1 2 3] ['a
>> > 'b 'c] ["cat" "dog" "bird"]])
>> >
>> > On Sun, Feb 15, 2009 at 7:42 PM, David Nolen
>> >  wrote:
>> > (map (fn [& rest] (apply vector rest)) [1 2 3] ['a 'b 'c] ["cat"
>> > "dog" "bird"])
>> >
>> >
>> > On Sun, Feb 15, 2009 at 7:16 PM, samppi  wrote:
>> >
>> > What would I do if I wanted this:
>> >
>> > [[a0 a1 a2] [b0 b1 b2] ...] -> [[a0 b0 ...] [a1 b1 ...] [a2 b2 ...]]
>> >
>> > I could write a loop, I guess, but is there a nice, idiomatic,
>> > functional way of doing this? I didn't spot a way in
>> > clojure.contrib.seq-utils either.
>> >
>> >
>> >
>> >
>> > >
>>
>>
>>
>>
>
> >
>

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



Is syntax quote "reader" only?

2009-02-16 Thread Brian Will

I'm a bit mystified how syntax quote does what it does. I don't see
how syntax quote can quote the whole while unquoting parts without
some evaluation-time intervention. If I had to implement it myself,
I'd just punt the problem to evaluation-time by introducing a special
form 'unquote', e.g.:

  `(a b ~(c d))

  (quote ((unquote a) 3 (unquote (c d)))

But this isn't what Clojure does, so I'm wondering, how does syntax
quote do its business while remaining strictly a reader-time only
mechanism?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Importing lots of Java classes at once

2009-02-20 Thread Brian Carper

One could argue that wildcard imports in Java (import package.*) are
evil, pollute your namespaces, create potential naming conflicts,
etc.  One would probably be correct.

One could also argue that having to manually type a list of dozens of
classnames is pretty tedious, especially if all you want to do is goof
off at a REPL for a few minutes.  e.g. I wanted to run some SWT
snippets [1], and to import all the necessary SWT classes into Clojure
can be a bit of a pain.

I found this somewhat appalling bit of code [2] which I can use to get
a list of all the classnames in some package and then import them all
that way.  There are all kinds of ways that code can fail though.
Does anyone else have a way that they routinely import lots and lots
of Java classes at once?  I don't care how dirty a hack it is, I'm not
going to do this in production code.  I only want to save my fingers a
bit of typing.

I know this probably isn't planned [3] for Clojure, just looking for
the best workaround.

[1]: http://www.eclipse.org/swt/snippets/
[2]: http://forums.sun.com/thread.jspa?threadID=341935&start=30&tstart=0
[3]: 
http://groups.google.com/group/clojure/browse_thread/thread/c65e19d51a5b794c/732925c7936abf83
--~--~-~--~~~---~--~~
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: Importing lots of Java classes at once

2009-02-24 Thread Brian Doyle
I wrote something similar to what you are asking about.  My
code does not import java class files but calls 'use' on clojure
files that live in the clojure-contrib.jar file.   I load this when I
start the REPL only.


(defn name-to-symbol [lib-name]
  "Converts the lib-name to a symbol"
(-> lib-name (.replaceFirst ".clj$" "") (.replaceAll  "_" "-")
(.replaceAll "/" ".") (symbol)))

(defn contrib-ns [jar]
  "Returns a seq of symbols from the clojure.contrib package, is not
recursive"
  (for [f (map #(.getName %)
   (enumeration-seq (.entries (java.util.zip.ZipFile. jar
:when (and (.endsWith f "clj")
   (= 3 (count (.split f "/")))
   (not (or (.endsWith f "test_clojure.clj") (.endsWith f
"test_contrib.clj"]
(name-to-symbol f)))

;sets the variable to the colure-contrib.jar path, otherwise nil
(def contrib-jar (if-let [url (.getResource
(ClassLoader/getSystemClassLoader) "clojure-contrib.jar")]
   (.getFile url)))

(defn use-contribs []
  "Calls the use function on every clj file in the clojure.contrib package.
Not every clj file can
  be loaded because of function name clashes with the core."
  (if contrib-jar
(println (str "use " (reduce (fn [ret n]
  (try
(use n)
(conj ret n)
(catch Exception _ ret))) []
(contrib-ns contrib-jar))


On Fri, Feb 20, 2009 at 10:48 PM, Jason Wolfe  wrote:

>
> I have a horrible hack to do this, which uses even more appalling code
> than [2] ripped off from a different forum, but which (in my limited
> experience) seems to work OK.  I'll email it to you privately, and to
> anyone else who wants to use it (just ask).
>
> -Jason
>
> On Feb 20, 9:33 pm, Brian Carper  wrote:
> > One could argue that wildcard imports in Java (import package.*) are
> > evil, pollute your namespaces, create potential naming conflicts,
> > etc.  One would probably be correct.
> >
> > One could also argue that having to manually type a list of dozens of
> > classnames is pretty tedious, especially if all you want to do is goof
> > off at a REPL for a few minutes.  e.g. I wanted to run some SWT
> > snippets [1], and to import all the necessary SWT classes into Clojure
> > can be a bit of a pain.
> >
> > I found this somewhat appalling bit of code [2] which I can use to get
> > a list of all the classnames in some package and then import them all
> > that way.  There are all kinds of ways that code can fail though.
> > Does anyone else have a way that they routinely import lots and lots
> > of Java classes at once?  I don't care how dirty a hack it is, I'm not
> > going to do this in production code.  I only want to save my fingers a
> > bit of typing.
> >
> > I know this probably isn't planned [3] for Clojure, just looking for
> > the best workaround.
> >
> > [1]:http://www.eclipse.org/swt/snippets/
> > [2]:http://forums.sun.com/thread.jspa?threadID=341935&start=30&tstart=0
> > [3]:
> http://groups.google.com/group/clojure/browse_thread/thread/c65e19d51...
> >
>

--~--~-~--~~~---~--~~
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: sequences from Enumerations

2009-03-02 Thread Brian Doyle
I had the same issue and ended up having to use enumeration-seq function.
Seems
strange but it worked.

On Mon, Mar 2, 2009 at 4:22 PM, Mark Volkmann wrote:

>
> Should I be able to do something like this?
>
> (doseq [table-column (-> jtable .getColumnModel .getColumns)]
>
> javax.swing.JTable has a getColumnModel method that returns a
> TableColumnModel.
> TableColumnModel has a getColumns method that returns
> Enumeration.
> I was hoping that would automatically be treated as a sequence, but I get
>
> java.lang.IllegalArgumentException: Don't know how to create ISeq from:
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
> >
>

--~--~-~--~~~---~--~~
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: sequences from Enumerations

2009-03-02 Thread Brian Doyle
That makes sense now.  Thanks for the link to the thread.

On Mon, Mar 2, 2009 at 5:01 PM, Stephen C. Gilardi  wrote:

>
> On Mar 2, 2009, at 6:37 PM, Brian Doyle wrote:
>
>  I had the same issue and ended up having to use enumeration-seq function.
>>  Seems
>> strange but it worked.
>>
>
> The seq function is not able to provide a seq on either an Enumeration or
> an Iterator.
>
> clojure.core provides enumeration-seq and iterator-seq to create seqs on
> them.
>
> The rationale for this is contained in this thread:
>
>
> http://groups.google.com/group/clojure/browse_thread/thread/decbd098646353c/7a78ebf588bf0f7e?lnk=gst&q=iterator-seq#7a78ebf588bf0f7e
>
> --Steve
>
>

--~--~-~--~~~---~--~~
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: On the importance of recognizing and using maps

2009-03-08 Thread Brian Carper

On Mar 8, 10:53 am, Rich Hickey  wrote:>
> In looking at some of the libraries, I am a bit concerned that maps
> are not being used when the logical entity is in fact a map.

One time I find myself abusing vectors where maps would be better is
in a situation where I have to retrieve key/value pairs in the order
they were inserted.

For example I'm working on a DSL for cascading stylesheets, and maps
should be perfect for specifying property declarations (right down to
curly braces for maps coincidentally and nicely matching the curly
braces in literal CSS).

But (css [:div {:padding "1px" :padding-left "5px"}]) won't work
because the order is lost.  Depending on the order "padding" and
"padding-left" show up in the final CSS, the meaning changes.  Not
sure what the best Clojure idiom would be in this case.  Vectors that
look like maps are the best I've come up with.

So "ordered maps" would be useful.  They have been endlessly re-
invented in the Ruby community, for example.  I think in upcoming Ruby
1.9, maps that preserve their insertion order are the default, in
spite of obviously worse performance compared to true hashed maps.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



clj-web-crawler

2009-03-09 Thread Brian Doyle
I wrote a Clojure script that wraps the Apache commons-client library for
crawling the web.   It's a simple 125 line script and I also wrote some test
cases for it as well.  I was wondering if this is something that
could/should
be included in clojure.contrib or if it should be a standalone Clojure
library?
The code is here if you want to check it out:

http://github.com/heyZeus/clj-web-crawler/tree/master

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



advice needed converting large files to xml

2009-03-16 Thread Brian Doyle
I've been using Clojure for about 6 months now and really like it.  I am
somewhat new to multi-threading
and using any of the parallel features in Clojure though.   I have a
situation where I need to convert
7 files from CSV to XML.  Each one of these files is about 180MB apiece in
size.   I have dual core machine
with 2GB of RAM and would like some advice on the best strategy for
processing these files in a way that
really utilizes both cores and my memory to really speed up the
processing.I'm sure this isn't the best
way, but I've only come up with starting up two threads at first, having
each thread open up a file,
call line-seq on that file, write out the XML for each line and then go to
the next file when it's complete.   Any
advice would be great.  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
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: advice needed converting large files to xml

2009-03-16 Thread Brian Doyle
On Mon, Mar 16, 2009 at 4:21 PM, Stu Hood  wrote:

> If you write your CSV -> XML processing as a function, you could pmap (
> http://clojure.org/api#pmap)  that function across the list of input
> files. pmap will transparently create the threads as needed, and it will
> probably be enough to saturate your disk.
>
> Thanks,
> Stu
>

Stu,  I just want to make sure I understand what you are saying here.  Would
it look something like this:

(pmap (fn [input-file]
   ; open input for reading
   ; open output for writing
   ; read line
   ; process line
   ; write line
 )
 ["input-file1", "input-file2", "input-file3", ])

Thanks.


>
>
> On Mon, Mar 16, 2009 at 5:56 PM, Brian Doyle wrote:
>
>> I've been using Clojure for about 6 months now and really like it.  I am
>> somewhat new to multi-threading
>> and using any of the parallel features in Clojure though.   I have a
>> situation where I need to convert
>> 7 files from CSV to XML.  Each one of these files is about 180MB apiece in
>> size.   I have dual core machine
>> with 2GB of RAM and would like some advice on the best strategy for
>> processing these files in a way that
>> really utilizes both cores and my memory to really speed up the
>> processing.I'm sure this isn't the best
>> way, but I've only come up with starting up two threads at first, having
>> each thread open up a file,
>> call line-seq on that file, write out the XML for each line and then go to
>> the next file when it's complete.   Any
>> advice would be great.  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
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: advice needed converting large files to xml

2009-03-16 Thread Brian Doyle
On Mon, Mar 16, 2009 at 4:29 PM, Mark Volkmann wrote:

>
> On Mon, Mar 16, 2009 at 4:56 PM, Brian Doyle 
> wrote:
> > I've been using Clojure for about 6 months now and really like it.  I am
> > somewhat new to multi-threading
> > and using any of the parallel features in Clojure though.   I have a
> > situation where I need to convert
> > 7 files from CSV to XML.  Each one of these files is about 180MB apiece
> in
> > size.   I have dual core machine
> > with 2GB of RAM and would like some advice on the best strategy for
> > processing these files in a way that
> > really utilizes both cores and my memory to really speed up the
> > processing.I'm sure this isn't the best
> > way, but I've only come up with starting up two threads at first, having
> > each thread open up a file,
> > call line-seq on that file, write out the XML for each line and then go
> to
> > the next file when it's complete.   Any
> > advice would be great.  Thanks.
>
> Most libraries that write XML build a data structure to represent the
> XML and then write it out. That doesn't work for writing out large XML
> documents because you'll run out of memory before you finish building
> the data structure.
>
> I don't know if there is a Clojure library that writes XML as you
> specify it. If there isn't then you should consider WAX, a Java
> library I wrote. You can learn more about it at
> http://ociweb.com/wax/. You could use it from Clojure. Check out the
> tutorial. It's a really simple library, it's really fast and it's very
> memory efficient!
>

Mark,

WAX looks really nice!  I'll look around in Clojure some more about writing
XML but if I don't find anything to my linking I'll give WAX a go.  Thanks!


>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
> >
>

--~--~-~--~~~---~--~~
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: New release 20090320

2009-03-20 Thread Brian Carper

On Mar 20, 7:15 am, Rich Hickey  wrote:
> New release 20090320 -http://clojure.googlecode.com/files/clojure_20090320.zip
>
> Incorporates all the recent additions - fully lazy seqs, :let option
> for doseq/for, letfn for mutually recursive local fns, synchronous
> watches, multi-arg set/union/difference/intersection, counted?, per-
> defmulti hierarchies, #_ ignore form reader macro, future-calls,
> future and pcalls/pvalues, defmulti docstrings and metadata, methods/
> prefers for multimethod reflection, uniform metadata handling for
> atoms/refs/agents/vars/namespaces, condp, release-pending-sends, AOT
> tweaks to support applets and Android, etc. All this in addition to
> many fixes and enhancements.
>
> The API docs page is now current - changes to the rest of the site
> will come soon.
>
> This release includes many patches from contributors, and input and
> reports from many users - thanks all!
>
> Rich

Congrats and many thanks to everyone who has worked so hard to make
Clojure so powerful and fun to use.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



  1   2   3   4   5   6   7   8   9   10   >