On Wednesday, December 5, 2012 8:45:00 PM UTC, miner wrote:
>
> You should treat rand and friends like i/o.  Don't bury them deep in your 
> code.  Write your pure functions so that they take a seed value (or 
> sequence).  


This is one approach to by-passing clojure's randoms, yes. (To be honest 
I'm surprised that Clojure didn't go the infinite sequence route.*) But

- See my point about API's ***that encourage you do the wrong thing.*** 
Quite simply, if you have api in an fp language and it is easily possible 
to make it behave in a more-or-less fp-ish way, then you probably should

- It won't help you worth a damn if you are using someone else's code and 
it uses randoms - but being able to set the seed probably will

- Adding a set rand is a backwards compatible fix for old code

* I sort of wonder if for the future it might be possible to make it so 
that IO, rand and other such beasts are handled exclusively by special lazy 
sequences, and such sequences could only be generated or received by 
functions with a special special form (an extra special form?) But that 
seemed too large a Dumb Idea to bring up on this little acquaintance with 
what is obviously an excellent language. (UHH! ME LIKE CLOJURE!  HIT WITH 
HAMMER TO MAKE MORE LIKE HASKELL WHILE NOT KNOW ENOUGH TO UNDERSTAND 
CONSEQUENCES! UHH!) Maybe using metadata? (UHH! ME STOP KIBITZING NOW!) So 
I stuck to the srand thing. (The taint thing was what impressed me about 
Haskell most - you probably guessed.)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to