ANN: tween-clj 0.4.0 (Tweening library for Clojure)

2012-09-17 Thread Glen Stampoultzis
tween-clj is a Clojure library designed to tween a value between two points.

Inbetweening or tweening is the process of generating intermediate
points between two points.

 Source code:   https://github.com/gstamp/tween-clj
 Jar file:   https://clojars.org/tween-clj
 Clojure Libraries Page:
http://clojure-libraries.appspot.com/library/tween-clj

A small example application can be found here:

 https://github.com/gstamp/tween-clj/tree/master/examples

-- 
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 Quartzite 1.0 (final)

2012-09-17 Thread Glen Stampoultzis
On 18 September 2012 06:53, Michael Klishin wrote:

>  * Solid documentation (my favorite feature)


Mine too!  Nice job.

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

2012-04-03 Thread Glen Stampoultzis
Also... http://clojure-libraries.appspot.com

On 24 March 2012 23:45, Rostislav Svoboda wrote:

> A nice list of tools and libraries I stumbled upon. Enjoy!
>
> http://www.clojure-toolbox.com/
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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

Re: Calling all Melbourne, Australia, Clojure users

2012-02-08 Thread Glen Stampoultzis
On 7 February 2012 22:23, James Sofra  wrote:

>
> So please drop a note here, or you email me directly, to let me know if
> you are in Melbourne and interesting in catching up to chat about and hack
> Clojure.
>
>
I'd be interested.

-- 
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: deep-freeze serialization library

2011-12-30 Thread Glen Stampoultzis
On 30 December 2011 17:00, Timothy Baldridge  wrote:

> A few months back I released 1.0 of deep-freeze, a binary
> serialization library for Clojure. Due to recent additions by Peter
> Taoussanis I thought it would be about time to let some more people
> know about this project, and bump the version number to 1.2
>
>
I was just wondering what the license for this project is.  I couldn't find
anything at the github page.

-- 
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: Avout: Distributed State in Clojure

2011-12-04 Thread Glen Stampoultzis
On 3 December 2011 01:44, David Edgar Liebke  wrote:

> Hi Glen,
>
> >
> > The init-stm step is still referenced in the documentation as being
> required BTW.
> >
>
> Thanks, I'll remove the reference.
>
> > I had a couple of questions.
> >
> > I noticed that when I create a reference (zk-ref) I need to provide an
> initial value.  For each VM I do this for - it ends up clobbering the
> previous value.  Is there anyway to create a reference without necessarily
> clobbering existing data?
>
> Yep, like Chris said, you can just leave off the initial value when
> creating a Ref or Atom, just like with the in-memory versions.
>
>
Okay, thanks. Not sure how I missed the second arg list when I looked up
the docs.

A related question.  If I wanted to do a once-off initialization of the
value (ie, the first VM to create the distributed ref will set the value)
how would I go about it?



> >
> > My second question is to do with derefs. The documentation says that
> Avout caches multiple derefs and that it will invalidate the cache when the
> ref is locally or remotely updated.  My own testing seems to indicate that
> the deref still see the old values after a remote change is made.  If I
> wrap the deref in a dosync!! however that seems to trigger the invalidation
> and I see the correct value. Am I missing something?
> >
>
> I can't reproduce this behavior, can you provide a code snippet where the
> cache isn't getting invalidated and maybe some additional details on your
> setup?
>
>
I think I've narrowed down what was triggering the problem for me.  In my
code I had something like this:

(dosync!! client
  (alter!! r0 inc)
  (alter!! r1 conj @r0)
  (Thread/sleep 2))

If I deref r1 in the second VM before the thread has finished sleeping I
get the expected (unmodified) value. Once the thread finishes sleeping if I
deref it again it doesn't update.  If instead I wait until after the thread
finishes before doing the deref then it shows the correct value.

Let me know if you still can't reproduce it and I'll try to provide more
detail.

Regards,

Glen

-- 
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: Avout: Distributed State in Clojure

2011-12-01 Thread Glen Stampoultzis
On 2 December 2011 05:26, liebke  wrote:

> Just released Avout 0.5.2, which now includes automatic STM
> initialization (no more pesky init-stm step).
>
>
The init-stm step is still referenced in the documentation as being
required BTW.

I had a couple of questions.

I noticed that when I create a reference (zk-ref) I need to provide an
initial value.  For each VM I do this for - it ends up clobbering the
previous value.  Is there anyway to create a reference without necessarily
clobbering existing data?

My second question is to do with derefs. The documentation says that Avout
caches multiple derefs and that it will invalidate the cache when the ref
is locally or remotely updated.  My own testing seems to indicate that the
deref still see the old values after a remote change is made.  If I wrap
the deref in a dosync!! however that seems to trigger the invalidation and
I see the correct value. Am I missing something?

Great work on this library.  Distributed STM has a lot of potential.

-- Glen

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

Re: How to attach debugger on clojure's repl ?

2011-09-22 Thread Glen Stampoultzis
On 22 September 2011 11:04, Scott Jaderholm  wrote:

> While that still works, ritz is really where it's at for awesome debugging
> clojure in emacs. It allows stepping and stuff with a nice UI.
>
> https://github.com/pallet/ritz
>
> Video (only for overview, follow instructions at url above)
> http://www.youtube.com/watch?v=d_L51ID36w4
>
> One of my favorite things with it is using it with OpenJDK w/ source so I
> can go down the rabbit hole of stepping into my code, Clojure, and the JVM
> itself (just for fun, not had a need for this yet).
>
> Scott
>
>
Ritz looks really nice the setup seems complicated.  I haven't had much luck
setting it up unfortunately.

-- 
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: ClojureSphere - browse the Clojure ecosystem

2011-09-06 Thread Glen Stampoultzis
On 7 September 2011 01:17, Justin Kramer  wrote:

> Prompted by a question on IRC a couple days ago, I built a tool that allows
> you to browse the dependency graph of Clojure projects from GitHub &
> Clojars:
>
> http://clojuresphere.herokuapp.com/
>
> You can see dependencies of a project, but also projects which depend on
> it. You can also see how many projects depend on a specific version
> (combined current & historical usage).
>
> There are caveats, which you can read about on GitHub:
> https://github.com/jkk/clojuresphere
>
> If anyone is interested in having this sort of thing added to Clojars,
> ClojureDocs, or other community sites, let me know.
>
>
>
Very nice tool. I found a lot of libraries I haven't yet got on Clojure
Libraries [1]. I might see if I can link through to the corresponding page
on clojuresphere.

[1] http://clojure-libraries.appspot.com

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

Re: Clojure for large programs

2011-07-06 Thread Glen Stampoultzis
On 7 July 2011 09:39, Zach Tellman  wrote:

> I agree that namespaces should be designed to be consumed, but that can be
> pretty taxing on the developer.  In my libraries, I tend to split the
> functions into whatever sub-namespaces I want to keep the organization easy
> for me, and then import all the functions I want to expose into a
> higher-level namespace.
>
> For example, in Aleph I have HTTP functionality implemented in
> aleph.http.client, aleph.http.server, aleph.http.websocket, etc. but all the
> useful functions are gathered together into aleph.http.  This means that I
> don't have to navigate a monolithic namespace, but the users of my library
> don't have to declare a dozen namespaces to get anything done.  I find this
> approach scales for me pretty well, and I haven't heard any complaints from
> the people using my libraries about the organization.
>

I think that's a fairly sane way to organise things.  I tend to get annoyed
when a library has several use/requires to make use of it.

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

Re: Clojure for large programs

2011-07-02 Thread Glen Stampoultzis
On 3 July 2011 11:26, Mark Engelberg  wrote:

>  But Clojure's
> lack of a "fail-fast" philosophy has burned me several times, with
> hard-to-track-down bugs that were far-removed from the actual cause.
> The larger my code grows, the more this annoys me, reminding me too
> much of my days tracking down bugs in imperative programs.
>
>
I wonder if many people use the pre and post assertions when coding Clojure?
 Assertions (& pre/post-conditions) seem to have lost favour as a go-to tool
