On Feb 25, 11:48 am, linh <nguyenlinh.m...@gmail.com> wrote:
> where can i read about "application context" pattern?
It is something I had occasionally used in the past. As I started
working on Waterfront, I realized it is well suited for GUI apps in
a functional language. I am not sure where you can find information
about
it, it is just something that was sitting there in my head.

Anyway, I plan to write a more detailed description of this pattern
as it addresses a concrete need of Clojure developers. Hope to get
to that within the next few days.

-Itay


> i this the idiomatic way to write GUI in functional languages?
> i'm writing a small swing based app in clojure, and i have problems
> wirting the gui, because the gui code tends to be very imperative and
> messy.
>
> On 24 Feb, 15:04, Itay Maman <itay.ma...@gmail.com> wrote:
>
> > I've been silently following Clojure (and this group) for several
> > months now.Somewhere around December I started working on a Clojure
> > editor/REPL written in Clojure. This effort evolved into the
> > Waterfront project which is now available on sourceforge (http://
> > sourceforge.net/project/showfiles.php?group_id=249246).
>
> > Waterfront's Highlights:
>
> > * CTRL+E: Eval current selection, or the whole file if the selection
> > is empty
> > * Edit -> Eval as you type: When turned on (default) periodically
> > evaluates your code. Boosts productivity as many errors are detected
> > on the spot.
> > * Eval-ed code can inspect/mutate Waterfront by accessing the *app*
> > variable. For instance, if you eval this expression,
> > ((*app* :change) :font-name "Arial"), you will choose "Arial" as the
> > UI font.
> > * Eval-ed code can inspect the currently edited Clojure program. For
> > instance, if you eval this expression, ((*app* :visit) #(when (= (str
> > (first %1)) "cons") (println %1))), the output window will show all
> > calls, made by your code, to the cons function.
> > * Syntax and Evaluation errors are displayed on: (1) The Problems
> > window; (2) The line-number panel, as red markers.
> > * Source -> Generate -> Proxy: Generates a proxy for the given list of
> > super-types, with stub implementations for all abstract methods.
> > * F1: Shows the doc (as per Clojure's (doc x) function) of the
> > identifier under the caret.
> > * Source -> Reflect: Shows the synopsis of a Java class when the caret
> > stands on a class symbol (e.g.: java.awt.Color).
> > * CTRL+Space: Token-based auto completion.
> > * Full parenthesis matching.
> > * An extensible plugin architecture.
> > * Other goodies such as undo/redo, toggle comment, recently opened
> > files, indent/unindent, Tab is *always* two spaces, ...
>
> > In order to get started, you need to
> >   (1) Download the waterfront zip file 
> > from:http://sourceforge.net/project/showfiles.php?group_id=249246.
> >   (2) Unpack it into a local directory.
> >   (3) Edit wf.bat: fix the path to clojure.jar according to its
> > location on your machine.
>
> > Personally, this effort was quite interesting. Writing GUI
> > applications in a functional language is sometimes a challenging task
> > (at least if you want your Clojure code not to be a transliteration of
> > Java code…).  I used a pattern the "application context" pattern: an
> > immutable map describing the application's current state that is
> > passed around. This made it possible for most of Waterfront's code to
> > be purely functional. Consequently, plugins can accomplish a lot with
> > just a handful of lines. Many plugins span about 60 lines of code.
> > Vast majority of them are less than 200 LOC. The main module, ui.clj,
> > that implements the underlying engine is also less than 200 LOC. I
> > think this is a very good indication to Clojure's power.
>
> > Hope you'll find it useful. I'd be happy if anyone would like to join
> > and contribute to Waterfront. Your feedback, either on-line or
> > offline, will be highly appreciated.
>
> > --
> > Itay Mamanhttp://javadots.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
-~----------~----~----~----~------~----~------~--~---

Reply via email to