Explorer

definy.split-words

description
acc followed by the words of text from index separated by spaces
type
Fn(text: String, index: Number, current: String, acc: List<String>) -> List<String>
expression
fn(text$0, index$1, current$2, acc$3) =>
  let flushed$4 = match @core.equal(left: $2, right: "") {
      true =>
        $3,
      false =>
        @core.list-append(list: $3, item: $2)
    };
  match @core.less-than(left: $1, right: @core.string-length(value: $0)) {
    false =>
      $4,
    true =>
      let character$5 = @core.string-slice(value: $0, start: $1, end: @core.plus(left: $1, right: 1));
      match @definy.is-space(character: $5) {
        true =>
          @definy.split-words(text: $0, index: @core.plus(left: $1, right: 1), current: "", acc: $4),
        false =>
          @definy.split-words(
            text: $0,
            index: @core.plus(left: $1, right: 1),
            current: @core.string-concat(left: $2, right: $5),
            acc: $3
          )
      }
  }
visibility
public
definy.split-words (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: BMpCLrZz3mrG6f9F8llOTSHDXoSaDxO1ukk3aLh17zo
content hash: 9ARci5YRhk-emhi_wlqPJK5l6CC2d8WyCI6dhKAtr2U