Re: [Unicon-group] Succeed() useless? UTR18 Unicon, Snobol

2016-02-14 Thread Michael Meehan
Man,  you are truly one righteous hard core dude out there still slinging the 
Snobol. Thanks to all the great computer scientists who are keeping this 
tradition alive. For my modest contribution, I am working with a graduate 
student to put an #IFDEF together to use the SIMD instructions on the Intel AVX 
capable processors to implement arbitrary precision integers, hopefully 8x 
faster than the "copy it straight from Knuth implementation." It has,of course, 
 occurred to us that string comparisons (which is what this language MUST excel 
at  (particularly the "on the eventual abstract machine" multi-byte ones) would 
benefit from the SIMD instructions.  I applaud the great work you have 
continued and will let you know when we have a minor (sub-build) branch that 
will make the "largeint" stuff work faster by using the SIMD instructions. 

Michael Meehan
mee...@wwu.edu for work-related items only
jmichaelmee...@gmail.com for non-work-related items only


From: Jay Hammond 
Sent: Sunday, February 14, 2016 4:14 PM
To: unicon-group@lists.sourceforge.net; sno...@yahoogroups.com
Subject: [Unicon-group] Succeed() useless? UTR18 Unicon, Snobol

I too am interested in Snobol patterns in Unicon. I still use Snobol
more than Unicon, 'cos that's where the easy string scanning is.

I found something quite surprising (flamebait even).

Pattern Matching in Unicon
Clinton Jeffery, Sudarshan Gaikaiwari and John Goettsche
Unicon Technical Report: 1
February 9, 2016


Here's a url for the technical reports

http://unicon.sourceforge.net/reports.html

& this is UTR18

http://unicon.org/utr/utr18.pdf

and here's a quote.  I thought someone might like to tell me why
I am wrong to dispute the following statement on page number 16, the
17th of 23

"4.4.8 Succeed(): Match Always

This pattern was added to Unicon to match SNOBOL4 pattern for pattern.
The authors do not know of any meaningful use of Succeed()."

When I started programming, I did not see a need for no-op. In
assembler, Forth and genetics, there are useful side effects to no-op.

I know a practical use for Succeed() or its equivalents.
Do you have any more?


Snobol assigns a pattern to the variable SUCCEED, and that value is
&SUCCEED which also exists. It does not have Succeed() the function.


In Snobol,
Succeed always successfully matches the null string.
likewise Succeed() in Unicon .

If I assign that null string to a variable,  I can recognise that
succeed matched null.
If succeed is the last alternative of several that pattern-match, then,
in context,
Succeed() represents the pattern that recognises that the desired
pattern is
absent.


< one><2><3><5>
<2><3><5>



and that's useful for erasing unwanted data (by assignment), and
recognising gap in paradigm patterns. (There is an example lower down)


Icon, unlike Snobol4, has &null. UTR18 speaks of patterns like Pos()
matching the empty string. The Green book (The Snobol4 Programming
language 2nd ed. Griswold Poage & Polonsky) says the empty string and
the the null value are the same.

Using the uninitialised value of null instead of Succeed() is poor
practice, because in general one should not rely on the value
(if any) of uninitialised variables.

But looking hard at the Green book, I can always use the null string or
'' or "" to represent &null in Snobol. I can replace Succeed ( or
Succeed() ) by a pattern matching null (including but not limited to:
testing for the current cursor position, and matching the null string)
in both Icon & Snobol.

As far as I know, I can strictly replace Succeed() with  a pattern
valued &null because a successful function that has no return value,
returns null. Or is there something about transmission I have ignored
that I should not have?

So there are equivalents to Succeed() we can use.  And the use is, as I
said, for matching the gap in the paradigm.  It's possible to avoid the
use of the expression "Succeed()"  but the construction (in some form)
is necessary.

That's perhaps too abstract? I give a less abstract example.  It
corresponds fairly closely, I now discover, to the pattern match on
pages 35-36, section 2.6  of the Green book.  So you may not need to
read it at all.

Jay

Example_start

My data matches 5 patterns 1,2,3,4,5   .This is the fat version.
or maybe just 3 patterns 1,3,5  I call that variant degenerate or skinny.

Imagine a sort of census data perhaps in CSV format,  where if
respondent was ever married, they must also state the  number of
children,  and the number of divorces.

I'm analysing columns of data. the data in the columns is of variable
width so I pattern match the data. I am faced with two sorts of rows,
full fat ones, and skinny ones. Full fat rows have 5 columns, skinny
(degenerate) ones just 3.

To put all t

Re: [Unicon-group] Succeed() useless? UTR18 Unicon, Snobol

2016-02-14 Thread Michael Meehan
Man,  you are truly one righteous hard core dude out there still slinging the 
Snobol. Thanks to all the great computer scientists who are keeping this 
tradition alive. For my modest contribution, I am working with a graduate 
student to put an #IFDEF together to use the SIMD instructions on the Intel AVX 
capable processors to implement arbitrary precision integers, hopefully 8x 
faster than the "copy it straight from Knuth implementation." It has,of course, 
 occurred to us that string comparisons (which is what this language MUST excel 
at  (particularly the "on the eventual abstract machine" multi-byte ones) would 
benefit from the SIMD instructions.  I applaud the great work you have 
continued and will let you know when we have a minor (sub-build) branch that 
will make the "largeint" stuff work faster by using the SIMD instructions.

Michael Meehan
mee...@wwu.edu for work-related items only
jmichaelmee...@gmail.com for non-work-related items only

Michael Meehan
mee...@wwu.edu for work-related items only
jmichaelmee...@gmail.com for non-work-related items only


From: Jay Hammond 
Sent: Sunday, February 14, 2016 4:14 PM
To: unicon-group@lists.sourceforge.net; sno...@yahoogroups.com
Subject: [Unicon-group] Succeed() useless? UTR18 Unicon, Snobol

I too am interested in Snobol patterns in Unicon. I still use Snobol
more than Unicon, 'cos that's where the easy string scanning is.

I found something quite surprising (flamebait even).

Pattern Matching in Unicon
Clinton Jeffery, Sudarshan Gaikaiwari and John Goettsche
Unicon Technical Report: 1
February 9, 2016


Here's a url for the technical reports

http://unicon.sourceforge.net/reports.html

& this is UTR18

http://unicon.org/utr/utr18.pdf

and here's a quote.  I thought someone might like to tell me why
I am wrong to dispute the following statement on page number 16, the
17th of 23

"4.4.8 Succeed(): Match Always

This pattern was added to Unicon to match SNOBOL4 pattern for pattern.
The authors do not know of any meaningful use of Succeed()."

When I started programming, I did not see a need for no-op. In
assembler, Forth and genetics, there are useful side effects to no-op.

I know a practical use for Succeed() or its equivalents.
Do you have any more?


Snobol assigns a pattern to the variable SUCCEED, and that value is
&SUCCEED which also exists. It does not have Succeed() the function.


In Snobol,
Succeed always successfully matches the null string.
likewise Succeed() in Unicon .

If I assign that null string to a variable,  I can recognise that
succeed matched null.
If succeed is the last alternative of several that pattern-match, then,
in context,
Succeed() represents the pattern that recognises that the desired
pattern is
absent.


< one><2><3><5>
<2><3><5>



and that's useful for erasing unwanted data (by assignment), and
recognising gap in paradigm patterns. (There is an example lower down)


Icon, unlike Snobol4, has &null. UTR18 speaks of patterns like Pos()
matching the empty string. The Green book (The Snobol4 Programming
language 2nd ed. Griswold Poage & Polonsky) says the empty string and
the the null value are the same.

Using the uninitialised value of null instead of Succeed() is poor
practice, because in general one should not rely on the value
(if any) of uninitialised variables.

But looking hard at the Green book, I can always use the null string or
'' or "" to represent &null in Snobol. I can replace Succeed ( or
Succeed() ) by a pattern matching null (including but not limited to:
testing for the current cursor position, and matching the null string)
in both Icon & Snobol.

As far as I know, I can strictly replace Succeed() with  a pattern
valued &null because a successful function that has no return value,
returns null. Or is there something about transmission I have ignored
that I should not have?

So there are equivalents to Succeed() we can use.  And the use is, as I
said, for matching the gap in the paradigm.  It's possible to avoid the
use of the expression "Succeed()"  but the construction (in some form)
is necessary.

That's perhaps too abstract? I give a less abstract example.  It
corresponds fairly closely, I now discover, to the pattern match on
pages 35-36, section 2.6  of the Green book.  So you may not need to
read it at all.

Jay

Example_start

My data matches 5 patterns 1,2,3,4,5   .This is the fat version.
or maybe just 3 patterns 1,3,5  I call that variant degenerate or skinny.

Imagine a sort of census data perhaps in CSV format,  where if
respondent was ever married, they must also state the  number of
children,  and the number of divorces.

I'm analysing columns of data. the data in the columns is of variable
width so I pattern match the data. I am faced with two sorts of rows

[Unicon-group] Succeed() useless? UTR18 Unicon, Snobol

2016-02-14 Thread Jay Hammond
I too am interested in Snobol patterns in Unicon. I still use Snobol
more than Unicon, 'cos that's where the easy string scanning is.

I found something quite surprising (flamebait even).

Pattern Matching in Unicon
Clinton Jeffery, Sudarshan Gaikaiwari and John Goettsche
Unicon Technical Report: 1
February 9, 2016


Here's a url for the technical reports

http://unicon.sourceforge.net/reports.html

& this is UTR18

http://unicon.org/utr/utr18.pdf

and here's a quote.  I thought someone might like to tell me why
I am wrong to dispute the following statement on page number 16, the 
17th of 23

"4.4.8 Succeed(): Match Always

This pattern was added to Unicon to match SNOBOL4 pattern for pattern.
The authors do not know of any meaningful use of Succeed()."

When I started programming, I did not see a need for no-op. In
assembler, Forth and genetics, there are useful side effects to no-op.

I know a practical use for Succeed() or its equivalents.
Do you have any more?


Snobol assigns a pattern to the variable SUCCEED, and that value is
&SUCCEED which also exists. It does not have Succeed() the function.


In Snobol,
Succeed always successfully matches the null string.
likewise Succeed() in Unicon .

If I assign that null string to a variable,  I can recognise that 
succeed matched null.
If succeed is the last alternative of several that pattern-match, then, 
in context,
Succeed() represents the pattern that recognises that the desired 
pattern is
absent.


< one><2><3><5>
<2><3><5>



and that's useful for erasing unwanted data (by assignment), and
recognising gap in paradigm patterns. (There is an example lower down)


Icon, unlike Snobol4, has &null. UTR18 speaks of patterns like Pos()
matching the empty string. The Green book (The Snobol4 Programming
language 2nd ed. Griswold Poage & Polonsky) says the empty string and
the the null value are the same.

Using the uninitialised value of null instead of Succeed() is poor
practice, because in general one should not rely on the value
(if any) of uninitialised variables.

But looking hard at the Green book, I can always use the null string or
'' or "" to represent &null in Snobol. I can replace Succeed ( or
Succeed() ) by a pattern matching null (including but not limited to:
testing for the current cursor position, and matching the null string)
in both Icon & Snobol.

As far as I know, I can strictly replace Succeed() with  a pattern
valued &null because a successful function that has no return value,
returns null. Or is there something about transmission I have ignored
that I should not have?

So there are equivalents to Succeed() we can use.  And the use is, as I
said, for matching the gap in the paradigm.  It's possible to avoid the
use of the expression "Succeed()"  but the construction (in some form)
is necessary.

That's perhaps too abstract? I give a less abstract example.  It
corresponds fairly closely, I now discover, to the pattern match on
pages 35-36, section 2.6  of the Green book.  So you may not need to 
read it at all.

Jay

Example_start

My data matches 5 patterns 1,2,3,4,5   .This is the fat version.
or maybe just 3 patterns 1,3,5  I call that variant degenerate or skinny.

Imagine a sort of census data perhaps in CSV format,  where if
respondent was ever married, they must also state the  number of
children,  and the number of divorces.

I'm analysing columns of data. the data in the columns is of variable
width so I pattern match the data. I am faced with two sorts of rows,
full fat ones, and skinny ones. Full fat rows have 5 columns, skinny
(degenerate) ones just 3.

To put all the data in a structure prior to processing, I read the data
row by row, and assign the columns to the appropriate variable.

snn = span('0123456789')
   p1 = ("£" snn ("." (snn | Succeed) | Succeed)) . colOneData

* p1 matches column 1, p2 matches column 2 etc
* each pattern assigns what it matches to its column.
  fullfat = p1 p2 p3 p4 p5
  skinny = p2 p3 p5

  row  fullfat  | skinny :s(report_and_iterate)f(fixup)

  ok, I iterate for a few rows, and after a fat row, I get a skinny row.
  colOneData and colfourData still contain the data for the fat row.

  colTwoData  colThreeData and colFiveData contain skinny data. As a
  programmer I must somehow recognise that the skinny row had no data in
  columns 1 and 4. I can represent no data as the null value in the
  corresponding variable.

  How to do that? I can
  ++ pre-test each row,
  ++ set a flag when I match a  skinny row, & test the flag when reporting,
  then  run a function that erases  colOneData and colfourData
 just in time
  ++ run the same function at the end of a successful  skinny match,

   there are lots of (inelegant) ways.

To only overwrite the fat data when in a successful skinny match, I
conditionally assign the null string to the variables corresponding to
the absent columns.  I match null for columns 1 and 4 in the skinny
match.
I alter the subpatterns  of fullfat and sk