for programmers.  Most coders instead seem to go for unit testing
exclusively.  It seems to me that assertions could provide a lot benefit in
dynamic programs as a way to fail-fast and as a way to document intention.
In my limited experiments with them I've found them to be helpful.  I do
wish Clojure would give greater detail as to what went wrong when an
assertion fails though.  See Groovy's assert statement for an example of a
very helpful error report [1].

[1]
http://dontmindthelanguage.wordpress.com/2009/12/11/groovy-1-7-power-assert/

-- 
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: Emacs setup - quick navigation to files and definitions

2011-06-12 Thread Glen Stampoultzis
ctrl-x ctrl-i lists the current symbols and lets you jump to them.  I don't
know of anything that does it across a project however.

On 13 June 2011 12:42, yair  wrote:

> I mean something like a window or tab somewhere on the screen that
> would list all .clj files in the project directory, and for each of
> them, or at least for the current one, a list of all definitions
> (defn, defn- def) sorted alphabetically or at least by order of
> appearance in the file.  Think of the project view in Eclipse that
> shows all the Java classes, along with the outline view that shows all
> fields and members.
>
> Thanks
>
> On Jun 13, 12:30 pm, Vagif Verdi  wrote:
> > What do you mean by navigation ? Slime supports jumping to function
> > definition (Alt-.) and back (Alt-,) And this works not only in your
> > own code but also in all contrib libraries.
> > So what else do you need ?
> >
> > On Jun 12, 6:50 pm, yair  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > With swank and slime all set-up along with CDT, further improved by
> > > slime autocomplete, my emacs setup is getting pretty close to being a
> > > full featured, highly clojure focused IDE.  One thing I am struggling
> > > with while working on a larger than usual project (i.e. 7 source files
> > > some of which have 200-300 lines) is quickly navigating between source
> > > files and the definitions within them.  I took a look at CEDET but it
> > > seemed a bit overwhelming, and I wasn't sure the effort would be worth
> > > it as I couldn't tell if clojure would then be supported within it.
> >
> > > So, which plugins do you use in emacs for navigating between clojure
> > > source files and definitions?
> >
> > > Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
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: clj3D, a Clojure 3D Library

2011-04-06 Thread Glen Stampoultzis
On 7 April 2011 07:18, Ken Wesson  wrote:

> On Wed, Apr 6, 2011 at 4:46 PM, Benny Tsai  wrote:
> > Works for me (Chrome 10.0.648.204, Windows XP SP3).
>
> Well, this is just screwy. I have tried restarting Chrome, disabling
> and re-enabling its Flash plugin, and various other things. No joy.
> And Chrome says the version I have is 10.2.154.25. YouTube says you
> need version 10.1 or better -- so, 10.2.154.25 < 10.1?! And the
> ever-so-helpful update download link they provide is to a page at
> Adobe that tries to push version 10.2.153.1 which is also older than
> what I've got. WTF?!
>
>
Hi Ken,

Perhaps you can use HTML5 video instead.  To opt-in go here:

http://www.youtube.com/html5

the link is at the bottom and should say
something like "Join the HTML5 trial".

Regards,

Glen

-- 
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: Emacs `align' function customization for Clojure

2011-04-02 Thread Glen Stampoultzis
I created an align for Clojure a little while back. [1] It has some
limitations such as not handling type hints (yet) but works well enough.
There was also a fork [2] that added alignment to compojure forms.

[1] http://clojure-libraries.appspot.com/show/34002
[2] https://github.com/scottjad/align-cljlet


On 2 April 2011 16:50, Christian Schuhegger
wrote:

> I am replying to this thread from January this year:
> https://groups.google.com/group/clojure/browse_frm/thread/47c388127e0da3ef
>
> I am not certain if my solution fulfills the aesthetic requirements of
> clojure hackers, but I use one of my old C/C++ marcros for aligning
> equal signs to align at commas (see below). As commas in clojure are
> whitespace you can put them in front of the clauses you want to be
> aligned, e.g. in let binding forms. You select the region you want the
> alignment to happen and press C-= and the full block gets nicely
> aligned.
>
> I hope this may be useful for other people, too.
>
> -- snip start --
> (defun align-equals (start end)
>  "make the first assignment operator on each line line up vertically"
>  (interactive "*r")
>  (save-excursion
>   (let ((indent 0))
> (narrow-to-region start end)
> (beginning-of-buffer)
> (while (not (eobp))
>   (if (find-assignment)
>   (progn
> (exchange-point-and-mark)
> (setq indent (max indent (current-column)))
> (delete-horizontal-space)
> (insert " ")))
>   (forward-line 1))
> (beginning-of-buffer)
> (while (not (eobp))
>   (if (find-assignment)
>   (indent-to-column (1+ (- indent  (- (mark) (point))
>   (forward-line 1)))
>   (widen)))
>
> (defun find-assignment ()
>  (if (re-search-forward
> "[^<>=!]=\\|\\+=\\|-=\\|\\*=\\|/=\\|&=\\||=\\|\\^=\\|<<=\\|>>=\
> \|:=\\|:\\|,"
> (save-excursion (end-of-line) (point)) t)
>  (progn
>(goto-char (match-beginning 0))
>(if (looking-at ".==")
>nil
>  (if (looking-at
> "\\+=\\|-=\\|\\*=\\|/=\\|&=\\||=\\|\\^=\\|<<=\\|>>=\
> \|:=\\|:\\|,")
>  (set-mark (match-end 0))
>(forward-char 1)
>(set-mark (1+ (point
>  (delete-horizontal-space)
>  t))
>nil))
>
> (global-set-key [(control =)] 'align-equals)
>
> -- snip end --
>
> --
> 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: ANN: Clojure Libraries

2011-03-01 Thread Glen Stampoultzis
Changed.  Thanks.

On 2 March 2011 08:52, Sergey Didenko  wrote:
> Thanks, Glen.
>
> A correction: "calx" does not belong to the GUI category.
>
> May be "Utility" is better?
>
> --
> 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: ANN: Clojure Libraries

2011-02-27 Thread Glen Stampoultzis
On 28 February 2011 12:01, James Reeves  wrote:
> On 27 February 2011 23:56, Glen Stampoultzis  wrote:
>> PS. This overlaps somewhat with Clojure Toolbox which, via an
>> unfortunate coincidence, came out about the same time. There are some
>> important differences however, so I thought it best to continue with
>> this release.
>
> I'd definitely encourage you to continue :)
>
> I know of at least one other effort to categorize Clojure libraries,
> and each has taken a different approach to this problem. I'm generally
> of the opinion that a diverse ecosystem is usually better than a
> monoculture.
>
> - James

It is funny how these things happen.  There were also a couple of
Clojure API documentation sites that came out around the same time as
well.

Writing the site has been a fun exercise.

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


ANN: Clojure Libraries

2011-02-27 Thread Glen Stampoultzis
Hi everyone,

I'd like to announce the availability of Clojure Libraries
(http://clojure-libraries.appspot.com/).  Clojure Libraries is a
database for keeping track of Clojure libraries and tools.  Clojure
Libraries can be edited by end users (by logging in with a Google
account).  Edits are tracked somewhat like a wiki and bad edits can be
compared and rolled back.  Comments can also be added to individual
libraries and extra details like the group and artifact name can be
added (which will link through to clojars automatically).

Some of the features I plan on adding in the near future include:

* Atom feeds for changes to the site
* Editing of categories and subcategories
* Ratings
* A search feature

I planned on putting this on it's own domain however there were a few
technical issues when I attempted to do this so for now you can just
access it via http://clojure-libraries.appspot.com/.

If you'd like to add or edit a library but don't have a Google account
(and would prefer not to create one) feel free to email me directly at
gst...@gmail.com and I'll add it for you.

PS. This overlaps somewhat with Clojure Toolbox which, via an
unfortunate coincidence, came out about the same time. There are some
important differences however, so I thought it best to continue with
this release.

Regards,

Glen

-- 
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: Release.Next Version Number

2011-02-23 Thread Glen Stampoultzis
>> - better discovery for existing, well-tested libraries.
>
> You can search on http://clojars.org/. This works well for me.
> However, the key to well tested libraries is having people give
> feedback if a library breaks or is badly documented or doesn't meet
> their needs.

I'm currently working on something that might help fill this space.
It's not yet complete and shouldn't be used except for testing at this
stage.

http://clojure-libraries.appspot.com/

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


Re: Emacs `align' function customization for Clojure

