package mindstorm

  1. Overview
  2. Docs

List files on the brick matching a given pattern.

type 'a iterator

An iterator to allow to enumerate files on the brick.

val patt : 'a conn -> string -> 'a iterator

Find.patt conn fpatt returns an iterator listing the filenames mathing the pattern fpatt. The following types of wildcards are accepted:

  • filename.extension
  • *.[file type name]
  • filename.*
  • *.*
  • raises File_not_found

    if no file was found

val current : 'a iterator -> string

Find.patt conn fpatt returns an iterator listing the filenames mathing the pattern fpatt. The following types of wildcards are accepted:

  • filename.extension
  • *.[file type name]
  • filename.*
  • *.*
  • raises File_not_found

    if no file was found

Find.current i returns the current filename.

val current_size : 'a iterator -> int

Find.current i returns the current filename.

Find.current_size i returns the current filename size (number of bytes).

val next : 'a iterator -> unit

Find.current_size i returns the current filename size (number of bytes).

Execute a new request to the brick to retrieve the next filename matching the pattern.

  • raises File_not_found

    if no more file was found. When this exception is raised, the iterator is closed.

val close : 'a iterator -> unit

Execute a new request to the brick to retrieve the next filename matching the pattern.

  • raises File_not_found

    if no more file was found. When this exception is raised, the iterator is closed.

close_iterator i closes the iterator i. Closing an already closed iterator does nothing.

val iter : 'a conn -> f:(string -> int -> unit) -> string -> unit

iter f fpatt iterates f name size on all the filenames matching the pattern fpatt (see Mindstorm.NXT.Find.patt for the accepted patterns).

val map : 'a conn -> f:(string -> int -> 'b) -> string -> 'b list

iter f fpatt iterates f name size on all the filenames matching the pattern fpatt (see Mindstorm.NXT.Find.patt for the accepted patterns).

map f fpatt maps f name size on all the filenames matching the pattern fpatt and return the list formed of those. (See Mindstorm.NXT.Find.patt for the accepted patterns.)

val fold : 'a conn -> f:(string -> int -> 'b -> 'b) -> string -> 'b -> 'b

map f fpatt maps f name size on all the filenames matching the pattern fpatt and return the list formed of those. (See Mindstorm.NXT.Find.patt for the accepted patterns.)

fold f fpatt a0 folds f on all the filenames matching the pattern fpatt (see Mindstorm.NXT.Find.patt for the accepted patterns).