Skip to content

example in https://hookrace.net/nim-iterutils/iterutils.html broken #4

@timotheecour

Description

@timotheecour
#test.nim

import iterutils
from sequtils import toSeq
import sugar

proc test1()=
  for i in filter(map(filter(2..10, proc(x: int): bool = x mod 2 == 0),
           proc(x: int): int = x * 2), proc(x: int): bool = x mod 8 == 0):
    echo i

  var s = toSeq (2..10).filter(proc(x): bool = x mod 2 == 0).
      map(proc(x): int = x * 2).filter(proc(x): bool = x mod 8 == 0)
  echo s

  var a = (2..10).filter(proc(x: int): bool = x mod 2 == 0)
  var b = a.map((x: int) => x * 2)
  for i in b.map((x: int) => x + 2):
    echo i
test1()

gives:
test.nim(19, 17) Error: invalid indentation

fixing that gives other errors, and nothing prints

This example should be a test file in this repo so others can fix it (ideally something ran by nimble test iterutils)

links

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions