summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2019-11-22 19:57:43 +0100
committerMiran <narimiran@disroot.org>2019-11-22 19:57:43 +0100
commit2acf74d458accf65d969199a389c8dbc2eedab55 (patch)
tree086b8566b5c7af2ba509c2b24c8776c4e1482f5e /lib
parentc85e266d1d6553fe14ecd28af7a58687672c859d (diff)
downloadNim-2acf74d458accf65d969199a389c8dbc2eedab55.tar.gz
delete list comprehension (#12392)
The `lc` macro is now part of `graveyard` repository.
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/sugar.nim58
1 files changed, 0 insertions, 58 deletions
diff --git a/lib/pure/sugar.nim b/lib/pure/sugar.nim
index c811f115c..af32e1546 100644
--- a/lib/pure/sugar.nim
+++ b/lib/pure/sugar.nim
@@ -122,64 +122,6 @@ macro `->`*(p, b: untyped): untyped =
 
   result = createProcType(p, b)
 
-type ListComprehension = object
-var lc* {.deprecated.}: ListComprehension
-
-template `|`*(lc: ListComprehension, comp: untyped): untyped {.deprecated.} = lc
-
-macro `[]`*(lc: ListComprehension, comp, typ: untyped): untyped {.deprecated.} =
-  ## List comprehension, returns a sequence. `comp` is the actual list
-  ## comprehension, for example ``x | (x <- 1..10, x mod 2 == 0)``. `typ` is
-  ## the type that will be stored inside the result seq.
-  ##
-  ## .. code-block:: nim
-  ##
-  ##   echo lc[x | (x <- 1..10, x mod 2 == 0), int]
-  ##
-  ##   const n = 20
-  ##   echo lc[(x,y,z) | (x <- 1..n, y <- x..n, z <- y..n, x*x + y*y == z*z),
-  ##           tuple[a,b,c: int]]
-  ## **Deprecated since version 0.19.9**
-
-  expectLen(comp, 3)
-  expectKind(comp, nnkInfix)
-  assert($comp[0] == "|")
-
-  result = newCall(
-    newDotExpr(
-      newIdentNode("result"),
-      newIdentNode("add")),
-    comp[1])
-
-  for i in countdown(comp[2].len-1, 0):
-    let x = comp[2][i]
-    expectMinLen(x, 1)
-    if x[0].kind == nnkIdent and $x[0].ident == "<-":
-      expectLen(x, 3)
-      result = newNimNode(nnkForStmt).add(x[1], x[2], result)
-    else:
-      result = newIfStmt((x, result))
-
-  result = newNimNode(nnkCall).add(
-    newNimNode(nnkPar).add(
-      newNimNode(nnkLambda).add(
-        newEmptyNode(),
-        newEmptyNode(),
-        newEmptyNode(),
-        newNimNode(nnkFormalParams).add(
-          newNimNode(nnkBracketExpr).add(
-            newIdentNode("seq"),
-            typ)),
-        newEmptyNode(),
-        newEmptyNode(),
-        newStmtList(
-          newAssignment(
-            newIdentNode("result"),
-            newNimNode(nnkPrefix).add(
-              newIdentNode("@"),
-              newNimNode(nnkBracket))),
-          result))))
-
 macro dump*(x: typed): untyped =
   ## Dumps the content of an expression, useful for debugging.
   ## It accepts any expression and prints a textual representation