2011-01-10 Thread Glen Stampoultzis
On 6 January 2011 04:29, Scott Jaderholm  wrote:

> On Tue, Jan 4, 2011 at 9:10 PM, Eric Schulte 
> wrote:
> > I wonder if anyone else has written any similar Emacs alignment rules
> > for Clojure which they would be interested in sharing?
>
> Alignment rules for let and defroutes are at the top of my most wanted
> list.
>
>
align-let.el [1] might be a reasonable starting point for someone wanting to
create something for clojure.  I have not tried it myself so I have no idea
if it even works.

[1]
http://www.mail-archive.com/gnu-emacs-sources@gnu.org/msg01979/align-let.el

-- 
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: Library and development process for GAE

2011-01-09 Thread Glen Stampoultzis
On 10 January 2011 04:37, Constantine Vetoshev  wrote:

> On Jan 9, 10:54 am, Stefan Kamphausen  wrote:
> > Given that decision I'd like to understand the general development
> process.
> > Does one always compile to a class (ns ...gen-class ..extends ..Servlet)
> and
> > will the appengine development server pick up the changes, or will I just
> > recompile a function (using a setup with Emacs and SLIME), what about the
> > REPL mode of appengine-magic together with the datastore and other
> features.
>
> I'm the author of appengine-magic, so my opinion is necessarily biased
> in its favor. :)
>
>
-- chop --

I've been using appengine-magic to develop a webapp for keeping track of
Clojure libraries.  I've found it really nice to use and I haven't even
switched to the 0.4.0 branch yet.  Many thanks Constantine for such a
fantastic library.  I can't imagine trying to get all the app-engine
libraries working without it.

Regards,

Glen

-- 
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: Let's see how fast we can make this

2010-12-25 Thread Glen Stampoultzis
On 26 December 2010 03:00, Ivan  wrote:

> Would be interesting to see tests done on UTF-8 strings as this is the
> only type that Java supports.
>

Do you mean UTF-16?

-- 
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: sort-by reverse order?

2010-11-21 Thread Glen Stampoultzis
On 22 November 2010 15:30, Glen Stampoultzis  wrote:

>
> On 22 November 2010 15:02, Alex Baranosky 
> wrote:
>
>> Hi guys,
>>
>> I'm trying to figure out how to use sort-by in reverse order.
>>
>> something like:
>>
>> (defn keyfn [p]
>> (:last-name p))
>>
>> (sort-by keyfn persons)
>>
>> where persons is a map...
>>
>> I don't see it in the docs, what's the idiomatic way to do this?
>>
>>
> Not sure if this is the most idiomatic way but there's always:
>
> (reverse (sort-by :last-name persons))
>
> or
>
> (sort-by :last-name #(compare %2 %1) persons)
>
>
>

Actually having put forward that second example there I'm not sure how it
actually works.  The docs suggest that the 2nd parameter needs to implement
Comparator (peeking at the source confirms this) but compare returns back a
number.  It is possible this might be just working by accident.

- Glen

-- 
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: sort-by reverse order?

2010-11-21 Thread Glen Stampoultzis
On 22 November 2010 15:02, Alex Baranosky wrote:

> Hi guys,
>
> I'm trying to figure out how to use sort-by in reverse order.
>
> something like:
>
> (defn keyfn [p]
> (:last-name p))
>
> (sort-by keyfn persons)
>
> where persons is a map...
>
> I don't see it in the docs, what's the idiomatic way to do this?
>
>
Not sure if this is the most idiomatic way but there's always:

(reverse (sort-by :last-name persons))

or

(sort-by :last-name #(compare %2 %1) persons)

-- 
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: Clojure Games

2010-11-20 Thread Glen Stampoultzis
On 20 November 2010 02:37, Tim Visher  wrote:

> Here's something quick I threw together this morning.  I like your
> logo a lot but I thought it had a little more potential. :)
>
> Anyway, free for you to use if you feel so inclined.  Thanks.
>
>
 Since the ghost is bitmaped maybe the pacman should be too?  Also, I think
the Clojure logo is copyrighted so permission might need to be obtained to
reuse it.

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

Re: [ANN] appengine-magic: using Clojure with Google App Engine

2010-10-04 Thread Glen Stampoultzis
On 21 September 2010 07:15, Constantine Vetoshev  wrote:

> I'd like to announce the release of a working version of appengine-
> magic, a library designed to make it easier to get started with Google
> App Engine using Clojure.
> .. chop ..


I noticed it uses ring out of the box.  I was wondering if this is
compatible with compojure?  There also seems to be a compojure-gae project
floating around so I'm a little confused as to which project I should be
using.

Regards,

Glen

-- 
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: usage examples in clojure api docs

2010-07-02 Thread Glen Stampoultzis
On 3 July 2010 10:12, David Nolen  wrote:
> On Fri, Jul 2, 2010 at 3:46 AM, Justin Kramer  wrote:
>>
>> Partly in response to this issue and partly to get my feet wet with
>> Ring and friends, I spent the last few nights writing a proof-of-
>> concept Wiki to collect structured Clojure usage examples:
>>
>> http://clojure-examples.appspot.com/
>>
>> Here's a sample function page:
>>
>> http://clojure-examples.appspot.com/clojure.core/contains%3F
>>
>> I tried to come up with something that encourages a many-hands
>> approach while maintaining structure and quality. There are plenty of
>> missing features, but it should be easy for anyone interested to jump
>> in and write some examples. It uses a modified version of Markdown for
>> syntax. Content could be exported/parsed en masse relatively easily.
>>
>> The source is on GitHub: http://github.com/jkk/clj-wiki
>>
>> Does this seem like a worthwhile approach?
>>
>> Justin
>
> Nice job for getting the ball rolling on this!
> David
>

+1 Perfect!  I'd encourage everyone to get behind this.  The barrier
to entry is very low so no reason not to help out.

The only thing missing is a search system.  Also it would probably be
a good idea to make the licensing of contributions explicit (boring
but important detail). I didn't see anything on the site about that.

-- 
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: usage examples in clojure api docs

2010-06-29 Thread Glen Stampoultzis
On 30 June 2010 10:01, Mark Fredrickson  wrote:
>  user> (doc foo)
> -
> user/foo
> ([a b])
>  Adds two numbers
> === Categories ===
>
> :bar, :baz, :other
>
> === See Also ===
>
> * #'user/bar
>
> === Examples ===
>
>> (foo 1 2)
> 3
>> (foo 3 4)
> 7
>
> === References ===
>
> * http://foo.com
> * http://bar.com
>
> There is also a (run-examples foo) function that evaluates the
> examples.
>
> The API/interface is in flux, but the example spells out the basics.
> Call (postdoc var {:key1 value1 :key2 value2 ... }). The hash-map is
> stuffed into the var's metadata, overwriting the doc-string with
> additional information. Other systems could parse the map structure to
> provide clickable links, etc. The system is ad-hoc --- any key is
> valid and keys are used as the dispatching agent for multimethods --
> so feel free to come up with additional keys. I think we should let
> this grow organically for while before specifying formal semantics.
>
> I'm gladly accepting patches, especially for postdoc.clojure.core --
> the file that documents clojure.core vars (so far, only conj).
>
> Check it out, fork it, patch it, use it, enjoy!
>
> -Mark

I think examples on their own without a commentary to go along with
them are somewhat limited.  jQuery generally has some good examples of
what detailed API documentation with examples can/should look like -
http://api.jquery.com/change/

I think extending the existing documentation with extra information is
potentially a good idea but it needs to be a commentary rather than a
plain example without extra explanation IMHO.

-- 
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 script with shebangoid on windows

2010-05-30 Thread Glen Stampoultzis
On 31 May 2010 04:51, Paul Moore  wrote:

> On 30 May 2010 12:31, alux  wrote:
> > Small addition, you missed to add the : before eof
> >
> > replace "goto eof" by "goto :eof"
>
> Thanks, good catch. ("goto eof" without the colon works on TCC, which
> I normally use as my command shell).
>
>
I noticed it seemed to have problems when trying to use an absolute path to
reference clojure.jar.

java -cp d:\products\clojure\clojure.jar clojure.main "%~f0" %*

Using forward slashes instead seemed to do the trick.

-- 
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: Documentation (was: Re: duck-streams missing from clojure-contrib.jar file)

2010-04-21 Thread Glen Stampoultzis
On Thursday, April 22, 2010, Tom Faulhaber  wrote:

>
> A couple things I've also been thinking about are building in a search
> capability and building a "super-index" of not only core and contrib
> but various other external libraries that would link back to their
> doc.

I think building a super index is a great idea and would be very
useful.  The current indexes are great because you can easily search
for a function on one page.  Anything that reduces the number of pages
you need to visit to find stuff is useful in my opinion.

The ultimate would be something that let's users contribute their own
comments but that may be going beyond the scope of what you want
autodoc to be.

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


Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-07 Thread Glen Stampoultzis
On 5 March 2010 17:22, Meikel Brandmeyer  wrote:

> Hi,
>
> On Mar 5, 1:03 am, Felix Breuer  wrote:
>
> > I agree that Windows is a second class citizen as far as clojure
> > tools go.
>
> Oh please stop that. I have a stable setup of Gradle + Clojuresque +
> VimClojure on Windows. Granted setting up VimClojure on Windows is
> tricky due to Vim and Windows specifics, but it's doable. However the
> Gradle + Clojuresque part is as easy and trivial as it can get. And
> this setup survived already a few updates of the different components
> without blowing up a single time. I type "gradle runServer" in the
> morning and get a running Jetty/Nailgun combination for dynamic
> development with VimClojure - without thinking a single time about the
> classpath. Which actually consists of several checked out other
> projects (enlive, ring, fleetdb, ...). They were modified non-
> intrusively to use clojuresque instead of maven/ant/lein/whatever as
> build system. It checks the interdependencies and rebuilds the
> required jars if necessary. A change in a dependency is immediately
> picked up. If necessary, I can fix a known-to-work version in my local
> repository with a few commands.
>
> All without virtualbox, VMWare or whatever. So if one tool doesn't
> fill your need, then choose another.
>
> I apologise for sounding a little harsh.
>
>
Hi Meikel, sorry if my email came off as being a bit critical but I'm not
sure what I said was necessarily inaccurate - perhaps a little unhelpful.
 It seems (from my limited observations) that most of the Clojure developers
are Linux/Mac people so it's understandable that Windows isn't currently as
well supported by all tools.  That is meant more as a general observation
than a criticism.

My own problems getting emacs set up were more of an issue with ELPA than
Clojure-Swank in particular.  The Lein setup is a known shortcoming
currently that hopefully will be corrected at some point.  I hope so because
it seems to be becoming a standard in the community.  If my Clojure improves
maybe Windows support is something I can take a look at myself.

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

Re: Leiningen, Clojure and libraries: what am I missing?

2010-03-04 Thread Glen Stampoultzis
On 5 March 2010 04:39, Chris Perkins  wrote:

>
> The situation is worse on Windows, where I can't even get leiningen to
> work at all.  Luckily I'm only working on one clojure project, so I
> just copy clojure.jar and clojure-contrib.jar into my project's lib
> directory, as well as a faked version of swank-clojure.jar (just a
> zipfile of swank source, renamed to ".jar").  That works well enough
> for me. Then I have a tiny little Rakefile that builds a classpath
> string from the contents of lib/, and has two tasks: run tests, and
> start a repl (which I rarely use anymore, since I got swank-clojure
> working).
>
>
Windows seems to be a second class citizen as far as clojure tools go.  I
wasn't able to figure out how to get it going on Windows either which makes
things much harder considering so many clojure projects are now using it.

Getting swank-clojure going in Windows is also a pain.  To install it the
recommended way via ELPA you need to patch the ELPA source code first.  This
isn't documented at the swank-clojure site either.

I'm hopeful this situation will improve going forward but right now things
are still very bleeding edge.

-- 
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: Full Disclojure - I Need Topics!

2010-02-04 Thread Glen Stampoultzis
On 25 January 2010 16:34, Sean Devlin  wrote:

> Hello everyone,
> I'm having a blast making the Full Disclojure series.  It's one the
> best projects I've had a chance to work on.
>
> However, there's going to be a problem soon.  I only have a few more
> topics left before I run out.  No more topics, no more videos.
>
> This is where you come in.  I'm interested in what the community (i.e.
> you) would like to see talked about.  It could be the core language,
> contrib, a popular library, your-really-awesome-library-that-you-would-
> like-to-get-exposure, or some development tool.  Bring up anything and
> everything.  If it's interesting enough, I'll try to do an episode on
> it.  There are no bad suggestions.
>
>
Here's a challenge for you - Monads.  If you can clearly explain monads
you'll be my hero. :-)

