Re: 4Clojure exersice question

2012-01-16 Thread Meikel Brandmeyer
Hi, Am 14.01.2012 um 14:19 schrieb Erlis Vidal: > Sometimes while solving a problem, we can not see simpler solutions. > > What do you think? Clojure is homoiconic. Walk the output of the reader and for each symbol do a (resolve sym) and check the Var against the list of forbidden Vars. Info

Re: 4Clojure exersice question

2012-01-14 Thread Erlis Vidal
Hi guys, I don't know how the validations for this are done, but in this case I can think on a naive check for the usage of a banned function. I think a regex can do it. Something that look for* (count\s*+* * I know maybe there are more edges cases but I don't think it'll be much than that. I unde

Re: 4Clojure exersice question

2012-01-13 Thread Anthony Grimes
I responded to this earlier, but I accidentally hit the 'reply to author' button instead of 'reply to post', and thus it went directly to Cedric rather than to the group. I'll respond here and quote the previous emails: On Fri, Jan 13, 2012 at 8:57 PM, Anthony Grimes wrote: > 4Clojure uses cl

Re: 4Clojure exersice question

2012-01-13 Thread Charlie Griefer
On Jan 13, 2012, at 4:47 PM, Anthony Grimes wrote: > Clojail errs on the side of safety and not on the side of "Oh, well maybe he > wasn't trying to break the sandbox. Let's allow it anyway.". Treating macros > as opaque is just another hole in what is already difficult sandboxing. > Macros ar

Re: 4Clojure exersice question

2012-01-13 Thread Jack Moffitt
An alternative solution to trying to make macros opaque is just to disallow the macros which depend on disallowed functions. It should be a relatively simple matter to generate this list programmatically from clojure.core source. So instead of just saying "You can't use count." It would say "You c

Re: 4Clojure exersice question

2012-01-13 Thread Cedric Greevey
On Fri, Jan 13, 2012 at 6:47 PM, Anthony Grimes wrote: > Clojail errs on the side of safety and not on the side of "Oh, well maybe he > wasn't trying to break the sandbox. Let's allow it anyway.". Treating macros > as opaque is just another hole in what is already difficult sandboxing. > Macros ar

Re: 4Clojure exersice question

2012-01-13 Thread Anthony Grimes
Clojail errs on the side of safety and not on the side of "Oh, well maybe he wasn't trying to break the sandbox. Let's allow it anyway.". Treating macros as opaque is just another hole in what is already difficult sandboxing. Macros are not even remotely close to functions. They *create* code.

Re: 4Clojure exersice question

2012-01-13 Thread Cedric Greevey
On Thu, Jan 12, 2012 at 3:31 AM, markus wrote: > Computers don't accuse, they process data. And they are not (yet?) > capable of reading a user's intentions. Technically no, but it's doubtful that a user using a macro like "for" intends to "cheat", so from the *programmer's* standpoint it's not c

Re: 4Clojure exersice question

2012-01-13 Thread markus
Computers don't accuse, they process data. And they are not (yet?) capable of reading a user's intentions. On 11 Jan., 19:02, Cedric Greevey wrote: > It seems dubious to me that it accuses users of cheating when they > clearly had no intent to cheat. Is this intended behavior of 4Clojure > or a b

Re: 4Clojure exersice question

2012-01-11 Thread Erlis Vidal
Hi Cedric, You know what? Now I understand what happens but while solving the problem I though something was wrong. Maybe this is something to consider in the future. Thanks for all the responses. On Wed, Jan 11, 2012 at 1:02 PM, Cedric Greevey wrote: > It seems dubious to me that it accuses u

Re: 4Clojure exersice question

2012-01-11 Thread Cedric Greevey
It seems dubious to me that it accuses users of cheating when they clearly had no intent to cheat. Is this intended behavior of 4Clojure or a bug? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroup

Re: 4Clojure exersice question

2012-01-11 Thread Erlis Vidal
Thank you guys, for all the tips! On Wed, Jan 11, 2012 at 11:08 AM, blcooley wrote: > > > On Jan 10, 12:03 pm, Erlis Vidal wrote: > > Hi, > > > > I'm solving the following exercise and when I'm trying to use the answer: > > > > #(reduce + (for [x coll] 1)) > > > > I get the error saying that I

Re: 4Clojure exersice question

2012-01-11 Thread blcooley
On Jan 10, 12:03 pm, Erlis Vidal wrote: > Hi, > > I'm solving the following exercise and when I'm trying to use the answer: > > #(reduce + (for [x coll] 1)) > > I get the error saying that I was using "count" which I'm not. Someone > knows why is that? Is this a bug in 4Clojure or something in t

Re: 4Clojure exersice question

2012-01-10 Thread Baishampayan Ghose
Try using map instead - (fn [s] (reduce + (map (fn [_] 1) s))) Or even better - (fn [s] (reduce (fn [x _] (inc x)) 0 s)) Regards, BG On Tue, Jan 10, 2012 at 11:33 PM, Erlis Vidal wrote: > Hi, > > I'm solving the following exercise and when I'm trying to use the answer: > > #(reduce + (for [x

Re: 4Clojure exersice question

2012-01-10 Thread Jack Moffitt
> > I'm solving the following exercise and when I'm trying to use the answer: >> >> #(reduce + (for [x coll] 1)) >> >> I get the error saying that I was using "count" which I'm not. Someone >> knows why is that? Is this a bug in 4Clojure or something in the language >> that I cannot see? >> >> If o

Re: 4Clojure exersice question

2012-01-10 Thread Erlis Vidal
I did an small mistake in the previous email but it's irrelevant I get the same result. the function should be #(reduce + (for [x %] 1)) Thanks, Erlis On Tue, Jan 10, 2012 at 1:03 PM, Erlis Vidal wrote: > Hi, > > I'm solving the following exercise and when I'm trying to use the answer: > > #(