Re: Clojure beginner: IF statement error!

2016-03-06 Thread Bryan Maass
Welcome to Clojure Renata!

Since you're familiar with lisp but not the Clojure idioms, you may want to 
take a scan through the clojure style guide 

.

-- 
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/d/optout.


Re: Clojure beginner: IF statement error!

2016-03-05 Thread Mars0i
Just spelling out what the previous comments implied:

You're giving 'if' five arguments:

(= M 0) 
1 
"in case pow is 0 return 1"
(do (* N (recur N (- M 1)
"decrease power M each itr"

'if' needs at least two arguments, and is normally used with three.  If you 
delete the strings, your code will be correct.

-- 
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/d/optout.


Re: Clojure beginner: IF statement error!

2016-03-04 Thread Jason Felice
Comments start with a semicolon (;).

On Fri, Mar 4, 2016 at 7:23 PM, Joseph Smith  wrote:

> Those strings are in the if form.
>
> ---
> Joe R. Smith
> j...@uwcreations.com
> @solussd
>
>
> On Mar 4, 2016, at 6:48 PM, Renata Akhm  wrote:
>
> Hi! I've just strated coding on Clojure and tried to move some of my Lisp
> code to Clojure:
> (defn mpow
> [N M]
> (if (= M 0) 1 "in case pow is 0 return 1"
> (do (* N (recur N (- M 1) "decrease power M each itr"
> )
> So it just calculates power recursively. When I run it the "Too many
> arguments to if" error occures. What am I doing wrong? Thank you in advance
> for help!
>
> Renata
>
> --
> 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/d/optout.
>
> --
> 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/d/optout.
>

-- 
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/d/optout.


Re: Clojure beginner: IF statement error!

2016-03-04 Thread Joseph Smith
Those strings are in the if form. 

---
Joe R. Smith
j...@uwcreations.com
@solussd


> On Mar 4, 2016, at 6:48 PM, Renata Akhm  wrote:
> 
> Hi! I've just strated coding on Clojure and tried to move some of my Lisp 
> code to Clojure:
> (defn mpow
>   [N M]
>   (if (= M 0) 1 "in case pow is 0 return 1"
>   (do (* N (recur N (- M 1)   "decrease power M each itr"
> )
> So it just calculates power recursively. When I run it the "Too many 
> arguments to if" error occures. What am I doing wrong? Thank you in advance 
> for help!
> 
> Renata
> -- 
> 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/d/optout.

-- 
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/d/optout.


Clojure beginner: IF statement error!

2016-03-04 Thread Renata Akhm
Hi! I've just strated coding on Clojure and tried to move some of my Lisp 
code to Clojure:
(defn mpow
[N M]
(if (= M 0) 1 "in case pow is 0 return 1"
(do (* N (recur N (- M 1) "decrease power M each itr"
)
So it just calculates power recursively. When I run it the "Too many 
arguments to if" error occures. What am I doing wrong? Thank you in advance 
for help!

Renata

-- 
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/d/optout.