-- 
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 for game programming?

2009-09-01 Thread Glen Stampoultzis
I've been fiddling with the LWJGL [1] with a view to making a game for my
children.  It's slow going because when I learn more about Clojure I end up
changing my mind about how I want things structured.  OpenGL is all new to
me as well - as is game programming in general.

As part of my explorations I came across scratch [2].  It has an interesting
approach where every object seems to live in its own thread.  That seems to
make dealing with state a lot simpler.  My initial approaches have been
complicated by the fact that the event loop makes handling state kind of
disconnected.  It would be great to be able to express things in a more
linear way.  This is what I'm exploring now.

[1] http://www.lwjgl.org/
[2] http://scratch.mit.edu/


2009/8/30 Elliott Slaughter 

>
> Hi,
>
> I'm visiting from the Common Lisp game-dev crowd and wanted to try out
> Clojure for writing games.
>
> I saw some JOGL examples posted in this group, in addition to the
> cloggle library which wraps some JOGL functionality. Cloggle is pretty
> thin right now and uses glFunctionNames as they are, so I've added
> some patches to convert glFunctionNames to Lispier function-names, and
> tried to Lispify the interface in general [1].
>
> I think I'd be fairly comfortable writing a graphics engine with my
> patched version of cloggle. What I'm not so sure about is writing the
> game simulation model.
>
> All game simulation models I've seen used graphs of mutable objects;
> I'm not entirely sure how to move to a more functional model. One the
> one hand, reallocating the game world on every frame seems excessive
> (even if Java's GC is fast), and on the other hand putting refs
> everywhere a value could potentially change seems equally excessive
> (and probably detrimental to performance).
>
> I just saw zippers on the other libraries page, but haven't had the
> time to read it and don't know if it meets my needs or not.
>
> If anyone has suggestions on simulating interactions between trees of
> objects (especially on the Clojure way to do it), I'd appreciate it.
> Comments on my cloggle patches also welcome.
>
> [1] http://github.com/slaguth/cloggle/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
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: Improving the documentation

2009-08-16 Thread Glen Stampoultzis
> I took a shot at it at
> http://ociweb.com/mark/clojure/ClojureCategorized.html. Suggestions
> for changes to this are welcomed. Also check out
> http://ociweb.com/mark/clojure/article.html.
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
>
Since you're asking. :-)

That page would be greatly enhanced by a link through to the documentation
for each function.

There was a nice summary in the files section as well that was somewhat
similar to what you've done.

My ideal would be a system that categories all the docs, included links
through to the detailed documentation for each function as well as links to
examples.  A lot of this stuff is there if you search hard enough - it's
just not all nicely cross referenced.

--~--~-~--~~~---~--~~
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 performance tests and clojure a little slower than Java

2009-08-12 Thread Glen Stampoultzis
>
> There was a good thread on this list some weeks ago which mentioned
> another JVM flag:
> -XX:+PrintOptoAssembly
>
> The original thread:
>
> http://groups.google.com/group/clojure/browse_thread/thread/314952431ec064b7?fwc=1
>
>
There's some more information about it at [1].  It looks like you need a
plugin to get it to work.  I'm on Windows and unfortunately for Windows
there doesn't seem to be a prebuilt binary for this platform.

[1] http://wikis.sun.com/display/HotSpotInternals/PrintAssembly

--~--~-~--~~~---~--~~
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: Website down?

2009-07-27 Thread Glen Stampoultzis
Seems to be up.
http://downforeveryoneorjustme.com/clojure.org


2009/7/27 John Newman 

> I've been trying to get to Clojure.org  for a few days
> now and I can't get to it from my military network, nor my civilian
> satellite connection (I'm deployed).  I can't ping it though (resolves to
> 75.126.104.177).  Is anyone else having the same problem?
>
> --
> John
>
> >
>

--~--~-~--~~~---~--~~
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: Emacs clojure mode: how to set current directory & classpath

2009-07-21 Thread Glen Stampoultzis
2009/7/21 Anne Ogborn 

>
>
> While we're on this subject, anybody know the same information for La
> Clojure?  That is, how to set up the current directory and classpath so one
> can compile java classes from Clojure?
>
> IntelliJ has many strengths, but a simple, transparent mechanism to add an
> arbitrary directory or jar to the classpath isn't among them.
>
>
Project Settings -> Modules -> Dependencies (tab) -> Add.

I'm not sure if that's what you mean by transparent mechanism.  You always
setup the dependencies on a per project basis.  You can set up "Jar
Directories" to automatically include all jars inside a particular
directory. This stops you having to specify them individually.

I'm hoping we don't have to wait too much longer for the next release of La
Clojure.  The current version is a nice start but is a little rough around
the edges.

--~--~-~--~~~---~--~~
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: Examining performance on the JVM

2009-07-15 Thread Glen Stampoultzis
Apparently it's possible to see the assembly instructions if you're running
a debug VM [1].

-XX:+PrintOptoAssembly dumps to the console a log of all assembly being
generated for JITed methods. The instructions are basically x86 assembly
with a few Hotspot-specific instruction names that get replaced with
hardware-specific instructions during the final assembly phase. In addition
to the JITed assembly, this flag also shows how registers are being
allocated, the probability of various branches being followed (along with
multiple assembly blocks for the different paths), and information about
calls back into the JVM.

[1] http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html


2009/7/16 Bradbev 

>
> I see lots of discussion on this list about Clojure performance & how
> to get it to Java speed.  I am also interested in the next steps that
> happen, how does the JVM convert byte code down to machine code and
> how does one examine that?
> The profiling tools I use for C code let me look at what the compiler
> has done with my C/C++ code & where the machine is running slow (cache
> misses, pipeline stalls, etc).
> JVM apps obviously have another layer of indirection, the first layer
> is the quality of the byte code that has been generated, and then how
> hotspot compiles that into machine code.
> What tools are out there that let you examine the bytecode & JVM
> machine code output?  It would also be really nice if there were tools
> that told you why the JVM did or did not manage to optimize a block of
> code.
>
> I'm just curious here really, but it does seem like there are many
> knowledgeable people on this list that might be able to offer some
> tips.
>
> Thanks,
> Brad
> >
>

--~--~-~--~~~---~--~~
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: Penumbra, a new set of OpenGL bindings

2009-07-06 Thread Glen Stampoultzis
2009/7/1 ztellman 

>
> Most of the OpenGL code I've seen has been a fairly literal
> translation of the corresponding Java, so as a way of getting my feet
> wet in Clojure I've written something that tries to be a little more
> idiomatic.  It can be found at
> http://github.com/ztellman/penumbra/tree/master
>
> The only really novel thing it brings to the table is intra-primitive
> transformations, which means that you can update the transformation
> matrix while defining a shape.  It's always bothered me that OpenGL
> doesn't allow this, so I added an additional transform step before
> passing the coords to glVertex.  This can be bypassed, but if you use
> call lists it doesn't affect your performance at all.
>
> If anyone has any questions or thoughts, I'd be happy to hear them.
>
>
Looks very nice.  I was just wondering what the license is.  I didn't see
anything on the site.

--~--~-~--~~~---~--~~
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: subvec drops metadata

2009-06-30 Thread Glen Stampoultzis
I couldn't say whether it should or not but I've faced similar issues with
attaching metadata to various collections.  It becomes very easy to lose the
metadata when you're dealing with collections since many high level
functions tend to return new seqs.  I found myself having to reappy the
metadata frequently.

2009/7/1 bayerf 

>
> The subject says all: Should subvec keep the parent vector's metadata
> (it currently doesn't) or not?
> Similar functions like conj, assoc, dissoc DO keep the metadata of the
> collection.
>
> >
>

--~--~-~--~~~---~--~~
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: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Glen Stampoultzis
2009/6/26 James Reeves 

>
> On Jun 25, 7:01 pm, Four of Seventeen  wrote:
> > On Jun 25, 12:18 pm, James Reeves  wrote:
> >
> > > Some languages go a step further, and highlight syntax errors directly
> > > with some ASCII art:
> >
> > >   Unmatched delimiter:
> > > (let [x map inc nums)]
> > > ^
> >
> > The javac compiler, for one.
>
> Huh. So it does. Okay, maybe it's not an impractical idea after all :)
>
>
I think it is worth looking at what JRuby does when it spits out an error.
They don't show a Java stacktrace at all but rather one that looks a lot
closer to what native Ruby shows.  I'd suggest Java stack traces are a poor
fit for reporting clojure errors since they don't match that closely to the
underlying language structure.

--~--~-~--~~~---~--~~
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: I must be blind. No matching method found?

2009-06-24 Thread Glen Stampoultzis
Seems to fine under Windows XP:
user> (.substring (StringBuilder. "i must be blind") 4)
"st be blind"


2009/6/25 Adrian Cuthbertson 

> There was a post a few days ago about a StringBuilder problem on MacOs Java
> 1.5. I think this is the same problem (i.e Java not Clojure).
>
> Rgds, Adrian.
>
>
> On Thu, Jun 25, 2009 at 4:52 AM, Cosmin Stejerean wrote:
>
>>
>>
>> On Wed, Jun 24, 2009 at 8:59 PM, CuppoJava wrote:
>>
>>>
>>> Hi guys,
>>> I'm having the hardest time figuring out why this won't run. I've been
>>> staring at it for the last half hour, and it's only a single line.
>>> Another pair of eyes would be beneficial I think.
>>>
>>> (.substring (StringBuilder. "i must be blind") 4)
>>> (.substring (StringBuilder. "i must be blind") (int 4))
>>>
>>> Both give me:
>>>
>>> java.lang.IllegalArgumentException: No matching method found:
>>> substring for class java.lang.StringBuilder
>>>
>>
>> Odd, I get the same error running against Clojure 1.0
>>
>> Clojure 1.0.0-
>> user=> (.substring (StringBuilder. "i must be blind") 4)
>> java.lang.IllegalArgumentException: No matching method found: substring
>> for class java.lang.StringBuilder (NO_SOURCE_FILE:0)
>> user=> (.substring (StringBuilder. "i must be blind") (int 4))
>> java.lang.IllegalArgumentException: No matching method found: substring
>> for class java.lang.StringBuilder (NO_SOURCE_FILE:0)
>>
>> --
>> Cosmin Stejerean
>> http://offbytwo.com
>>
>>
>>
>>
>>
>
> >
>

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



Re: Good examples of defmulti polymorphism

2009-06-02 Thread Glen Stampoultzis
Actually considering I'm currently writing a game in clojure that contains a
lot of state this _is_ a good real world example for me.  Thanks very much
Laurent.

2009/6/3 Laurent PETIT 

>
> Hi,
>
> Here is an example of the implementation of the "Visitor" design
> pattern in clojure.
> Multimethods are sufficiently powerfull and there is nothing explictly
> named "xxVisitor" in the code example, since with clojure the Visitor
> pattern is a non-issue and solved by the more general multimethod
> concept.
>
> Find the code in the files section of clojure google group :
> http://clojure.googlegroups.com/web/state.clj
>
> And find here an example of using the code :
>
> 1:6 designpatterns.state=> (-> (create-photo-booth 3) insert-coin
> button-identity-photo insert-coin button-release-coin)
> Insert coin
> Select your photo
> Take your identity photo
> Select your photo
> liberer piece
> {:photos 2, :state :needs-coin}
> 1:7 designpatterns.state=>
>
> It's more a tutorial-like example than a "real life" example, but I
> hope it will help,
>
> Regards,
>
> --
> Laurent
>
> 2009/6/2 Glen Stampoultzis :
> > I'm used to polymorphism in OO systems where everything in driven from
> > inheritance hierarchy.  Clojures defmulti style polymorphism seems
> powerful
> > but has left me wondering how to most effectively use it.  I'm looking
> for
> > some good real world examples of how people have used polymorphism in
> > clojure.
> > Regards,
> > Glen Stampoultzis
> >
> >
> >
> > >
> >
>
> >
>

--~--~-~--~~~---~--~~
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: Good examples of defmulti polymorphism

2009-06-02 Thread Glen Stampoultzis
Some good examples from everyone.  Thank you.

2009/6/3 Richard Newman 

>
> Some work in which I'm currently engaged uses ad hoc hierarchies for
> dispatching on a handler and either a message method or a method and
> response code. In the realm of HTTP clients -- imagine that the
> response arrives as a method invocation -- the equivalent would be
> writing something like
>
> (defmethod do-response [MyHandler :post :ok]
>  ;; Handle a success response to my POST request
>  )
>
> (defmethod do-response [MyHandler :any-method :failure]
>  ;; Handle any kind of failure response to any method (GET, POST,
> PUT...).
>  )
>
> The dispatch function can introspect the message itself to extract the
> method, code, etc. etc. -- this is basically polymorphism over any
> facet of the arguments, with full programmatic power to extract those
> facets. Most importantly, applications can themselves augment the
> hierarchy to include meaningful groupings -- in my example above, the
> various methods all derive from :any-method, and you could easily
> imagine a server having a :methods-i-cant-handle node in its
> hierarchy, making that piece of logic explicit in the tree.
>
> This example doesn't look that compelling, except that my real domain
> has a rich hierarchy of message and response types, which allows a
> great deal of abstraction in message handling.
>
> (I hope one day to be able to unveil what I'm doing. It's not that
> innovative, but it's not done 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
-~--~~~~--~~--~--~---



Good examples of defmulti polymorphism

2009-06-02 Thread Glen Stampoultzis
I'm used to polymorphism in OO systems where everything in driven from
inheritance hierarchy.  Clojures defmulti style polymorphism seems powerful
but has left me wondering how to most effectively use it.  I'm looking for
some good real world examples of how people have used polymorphism in
clojure.
Regards,

Glen Stampoultzis

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



Slime and OpenGL

2009-05-19 Thread Glen Stampoultzis
I'm trying to write a little game with clojure and OpenGL using the LWJGL
library.  It's running fine outside of slime but when I run it within slime
I'm getting an error on this call:

  (Display/setVSyncEnabled true)


user=> java.lang.NullPointerException (splat.clj:0)
at clojure.lang.Compiler.eval(Compiler.java:4543)
at clojure.lang.Compiler.load(Compiler.java:4857)
at clojure.lang.Compiler.loadFile(Compiler.java:4824)
at clojure.lang.RT$4.invoke(RT.java:273)
at
swank.commands.basic$compile_file_for_emacs_STAR___736.invoke(basic.clj:109)
at swank.commands.basic$compile_file_for_emacs__739.invoke(basic.clj:126)
at clojure.lang.Var.invoke(Var.java:354)
at user$eval__1498.invoke(NO_SOURCE_FILE)
at clojure.lang.Compiler.eval(Compiler.java:4532)
at clojure.core$eval__3990.invoke(core.clj:1728)
at swank.core$eval_in_emacs_package__307.invoke(core.clj:55)
at swank.core$eval_for_emacs__384.invoke(core.clj:123)
at clojure.lang.Var.invoke(Var.java:354)
at clojure.lang.AFn.applyToHelper(AFn.java:179)
at clojure.lang.Var.applyTo(Var.java:463)
at clojure.core$apply__3243.doInvoke(core.clj:390)
at clojure.lang.RestFn.invoke(RestFn.java:428)
at swank.core$eval_from_control__310.invoke(core.clj:62)
at swank.core$spawn_worker_thread__407$fn__438$fn__440.invoke(core.clj:162)
at clojure.lang.AFn.applyToHelper(AFn.java:171)
at clojure.lang.AFn.applyTo(AFn.java:164)
at clojure.core$apply__3243.doInvoke(core.clj:390)
at clojure.lang.RestFn.invoke(RestFn.java:428)
at swank.core$spawn_worker_thread__407$fn__438.doInvoke(core.clj:158)
at clojure.lang.RestFn.invoke(RestFn.java:402)
at clojure.lang.AFn.run(AFn.java:37)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.lwjgl.opengl.GL11.glGetError(GL11.java:1284)
at org.lwjgl.opengl.Util.checkGLError(Util.java:52)
at
org.lwjgl.opengl.WindowsContextImplementation.setSwapInterval(WindowsContextImplementation.java:109)
at org.lwjgl.opengl.Context.setSwapInterval(Context.java:219)
at org.lwjgl.opengl.Display.setSwapInterval(Display.java:983)
at org.lwjgl.opengl.Display.setVSyncEnabled(Display.java:995)
at user$init__1601.invoke(splat.clj:30)
at user$eval__1794.invoke(splat.clj:431)
at clojure.lang.Compiler.eval(Compiler.java:4532)
... 26 more


I've checked my classpath, java.library path & current working directory and
they're all set correctly but something in different about the environment
is triggering this error.  Anyone with any clue about what's going on?

Regards,

Glen Stampoultzis

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



Best practices for Slime with Clojure

2009-05-16 Thread Glen Stampoultzis
Hi,
I've recently been trying to work with Emacs and Slime on Windows using
Clojure Box. Having never used emacs at all it is tough going.  I had a
question or two regarding best practices.

The first is regarding classpaths.  I've managed to figure out how to setup
my classpath and library path (since I'm using native libs) by adding the
following to my .emacs file:

(custom-set-variables
 '(swank-clojure-library-paths (quote ("libpathgoeshere")))
 '(swank-clojure-extra-classpaths (quote ("path1" "path2" ...

The problem with this is that it's specific to one particular project.
 Different projects will likely have different classpath requirements and it
seems clunking to go through and change this every time I switch projects.
 Is there a good way to manage this with emacs?

The other problem I have is with the current working directory.  The swank
process seems to use my home directory as the current working
directory regardless of what the current working directory of emacs
currently is.  Is there any way to set this and to manage it on a per
project basis?

Regards,

Glen Stampoultzis

--~--~-~--~~~---~--~~
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: Request for improved error reporting

2009-03-28 Thread Glen Stampoultzis
2009/3/29 Stephen C. Gilardi 

>
> On Mar 28, 2009, at 10:31 PM, Glen Stampoultzis wrote:
>
>  It wasn't really this specific problem that I wanted to point out but more
>> to trigger a rethink of how errors are reported back to the user.
>>
>
> I understand, but without specifying which Clojure you're using and giving
> an example of how it happened, it's hard to compare our results.
>

Sorry when I said the latest released version of clojure I thought that
would be enough to go on.  I was using clojure_20090320.zip which matches
your version.



>
>  Here's an example that gives an error somewhat similar to the one I
>> posted:
>>
>> (defn testing [a b] (print a b))
>> (testing)
>>
>> java.lang.NoSuchMethodError:
>> java.lang.Class.getSimpleName()Ljava/lang/String; (testing.clj:0)
>> [ and lots more stack trace ]
>>
>>
>
> Here's what I get with clojure_20090320 downloaded from:
>
>http://code.google.com/p/clojure/downloads/list
>
> % java -cp clojure.jar clojure.main
> Clojure
> user=> (defn testing [a b] (print a b))
> #'user/testing
> user=> (testing)
> java.lang.IllegalArgumentException: Wrong number of args passed to:
> user$testing (NO_SOURCE_FILE:0)
> user=>
>
> That's quite different from your result and I think more in line with what
> you're requesting. Are you able to reproduce this result using the Clojure
> version I referenced?
>
> --Steve
>
>
The difference was that I wasn't running through the REPL.  When I run
through the REPL I get the same result as you. If you run the code from a
file you get:

C:\products\clojure>java -cp clojure.jar clojure.main test.clj
java.lang.IllegalArgumentException: Wrong number of args passed to:
user$testing (test.clj:0)
at clojure.lang.Compiler.eval(Compiler.java:4533)
at clojure.lang.Compiler.load(Compiler.java:4846)
at clojure.lang.Compiler.loadFile(Compiler.java:4813)
at clojure.main$load_script__5793.invoke(main.clj:206)
at clojure.main$script_opt__5824.invoke(main.clj:258)
at clojure.main$main__5848$fn__5850.invoke(main.clj:333)
at clojure.main$main__5848.doInvoke(main.clj:328)
at clojure.lang.RestFn.invoke(RestFn.java:413)
at clojure.lang.Var.invoke(Var.java:346)
at clojure.lang.AFn.applyToHelper(AFn.java:173)
at clojure.lang.Var.applyTo(Var.java:463)
at clojure.main.main(main.java:39)
Caused by: java.lang.IllegalArgumentException: Wrong number of args passed
to: user$testing
at clojure.lang.AFn.throwArity(AFn.java:449)
at clojure.lang.AFn.invoke(AFn.java:48)
at user$eval__4.invoke(test.clj:2)
at clojure.lang.Compiler.eval(Compiler.java:4522)
... 11 more

I think part of my problem is that I'm thinking of it as a compile error
when actually it's a runtime error.  Even so most of the stack is
unnecessary - would it be feasible (or even desirable) to strip the parts
not relevant to the user?

--~--~-~--~~~---~--~~
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: Request for improved error reporting

2009-03-28 Thread Glen Stampoultzis
It wasn't really this specific problem that I wanted to point out but more
to trigger a rethink of how errors are reported back to the user.
Here's an example that gives an error somewhat similar to the one I posted:

(defn testing [a b] (print a b))
(testing)

java.lang.NoSuchMethodError:
java.lang.Class.getSimpleName()Ljava/lang/String; (testing.clj:0)
at clojure.lang.Compiler.eval(Compiler.java:4533)
at clojure.lang.Compiler.load(Compiler.java:4846)
at clojure.lang.Compiler.loadFile(Compiler.java:4813)
at clojure.main$load_script__5793.invoke(main.clj:206)
at clojure.main$script_opt__5824.invoke(main.clj:258)
at clojure.main$main__5848$fn__5850.invoke(main.clj:333)
at clojure.main$main__5848.doInvoke(main.clj:328)
at clojure.lang.RestFn.invoke(RestFn.java:413)
at clojure.lang.Var.invoke(Var.java:346)
at clojure.lang.AFn.applyToHelper(AFn.java:173)
at clojure.lang.Var.applyTo(Var.java:463)
at clojure.main.main(main.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:582)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.lang.NoSuchMethodError:
java.lang.Class.getSimpleName()Ljava/lang/String;
at clojure.lang.AFn.throwArity(AFn.java:447)
at clojure.lang.AFn.invoke(AFn.java:48)
at user$eval__4.invoke(testing.clj:3)
at clojure.lang.Compiler.eval(Compiler.java:4522)
... 16 more


Using latest released version of clojure.


2009/3/29 Stephen C. Gilardi 

>
> On Mar 28, 2009, at 8:01 PM, Glen Stampoultzis wrote:
>
>  Sorry I just realized I was a bit ambiguous with this.  The exception does
>> show the line number (in the second stack trace).  But it's gone missing in
>> the top one.
>>
>
> Is this with the current svn or most recent release of Clojure? It would be
> helpful if you could post a (small) reproducible recipe for a test case that
> shows the problem.
>
> --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: Request for improved error reporting

2009-03-28 Thread Glen Stampoultzis
Sorry I just realized I was a bit ambiguous with this.  The exception does
show the line number (in the second stack trace).  But it's gone missing in
the top one.

2009/3/29 Glen Stampoultzis 

> Hi, I've been really enjoying getting to know clojure.  It's an awesome
> language that has got me very interested in learning more. One thing that
> hasn't left me impressed is the error reporting.
>
> I recently got this one that left me scratching my head:
>
> java.lang.NullPointerException (splat.clj:0)
> at clojure.lang.Compiler.eval(Compiler.java:4533)
> at clojure.lang.Compiler.load(Compiler.java:4846)
> at clojure.lang.Compiler.loadFile(Compiler.java:4813)
> at clojure.main$load_script__5793.invoke(main.clj:206)
> at clojure.main$script_opt__5824.invoke(main.clj:258)
> at clojure.main$main__5848$fn__5850.invoke(main.clj:333)
> at clojure.main$main__5848.doInvoke(main.clj:328)
> at clojure.lang.RestFn.invoke(RestFn.java:413)
> at clojure.lang.Var.invoke(Var.java:346)
> at clojure.lang.AFn.applyToHelper(AFn.java:173)
> at clojure.lang.Var.applyTo(Var.java:463)
> at clojure.main.main(main.java:39)
> Caused by: java.lang.NullPointerException
> at user$render_layer__37.invoke(splat.clj:311)
> at user$render_layers__40.invoke(splat.clj:315)
> at user$active_update__43.invoke(splat.clj:323)
> at user$run__55.invoke(splat.clj:349)
> at user$eval__58.invoke(splat.clj:378)
> at clojure.lang.Compiler.eval(Compiler.java:4522)
> ... 11 more
>
> There are a few things wrong here and with clojure error reporting in
> general:
>
> 1. I'm not getting a line number for some reason.
> 2. I don't get any indication what the nature of the error is.
> 3. I get a big (nested) stack trace that has more to do with clojure
> compiler internals than my program.
>
> Even when clojure does tell you what went wrong I don't really need to see
> the compiler internals.  Just the parts relevant to my program.  Perhaps
> some context (such as printing the source line causing the problem) and a
> clear message stating the nature of the problem.
>
> Regards,
>
> Glen
>

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



Request for improved error reporting

2009-03-28 Thread Glen Stampoultzis
Hi, I've been really enjoying getting to know clojure.  It's an awesome
language that has got me very interested in learning more. One thing that
hasn't left me impressed is the error reporting.

I recently got this one that left me scratching my head:

java.lang.NullPointerException (splat.clj:0)
at clojure.lang.Compiler.eval(Compiler.java:4533)
at clojure.lang.Compiler.load(Compiler.java:4846)
at clojure.lang.Compiler.loadFile(Compiler.java:4813)
at clojure.main$load_script__5793.invoke(main.clj:206)
at clojure.main$script_opt__5824.invoke(main.clj:258)
at clojure.main$main__5848$fn__5850.invoke(main.clj:333)
at clojure.main$main__5848.doInvoke(main.clj:328)
at clojure.lang.RestFn.invoke(RestFn.java:413)
at clojure.lang.Var.invoke(Var.java:346)
at clojure.lang.AFn.applyToHelper(AFn.java:173)
at clojure.lang.Var.applyTo(Var.java:463)
at clojure.main.main(main.java:39)
Caused by: java.lang.NullPointerException
at user$render_layer__37.invoke(splat.clj:311)
at user$render_layers__40.invoke(splat.clj:315)
at user$active_update__43.invoke(splat.clj:323)
at user$run__55.invoke(splat.clj:349)
at user$eval__58.invoke(splat.clj:378)
at clojure.lang.Compiler.eval(Compiler.java:4522)
... 11 more

There are a few things wrong here and with clojure error reporting in
general:

1. I'm not getting a line number for some reason.
2. I don't get any indication what the nature of the error is.
3. I get a big (nested) stack trace that has more to do with clojure
compiler internals than my program.

Even when clojure does tell you what went wrong I don't really need to see
the compiler internals.  Just the parts relevant to my program.  Perhaps
some context (such as printing the source line causing the problem) and a
clear message stating the nature of the problem.

Regards,

Glen

--~--~-~--~~~---~--~~
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: The Application Context Pattern

2009-03-04 Thread Glen Stampoultzis
Thank you.  Makes perfect sense to me now.

2009/3/5 Itay Maman 

>
> Suppose you have three observers: o1, o2, o3. run-observers evaluates
> them in this order.
> Let's assume we don't have run-observers-till-fixpoint. Thus, after
> the evaluation of a processor we will use run-observers to run these
> observers.
> Under this scenario, what will happen if o3 will return a new context?
> o1 and o2 were already evaluated so they will not be able to react to
> the updates in the context issued by o3.
>
> run-observers-till-fixpoint takes care of that by repeatedly looping
> thru all observers until the context stabilizes. This has the
> disadvantage of a possible infinite loop, but the advantage of making
> the context pattern indifferent of the order of the observers. My
> experience shows that observers ordering issues are more complicated
> to solve than infinite loops among observers.
>
> --
> Itay Maman
> http://javadots.blogspot.com/
>
>
>
> On Mar 4, 8:45 am, Glen Stampoultzis  wrote:
> > Hi Itay,
> > Thanks for posting this example.  Being new to Clojure it's a nice
> example
> > to study since it solves a very realistic problem that many new to
> > functional programming will face.
> >
> > I think I've unraveled most of how the code is working but there's one
> > function I'm not particularly clear about.
> >
> > (defn- run-observers-till-fixpoint [prev next]
> >   (let [observers (next :observers)
> >new-next (run-observers prev next observers)]
> > (if (= new-next next)
> >   new-next
> >   (recur next new-next) )))
> >
> > While I understand run-observers, run-observers-till-fixpoint has be
> > baffled.  Why is this required?
> >
> > 2009/2/27 Itay Maman 
> >
> >
> >
> > > Some of the reaction for Waterfront was related to the Application
> > > Context Pattern (ACP) - The pattern that allows most of Waterfront's
> > > code to be purely functional. I'll try to explain the basics in this
> > > post. Let me start with the motivation: the reason why FP is at odds
> > > with GUI code.
> >
> > > (Pure) Functional code has no side effects, which implies immutability
> > > of state. There are no fields nor global variables that can be
> > > assigned to. Thus, one function can affect the computation carried out
> > > by another function only by the passing of parameters. Most GUI
> > > systems are built around the notion of event handlers which are
> > > invoked by a message processing loop. There is no chain of calls from
> > > one event handler to another.
> > > In particular, if handler "A" computed some new value it cannot pass
> > > it on to handler "B" because the system will call "B" only after "A"
> > > returns. That's the predicament.
> >
> > > ACP overcomes this by capturing the applications current state in an
> > > immutable map. All event handlers receive a single parameter which is
> > > the "current" context and compute the "new" context. A typical handler
> > > (henceforth: "context processing function") will carry out these
> > > activities: (a) Examine the current context; (b) Perform some GUI
> > > operations (setSize, setText, etc.); (c) Compute a new context based
> > > on the current context and on information obtained from the GUI
> > > (getText, etc.). The caller (henceforth: "dispatcher") takes the
> > > returned context and will use it as the new current context, the next
> > > time a context processing function is invoked.
> >
> > > This means that when you register event handler with a Swing widget
> > > the handler needs to to call the ACP dispatcher passing it a context
> > > processing function.
> >
> > > The net effect of this approach is that only the dispatcher has to
> > > deal with mutable state. The context processors are functional: they
> > > merely compute the new state from the current.
> >
> > > application-context-pattern.clj (http://groups.google.com/group/
> > > clojure/web/application-context-pattern.clj) shows a concrete example.
> > > It's about 140 LOC (ripped off from the real Waterfront codebase)
> > > structured as follows:
> > >  Lines 1..40: General-purpose helpers.
> > >  Lines 40..90: The ACP infrastructure
> > >  Lines 90..140: A quick sample, built around ACP.
> >
> > > The sample program opens a JFra

Re: The Application Context Pattern

2009-03-04 Thread Glen Stampoultzis
Hi Itay,
Thanks for posting this example.  Being new to Clojure it's a nice example
to study since it solves a very realistic problem that many new to
functional programming will face.

I think I've unraveled most of how the code is working but there's one
function I'm not particularly clear about.

(defn- run-observers-till-fixpoint [prev next]
  (let [observers (next :observers)
   new-next (run-observers prev next observers)]
(if (= new-next next)
  new-next
  (recur next new-next) )))

While I understand run-observers, run-observers-till-fixpoint has be
baffled.  Why is this required?


2009/2/27 Itay Maman 

>
> Some of the reaction for Waterfront was related to the Application
> Context Pattern (ACP) - The pattern that allows most of Waterfront's
> code to be purely functional. I'll try to explain the basics in this
> post. Let me start with the motivation: the reason why FP is at odds
> with GUI code.
>
> (Pure) Functional code has no side effects, which implies immutability
> of state. There are no fields nor global variables that can be
> assigned to. Thus, one function can affect the computation carried out
> by another function only by the passing of parameters. Most GUI
> systems are built around the notion of event handlers which are
> invoked by a message processing loop. There is no chain of calls from
> one event handler to another.
> In particular, if handler "A" computed some new value it cannot pass
> it on to handler "B" because the system will call "B" only after "A"
> returns. That's the predicament.
>
> ACP overcomes this by capturing the applications current state in an
> immutable map. All event handlers receive a single parameter which is
> the "current" context and compute the "new" context. A typical handler
> (henceforth: "context processing function") will carry out these
> activities: (a) Examine the current context; (b) Perform some GUI
> operations (setSize, setText, etc.); (c) Compute a new context based
> on the current context and on information obtained from the GUI
> (getText, etc.). The caller (henceforth: "dispatcher") takes the
> returned context and will use it as the new current context, the next
> time a context processing function is invoked.
>
> This means that when you register event handler with a Swing widget
> the handler needs to to call the ACP dispatcher passing it a context
> processing function.
>
> The net effect of this approach is that only the dispatcher has to
> deal with mutable state. The context processors are functional: they
> merely compute the new state from the current.
>
> application-context-pattern.clj (http://groups.google.com/group/
> clojure/web/application-context-pattern.clj) shows a concrete example.
> It's about 140 LOC (ripped off from the real Waterfront codebase)
> structured as follows:
>  Lines 1..40: General-purpose helpers.
>  Lines 40..90: The ACP infrastructure
>  Lines 90..140: A quick sample, built around ACP.
>
> The sample program opens a JFrame with two buttons: Input and Output.
> A click on the input button will pop-up an input dialog box. A click
> on the output button will pop-up a message box showing the last value
> entered into the input box. There's also a JLabel showing the length
> of the input, but let's ignore it for the moment.
>
> The entry point into the ACP world is the bootstrap function. It takes
> two parameters: a context processing function and an initial context.
> In the example, this is carried out at the bottom of the run-it
> function:
>
>  (defn run-it []
>(let [build-ui (fn [ctx]
>  (let [f (javax.swing.JFrame. "Frame")
>b-in (javax.swing.JButton. "Input")
>b-out (javax.swing.JButton. "Output")]
>
>(.addActionListener b-in (new-action-listener (fn [event]
>  ((ctx :dispatch) get-input
>
>(.addActionListener b-out (new-action-listener (fn [event]
>  ((ctx :dispatch) show-output
>
>(.setLayout f (java.awt.FlowLayout.))
>(doseq [x [b-in b-out]]
>  (.add f x) )
>
>(doto f
>  (.setSize 500 300)
>  (.setDefaultCloseOperation javax.swing.JFrame/
> DISPOSE_ON_CLOSE)
>  (.setVisible true))
>
>(assoc ctx :frame f) ))]
>
>(invoke-later #(bootstrap build-ui {})) ))
>
>
> invoke-later is a utility function that is mapped to SwingUtilities/
> invokeLater.
>
> Let's drill down into the build-ui function: It takes the current
> context (ctx parameter). Then it creates the frame and the buttons. It
> uses new-action-listener (another utility) to register an action
> listener with the buttons. The first listener looks like this:
>  ((ctx :dispatch) get-input
>
> It uses (ctx :dispatch) to obtain the dispatcher from which ctx was
> obtained, and evaluates it passing get-input as the context processing
> function. The call to bootstrap initialized this dispatcher and added
> the :dispatch mapping to the initial context.
>
> get-input looks lik