Re: Problem with map (only when running on browser)

2013-04-01 Thread Alan Thompson
I second that, Nico!  For some reason the lines are not wrapping at all in
GMail and are coming in a couple of hundred char's wide!
Alan


On Sat, Mar 30, 2013 at 8:54 AM, Cedric Greevey  wrote:

> On Sat, Mar 30, 2013 at 10:09 AM, Nico  wrote:
>
>> BTW, it seems like knowing Clojure is a requirement to start using
>> Clojurescript,
>>
>
> I think the general expectation has been that anyone using Clojurescript
> is likely to be using both.
>
> Maybe you should just learn Clojure? Between the many tutorial and
> documentation resources posted, try-clojure, and the lightweight IDE clooj,
> it shouldn't be too difficult.
>
> P.S. Please fix your linewrap. The long lines make it inconvenient to read
> this entire thread, at least in gmail's web interface.
>
> --
> --
> 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.
>
>
>

-- 
-- 
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: Problem with map (only when running on browser)

2013-03-30 Thread Cedric Greevey
On Sat, Mar 30, 2013 at 10:09 AM, Nico  wrote:

> BTW, it seems like knowing Clojure is a requirement to start using
> Clojurescript,
>

I think the general expectation has been that anyone using Clojurescript is
likely to be using both.

Maybe you should just learn Clojure? Between the many tutorial and
documentation resources posted, try-clojure, and the lightweight IDE clooj,
it shouldn't be too difficult.

P.S. Please fix your linewrap. The long lines make it inconvenient to read
this entire thread, at least in gmail's web interface.

-- 
-- 
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: Problem with map (only when running on browser)

2013-03-30 Thread Jim - FooBar();
Clojurescript is Clojure...you may be able to skip some JVM 
idiosyncrasies but it's the same language - no way around that!


Jim

On 30/03/13 14:09, Nico wrote:
Thank you very much sw1nn and John, both worked great. This goes to 
show how much of a newb I am.


Sorry if this is the wrong group (just realized it is the Clojure 
group and not Clojurescript one).


BTW, it seems like knowing Clojure is a requirement to start using 
Clojurescript, do you guys know of any turorials/resources to learn 
Clojurescript that don't rely on previous Clojure knowledge? (so far 
I've seen Clojurescript One and Modern. Clojurescript One is way too 
much for starters, too many things going on at once. Modern is better, 
but I couldn't get domina 1.0.2-SNAPSHOT to be automatically fetched 
from Clojars, hence I got stuck).



On Saturday, March 30, 2013 8:31:37 AM UTC-4, John Hume wrote:

When you want a side effect and don't care about return values,
it's idiomatic to use doseq.

(doseq [c calls-log] (log-call c))

On Mar 30, 2013 4:23 AM, "Neale Swinnerton" > wrote:

;(.log js/console (pr-str calls-log 
(map log-call calls-log)))

map is lazily evaluated, so if you never read it's result
nothing happens.

You can force evaluation with doall (and variants)

so...

  (doall (map log-call calls-log))

will behave as you expect.

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


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




--
--
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: Problem with map (only when running on browser)

2013-03-30 Thread Nico
Thank you very much sw1nn and John, both worked great. This goes to show 
how much of a newb I am. 

Sorry if this is the wrong group (just realized it is the Clojure group and 
not Clojurescript one).

BTW, it seems like knowing Clojure is a requirement to start using 
Clojurescript, do you guys know of any turorials/resources to learn 
Clojurescript that don't rely on previous Clojure knowledge? (so far I've 
seen Clojurescript One and Modern. Clojurescript One is way too much for 
starters, too many things going on at once. Modern is better, but I 
couldn't get domina 1.0.2-SNAPSHOT to be automatically fetched from 
Clojars, hence I got stuck).


On Saturday, March 30, 2013 8:31:37 AM UTC-4, John Hume wrote:
>
> When you want a side effect and don't care about return values, it's 
> idiomatic to use doseq. 
>
> (doseq [c calls-log] (log-call c)) 
> On Mar 30, 2013 4:23 AM, "Neale Swinnerton" 
> > 
> wrote:
>
>> ;(.log js/console (pr-str calls-log 
>>> (map log-call calls-log)))
>>>
>>> map is lazily evaluated, so if you never read it's result nothing 
>> happens.
>>
>> You can force evaluation with doall (and variants)
>>
>> so...
>>
>>   (doall (map log-call calls-log)) 
>>
>> will behave as you expect.
>>  
>>
>> -- 
>> -- 
>> 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.
>>  
>>  
>>
>

-- 
-- 
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: Problem with map (only when running on browser)

2013-03-30 Thread John D. Hume
When you want a side effect and don't care about return values, it's
idiomatic to use doseq.

(doseq [c calls-log] (log-call c))
On Mar 30, 2013 4:23 AM, "Neale Swinnerton"  wrote:

> ;(.log js/console (pr-str calls-log 
>> (map log-call calls-log)))
>>
>> map is lazily evaluated, so if you never read it's result nothing happens.
>
> You can force evaluation with doall (and variants)
>
> so...
>
>   (doall (map log-call calls-log))
>
> will behave as you expect.
>
>
> --
> --
> 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.
>
>
>

-- 
-- 
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: Problem with map (only when running on browser)

2013-03-30 Thread Neale Swinnerton
>
> ;(.log js/console (pr-str calls-log 
> (map log-call calls-log)))
>
> map is lazily evaluated, so if you never read it's result nothing happens.

You can force evaluation with doall (and variants)

so...

  (doall (map log-call calls-log))

will behave as you expect.

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




Problem with map (only when running on browser)

2013-03-29 Thread Nico
I have the following code:

(defn log-call [call]
  (.log js/console (pr-str call)))

(defn generate-report []
  ;; Get the data from the textarea calls_log
  (let [all-calls (.split (.-value (.getElementById js/document 
"calls_log")) "\n")
[calls-headers & calls-log] all-calls]
  
; Output all calls to the console log
;(.log js/console (pr-str calls-log 
(map log-call calls-log)))


That code works on the REPL connected to the browser, and the date is 
displayed on the console. However, the compiled code doesn't run on the 
browser. I've tried debugging it with Chrome, but I'm not getting any 
errors, and I don't really know what's going on when following it step by 
step.

If I comment the last line and uncomment the second to last, the code works 
on the browser. So basically if I don't do the map, it works. I am very 
confused.

I only started using ClojureScript today, and already had a bunch of 
problems (including not being able to get domina 1.0.2-SNAPSHOT to work, 
trying to follow the moder_cljs tutorial), so I would really appreciate 
some help with this. Thank you very much!


Nico

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