stevan apter | 1 Jun 02:28 2003

Re: [stack] Re: K for Joy Programmers (paper), continuations

>  
> BTW, have any of the vector techniques used in K been applied to 
> text/file manipulation?  I realize that K's forte is math, but I 
> would think that treating strings as lists--or as trees--could 
> provide some advantages over C-style strings in terms of flexibility, 
> complex algorithms, especially for really massive agglomerations of 
> text.  (I'm just now starting to read the K reference on I/O, so, I 
> don't know much about it.).  

k might have a slight performance edge in text processing (see
http://www.kx.com/a/k/examples/bell.k for comparison with perl
and c on the bell labs scripting language benchmark), but to be
competitive in this area one would have to hook up one of the
standard regexp packages.  as arthur is wont to say, k prefers
data processing (binary) to text processing.

on a slightly perpendicular matter, i've been skimming some 
documents on continuations -- i think i understand the concept --
especially the work done on stackless python.  very intriguing,
especially since the c-stack limits the number of recursions
one can perform in k.  although it is pretty rare to hit the
limit (the ackermann function is a notable example), it is 
annoying to have to worry about it, especially in a recursion-
intensive language like joy.

i see that call-cc has come and gone in joy, and i'm wondering
whether you (manfred) regard continuations as a piece of exotica,
or foresee it as being useful in joy.

>  
(Continue reading)

phimvt | 2 Jun 05:29 2003
Picon
Picon

Re: [stack] pervasive operations, n-ary treemap


On Fri, 30 May 2003, stevan apter wrote:
[..]
> here's what my joy console looks like:
> 
>     JOY  -  compiled at 15:46:02 on May 13 2003 (NOBDW)
>     Copyright 2001 by Manfred von Thun
>     [[1 2 3] 4 [5 6]]  [0 swap -]  treemap
>     .
>     [0 swap -]
>     .
>     [[1 2 3] 4 [5 6]]

I see what is happening. The treemap combinator is actually
defined in the sequence library "seqlib.joy". After the two
heading lines your run does not mention any libraries. Since
you mention something to this effect in a later posting, I'll
quickly explain here:

"Automatic" inclusion of libraries:

    Under Unix and under VMS the Joy interpreter does this:
    If in the current working directory there is a file called
    "usrlib.joy", then Joy will start reading from there
    (typically there will be personal definitions, and also
    some calls of the form '"somethinglib.joy" include.',
    most commonly '"inilib.joy" include.", and if that has been
    included some further calls become possible such as
    '"seqlib" libload.'). After the end of all that Joy should
    be ready to read from the terminal.
(Continue reading)

phimvt | 2 Jun 06:00 2003
Picon
Picon

Re: [stack] Re: K for Joy Programmers (paper), continuations


On Sat, 31 May 2003, stevan apter wrote:

[..]

> i see that call-cc has come and gone in joy, and i'm wondering
> whether you (manfred) regard continuations as a piece of exotica,
> or foresee it as being useful in joy.

I have used continuations twice in Joy libraries: in the propositional
logic tableaux library 'plglib.joy', and in the grammar generating/
parsing library 'grmlib.joy'. Both use explicit continuations (=
quotations that may or may not be called) on top of the stack,
and both use them for backtracking: if success, call continuation,
else return. The initial continuation is a call to write some
value on the stack, and any successes change that value and some
also augment the continuation by some further goal to be achieved
before the write instruction is reached. (I had done that sort of
thing a lot in Pascal.)

Apart from explicit continuations like that, Joy still has an
operator 'conts' which pushes the current implicit continuations
on the stack - but the manual currently warns about its use.
It is harmless, and perhaps instructive, to put
     conts  putln
inside a program to see what outstanding implicit continuations there are. 
I had hoped that I would find a use for it that could not be achieved by
explicit continuations. I have not thought about the topic for quite a
while, and for the time being I'll remain openminded. Any ideas? 

(Continue reading)

stevan apter | 2 Jun 13:42 2003

[stack] joy libraries

thanks - that worked.

JOY  -  compiled at 15:46:02 on May 13 2003 (NOBDW)
Copyright 2001 by Manfred von Thun
usrlib  is loaded
inilib  is loaded
agglib  is loaded

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/saFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
concatenative-unsubscribe <at> egroups.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

stevan apter | 2 Jun 14:13 2003

[stack] conts


----- Original Message ----- 
From: <phimvt <at> lurac.latrobe.edu.au>
To: <concatenative <at> yahoogroups.com>
Sent: Monday, June 02, 2003 12:00 AM
Subject: Re: [stack] Re: K for Joy Programmers (paper), continuations

> 
> On Sat, 31 May 2003, stevan apter wrote:
[..]

> Apart from explicit continuations like that, Joy still has an
> operator 'conts' which pushes the current implicit continuations
> on the stack - but the manual currently warns about its use.
> It is harmless, and perhaps instructive, to put
>      conts  putln
> inside a program to see what outstanding implicit continuations there are. 
> I had hoped that I would find a use for it that could not be achieved by
> explicit continuations. I have not thought about the topic for quite a
> while, and for the time being I'll remain openminded. Any ideas? 
> 

an explanation of the behavior of conts would be appreciated.

if i understand correctly, 'conts' pushes the future of the
current computation onto the stack.  so i understand

2 3 conts putln + 4 5 * - .
[[+ 4 5 * -]]
-15
(Continue reading)

John Cowan | 2 Jun 14:19 2003

Re: [stack] conts

stevan apter scripsit:

> if i understand correctly, 'conts' pushes the future of the
> current computation onto the stack.  so i understand
> 
> 2 3 conts putln + 4 5 * - .
> [[+ 4 5 * -]]
> -15
> 
> (but why the extra level of quotation?)

Because not only the rest of the current quotation, but the rest of
all quotations in which it is nested, is the value of conts, which is
why it is conts, not cont.

--

-- 
Long-short-short, long-short-short / Dactyls in dimeter,
Verse form with choriambs / (Masculine rhyme):  jcowan <at> reutershealth.com
One sentence (two stanzas) / Hexasyllabically   http://www.reutershealth.com
Challenges poets who / Don't have the time.     --robison who's at texas dot net

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/saFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
concatenative-unsubscribe <at> egroups.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
(Continue reading)

stevan apter | 2 Jun 15:02 2003

[stack] trees in practice

> 
> My question is about all the other trees, which contain non-homogeneous
> lists, ones containing as members both other lists and leaves.
> Do you have any examples of those arising in practise?
> The only ones that I would come across are the formulas or expressions
> that arise from various notations e.g. [+ 2 [* 3 4]] for Lisp.
> But these are not the sort of things one would want to (tree)map.
> 

you put your finger on it - structured data, but not necessarily
confined to syntax trees.  for example, in our app, the definition
of a simulation will contain timeseries with various scalar
parameters, e.g. 

[offset<=somedate offset>somedate [... timeseries ...]]

i think you can see similar configurations wherever there is a 
GUI (e.g. a search-in-files popup contains a list of files,
a search-for-string, a checkbox to search within directories,
&c.)  (in fact, directory structures themselves are trees more
often than not:  a directory containing files + directories)

the 'iterate' combinator in ck will take a list with an 
initial element and then some further lists:

      [10 [1 2 3][4 5 6]] [+*] iterate
   3150

in fact, trees are so common that i just don't think of them
as separate from the general case of lists of lists of ...
(Continue reading)

John Cowan | 2 Jun 15:04 2003

Re: [stack] trees in practice

stevan apter scripsit:

> > Do you have any examples of those arising in practise?
> > The only ones that I would come across are the formulas or expressions
> > that arise from various notations e.g. [+ 2 [* 3 4]] for Lisp.
> > But these are not the sort of things one would want to (tree)map.
> > 
> 
> you put your finger on it - structured data, but not necessarily
> confined to syntax trees.  

Another excellent example is HTML, which can be readily understood as
a non-homogeneous tree:

[[p "This is a simple text."] [p "This is an " [em "important"] " text."]]

Joy lists, Lisp s-expressions, and SGML/HTML/XML are all instances of
the same data structure.

--

-- 
Is a chair finely made tragic or comic? Is the          John Cowan
portrait of Mona Lisa good if I desire to see           jcowan <at> reutershealth.com
it? Is the bust of Sir Philip Crampton lyrical,         www.ccil.org/~cowan
epical or dramatic?  If a man hacking in fury           www.reutershealth.com
at a block of wood make there an image of a cow,
is that image a work of art? If not, why not?               --Stephen Dedalus

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/saFolB/TM
(Continue reading)

stevan apter | 2 Jun 15:32 2003

Re: [stack] trees in practice

but i guess the point of manfred's question is, where do you encounter
trees which you would want to process with the tree combinators?  that
would seem to narrow the hunt for examples to ones which satisfy two
constraints:  (i) the structure of the data is not known, and (ii)
there is an operation you want to apply to the leaves.  i think your
html example might qualify (if strings are leaves, as they are in 
joy).

----- Original Message ----- 
From: "John Cowan" <cowan <at> ccil.org>
To: <concatenative <at> yahoogroups.com>
Sent: Monday, June 02, 2003 9:04 AM
Subject: Re: [stack] trees in practice

> stevan apter scripsit:
> 
> > > Do you have any examples of those arising in practise?
> > > The only ones that I would come across are the formulas or expressions
> > > that arise from various notations e.g. [+ 2 [* 3 4]] for Lisp.
> > > But these are not the sort of things one would want to (tree)map.
> > > 
> > 
> > you put your finger on it - structured data, but not necessarily
> > confined to syntax trees.  
> 
> Another excellent example is HTML, which can be readily understood as
> a non-homogeneous tree:
> 
> [[p "This is a simple text."] [p "This is an " [em "important"] " text."]]
> 
(Continue reading)

John Cowan | 2 Jun 16:47 2003

Re: [stack] trees in practice

stevan apter scripsit:

> but i guess the point of manfred's question is, where do you encounter
> trees which you would want to process with the tree combinators?  that
> would seem to narrow the hunt for examples to ones which satisfy two
> constraints:  (i) the structure of the data is not known, and (ii)
> there is an operation you want to apply to the leaves.  i think your
> html example might qualify (if strings are leaves, as they are in 
> joy).

Just so.  Thus a good use of treemap would be to extract a list of strings
(easily transformed to a single string) from an HTML text.

--

-- 
John Cowan  jcowan <at> reutershealth.com  www.reutershealth.com  www.ccil.org/~cowan
Assent may be registered by a signature, a handshake, or a click of a computer
mouse transmitted across the invisible ether of the Internet. Formality
is not a requisite; any sign, symbol or action, or even willful inaction,
as long as it is unequivocally referable to the promise, may create a contract.
       --_Specht v. Netscape_

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/saFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
concatenative-unsubscribe <at> egroups.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 
(Continue reading)


Gmane