Some basic guidance to designing functional vs. state parts of app

2010-03-03 Thread Sophie
As a bit of a newbie to the functional + identity/state design space, I'm struggling a bit with where to use identity constructs (refs) and where to stay with pure functions, and could use some guidance. Pardon me if some of my terms are a bit off. Here is a simple hypothetical app for matching App

Re: Some basic guidance to designing functional vs. state parts of app

2010-03-04 Thread Sophie
Thank you all, the replies so far and the questions have already deepened my understanding considerably! Looking forward to more. I think a bit more discussion like this (not necessarily my quite skimpy example) would be quite valuable to many like me. -- You received this message because you ar

Re: clojure slides

2010-03-07 Thread Sophie
Re: Emacs + Slime + paredit. I did not see Clojure listed as supported for Slime and paredit. Do you know if: - AquaEmacs (mac) is a shoe-in? - Can you do all Slime stuff in Clojure? evaluate, macro-expand, docs, etc? - Same for par-edit Thanks! On Mar 4, 1:56 pm, Baishampayan Ghose wrote: > Wi

Benefit of declarative functional UI in Clojure?

2010-03-25 Thread Sophie
Would a Clojure app benefit sigificantly from a declarative functional UI along the lines of Lunascript http://www.asana.com/luna or FlapJax http://www.flapjax-lang.org/ ? The results look quite impressive ... but I don't have much to compare to in Clojure. I am relatively new to both Clojure and

Re: labrepl, making Clojure more accessible

2010-03-26 Thread Sophie
Just tried this with NetBeans 6.7.1 on OSX 10.5.8. Got through all setup steps with no problem. When I try to start the project REPL, I get: "There did not appear to be both valid clojure and clojure-contrib jars present in the classpath... (some paths to ...1.2.0-master- SNAPSHOT.jar)" If I elec

Re: Logic programming in Clojure

2010-03-26 Thread Sophie
Really nice! Is it aware of all Clojure structures, including maps etc? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient w

Mutually-referencing structures

2010-04-05 Thread Sophie
(deftype Account [owner balance]) (deftype Person [accounts]) joe has 1 account. How to I create / initialize joe & the account with mutual references? I'd rather not use refs. Thanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: Mutually-referencing structures

2010-04-05 Thread Sophie
Is this a Clojure restriction, or is it intrinsic to functional programming? If my app is essentially about a user creating and editing a graph structure (sometimes via crud-level interactions, other times by somewhat larger refactorings), is either Clojure or functional not a good match? Thanks

Re: Mutually-referencing structures

2010-04-05 Thread Sophie
> It's a consequence of immutable data structures, which are an aspect of > functional programming. An immutable object can never be changed But single-assignment is a quite valid (and more flexible?) form of immutability. I'm not convinced cycles are intrinsically tied to it in any way. (In fa

Set as function

2010-04-05 Thread Sophie
Why this behavior? user=> (#{5 nil} 5) 5 user=> (#{5 nil} 4) nil user=> (#{5 nil} nil) nil rather than the seemingly more informative: user=> (#{5 nil} 5) true user=> (#{5 nil} 4) false user=> (#{5 nil} nil) true user=> (#{5 false} true) false user=> (#{5 false} false) true i.e. set as character

Re: Mutually-referencing structures

2010-04-06 Thread Sophie
On Apr 6, 8:09 am, Christophe Grand wrote: > > Let say one can write: > (def john-doe {:name "John Doe" :email "j...@doe.com" :account {:owner > # :balance 1000}}) At this point the cyclic structure is a consistent value. As long as updates create new values that match the domain invariants, why

A syntax question: positional & keyword

2010-04-06 Thread Sophie
Please don't misunderstand this post - it is not asking for a change of syntax, just trying to understand something. Clojure has chosen positional parameters (just like for Lisp, C, C++, Java, Ruby, Python, Prolog, ...) Smalltalk composes a full method name from a prefix-name + named parameters.

Re: Set as function

2010-04-06 Thread Sophie
On Apr 6, 12:16 am, Alex Osborne wrote: > Calling the set as if it is a fn is a short-hand for "get", that is > retrieving an element from the set. Why would you want to do this, when > to look it up you need to know what element is?  Sets are based on > value-equality not reference-equality.  T

Re: A syntax question: positional & keyword

2010-04-06 Thread Sophie
On Apr 6, 4:46 pm, Jarkko Oranen wrote: > problem is that they also make some very common functional patterns > cumbersome: most notably function application (ie. apply), > composition, and higher-order functions. I don't think it should be either-or (and positional would be needed anyway to call

Re: A syntax question: positional & keyword

2010-04-06 Thread Sophie
On Apr 6, 5:23 pm, Stuart Halloway wrote: > Have you seen destructuring of rest args in the current master branch? > > (defn foo [& {:keys [a b c]}] [a b c]) > > (foo :a 1 :c 3) > => [1 nil 3] > > With this last bit of sugar in place I am extremely happy with   > Clojure's arg handling. Hmmm. Loo

Re: A syntax question: positional & keyword

2010-04-06 Thread Sophie
Don't you think - fixed-order named parameters could (should?) be a separate issue from - optional, any-order, named parameters ? ;; :x :y are fixed order, named, while :a :b are optional, named (defn foo [:x :y & {:keys [a b]] [x, y, a, b]) (foo :x 1 :y 2) => [1 2 nil nil] (foo :x 1 :a 2) =

Re: Mutually-referencing structures

2010-04-06 Thread Sophie
I would really love to see (clearly by someone much smarter than I :) an insightful summary of these kinds of concept-heavy discussions, "stickied" or "FAQd" or even "book'd" somewhere. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this g

Re: A syntax question: positional & keyword

2010-04-06 Thread Sophie
On Apr 6, 7:03 pm, ataggart wrote: > See: > > http://richhickey.github.com/clojure-contrib/def-api.html#clojure.con... Ah, thank you (all). Will this be in 1.2? Is run-time cost expected to be minor, and will passing unrecognized keys be an error? -- You received this message because you are s

Re: A syntax question: positional & keyword

2010-04-08 Thread Sophie
On Apr 7, 7:56 am, David Nolen wrote: > The runtime cost of destructuring is not worth getting worked up > about. It's easy to check this yourself with (time ...) Results below: user=> (defn fk [& {:keys [a b c]}] (+ a b c)) user=> (defn fp [a b c] (+ a b c)) user=> (time (dotimes [_ 100]

Re: A syntax question: positional & keyword

2010-04-08 Thread Sophie
On Apr 7, 12:37 pm, Armando Blancas wrote: > in other languages they'd be annotations and maybe perceived > as redundant, e.g. a call like: (circle x y radius) is readable Ah, but what about: (circle year population income) vs. (circle :x year :y population :r income) > In Smtalltalk a single-ar

Re: A syntax question: positional & keyword

2010-04-08 Thread Sophie
On Apr 8, 11:08 am, David Nolen wrote: > In my own code I only avoid the convenience of destructuring in the > rare tight loops such as calculations intended to drive animations. But when you write a function you would have to decide positional vs. keyword. Would you then take a guess about usage

How to hide data representation with keywords for deftype accessor?

2010-04-10 Thread Sophie
(deftype A [x]) gives me an accessor (:x anA) Then I decide to change data representation of A without impacting client code, but I don't seem able to define a function (defn :x [anA] ...) Should I be doing something different? Thanks! -- You received this message because you are subscribed to

Which version of Netbeans to use Compojure on OSX?

2010-04-21 Thread Sophie
I see downloads named - Java SE (45MB) - Java FX (76MB) - Java (146MB) - apparently includes Sun Glassfish Server & what-not I'm using OSX 10.5.8, and just want to install the easiest Netbeans (with Enclojure) to for development with Compojure. Would I use Compojure with Jetty? Apache (buil

Re: problem installing clojure/Enclojure with Netbeans

2010-04-23 Thread Sophie
I had trouble with Enclojure 1.1.1 What worked for me: uninstall it and follow the Netbeans section at http://github.com/relevance/labrepl -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com N

Re: clojure 1.2 seq fn enhancement FAQ

2010-04-30 Thread Sophie
On Apr 29, 3:21 am, ataggart wrote: > Functions named contains-key? and contains-val? would make a lot more > sense to me than the current contains? and new seq-contains?. Amen. Even independent of any performance expectations. -- You received this message because you are subscribed to the Go