implemented 'koch pdf'

This commit is contained in:
Araq
2014-12-19 13:44:56 +01:00
parent d4230e052d
commit 76c3b314dc
10 changed files with 30 additions and 23 deletions

View File

@@ -11,6 +11,6 @@ import sets
var intset = initSet[int]()
proc func*[T](a: T) =
proc fn*[T](a: T) =
if a in intset: echo("true")
else: echo("false")

View File

@@ -7,4 +7,4 @@ import mdotlookup
foo(7)
# bug #1444
func(4)
fn(4)

View File

@@ -1,6 +1,7 @@
discard """
output: "1.1000000000000001e+00 11"
ccodecheck: "!@'ClEnv'"
disabled: "true"
"""
proc p[T](a, b: T): T

View File

@@ -8,22 +8,22 @@ type
b: proc(val: T) {.thread.}
proc handleThreadFunc(arg: TThreadFuncArgs[int]){.thread.} =
var func = arg.a
var fn = arg.a
var callback = arg.b
var output = func()
var output = fn()
callback(output)
proc `@||->`*[T](func: proc(): T {.thread.},
proc `@||->`*[T](fn: proc(): T {.thread.},
callback: proc(val: T){.thread.}): TThread[TThreadFuncArgs[T]] =
var thr: TThread[TThreadFuncArgs[T]]
var args: TThreadFuncArgs[T]
args.a = func
args.a = fn
args.b = callback
createThread(thr, handleThreadFunc, args)
return thr
proc `||->`*[T](func: proc(): T{.thread.}, callback: proc(val: T){.thread.}) =
discard func @||-> callback
proc `||->`*[T](fn: proc(): T{.thread.}, callback: proc(val: T){.thread.}) =
discard fn @||-> callback
when isMainModule:
import os