Re: map output to string

2014-07-08 Thread Glen Rubin
> making, that produces the problem. > > In addition, your report function has an extra ")" at the end. > > I tried patching up everything in a minimal way but then I don't see a > problem. > > -Lee > > On Jul 8, 2014, at 10:38 PM, Glen Rubin > >

Re: map output to string

2014-07-08 Thread Glen Rubin
cases I apply the list function to do this: > > => (str (map inc (range 10))) > "clojure.lang.LazySeq@c5d38b66" > > => (str (apply list (map inc (range 10 > "(1 2 3 4 5 6 7 8 9 10)" > > -Lee > > > > On 8 July 2014 09:49, Glen Rubin > &g

Re: map output to string

2014-07-07 Thread Glen Rubin
that running them at the > REPL will force them to be fully realised, whereas a lazy sequence may not > be realised in other contexts. I didn't understand where 'clojure-lazy-seq' > is coming from in your question so I'm not sure if that's your issue or not. >

map output to string

2014-07-07 Thread Glen Rubin
my-fn takes a number and a string as argument and outputs a string. I am using map-indexed and my-fn to comprehend a list of items with numbered index as follows, (map-indexed (fn [idx itm] (my-fn idx itm)) '(list-of-crap)) When i run this on the repl everything works well and I get a si

Re: lazy list comprehension

2014-06-27 Thread Glen Rubin
yes, map-indexed seems to make the most sense here. thanks On Friday, June 27, 2014 8:13:53 AM UTC-7, Linus Ericsson wrote: > > You probably want map-indexed > > http://clojuredocs.org/clojure_core/1.2.0/clojure.core/map-indexed > > /L > > > 2014-06-27 17:10 GMT+02:00 Leonardo Borges >: > >> Try

lazy list comprehension

2014-06-27 Thread Glen Rubin
I have a list that I want to combine in some way with an incremented list, so I was trying to write a for expression like this: (for [i '(my-list-of-crap), j (iterate inc 0)] (str i j)) The problem with this is that it yields an out of memory area. I assume this is b/c of my poor use of the i

delete-file needs to be vector?

2014-06-12 Thread Glen Rubin
I wrote a fn to delete a couple files: (defn del-temps (clojure.java.io/delete-file "C:/temp/fs.png" true) (clojure.java.io/delete-file "C:/temp/fs.txt" true)) When I run my program I get the following error: Exception in thread "main" java.lang.IllegalArgumentException: Parameter dec

if else list of commands

2014-06-12 Thread Glen Rubin
Pretty basic question. How do I run a couple commands in the else section on an if-else function? Or can I only run one and need to define a function that does both commands? THanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

generate rtf

2014-06-11 Thread Glen Rubin
I am writing a program that needs to process some text and then generate an RTF file. I am using the spit command, but the file I generate gives me an error message when I try opening it using Windows Word, it brings up a message box stating: Word was unable to read this document. It may be c

importing a single function in ns

2014-06-06 Thread Glen Rubin
My namespace currently looks like this: (ns providence.core (:gen-class) (:use seesaw.chooser) (:use seesaw.core) (:use clojure.java.shell)) However, I only use sh from java.shell choose-file from seesaw.chooser and alert from seesaw.core. How do I import these single functions from th

use :only in ns

2014-06-04 Thread Glen Rubin
In my ns i am using a couple of libraries, e.g. (ns providence.core (:gen-class) (:use seesaw.chooser)) However, I only want to use 1 or 2 commands from these libraries, for example (choose-file) from the above seesaw.chooser. How do I specify only a single library? thanks -- You rece

Re: deskewing image

2014-06-03 Thread Glen Rubin
my clojure-fu and java-fu are both pretty weak as I am still rather green. I guess I will put a hold on this for now until I am more advanced. On Monday, June 2, 2014 10:42:35 PM UTC-7, Atamert Ölçgen wrote: > > > > On Tue, Jun 3, 2014 at 5:14 AM, Glen Rubin > wrote: > >

deskewing image

2014-06-02 Thread Glen Rubin
I am interested in automatically deskewing of a scanned image before ocr processing using tesseract. I found the following, which is some java code to do it http://anydoby.com/jblog/en/java/1990 Can anyone give some advice on how to make use of this java code using clojure? -- You received

Re: text processing function

2014-06-01 Thread Glen Rubin
get" function can't find a result, it returns nil. > > - James > > > On 1 June 2014 17:09, Glen Rubin > wrote: > >> I am doing some text processing using clojure and attempting to extract a >> person's name by regex and then assign it to a map. The r

text processing function

2014-06-01 Thread Glen Rubin
I am doing some text processing using clojure and attempting to extract a person's name by regex and then assign it to a map. The result I get takes one of several forms: nil (if i can't find the name) [fullname] [fullname lastname] [fullname lastname firstname] [fullname lastname firstname

load-file for lein main function

2014-05-28 Thread Glen Rubin
I am doing text processing on an OCR text file using clojure. Basically, I (slurp) in the ocr text file and then use regular expressions to extract and (def) the bits of data I am interested in. This script to do this is complete, it prompts user for the file to slurp using seesaw.chooser lib

regex strings

2014-05-27 Thread Glen Rubin
I have a string of the general form: Name: Last,First Middle ID: GA88192 I am trying to extract the first name by invoking string.replace function, for example to extract the first name I invoke the following where 'nameidstring' is the general form above: (clojure.string/replace nameidstri

partitioning iterative list

2010-12-24 Thread Glen Rubin
Can I do the following without using loops?? I have list, e.g. '(4 6 66 33 26 6 83 5) I want to partition it so that I get a subset of lists that build up to the original: ( (4) (4 6) (4 6 66) (4 6 66 33) ) -- You received this message because you are subscribed to the Google Groups "Cloj

Re: replace first n items in sequence

2010-12-18 Thread Glen Rubin
> trying to write one: > > (defn replace-first-n [xs ys] >   (let [n (count ys)] >     (concat ys (drop n xs)))) > > On Dec 18, 2:38 pm, Glen Rubin wrote: > > > > > > > > > I am looking for a fn that does the following.  Let's say i have &g

replace first n items in sequence

2010-12-18 Thread Glen Rubin
I am looking for a fn that does the following. Let's say i have sequences A & B A: '(1 2 3 4 5 6 7 8 9 10) B '(54 666 23) I want to replace A's first items with B's, so that I get: '(54 666 23 4 5 6 7 8 9 10) Is there a fn to do this? Otherwise, I will write one. Thanks! -- You received

range with decimal values

2010-12-04 Thread Glen Rubin
If I use the range fn with a decimal number for step I get back something like this: (range 0.05 0.16 0.01) user> (0.05 0.060005 0.07 0.08 0.09 0.0 0.10999 0.11998 0.12998 0.13999 0.15) Really I want output more like i g

Re: fastest way to remove nils

2010-11-18 Thread Glen Rubin
So, it seems the way I was removing nils using filter was already the best way. still nice to learn about the keep fn. thx! On Nov 17, 8:38 pm, Ken Wesson wrote: > On Wed, Nov 17, 2010 at 7:55 PM, Robert McIntyre wrote: > > So, just to be clear, > > > user> (def nil-seq (doall (interleave (rep

fastest way to remove nils

2010-11-16 Thread Glen Rubin
What is the fastest way to remove nils from a sequence? I usually use the filter function, but I see there are other functions like remove that should also do the trick. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send emai

Mobile Clojure

2010-11-10 Thread Glen Rubin
Are there any mobile platforms that clojure runs well on? I saw that clojure is available for Android, but runs very slowly. -- 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

reducing terms in vector

2010-10-28 Thread Glen Rubin
Hi! A little stuck on how to do this efficiently. I have data that looks like this ( [ [1 2] [3 4] [5 6] ... ] [ [5 6] [7 8] [9 0] ... ] ...) I am trying to sum the vector pairs, e.g [6 8] [10 12] [14 6] thx! -- You received this message because you are subscribed to the Google Groups "Clo

Re: challenge with vectors

2010-10-27 Thread Glen Rubin
awesome dude!!! Thanks for the book recommendation...I'll take a look at those when I can. Right now I am just eager to get my code working ;) On Oct 27, 1:18 pm, Aravindh Johendran wrote: > On Oct 27, 8:24 am, Glen Rubin wrote: > > > wow, i think you just went way over my h

Re: challenge with vectors

2010-10-27 Thread Glen Rubin
wow, i think you just went way over my head. First off a very naive question: I thought all clojure programming was functional, as long as you are not using refs, agents, or other mutable values etc...?? On Oct 27, 12:26 am, Aravindh Johendran wrote: > What kind of an answer are you looking

challenge with vectors

2010-10-26 Thread Glen Rubin
I have a sequence like this: [ [a b] [a b] [a b] [a b] ] where a and b are numbers. I would like to return the vector and its index for which b is the least in this collection. For example, if my data is as follows [ [22 5] [56 8] [99 3] [43 76] ] I would like to return 3rd vector in the coll

problem connecting through slime

2010-10-23 Thread Glen Rubin
Hey!!! Maybe this is not the best place to ask this question, but seeing as how many of you use emacs to code I will give it a shot. I am using emacs, slime, swank combo. When I try to slime-connect, I initially get the following error: error in process filter: Symbol's value as variable is voi

Re: exception thrown when passing in nil parameter

2010-09-28 Thread Glen Rubin
ame behavior for every arity, > with some default argument values. > > -S > > On Sep 27, 2:13 pm, Glen Rubin wrote: > > > > > I have a function that will accept 3 or 4 parameters.  Another > > function I have calls it and passes in 4 arguments.  Sometimes, the &

exception thrown when passing in nil parameter

2010-09-27 Thread Glen Rubin
I have a function that will accept 3 or 4 parameters. Another function I have calls it and passes in 4 arguments. Sometimes, the 4th argument is nil and this causes an error, instead of just calling the main function as if I passed in 3 arguments. Meaning the main function sees a 4th parameter w

Re: return index of a value

2010-09-27 Thread Glen Rubin
interesting! thx guys! On Sep 27, 10:45 am, Glen Rubin wrote: > I have a vector of numbers > > [0 99 3334 53 2 5 99 2 55 63] > > I'd like to find the first index of a particular value.  For example > if the value was 99 then I want to return 1, b/c the index of 99 is >

Re: finding value nearest x

2010-09-27 Thread Glen Rubin
ok, thx. just trying to keep myself to a high standard while learning this stuff ;) On Sep 27, 11:12 am, Michael Gardner wrote: > On Sep 27, 2010, at 9:59 AM, Glen Rubin wrote: > > > yes correct.  but i can write a fn to determine the index of the > > minimum distance in my ne

Re: finding value nearest x

2010-09-27 Thread Glen Rubin
:28 AM, Glen Rubin wrote: > > > It occurs to me that another way of doing this is to map a new list > > and then use the min fn.  something like: > > > (apply min (map #(Math/abs (- % 136)) xs)) > > > maybe this is better and involves less calculations? > > Th

return index of a value

2010-09-27 Thread Glen Rubin
I have a vector of numbers [0 99 3334 53 2 5 99 2 55 63] I'd like to find the first index of a particular value. For example if the value was 99 then I want to return 1, b/c the index of 99 is 1. I can do this with a loop/recur structure comparing each value in the list to my desired value, how

Re: finding value nearest x

2010-09-27 Thread Glen Rubin
It occurs to me that another way of doing this is to map a new list and then use the min fn. something like: (apply min (map #(Math/abs (- % 136)) xs)) maybe this is better and involves less calculations? On Sep 25, 2:19 pm, Glen Rubin wrote: > min-key looks good!  thx guys!!! > >

Re: finding value nearest x

2010-09-25 Thread Glen Rubin
min-key looks good! thx guys!!! On Sep 25, 10:44 am, Nicolas Oury wrote: > On Sat, Sep 25, 2010 at 3:40 PM, Jules wrote: > > Maybe this: (min-key #(abs (- % 136)) xs) > > Wouldn't that be (apply min-key #(abs (- % 136)) xs)? -- You received this message because you are subscribed to the Googl

finding value nearest x

2010-09-25 Thread Glen Rubin
I have a list of numbers and I want to find the one that is closest to 136. Is there an operator for performing this kind of operation or do I need to to do it algorithmically? thanks! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this

Re: multiple parameters passed to fns

2010-09-02 Thread Glen Rubin
gt; >    ([file channel sweepidx startidx size] > >     (let [collated-target1 (graph-part file channel sweepidx (+ 1 > > > sweepidx)) > >           collated-target2 (apply identity collated-target1) > >           ;apply starting point and size parameters > >          

multiple parameters passed to fns

2010-09-02 Thread Glen Rubin
I defined a fn whose execution depends on the number of parameters passed to it. It works fine! I am just concerned that I am doing this in a way that is not as concise as it could or should be. Here is my fn: (defn make-target "Parses text file for single sweep specified by sweepidx. If size

misunderstanding collection

2010-08-25 Thread Glen Rubin
After toying around at the REPL I realize that I have been working with a heretofore invalid understanding of collections. For example, working with the following collection(s): signal: (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8))) I wanted to sum each individual list: e.g. (

Re: trouble using nested map fn

2010-08-25 Thread Glen Rubin
I'm glad my question generated so much discussion! Thank you all for the suggestions...it's all good stuff trying to wrap my head around and improve my facility with clojure. On Aug 24, 1:27 am, Meikel Brandmeyer wrote: > Hi, > > On 24 Aug., 03:08, gary ng wrote: > > > (map #(for [s %2] (map *

trouble using nested map fn

2010-08-23 Thread Glen Rubin
I am trying to write a fn to correlate 2 signals using 3 nested map fn. I have 2 collections of data. THe first group of signals called target looks something like this. target: ( (1,2,3,4) (2,3,4,5) ...) The second collection is called signal and looks like this: signal: ( ((1,2,3,4)(2,3,4,

Re: take all

2010-08-20 Thread Glen Rubin
I just wrote a fn called takeall that seems to do what I want: (defn takeall [x & [y]] (if (and x y) (take x y) x)) On Aug 20, 1:44 pm, Glen Rubin wrote: > I am writing a fn to extract elements from a sequence using optional > start and end values.

take all

2010-08-20 Thread Glen Rubin
I am writing a fn to extract elements from a sequence using optional start and end values. I will do this by testing if 'end' or 'start' values are passed as parameters to the function. If the user does not specify a end value I would like the fn to return the entire sequence from 'start' to end

multiplying lists

2010-08-19 Thread Glen Rubin
I want to multiply a list of n items by h lists of n items, so that for example if i have list 'a' and 'b' (def a (list 1 2 3)) (def b (list '(4 5 6) '(7 8 9))) when multiplied I will get: ((4 10 18) (7 16 27)) -- You received this message because you are subscribed to the Google Groups "Cloj

gobble up a collection 2 at a time

2010-07-21 Thread Glen Rubin
Hi! I want to process a collection 2 elements at a time using map. My function accepts 2 parameters (a,b) and returns a result (c): (myfcn [a b]) => c so I want to iterate myfcn over a collection and create a new sequence for example let's say myfcn sums a and b, then i would like to do some

removing parethesis

2010-04-12 Thread Glen Rubin
I am working with a collection of integer sequences ...(e.g. coll: ((3 7 3 5 9 2 0 8 4 0 1 2323 4 11...) (243 4 664 478 3948...) (6 3 7 4 3335 2 4 5 7 6...)...) I want to create an average sequence such that all of the first elements are averaged, all of the second elements, etc However, I am

re-arranging sub-partitions

2010-04-11 Thread Glen Rubin
I am working with a collection of sequences ...(e.g. coll: ((/f /b /c /4 /5 /6 /3 /6 /f /4 /3 /2 /4 /5 /7 /3 /6...) (/2 /b /c /4 / 2 / 6 /3 /7 /f /4 /3 /2 /4 /5 /7 /3 /6...)...) I want to rearange the sequence into groups of 4 where the later 2 elements are moved to the front for example: (/f /b

(apply partition coll1 coll2 ...)

2010-04-11 Thread Glen Rubin
I am working with a collection of sequences ...(e.g. coll: ((/f /b /c /4 /5 /6 /3 /6 /f /4 /3 /2 /4 /5 /7 /3 /6) (/2 /b /c /4 /2 / 6 /3 /7 /f /4 /3 /2 /4 /5 /7 /3 /6)...) I want to partition the sequences into groups of 4, but when I try the following or something similar it fails saying either p

formatting hex string

2010-03-31 Thread Glen Rubin
I have a sequence of hex strings, e.g. "ff43" "0032" ... (you get the idea) I want to use clojure's short form on them, but short expects an authentic hex input, e.g. (short 0xff43) it will not accept something like (short "0xff43") Any suggestions would be gratefully appreciated!! -- You re

Re: regular expression sequence

2010-03-30 Thread Glen Rubin
ngle character that is not a lowercase letter (of > > the English alphabet).  Position matters: [-^] matches a literal > > hyphen or caret, and [] is not an empty character class but a syntax > > error (an unclosed character class that so far includes a literal ']' > &

Re: regular expression sequence

2010-03-30 Thread Glen Rubin
The result is a little bit strange still, since I am getting dupliates. First, it returns the string I want 49|00|12 12|a9|a4|ff but then it also returns the same string without the first and last 4 characters, e.g. 12|12|a9| Also, how come I don't need to escape the | inside the pare

regular expression sequence

2010-03-30 Thread Glen Rubin
I am having trouble with the re-seq regular expression form. I am not an expert on regex, so this is probably part of my problem. I have a k12 text file, basically it is hex broken up by '|' . I would like to grab all the hex between two hex numbers (sample text below). For example, I might wa

Re: byte and 2s complement

2010-03-28 Thread Glen Rubin
Halelujah! On Mar 28, 4:29 pm, Michael Wood wrote: > On 28 March 2010 22:07, Glen Rubin wrote: > > > I guess not, some of the values I am obtaining are off.  I have tried > > searching for a java class that will understand a signed (two's > > complement) hex (

Re: byte and 2s complement

2010-03-28 Thread Glen Rubin
I guess not, some of the values I am obtaining are off. I have tried searching for a java class that will understand a signed (two's complement) hex (16 bit, 0xff32) This is something so basic, I know there must be some in built function for this?? On Mar 28, 3:06 pm, Glen Rubin wrote: &

byte and 2s complement

2010-03-28 Thread Glen Rubin
I am working with 2's complement hex. It looks like i can get the value of any number by just using byte? e.g.: (byte 0xff32) -- 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 post

installing libraries

2010-03-27 Thread Glen Rubin
I want to start graphing some data i am woking with. I found and downloaded a library called dejcartes for this purpose http://www.markmfredrickson.com/code/ I am absolutely clueless as how to install this beast...my knowledge of java is extremely. i see there are a bunch of jar files as well cl

Re: convert hex string to number

2010-03-27 Thread Glen Rubin
thanks...you rock!! On Mar 27, 4:17 pm, Richard Newman wrote: > > Is there a function for converting these strings into normal hex or > > numbers??  I tried num, but it didn't work. > > user=> (read-string "0x44") > 68 > > Safer: > > (defn hex->num [#^String s] >    (binding [*read-eval* false] >

convert hex string to number

2010-03-27 Thread Glen Rubin
Hi! I am working with a sequence of hex numbers that are in string format, e.g. ("0x34" "0xff" "0x01" ...) Is there a function for converting these strings into normal hex or numbers?? I tried num, but it didn't work. Thanks! -- You received this message because you are subscribed to the G

converting long string to number

2010-03-25 Thread Glen Rubin
I am trying to convert a long string of numbers to a number, but get a java.lang.numberformatexception My long string of numbers has new line characters in it, so I am filtering out the newline characters before converting it back to a string. Then I try to use Integer. on it but get the above e

Re: listing factors of a number

2010-03-24 Thread Glen Rubin
Except Mathematica is kind of expensive $250 for the home edition. It looks like there is also Incanter which is a similar project using R free statistical computing environment On Mar 24, 12:55 pm, Mark Engelberg wrote: > Check out clojuratica.  It interfaces Clojure to a free version of > math

Re: determining index number for item in list

2010-03-24 Thread Glen Rubin
Of course! I keep making stupid mistakes like thisarg!!! On Mar 24, 9:28 am, Meikel Brandmeyer wrote: > Hi, > > On Mar 24, 2:21 pm, Glen Rubin wrote: > > > (loop [x 1 y (first (tri-nums))] > > ... > >    (recur (inc x) (first (rest (tri-nums > >

determining index number for item in list

2010-03-24 Thread Glen Rubin
I wrote the following code to produce a lazy sequence of the triangle numbers. (triangle numbers are the series of numbers: 1, 1+2, 1+2+3, etc...) (defn tri-nums [] "prduce a lazy sequence of triangle numbers" (let [triangles (map #(range 1 %) (iterate inc 2))] (map #(reduce + %) triangle

Re: listing factors of a number

2010-03-24 Thread Glen Rubin
27;s elliptic curve > factorization or the general number field sieve. I don't know of any > implementations in Clojure but there seem to be a few floating around > in Java. > > -Per > > On Wed, Mar 24, 2010 at 3:35 AM, kotor wrote: > > On Mar 23, 1:02 pm, Glen Rubin wrote:

listing factors of a number

2010-03-23 Thread Glen Rubin
Does anyone know of any existing libraries for clojure that has code which is optimized to list all of the factors of any given integer? -- 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

lazy-cons

2010-03-20 Thread Glen Rubin
Hey all, I am working through the problems on project euler. On question number 11 (http://projecteuler.net/index.php?section=problems&id=11), I was unable to come up with a solution, so I cheated and looked at some other people's answer's here: http://clojure-euler.wikispaces.com/Problem+011

filter sequence until false result

2010-03-13 Thread Glen Rubin
Hey all! I am trying to filter a sequence until a false value is returned. Is there a control-flow form to do this? ( I know I could write a loop statement to do it) Here are more details of what I am actually trying to do, in case above is not clear. input is the lazy sequence of primes: (u

Re: collections within collections

2010-03-11 Thread Glen Rubin
gt; user=> (map #(answer? %) (trips (range 1 7))) > (() () ([3 4 5]) () ()) > > > > On Wed, Mar 10, 2010 at 1:20 PM, Glen Rubin wrote: > > I am working on the following problem: > > >   Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = > > 1000

collections within collections

2010-03-10 Thread Glen Rubin
I am working on the following problem: Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000 My strategy is to produce a series of triplets of a^2 + b^2 and then filter out the ones where the c^2 is a perfect square, in order to determine Pythagorean triplets. I wrote a fun

Re: map not working in loop

2010-03-05 Thread Glen Rubin
hat a modification? thx everybody for the help! On Mar 5, 7:15 am, Richard Lyman wrote: > On Fri, Mar 5, 2010 at 7:05 AM, Glen Rubin wrote: > > The following code does not work, when using (range 1 5) as coll > > input: > > > (defn pyt [coll] > >  (loop [b (rest

map not working in loop

2010-03-05 Thread Glen Rubin
The following code does not work, when using (range 1 5) as coll input: (defn pyt [coll] (loop [b (rest (coll))] (map #(* % %) b))) The real code was more complicated, but I refined it to its simplest form while still producing the error. (map f coll) looks correct to me?? :( -- Y

no source file

2010-02-25 Thread Glen Rubin
Hi, I wrote some code, put it in a file, and now want to load that file. Here is the code I wrote, sqrs.clj: (use '[clojure.contrib.generic.math-functions :only (sqr)]) (defn square-of-sum [coll] "adds up collection of numbers and then squares it" (sqr (reduce + coll))) w

Re: processing two collections

2010-02-15 Thread Glen Rubin
I tried using your alternate definition for palindromes? , but an exception was thrown: java.lang.NullPointerException [Thrown class java.lang.RuntimeException] On Feb 15, 7:02 am, Meikel Brandmeyer wrote: > Hi, > > On Feb 15, 2:50 pm, Glen Rubin wrote: > > >   ;definiti

Re: processing two collections

2010-02-15 Thread Glen Rubin
indromic number is " palindromic-number " its roots are " root1" " root2)) message) On Feb 14, 11:17 pm, ataggart wrote: > On Feb 14, 5:49 pm, Glen Rubin wrote: > > > > > Thank you for the advice!  Just for reference I am working on project > >

Re: processing two collections

2010-02-14 Thread Glen Rubin
Feb 14, 8:52 am, "Steven E. Harris" wrote: > Glen Rubin writes: > > How do I take an element from one collection and test for no remainder > > (e.g. (zero? (mod x y)), when dividing by every element of the second > > collection, before processing the next item in

processing two collections

2010-02-14 Thread Glen Rubin
howdy clojure folks! I am a noob and trying to do the following: Suppose I have 2 collections of numbers: (range 1000 2000) (range 100 150) How do I take an element from one collection and test for no remainder (e.g. (zero? (mod x y)), when dividing by every element of the second collection, b

Re: defn

2010-01-25 Thread Glen Rubin
ue of 1.  The ([n] and ([n acc] lines are the declarations of the > parameter lists for the function.  Does that make sense? > > On Sun, Jan 24, 2010 at 7:23 PM, Glen Rubin wrote: > > I am trying to learn clojure by learning the programing by example > > open wiki book.  For an

defn

2010-01-25 Thread Glen Rubin
I am trying to learn clojure by learning the programing by example open wiki book. For an excercise demonstrating iteration they give the following example: (defn factorial ([n] (factorial n 1)) ([n acc] (if (= n 0) acc (recur (dec n) (* acc n) first