Re: Augmenting the defn attr-map

2009-08-17 Thread tsuraan
> The official docs for this are at: http://clojure.org/ > special_forms#let . That's a great link. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloju

Re: Augmenting the defn attr-map

2009-08-17 Thread Chas Emerick
On Aug 16, 2009, at 9:27 PM, Stephen C. Gilardi wrote: >> What I might be able to do is define alternatively-hinted versions >> of let, for, doseq, etc., and rebind clojure.core/destructure >> during the evaluation of those macros so that the s:String style >> can get layered on top of bind

Re: Augmenting the defn attr-map

2009-08-16 Thread Stephen C. Gilardi
On Aug 16, 2009, at 11:56 PM, tsuraan wrote: (defh a [b:String [c:Double :as list:java.util.List] {d:java.util.Random :d}] (.toCharArray b) (.size list) (.floatValue c) (.nextInt d)) What's that :as in the [ c:Double :as list:java.util.List ] vector? The entire expression you

Re: Augmenting the defn attr-map

2009-08-16 Thread tsuraan
> (defh a >[b:String [c:Double :as list:java.util.List] {d:java.util.Random :d}] >(.toCharArray b) >(.size list) >(.floatValue c) >(.nextInt d)) What's that :as in the [ c:Double :as list:java.util.List ] vector? --~--~-~--~~~---~--~~ You recei

Re: Augmenting the defn attr-map

2009-08-16 Thread Stephen C. Gilardi
On Aug 16, 2009, at 7:38 PM, Chas Emerick wrote: On Aug 16, 2009, at 6:29 PM, Stephen C. Gilardi wrote: Very cool! I like this a lot. Would you be up for writing some doc strings and including it in clojure.contrib.def? Yeah, I could do that. I don't actually think it's practical on its

Re: Augmenting the defn attr-map

2009-08-16 Thread Chas Emerick
On Aug 16, 2009, at 6:29 PM, Stephen C. Gilardi wrote: > On Aug 13, 2009, at 4:52 PM, Chas Emerick wrote: > >> I've actually been using it at the REPL here and there, and I've >> found >> it pretty pleasant -- it's a very pretty way to hint args compared to >> #^, and arg:Type ordering makes for

Re: Augmenting the defn attr-map

2009-08-16 Thread Stephen C. Gilardi
On Aug 13, 2009, at 4:52 PM, Chas Emerick wrote: I've actually been using it at the REPL here and there, and I've found it pretty pleasant -- it's a very pretty way to hint args compared to #^, and arg:Type ordering makes for easy readability (e.g. you can very easily scan an arg form and see w

Re: Augmenting the defn attr-map

2009-08-13 Thread Chas Emerick
On Aug 12, 2009, at 3:24 PM, Chas Emerick wrote: >> I'd hate to see somebody do it, but it's currently valid to define >> variables with colons in them, so there could be code out in the wild >> with those definition forms already. Other than that, I like the >> looks of it. I think the macro

Re: Augmenting the defn attr-map

2009-08-13 Thread Lauri Pesonen
2009/8/12 Chas Emerick : > > On Aug 12, 2009, at 3:19 PM, Mark Volkmann wrote: > >> I didn't release it was valid to define names with colons in them. >> Maybe that shouldn't be allowed. I'd like to be able to specify type >> hints using UML-like syntax like the second example from Chas which >> w

Re: Augmenting the defn attr-map

2009-08-12 Thread Chas Emerick
On Aug 12, 2009, at 3:19 PM, Mark Volkmann wrote: > I didn't release it was valid to define names with colons in them. > Maybe that shouldn't be allowed. I'd like to be able to specify type > hints using UML-like syntax like the second example from Chas which > was > > (defh foo [s:String unhinte

Re: Augmenting the defn attr-map

2009-08-12 Thread Chas Emerick
On Aug 12, 2009, at 2:02 PM, tsuraan wrote: > I didn't put it in yet, but I was thinking of just having nil in the > type vector for unhinted variables, so you could have > > (defn foo {:signature [ String String nil ]} [ a b c ] ...) > > and then c wouldn't be hinted. I hadn't thought of destru

Re: Augmenting the defn attr-map

2009-08-12 Thread Mark Volkmann
I didn't release it was valid to define names with colons in them. Maybe that shouldn't be allowed. I'd like to be able to specify type hints using UML-like syntax like the second example from Chas which was (defh foo [s:String unhinted-arg {a:int :a}] ...) On Wed, Aug 12, 2009 at 1:02 PM, tsura

Re: Augmenting the defn attr-map

2009-08-12 Thread tsuraan
> - There's already a lot of moving parts to type hinting, so adding > this optional approach into defn seems like it'd lead to unintended > consequences. That said, there's absolutely nothing wrong with an > alternative def form (defh? as in 'define hinted fn') -- there's > plenty of them throug

Re: Augmenting the defn attr-map

2009-08-12 Thread Chas Emerick
This is an interesting path to take. I'm not at all familiar with haskell, but a couple of thoughts anyway :-) : - There's already a lot of moving parts to type hinting, so adding this optional approach into defn seems like it'd lead to unintended consequences. That said, there's absolute

Augmenting the defn attr-map

2009-08-12 Thread tsuraan
I'd like to add a :signature entry to the attr-map of defn, that provides a haskell-style type signature to functions of the single-arglist-body form. I find the the normal way of providing hints to a function: (defn [ #^Class1 var1 #^Class2 var2 #^Class3 var3] ... ) is way too noisy, and the v