Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1054
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!rt.uk.eu.org!feed.xsnews.nl!border-3.ams.xsnews.nl!feeder.xennanews.com!feeder.xennanews.com!nf40.xennanews.com!not-for-mail |
|---|---|
| From | Cecil Westerhof <Cecil@decebal.nl> |
| Newsgroups | comp.lang.postscript |
| Subject | Re: Type of element on stack |
| Organization | Decebal Computing |
| References | <87fw4gnafj.fsf@Compaq.site.inet> <agdtriFrm26U1@mid.individual.net> <87pq3ij9ou.fsf@Compaq.site.inet> <k86l65$c3f$1@dont-email.me> |
| X-Homepage | http://www.decebal.nl/ |
| Date | Sat, 17 Nov 2012 14:39:00 +0100 |
| Message-ID | <877gpke4cr.fsf@Compaq.site.inet> (permalink) |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
| Cancel-Lock | sha1:tu3xk9M0CAqiB2+Tsan2gyLczAk= |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| X-Complaints-To | abuse@xennanews.com |
| Lines | 38 |
| NNTP-Posting-Host | 84.53.123.169 (84.53.123.169) |
| NNTP-Posting-Date | Sat, 17 Nov 2012 14:59:11 +0100 |
| Xref | csiph.com comp.lang.postscript:1054 |
Show key headers only | View raw
Op zaterdag 17 nov 2012 01:19 CET schreef luser droog:
> The next cool bit is 'exec'.
> 'type' returns an executable name, so you can do type-dispatch with a
> dictionary. eg.
>
> /do { %different things to different types
> <<
> /integertype{1 add}
> /booleantype{not}
> /realtype{2 exp}
> /stringtype{cvr 1 add}
>>> 1 index type % x dict x-type
> 2 copy known not {pop/default} if
> get exec % x'
> } def
>
> Wait. rats. that doesn't use the 'executable' part.
> How about...
>
> /do2 { %coerce input to integer
> <<
> /integertype{}
> /realtype{cvi}
> /booleantype{{1}{0}ifelse}
> /stringtype{cvr round cvi}
>>> begin
> dup type exec
> end
> } def
I have to look into this, to understand what is happening here, but I
gladly will do so. ;-}
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
Back to comp.lang.postscript | Previous | Next — Previous in thread | Find similar | Unroll thread
Type of element on stack Cecil Westerhof <Cecil@decebal.nl> - 2012-11-11 03:24 +0100
Re: Type of element on stack Dan Coby <adcoby@earthlink.net> - 2012-11-10 21:15 -0800
Re: Type of element on stack Cecil Westerhof <Cecil@decebal.nl> - 2012-11-11 10:34 +0100
Re: Type of element on stack Don Lancaster <don@tinaja.com> - 2012-11-12 20:41 -0800
Re: Type of element on stack Cecil Westerhof <Cecil@decebal.nl> - 2012-11-13 07:31 +0100
Re: Type of element on stack "luser.droog" <luser.droog@gmail.com> - 2012-11-16 18:19 -0600
Re: Type of element on stack Cecil Westerhof <Cecil@decebal.nl> - 2012-11-17 14:39 +0100
csiph-web