Re: Inflection on clojure.java.io/reader and writer

2013-02-05 Thread Kanwei Li
That's funny, I did exactly the same thing and wrote BufferedReader for 
both. DOH!

Although I have no idea how the internals of type hinting is, I do think 
it's peculiar that there doesn't seem to be type error checking, even 
though we are explicitly "defining" the type. I would feel like it should 
error, instead of falling back on reflection.

Kanwei

On Monday, February 4, 2013 12:36:51 PM UTC-5, AtKaaZ wrote:
>
> in other words:
> this:
>
>   (let [in (clojure.java.io/reader src)
> out (clojure.java.io/writer dest)
>
>
> becomes this:
> (let [^java.io.BufferedReader in (clojure.java.io/reader src)
>^java.io.BufferedWriter out (clojure.java.io/writer dest)
>
>
> and it works for me too. (but I wasted some time by having BufferedReader 
> in both places)
>
>
> On Mon, Feb 4, 2013 at 6:26 PM, Andy Fingerhut 
> 
> > wrote:
>
>> I don't have CCW Eclipse installed to test, but by saving that file on my 
>> Mac (should also work on Linux) in a subdirectory "obj", and editing it to 
>> add the ^java.io.BufferedReader in and ^java.io.BufferedWriter out type 
>> hints as suggested by Luc P. earlier in this thread, I was able to 
>> eliminate the reflection warnings:
>>
>> % mkdir obj
>> % cp  obj/solutions.clj
>>
>> # Original file without the type hints gives reflection warnings as 
>> expected
>>
>> % java -Dclojure.compile.path=./obj -cp clojure-1.4.0.jar:./obj 
>> clojure.lang.Compile solution
>> Compiling solution to ./obj
>> Reflection warning, solution.clj:38 - reference to field readLine can't 
>> be resolved.
>> Reflection warning, solution.clj:45 - reference to field readLine can't 
>> be resolved.
>> Reflection warning, solution.clj:63 - reference to field newLine can't be 
>> resolved.
>> Reflection warning, solution.clj:54 - reference to field newLine can't be 
>> resolved.
>>
>> # Now I hand-edit obj/solutions.clj to add the type hints, and recompile. 
>>  No reflection warnings.
>> % java -Dclojure.compile.path=./obj -cp clojure-1.4.0.jar:./obj 
>> clojure.lang.Compile solution
>> Compiling solution to ./obj
>> % 
>>
>> Perhaps you should try verifying that you added the type hints correctly, 
>> saved the source file, recompiled the one you wanted to in CCW Eclipse, etc.
>>
>> Andy
>>
>>
>> On Feb 4, 2013, at 9:10 AM, Kanwei Li wrote:
>>
>> Hey Andy,
>>
>> Thanks for offering to help. Here's a gist: 
>> https://gist.github.com/4696105
>>
>> As you can see at the bottom, I want the main method to read/write to 
>> STDIN/STDOUT, but for testing, I want to read from files instead.
>>
>> This is what I get in both CCW Eclipse and nrepl:
>>
>> Reflection warning, NO_SOURCE_PATH:4 - reference to field readLine can't 
>> be resolved.
>>
>> Reflection warning, NO_SOURCE_PATH:11 - reference to field readLine can't 
>> be resolved.
>>
>> Reflection warning, NO_SOURCE_PATH:29 - reference to field newLine can't 
>> be resolved.
>>
>> Reflection warning, NO_SOURCE_PATH:20 - reference to field newLine can't 
>> be resolved.
>> Thanks!
>>
>> On Sunday, February 3, 2013 4:38:38 PM UTC-5, Andy Fingerhut wrote:
>>>
>>> Can you post a larger chunk of code for us to examine, perhaps on github 
>>> or as a gist if it is over 30 lines of code or so?  Many of us have had 
>>> good success with eliminating reflection using type hints, so it should be 
>>> possible to make it work.
>>>
>>> Andy
>>>
>>> On Feb 3, 2013, at 12:50 PM, Kanwei Li wrote:
>>>
>>> Unfortunately it doesn't work.
>>>
>>> Reflection warning, NO_SOURCE_PATH:20 - call to write can't be resolved.
>>>
>>> Reflection warning, NO_SOURCE_PATH:21 - reference to field newLine can't 
>>> be resolved.
>>>
>>> On Sunday, February 3, 2013 2:35:23 PM UTC-5, Luc wrote:
>>>>
>>>> Why not add type hints like this ? 
>>>>
>>>> (let [^java.io.BufferedReader in  
>>>>^java.io.BufferedWriter out ...] 
>>>> .. 
>>>>
>>>> Luc P. 
>>>>
>>>> > Hey guys, 
>>>> > 
>>>> > I'm trying to read a lot of data, sometimes from *in* and sometimes 
>>>> from a 
>>>> > file. I extensively use the native .write and .read java methods. 
>>>> > 
>>>> &

Re: atl-clj: Atlanta, GA, USA Clojure meetup

2013-02-04 Thread Kanwei Li
Thanks for posting this. See you next week!

On Monday, February 4, 2013 10:58:32 AM UTC-5, Marshall Bockrath-Vandegrift 
wrote:
>
> Hi all: 
>
> As I myself missed when this group got started, I’d like to 
> delayed-announce the existence of atl-clj, a meetup group for Clojure 
> users in the Atlanta, GA area: 
>
> http://www.meetup.com/Atl-Clj/ 
>
> Current plan is to meet ~monthly on second Tuesdays.  The next scheduled 
> meetup is for February 12th, where I’ll be giving a talk + live-coding 
> demo on Cascalog. 
>
> If you’re in the Atlanta area, I hope you can make it! 
>
> -Marshall 
>
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Inflection on clojure.java.io/reader and writer

2013-02-04 Thread Kanwei Li
Hey Andy,

Thanks for offering to help. Here's a gist: https://gist.github.com/4696105

As you can see at the bottom, I want the main method to read/write to 
STDIN/STDOUT, but for testing, I want to read from files instead.

This is what I get in both CCW Eclipse and nrepl:

Reflection warning, NO_SOURCE_PATH:4 - reference to field readLine can't be 
resolved.

Reflection warning, NO_SOURCE_PATH:11 - reference to field readLine can't 
be resolved.

Reflection warning, NO_SOURCE_PATH:29 - reference to field newLine can't be 
resolved.

Reflection warning, NO_SOURCE_PATH:20 - reference to field newLine can't be 
resolved.
Thanks!

On Sunday, February 3, 2013 4:38:38 PM UTC-5, Andy Fingerhut wrote:
>
> Can you post a larger chunk of code for us to examine, perhaps on github 
> or as a gist if it is over 30 lines of code or so?  Many of us have had 
> good success with eliminating reflection using type hints, so it should be 
> possible to make it work.
>
> Andy
>
> On Feb 3, 2013, at 12:50 PM, Kanwei Li wrote:
>
> Unfortunately it doesn't work.
>
> Reflection warning, NO_SOURCE_PATH:20 - call to write can't be resolved.
>
> Reflection warning, NO_SOURCE_PATH:21 - reference to field newLine can't 
> be resolved.
>
> On Sunday, February 3, 2013 2:35:23 PM UTC-5, Luc wrote:
>>
>> Why not add type hints like this ? 
>>
>> (let [^java.io.BufferedReader in  
>>^java.io.BufferedWriter out ...] 
>> .. 
>>
>> Luc P. 
>>
>> > Hey guys, 
>> > 
>> > I'm trying to read a lot of data, sometimes from *in* and sometimes 
>> from a 
>> > file. I extensively use the native .write and .read java methods. 
>> > 
>> > According to the clojure doc for reader, it says that "Default 
>> > implementations always return a BufferedReader". However, when I write, 
>> > 
>> > (*defn* solve [src dest] 
>> > 
>> >   (*let* [in (clojure.java.io/reader src) 
>> > 
>> > out (clojure.java.io/writer dest) 
>> > 
>> > I get a bunch of reflection warnings on .read and .write, and most of 
>> the 
>> > running time is spent on reflection. AFAIK you can't type hint a (let) 
>> > construct, so what should I do here? 
>> > 
>> > 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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Inflection on clojure.java.io/reader and writer

2013-02-03 Thread Kanwei Li
Unfortunately it doesn't work.

Reflection warning, NO_SOURCE_PATH:20 - call to write can't be resolved.

Reflection warning, NO_SOURCE_PATH:21 - reference to field newLine can't be 
resolved.

On Sunday, February 3, 2013 2:35:23 PM UTC-5, Luc wrote:
>
> Why not add type hints like this ? 
>
> (let [^java.io.BufferedReader in  
>^java.io.BufferedWriter out ...] 
> .. 
>
> Luc P. 
>
> > Hey guys, 
> > 
> > I'm trying to read a lot of data, sometimes from *in* and sometimes from 
> a 
> > file. I extensively use the native .write and .read java methods. 
> > 
> > According to the clojure doc for reader, it says that "Default 
> > implementations always return a BufferedReader". However, when I write, 
> > 
> > (*defn* solve [src dest] 
> > 
> >   (*let* [in (clojure.java.io/reader src) 
> > 
> > out (clojure.java.io/writer dest) 
> > 
> > I get a bunch of reflection warnings on .read and .write, and most of 
> the 
> > running time is spent on reflection. AFAIK you can't type hint a (let) 
> > construct, so what should I do here? 
> > 
> > Thanks! 
> > 
> > -- 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@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+u...@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 unsubscribe from this group and stop receiving emails from it, send 
> an email to clojure+u...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
> > 
> -- 
> Softaddicts> sent by ibisMail from 
> my ipad! 
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Inflection on clojure.java.io/reader and writer

2013-02-03 Thread Kanwei Li
Hey guys,

I'm trying to read a lot of data, sometimes from *in* and sometimes from a 
file. I extensively use the native .write and .read java methods.

According to the clojure doc for reader, it says that "Default 
implementations always return a BufferedReader". However, when I write, 

(*defn* solve [src dest]

  (*let* [in (clojure.java.io/reader src)

out (clojure.java.io/writer dest)

I get a bunch of reflection warnings on .read and .write, and most of the 
running time is spent on reflection. AFAIK you can't type hint a (let) 
construct, so what should I do here?

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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Documentation fix for refs

2009-04-27 Thread Kanwei Li
Could the documentation at http://clojure.org/refs be updated to  
reflect the latest laziness changes? fnseq has been removed and  
there's no mention anywhere of how to modify the code. Thank you!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---