Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1567 > unrolled thread

Wow! 'name'-chains.

Started byluser- -droog <mijoryx@yahoo.com>
First post2013-08-02 21:42 -0700
Last post2014-05-05 14:58 -0700
Articles 5 — 3 participants

Back to article view | Back to comp.lang.postscript


Contents

  Wow! 'name'-chains. luser- -droog <mijoryx@yahoo.com> - 2013-08-02 21:42 -0700
    Re: Wow! 'name'-chains. Cecil Westerhof <Cecil@decebal.nl> - 2013-08-03 09:57 +0200
      Re: Wow! 'name'-chains. luser- -droog <mijoryx@yahoo.com> - 2013-08-03 02:07 -0700
    Re: Wow! 'name'-chains. jdaw1 <jdawiseman@gmail.com> - 2014-05-05 11:20 -0700
      Re: Wow! 'name'-chains. luser- -droog <mijoryx@yahoo.com> - 2014-05-05 14:58 -0700

#1567 — Wow! 'name'-chains.

Fromluser- -droog <mijoryx@yahoo.com>
Date2013-08-02 21:42 -0700
SubjectWow! 'name'-chains.
Message-ID<7b35b1e9-e337-474e-81f6-a233a6039a6f@googlegroups.com>
I discovered this while debugging my error handler, and
was about to "fix" it as a bug. But then I checked and
Ghostscript does it too. But I've never heard of anybody
doing this. Not sure if anyone realized you could ...

$ gsnd
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>/a /b cvx def
GS>/b /d def
GS>a
GS<1>=
d
GS>

Isn't that cool?

[toc] | [next] | [standalone]


#1570

FromCecil Westerhof <Cecil@decebal.nl>
Date2013-08-03 09:57 +0200
Message-ID<878v0jdx4u.fsf@Aspire.decebal.nl>
In reply to#1567
Op zaterdag 3 aug 2013 06:42 CEST schreef luser:

> I discovered this while debugging my error handler, and
> was about to "fix" it as a bug. But then I checked and
> Ghostscript does it too. But I've never heard of anybody
> doing this. Not sure if anyone realized you could ...
>
> $ gsnd GPL Ghostscript 9.06 (2012-08-08) Copyright (C) 2012 Artifex
> Software, Inc. All rights reserved. This software comes with NO
> WARRANTY: see the file PUBLIC for details.
> GS>/a /b cvx def
> GS>/b /d def
> GS>a
> GS<1>=
> d
> GS>
>
> Isn't that cool?

I agree that it is cool, but I do not see me using it. But then: I am
still a newbie.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#1572

Fromluser- -droog <mijoryx@yahoo.com>
Date2013-08-03 02:07 -0700
Message-ID<cc9e35ff-c8ee-492e-b4c4-1903a4c1221a@googlegroups.com>
In reply to#1570
On Saturday, August 3, 2013 2:57:53 AM UTC-5, Cecil Westerhof wrote:
> Op zaterdag 3 aug 2013 06:42 CEST schreef luser:
> 
> 
> 
> > I discovered this while debugging my error handler, and
> 
> > was about to "fix" it as a bug. But then I checked and
> 
> > Ghostscript does it too. But I've never heard of anybody
> 
> > doing this. Not sure if anyone realized you could ...
> 
> >
> 
> > $ gsnd GPL Ghostscript 9.06 (2012-08-08) Copyright (C) 2012 Artifex
> 
> > Software, Inc. All rights reserved. This software comes with NO
> 
> > WARRANTY: see the file PUBLIC for details.
> 
> > GS>/a /b cvx def
> 
> > GS>/b /d def
> 
> > GS>a
> 
> > GS<1>=
> 
> > d
> 
> > GS>
> 
> >
> 
> > Isn't that cool?
> 
> 
> 
> I agree that it is cool, but I do not see me using it. But then: I am
> 
> still a newbie.
> 

Yeah. I can't think of a way to use it. 
But I'll be on the lookout. :)

[toc] | [prev] | [next] | [standalone]


#1884

Fromjdaw1 <jdawiseman@gmail.com>
Date2014-05-05 11:20 -0700
Message-ID<97024e97-d9c1-410a-be2e-391645376a85@googlegroups.com>
In reply to#1567
Maybe I'm missing the story, but this seems like a natural use of cvx. Example usage from my usual program:

[
	currenttransfer   /exec cvx   1   /exch cvx   /sub cvx
	TitlesAnyGrey {TastingNotesCirclesBehindFadingFactorIfAnyGrey} {TastingNotesCirclesBehindFadingFactorIfAllBlack} ifelse
	/mul cvx   1   /exch cvx   /sub cvx
] cvx bind settransfer

Maybe I'm missing the story.

[toc] | [prev] | [next] | [standalone]


#1885

Fromluser- -droog <mijoryx@yahoo.com>
Date2014-05-05 14:58 -0700
Message-ID<23821969-b422-4969-b8fa-d136e94b4983@googlegroups.com>
In reply to#1884
On Monday, May 5, 2014 1:20:44 PM UTC-5, jdaw1 wrote:
> Maybe I'm missing the story, but this seems like a natural use of cvx. Example usage from my usual program:
> 
> [
> 	currenttransfer   /exec cvx   1   /exch cvx   /sub cvx
> 	TitlesAnyGrey {TastingNotesCirclesBehindFadingFactorIfAnyGrey} {TastingNotesCirclesBehindFadingFactorIfAllBlack} ifelse
> 	/mul cvx   1   /exch cvx   /sub cvx
> ] cvx bind settransfer
> 
> Maybe I'm missing the story.

It wasn't much of a discovery, and I'm still not sure
how to make use of it. But rather than thinking of a dictionary
as just a namespace to hold a set of procedures, I learned some
time ago that it is more general (and thus more powerful) than
that. A dictionary can make associations between pairs of values
of any type (except nulltype which cannot be used for a key, and
remembering that stringtype keys are automatically folded into
nametype). And the interpreter's action for executing a nametype
object is to load and then, if executable, execute it.

So the discovery was that the value in a dictionary association
pair can also be an executable name (no surprise here). But the
combination of the above means that you can represent a directed
graph in a dictionary using executable names for everything.
And then just mentioning the root name will traverse each and
every link until the end of the chain.

[
{ a b
  b c
  c d
  d e
  e f
} {}forall >> begin
a  % a loads b
   % b loads c
   % c loads d
   % d loads e
   % e loads f
   % f will then result in an undefined error of course.

Again, I don't really know what to do with it. But I was
surprised by the possibility of combining the elements
this way. By just calling 'a', a long series of actions
is initiated which is largely invisible. 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web