[Cs254f11] Last minute

Lee Spector lspector at hampshire.edu
Mon Dec 12 09:25:45 EST 2011


Does the second function, to which you are feeding this, take 5 arguments, and you want 0 to be the first, 5 the second, etc.?

If so, use apply, as in:

(defn myfn [a b c d e] (+ a b c d e))

(apply myfn '(0 5 2 4 334))

=> 345

If that's not what you meant then spell it out more completely.

 -Lee



On Dec 12, 2011, at 9:23 AM, David Edward Nishball wrote:

> I need to work on other things, so if someone could tell me I'd be appreciative.
> 
> What's the code in Clojure to turn this
> 
> (0 5 2 4 334)
> 
> Into this:
> 
> 0 5 2 4 334
> 
> For the purposes of feeding into another function?
> 
> _______________________________________________
> Cs254f11 mailing list
> Cs254f11 at lists.hampshire.edu
> https://lists.hampshire.edu/mailman/listinfo/cs254f11

--
Lee Spector, Professor of Computer Science
Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspector at hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438



More information about the Cs254f11 mailing list