Fwd: how to translate this snippet from Scheme to Clojure

2012-08-30 Thread Andy Coolware
Let's focus on that for a sec: (define ((A)) 1) is the same as (define (A) (lambda () 1));; defines procedure "(A)" I wonder if you meant >>defines procedure "((A))"<< instead. Assuming that, if "((A))" is just a name of the procedure, then "A" and "(A)". Should not evaluate at all. Appa

Re: how to translate this snippet from Scheme to Clojure

2012-08-30 Thread Andy Coolware
I use Rocket Scheme. The question was inspired by "Structure and Interpretation" http://www.youtube.com/watch?v=2Op3QLzMgSY at almost end of the video @ 1:11:11 I actually think that "((A))" is more just a symbol name since apparently you define "A" not a "((A))"/ It is more like a recursive/ne

Re: how to translate this snippet from Scheme to Clojure

2012-08-30 Thread Andy Coolware
On Wed, Aug 29, 2012 at 10:14 PM, Baishampayan Ghose wrote: > Something like this? > > (defn A [] > 1) > > (defn A [] > (fn [] 1)) That would work but I wonder about how "(define ((A)) 1)" is evaluated in Scheme and why similar and easier approach is not possible in Clojure? -- You received

how to translate this snippet from Scheme to Clojure

2012-08-29 Thread Andy Coolware
> (define (A) 1) # > A # > (A) 1 > (define ((A)) 1) # > A # > (A) # > ((A)) 1 Just wondering ... Andy -- 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

Re: struggling with two simple list of lists operations

2012-06-24 Thread Andy Coolware
I know, but this is list :-) -- 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 th

struggling with two simple list of lists operations

2012-06-24 Thread Andy Coolware
Hi, I am looking for two seemingly simple operations which require adding to the list: (( 1 2 ) ( 20 30) (40)) 50 => (( 1 2 ) ( 20 30) (40 50)) and (( 1 2 ) ( 20 30) (40 50)) 60 => (( 1 2 ) ( 20 30) (40 50) (60)) Basically it is appending an element as a list to the list

Re: How to speed up Clojure Training for New Recruitment

2012-06-20 Thread Andy Coolware
> Oh, and I also believe training is mostly a waste of resources. Training is > pushing information. It really depends how it is constructed. If it is a domain knowledge - this is just a info push. If this is a skill to be acquired - I have seen many hands on dedicated labs very effective. Now

Re: meta-questions - [clojure] in front of Subject line

2012-06-19 Thread Andy Coolware
So I followed the steps and it did not work: >  3) This will automatically create a filter on words: > list:"" however after changing filter to >>Matches: to:(clojure.googlegroups.com) Do this: Apply label "clojure"<< all seems to be just fine and I am a happy camper ... Thank you, Andy -- Yo

Re: meta-questions - [clojure] in front of Subject line

2012-06-18 Thread Andy Coolware
Hi, thx a lot for all viewpoints. I am personally a bit torn. On one hand, when I open my gmail I have hard time to distinguish between all groups I am subscribed too. When you get tens of threads updated daily, this is really handy. However, I hate to have a redundant information in Subject and

meta-questions - [clojure] in front of Subject line

2012-06-17 Thread Andy Coolware
Hi, I have been subscribed to a couple of groups as well as other stuff and find it useful to have a Subject line prefix indicating the source of conversation. Would it be possible to add something like that [clojure] Thx, Andy -- You received this message because you are subscribed to the Goo

Re: so why it has to be so complicated / Longest Increasing Sub-Seq

2012-06-13 Thread Andy Coolware
> > (defn lis [coll] >   (or (->> coll >            (partition-between (partial apply >=)) >            (sort-by (comp - count)) >            (filter next) >            (first)) >       [])) Totally agree on decomposing the problem into a single independent steps. This is what I did not like about

Re: so why it has to be so complicated / Longest Increasing Sub-Seq

2012-06-13 Thread Andy Coolware
On Wed, Jun 13, 2012 at 4:05 AM, JuanManuel Gimeno Illa wrote: > My solution: > > (defn lis [s] >   (->> s >        (partition 2 1) >        (partition-by (partial apply <=)) >        (filter (fn [[[a b]]] (< a b))) >        (reduce (fn [m s] (if (> (count s) (count m)) s m)) []) >        (#(cons

Re: so why it has to be so complicated / Longest Increasing Sub-Seq

2012-06-12 Thread Andy Coolware
forgot full listing: scala> List[Int](6, 7, 8, 1, 2, 3, 4, 1, 11, 10 ,11 ,12 ,13, | 3).foldLeft(List[List[Int]]()){(a,b)=> | if(a.isEmpty) List(List(b)) | else if(a.last.last < b) a.dropRight(1):::List(a.last:+b) | else a:::List(List(b)) | }.filter(_.

Re: so why it has to be so complicated / Longest Increasing Sub-Seq

2012-06-12 Thread Andy Coolware
Nice. But I wonder if sorting and (count coll) actually forces the algorithm to load everything into memory. My Clojure solution is more convoluted (will post it later) and suffers the same due to a recursive algorithm doing the transformation I described at the end. However I think I have someth

so why it has to be so complicated / Longest Increasing Sub-Seq

2012-06-12 Thread Andy Coolware
Hi, First a quick disclaimer. Those are my first steps in Clojure so I am not be super accustomed to the language entire landscape and might miss some basics here. However I was able to solve my first 4clojure hard problem https://www.4clojure.com/problem/53 and have some second thoughts after loo

Re: scanLeft

2012-06-11 Thread Andy Coolware
thx, I see it now. -- 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,

scanLeft

2012-06-11 Thread Andy Coolware
Hi, I am looking for a way to express following function in Clojure: scala> scanLeft(List(1,2,3))(0)(_ + _) res1: List[Int] = List(0, 1, 3, 6) Any insight? Andy ... -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Re: why String is not a collection (of Character)

2012-06-07 Thread Andy Coolware
I was wondering cause we can do all awesome stuff like that: user=> (last "abc") \c user=> (first "abc") \a user=> (map (fn[z] (str z "-")) "abc") ("a-" "b-" "c-") but this renders false user=> (coll? "abc") false A. -- You received this message because you are subscribed to the Google Groups

why String is not a collection (of Character)

2012-06-07 Thread Andy Coolware
Hi, So my questions is as in subject. I did a bit of research but could not find a good answer. Would appreciate an insight ... (thank you 'Andy) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegro