Clojure-Intro-Course / clojure-intro-class

NOTE: This repository is obsolete. Was: A pilot project to use Clojure for introductory computer science courses at the University of Minnesota - Morris
20 stars 3 forks source link

comp, constantly, repeat, repeatedly #96

Closed leek5pin closed 8 years ago

leek5pin commented 8 years ago

and other commonly used functions need preconditions

leek5pin commented 8 years ago

Is it just me, or does constantly not need redefining??? I can't imagine any type errors with it.

leek5pin commented 8 years ago

same goes for repeat

leek5pin commented 8 years ago

never mind, repeat does have a number argument

leek5pin commented 8 years ago

I'm not sure how I should test repeatedly for functionality. Either I need to use an atom, or have a function which is pretty much constant, or do random things but I don't want to deal with that.

I'll test it's errors for now, and revisit the testing for functionality.

leek5pin commented 8 years ago

weird: (repeat 5.23 "x") => '("x" "x" "x" "x" "x")

(repeatedly 5.23 (constantly "x")) => '("x" "x" "x" "x" "x" "x")