Working through this intro I cannot help but be
struck by two things :
1) How similar all of this is to the Forth
programs we were writing 30 years ago.
2) How NetKernel is implementing these ideas
with much bigger chunks of code i.e. at a
modules level rather than at a programming
level.
Forth was on target then. NetKernel is on target now.
Both are mostly not understood. NetKernel is pretty much
being ignored for that reason. Forth was both abused and
ridiculed. Funny how that goes.
From the tutorial
Prelude> let evens = filter even -- define the function
Prelude> evens [1..10] -- filter numbers out of a list
[2,4,6,8,10]
In Forth One would write,
: evens filter even ; <cr>
OK where OK is the response of the Forth Interpreter/Compiler
and <cr> means one hits the enter key
To use evens one writes
1 2 3 4 5 6 7 8 9 10 evens <cr>
2 4 6 8 10 OK
In forth I would define a word
: ... defining words here ; <cr> which worked like
1 10 ... <cr>
1 2 3 4 5 6 7 8 9 10
Then I could redefine evens as
: evens ... evens ; and use it as
1 10 evens <cr>
2 4 6 8 10
or
1 20 evens <cr>
2 4 6 8 10 12 14 16 18 20
OK.
Purely functional at this level with everything
pushed on and off of the stack. For the sake of
presentation I have printed the stack at the
output. Normally you would not see the stack
but the items would be there ready for use by
the next function (Forth word.)
Now NetKernel. Here one use the uri to represent
a function and its arguments. A context (how the
function is evaluated, DNS for the http schem uri,
other contexts for other uris) is used to make
sense of the uri (i.e. to evaluate it). I could
go on but so far no one on this list has yet
replied to previous posts about NetKernel so
I shall not. If you do want to learn more of
this, which I consider more important than
haskell, since it is a good way to organize
larger subsystems i.e. entire chunks of working
existing code. If anyone should care a starting
point is
http://netkernel.org
from which I quote
NetKernel a Generalized REST Abstraction
NetKernel provides a generalized REST abstraction
that extrapolates the core ideas to create a simple,
standards compliant model that results in a powerful
software development environment.
http://www.1060research-server-1.co.uk/docs/3.0.0/book/architectguide/doc_books_architect_restplusplus.html
http://tinyurl.com/2hg44f
REST is the basis of the http protocol. Roy Fielding,
co-founder of the Apache Software Project is the author
of the definitive document on REST, his doctoral thesis
at UCI. See
http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
While using only a few functions REST applies the core
ideas from functional programming to a higher (larger
modules) level of architectural style, hence the deep
connection with languages like haskell.
Richness of the REST environment comes not from many
verbs (functions) but from many nouns (resources).
The REST process may be thought of as translating
a verb (function) into a noun (resource). In English
we do this with gerunds (adding ing to the verb,
run -> running). If one uses many gerunds than
one can be very expressive with only a few verbs.
Really! Chuckle.
BobLQ
On 7/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Here's a nice little two part series introducing the basics of haskell:
http://www.onlamp.com/pub/a/onlamp/2007/05/21/an-introduction-to-haskell---part-1-why-haskell.html
http://www.onlamp.com/pub/a/onlamp/2007/07/12/introduction-to-haskell-pure-functions.html
I still haven't used it in anger but I definitely understand recursion and
purely functional programming a lot better now.
--
Tracy Reed
Check out my blog and photos at http://tracyreed.org
This message is cryptographically signed for your protection.
Key fingerprint = D4A8 4860 535C ABF8 BA97 25A6 F4F2 1829 9615 02AD
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg