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))

Annotation: formatting.. :(

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))

Annotation: for

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

Annotation: list comprehension

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)))

Annotation: list comprehension

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?

Annotation: dataflow..

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?


Annotation: future

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();

Annotation: channels

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`

Annotation: list comprehension syntax?

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

Summary:
Author:
Mode:
Body: