Changeset 30571 in project


Ignore:
Timestamp:
03/15/14 17:17:02 (7 years ago)
Author:
certainty
Message:

data-generators: documented gen-series, gen-keyword and gen-procedure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/data-generators

    r30564 r30571  
    248248Generator for a random boolean value
    249249
     250<procedure>(gen-procedure)</procedure>
     251Generator for a procedure. This is equivalent to (gen-procedure (<- (gen-fixnum 0 max-arity)) (gen-bool)).
     252
     253<procedure>(gen-procedure arity return-gen)</procedure>
     254Generator that generates procedures with the given '''arity''' with 0 <= '''arity''' <= max-arity.
     255max-arity is currently '''20'''. The procedures that are generated return a value that is created by invoking '''return-gen'''.
     256
    250257<procedure>(gen-sample candidates)</procedure>
    251258Generator that draws a random sample from the list of '''candidates'''.
     259
     260<procedure>(gen-series)</procedure>
     261Generator that returns values from the series starting at '''gen-current-fixnum-min''' till '''gen-current-fixnum-max''' by applying
     262'''add1''' in each step.
     263
     264<procedure>(gen-series start end step)</procedure>
     265Generator that generates values from '''start''' to '''end''' with steps as specified by the one-argument-procedure '''step'''.
     266The '''step''' procedure gets the current value during each application of the generator and must return the next possible value.
     267The generator automatically wraps around and starts over if the end of the series has been reached.
    252268 
    253269==== Combinators
     
    282298<procedure>(gen-symbol-of #!optional (char-gen (gen-char char-set:letter+digit)) (size (gen-current-default-size)))</procedure>
    283299Generator for a symbol where each character is generated from '''char-gen'''.
     300The '''size''' parameter specifies the size of the strings that are generated.
     301It is expected to be a thunk that returns the size as a fixnum. See '''with-size''' for a more convenient way to adjust this.
     302
     303<procedure>(gen-keyword ...)</procedure>
     304Alias for '''gen-keyword-of'''
     305
     306<procedure>(gen-keyword-of #!optional (char-gen (gen-char char-set:letter+digit)) (size (gen-current-default-size)))</procedure>
     307Generator for a keyword where each character is generated from '''char-gen'''.
    284308The '''size''' parameter specifies the size of the strings that are generated.
    285309It is expected to be a thunk that returns the size as a fixnum. See '''with-size''' for a more convenient way to adjust this.
Note: See TracChangeset for help on using the changeset viewer.