Paste: concept
Author: | dan |
Mode: | lisp |
Date: | Tue, 15 Sep 2009 13:13:42 |
Plain Text |
(def-chan in i-want-string)
(def-chan out give-string)
(def-db db1)
(module FooBar
(slots
(on-want (string)
(cond ((= string "name") (give "Bob"))
((= string "color") (give "Red"))
(t (for db1 (lambda (k v) (if (= k string) v '()))
'()
(lambda (v) (give v)))))))
(signals
(give (string))))
(let (fb (make FooBar))
(connect i-want-string (slot fb 'on-want))
(connect (signal fb 'give) give-string)
(register fb))
Author: | dan |
Mode: | lisp |
Date: | Tue, 15 Sep 2009 13:17:06 |
Plain Text |
(def-chan in i-want-string)
(def-chan out give-string)
(def-db db1)
(module FooBar
(slots
(on-want (string)
(cond ((= string "name") (give "Bob"))
((= string "color") (give "Red"))
(t (for db1 (lambda (k v) (if (= k string) v '()))
'()
(lambda (v) (give v)))))))
(signals
(give (string))))
(let (fb (make FooBar))
(connect i-want-string (slot fb 'on-want))
(connect (signal fb 'give) give-string)
(register fb))
Author: | dan |
Mode: | lisp |
Date: | Tue, 15 Sep 2009 13:23:10 |
Plain Text |
(for db1
(lambda (k v) \
(if (= k string) \ Map
v / Function
'())) /
'() - Reduce Function
(lambda (v) (give v))) - Action Function
Author: | dan |
Mode: | factor |
Date: | Tue, 15 Sep 2009 13:25:11 |
Plain Text |
(for db1
{v | v in values, v = string}
'()
(lambda (v) (give v)))
Author: | dan |
Mode: | factor |
Date: | Tue, 15 Sep 2009 13:26:51 |
Plain Text |
(for db1
{v | v in values, v = string}
'()
(lambda (v) (give v)))
List comprehension syntax taken from set builder notation.
Eg: S=\{\,2\cdot x\mid x \in \mathbb{N},\ x^2>3\,\}
Is there a reduce for list comprehensions...? a list decomprehension?
Author: | dan |
Mode: | factor |
Date: | Tue, 15 Sep 2009 17:24:26 |
Plain Text |
Dataflow:
a = b // Not bound until b has some value
c = 3 // Bound right away
print a // Prints whatever b is bound to, whenever b gets bound
print c // Prints 3 right away
b = 2
Output:
3
2
Why? Because the blocking occurs asynchronously.
What if "function calls" worked like this (and variables are handled as in Common Lisp/Scheme)?
Would this be too unweildy?
Author: | bartwe |
Mode: | c# |
Date: | Tue, 15 Sep 2009 17:30:18 |
Plain Text |
future<string> Kernel.CreateTempFileName() remote 'kernel::CreateTempFile'
print(CreateTempFileName());
future<void> Stuff()
{
var sf = DoSomethingAsync();
var of = DoOthertingAsync();
var yf = DoYetMoreAsync(sf);
return future(of, yf);
}
Stuff().Eval();
Author: | dan |
Mode: | factor |
Date: | Wed, 16 Sep 2009 08:18:22 |
Plain Text |
Structure:
[future = ]<input-channel or function>(<paramters>)[ : <output channel or lambda>]
f = doSomething(1, 2) // Async
print f // Block
f = doSomething(1, 2) // Async
sync f // Block (or `wait f` or whatever)
doSomething(1, 2) : {v| print v} // Async, prints result when ready
doSomething(1, 2) : some-channel // Async, result gets sent to `some-channel`
Author: | dan |
Mode: | c |
Date: | Wed, 16 Sep 2009 10:18:41 |
Plain Text |
{v*2 | v in values, v < 5}
or
{v*2 | v E values, v < 5}
or
{v*2 for v in values, v < 5}
or
{v*2 for v in values if v < 5}
????
New Annotation