Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a stateful transducer?

In the Clojure Core documentation for the 1.7 release - the following functions

dedupe
disj!
dissoc!
filter
keep
map
random-sample
remove
replace
take-while

Have the following text in their API description

Returns a transducer when no collection is provided.

And the following functions

drop
keep-indexed
partition-all
partition-by
take
take-nth

Have the following text.

Returns a *stateful* transducer when no collection is provided.

In addition - there has been this criticism of this wording.

enter image description here

My question is: What is a stateful transducer? ie what is similar about the grouped functions. (and is this the reason that people say typing a transducer would require dependent types?)

like image 968
hawkeye Avatar asked Oct 22 '14 11:10

hawkeye


1 Answers

State can be stored inside transducers. Corresponding slides:

https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/Transducers/00.34.26.jpg https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/Transducers/00.36.36.jpg

See Rich transducers talk - https://www.youtube.com/watch?v=6mTbuzafcII

like image 149
edbond Avatar answered Nov 07 '22 07:11

edbond