Re: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread john
yes that's the reason thank you very much!
Meikel also pointed me in that direction with ; (meta (first (nth 
(macroexpand-1 '(aTest)) 2))) => {:tag long} and on ihis blog
*http://kotka.de/blog/2009/12/with-meta_and_the_reader.html*<http://kotka.de/blog/2009/12/with-meta_and_the_reader.html>
 which 
has been very helpful
Many Thanx 
Am Donnerstag, 19. Juli 2012 05:49:02 UTC+2 schrieb dgrnbrg:

> I don't think that the type hint will appear in the printed output. It is 
> metadata, so it won't be shown by the printer. If you try (let [[_ _ [b] 
> (macroexpand-1 '(aTest))] (meta b)) you should see {:tag long}.
>
> On Wednesday, July 18, 2012 7:55:31 AM UTC-4, john wrote:
>>
>> Hello,
>> how do I get primitive typ hints to appear in the output of a macro?
>>  
>> like :
>> (defmacro aTest []
>>   `(~'defn ~'aFun [^long ~'b ]  (meta ~'b) ))
>>
>> (macroexpand-1 '(aTest))
>> yields :
>>
>> (aFun 7)
>> (macroexpand-1 '(aTest))
>> yields :
>>  
>> (defn aFun [b] (clojure.core/meta b))
>>  
>> but I wold like it to be :
>> (defn aFun [^long b] (clojure.core/meta b))
>>  
>> Many greetings
>> 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: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread dgrnbrg
I don't think that the type hint will appear in the printed output. It is 
metadata, so it won't be shown by the printer. If you try (let [[_ _ [b] 
(macroexpand-1 '(aTest))] (meta b)) you should see {:tag long}.

On Wednesday, July 18, 2012 7:55:31 AM UTC-4, john wrote:
>
> Hello,
> how do I get primitive typ hints to appear in the output of a macro?
>  
> like :
> (defmacro aTest []
>   `(~'defn ~'aFun [^long ~'b ]  (meta ~'b) ))
>
> (macroexpand-1 '(aTest))
> yields :
>
> (aFun 7)
> (macroexpand-1 '(aTest))
> yields :
>  
> (defn aFun [b] (clojure.core/meta b))
>  
> but I wold like it to be :
> (defn aFun [^long b] (clojure.core/meta b))
>  
> Many greetings
> 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: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread Meikel Brandmeyer (kotarak)
Hi,

the correct syntax is

(defmacro aTest
  []
  `(defn ~'aFun [~(with-meta 'b {:tag 'long})]))

; (meta (first (nth (macroexpand-1 '(aTest)) 2))) => {:tag long}

The 'long might also be a `long. I'm not sure about that one.

Kind regards
Meikel

PS: Shameless self-promotion: 
http://kotka.de/blog/2009/12/with-meta_and_the_reader.html

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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 do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread Ambrose Bonnaire-Sergeant
:-) Sorry, it has me stumped too.

Hopefully someone can clarify.

Ambrose

On Wed, Jul 18, 2012 at 8:28 PM, john  wrote:

> Hi Ambrose,
> I liked your core.logic video very much!
> But no the code doeen't seem to work:
>
> (defmacro aTest []
>   `(~'defn ~'aFun [^{:tag ~'long} ~'b ]  (meta ~'b) ))
>
> and I also tried:
>
> (defmacro aTest []
>   (list 'defn 'aFun (vector (with-meta 'b {:tag long})) '(meta b)))
> before
>
> (aFun 8) yields nil
>
> So I think the type hint are not on the param
>
> Am Mittwoch, 18. Juli 2012 14:18:21 UTC+2 schrieb Ambrose
> Bonnaire-Sergeant:
>
>> Hi John,
>>
>> The type hint ^long expands to ^{:tag long}.
>>
>> So something like this should do the trick (untested).
>>
>> (defmacro aTest []
>>   `(~'defn ~'aFun [^{:tag '~'long ~'b ]  (meta ~'b) ))
>>
>> Thanks,
>> Ambrose
>>
>>
>> Hello,
>>> how do I get primitive typ hints to appear in the output of a macro?
>>>
>>> like :
>>> (defmacro aTest []
>>>   `(~'defn ~'aFun [^long ~'b ]  (meta ~'b) ))
>>>
>>> (macroexpand-1 '(aTest))
>>> yields :
>>>
>>> (aFun 7)
>>> (macroexpand-1 '(aTest))
>>> yields :
>>>
>>> (defn aFun [b] (clojure.core/meta b))
>>>
>>> but I wold like it to be :
>>> (defn aFun [^long b] (clojure.core/meta b))
>>>
>>> Many greetings
>>> 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
>

-- 
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 do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread john
Hi Ambrose,
I liked your core.logic video very much!
But no the code doeen't seem to work:
 
(defmacro aTest []
  `(~'defn ~'aFun [^{:tag ~'long} ~'b ]  (meta ~'b) ))
 
and I also tried:

(defmacro aTest []
  (list 'defn 'aFun (vector (with-meta 'b {:tag long})) '(meta b)))
before
 
(aFun 8) yields nil
 
So I think the type hint are not on the param

Am Mittwoch, 18. Juli 2012 14:18:21 UTC+2 schrieb Ambrose Bonnaire-Sergeant:

> Hi John,
>
> The type hint ^long expands to ^{:tag long}.
>
> So something like this should do the trick (untested).
>
> (defmacro aTest []
>   `(~'defn ~'aFun [^{:tag '~'long ~'b ]  (meta ~'b) ))
>
> Thanks,
> Ambrose
>
>
> Hello,
>> how do I get primitive typ hints to appear in the output of a macro?
>>  
>> like :
>> (defmacro aTest []
>>   `(~'defn ~'aFun [^long ~'b ]  (meta ~'b) ))
>>
>> (macroexpand-1 '(aTest))
>> yields :
>>
>> (aFun 7)
>> (macroexpand-1 '(aTest))
>> yields :
>>  
>> (defn aFun [b] (clojure.core/meta b))
>>  
>> but I wold like it to be :
>> (defn aFun [^long b] (clojure.core/meta b))
>>  
>> Many greetings
>> 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: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread Ambrose Bonnaire-Sergeant
Hi John,

The type hint ^long expands to ^{:tag long}.

So something like this should do the trick (untested).

(defmacro aTest []
  `(~'defn ~'aFun [^{:tag '~'long ~'b ]  (meta ~'b) ))

Thanks,
Ambrose

On Wed, Jul 18, 2012 at 7:55 PM, john  wrote:

> Hello,
> how do I get primitive typ hints to appear in the output of a macro?
>
> like :
> (defmacro aTest []
>   `(~'defn ~'aFun [^long ~'b ]  (meta ~'b) ))
>
> (macroexpand-1 '(aTest))
> yields :
>
> (aFun 7)
> (macroexpand-1 '(aTest))
> yields :
>
> (defn aFun [b] (clojure.core/meta b))
>
> but I wold like it to be :
> (defn aFun [^long b] (clojure.core/meta b))
>
> Many greetings
> 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

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

how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread john
Hello,
how do I get primitive typ hints to appear in the output of a macro?
 
like :
(defmacro aTest []
  `(~'defn ~'aFun [^long ~'b ]  (meta ~'b) ))

(macroexpand-1 '(aTest))
yields :

(aFun 7)
(macroexpand-1 '(aTest))
yields :
 
(defn aFun [b] (clojure.core/meta b))
 
but I wold like it to be :
(defn aFun [^long b] (clojure.core/meta b))
 
Many greetings
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