[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: pipeing fucntions
- From: Patrick Rapin <toupie300@...>
- Date: Mon, 25 Jun 2012 20:04:38 +0200
There are better (more general but more complex) solutions.
First, you can do function composition :
function a(f)
return function(x)
return f(x) .. "a"
end
end
function b(f)
return function(x)
return f(x) .. "b"
end
end
f=b(a(function(x) return x end))
print(f"t")
Or you can use coroutines to implement filters.
Note: in both cases, the processing will be done sequentially, not
simultaneously in multiple cores.
If you really need multi-threading, you will need to deal with native
OS threads.