diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/collections/sequtils.nim | 9 | ||||
-rw-r--r-- | lib/pure/options.nim | 4 | ||||
-rw-r--r-- | lib/pure/strutils.nim | 2 |
3 files changed, 6 insertions, 9 deletions
diff --git a/lib/pure/collections/sequtils.nim b/lib/pure/collections/sequtils.nim index 71babe93b..b72face91 100644 --- a/lib/pure/collections/sequtils.nim +++ b/lib/pure/collections/sequtils.nim @@ -10,12 +10,9 @@ ## :Author: Alexander Mitchell-Robinson (Amrykid) ## ## This module implements operations for the built-in `seq`:idx: type which -## were inspired by functional programming languages. If you are looking for -## the typical `map` function which applies a function to every element in a -## sequence, it already exists in the `system <system.html>`_ module in both -## mutable and immutable styles. +## were inspired by functional programming languages. ## -## Also, for functional style programming you may want to pass `anonymous procs +## For functional style programming you may want to pass `anonymous procs ## <manual.html#anonymous-procs>`_ to procs like ``filter`` to reduce typing. ## Anonymous procs can use `the special do notation <manual.html#do-notation>`_ ## which is more convenient in certain situations. @@ -471,7 +468,7 @@ template toSeq*(iter: expr): expr {.immediate.} = ## if x mod 2 == 1: ## result = true) ## assert odd_numbers == @[1, 3, 5, 7, 9] - + when compiles(iter.len): var i = 0 var result = newSeq[type(iter)](iter.len) diff --git a/lib/pure/options.nim b/lib/pure/options.nim index 3122d58b1..2abb80016 100644 --- a/lib/pure/options.nim +++ b/lib/pure/options.nim @@ -28,7 +28,7 @@ ## ## .. code-block:: nim ## -## import optionals +## import options ## ## proc find(haystack: string, needle: char): Option[int] = ## for i, c in haystack: @@ -156,7 +156,7 @@ proc `$`*[T]( self: Option[T] ): string = when isMainModule: import unittest, sequtils - suite "optionals": + suite "options": # work around a bug in unittest let intNone = none(int) let stringNone = none(string) diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index b61df6086..6c561eaf9 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -1281,7 +1281,7 @@ proc editDistance*(a, b: string): int {.noSideEffect, # another special case: if len1 == 1: - for j in s..len2-1: + for j in s..s+len2-1: if a[s] == b[j]: return len2 - 1 return len2 |