Sign up now! · Forgot password?
RSS/Atom feed identi.ca Twitter

does number->string have format options?

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

6 of 6 messages available
Toggle history

Please log in to manage your subscriptions.

does number->string have format options? Burlen Loring 30 Apr 20:17
  does number->string have format options? Kevin Cozens 30 Apr 21:00
  does number->string have format options? Rob Antonishen 01 May 14:41
does number->string have format options? Kevin Cozens 01 May 16:28
  does number->string have format options? paynekj 02 May 09:00
   does number->string have format options? Burlen Loring 02 May 16:22
Burlen Loring
2012-04-30 20:17:30 UTC (about 2 years ago)

does number->string have format options?

Hi All,

does number->string have format options? What is the equivalent of "printf" in gimp tinyscheme?

I am scripting adding axes to an image and need to control of format of floating point numbers that will be passed to gimps text generation functions.

Thanks
Burlen

Kevin Cozens
2012-04-30 21:00:51 UTC (about 2 years ago)

does number->string have format options?

On 12-04-30 04:17 PM, Burlen Loring wrote:

does number->string have format options? What is the equivalent of "printf" in gimp tinyscheme?

The number->string function doesn't have format options or support for the optional radix parameter. There is no equivalent to "printf" in TinyScheme.

Rob Antonishen
2012-05-01 14:41:31 UTC (about 2 years ago)

does number->string have format options?

does number->string have format options? What is the equivalent of "printf" in gimp tinyscheme?

I am scripting adding axes to an image and need to control of format of floating point numbers that will be passed to gimps text generation functions.

Here is a helper function I had written to deal with this:

(define (number->fixedstring V D) (let ((D (trunc D)))
(string-append
(number->string (if (> D 0) (trunc V) (round V))) (if (> D 0) (string-append "." (number->string (round (* (- V (trunc V)) (pow 10 (trunc D)))))) "")
)
)
)

In use, the first parameter is the value and the second is the number of decimals to include. It rounds to the decimal specified and pads where zeros if needed.

(number->fixedstring 3.14159 0)

"3"

(number->fixedstring 3.14159 1)

"3.1"

(number->fixedstring 3.14159 2)

"3.14"

(number->fixedstring 3.14159 3)

"3.142"

(number->fixedstring 3.14159 4)

"3.1416"

(number->fixedstring 3.14159 5)

"3.14159"

(number->fixedstring 3.14159 6)

"3.141590"

(number->fixedstring 2.7 0)

"3"

-Rob A>

Kevin Cozens
2012-05-01 16:28:54 UTC (about 2 years ago)

does number->string have format options?

On 12-05-01 11:01 AM, Burlen Loring wrote:

I am looking for the programmers reference / documentation for the scheme interpreter included with gimp. I have so far not found it, and other scheme interpreters seem to have many different definitions for eg string parsing functions.

There is no official document for TinyScheme. The closest thing to it is the official R4RS or R5RS Scheme standard.

The R5RS document can be found at: http://www.schemers.org/Documents/Standards/R5RS/r5rs.pdf

Not all features documented are supported by TinyScheme but its a good starting point to see the language syntax or some of the features supported. If other Scheme interpreters have many different definitions for things like string parsing they may not be following the Scheme standard, may be using custom sets of Scheme code, or be using some features from R6RS, or functions from the Scheme SRFI's.

2012-05-02 09:00:50 UTC (about 2 years ago)
postings
14
contact
Send private message

does number->string have format options?

There is no official document for TinyScheme. The closest thing to it is the official R4RS or R5RS Scheme standard.

The R5RS document can be found at: http://www.schemers.org/Documents/Standards/R5RS/r5rs.pdf

Not all features documented are supported by TinyScheme but its a good starting point to see the language syntax or some of the features supported. If other Scheme interpreters have many different definitions for things like string parsing they may not be following the Scheme standard, may be using custom sets of Scheme code, or be using some features from R6RS, or functions from the Scheme SRFI's.

Isn't it about time that an "official" document was written for Tiny-Fu? at least documenting which features are supported and where differences exist between Tiny-Fu and R5RS.

I see it is on your To Do list: http://www.ve3syb.ca/software/tiny-fu/index.html

Burlen Loring
2012-05-02 16:22:42 UTC (about 2 years ago)

does number->string have format options?

On 05/02/2012 02:00 AM, paynekj wrote:

There is no official document for TinyScheme. The closest thing to it is the official R4RS or R5RS Scheme standard. The R5RS document can be found at:
http://www.schemers.org/Documents/Standards/R5RS/r5rs.pdf Not all features documented are supported by TinyScheme but its a good starting point to see the language syntax or some of the features supported. If other Scheme interpreters have many different definitions for things like string parsing they may not be following the Scheme standard, may be using custom sets of Scheme code, or be using some features from R6RS, or functions from the Scheme SRFI's.

Isn't it about time that an "official" document was written for Tiny-Fu? at least documenting which features are supported and where differences exist between Tiny-Fu and R5RS.

I see it is on your To Do list: http://www.ve3syb.ca/software/tiny-fu/index.html

Yes, That would be super! It's insane that tinyscheme does not have documentation!

I use it pretty much entirely in batch mode to post processes large time series of rendered images from scientific datasets so from my point of view the batch mode scripting is essential. Tinyscheme is lacking very basic functionality that is pretty standard these days (eg formatted io routines). If there is there any chance to replace tinyscheme with some other scheme implementation it would be a huge improvement (0.02$). perhaps mit scheme or racket or some other implementation that is more full featured? Both of these have excellent documentation as well. It's crazy ridiculous that I spent a day to re-invent and debug printf! that functionality should be there already. debugging scheme code under the gimp is fairly difficult. for example tinyscheme io streams are buffered and there is no way to set the buffering mode when you open a stream (?!), and there is no fflush equivalent. at least I couldn't find these features. the other scheme implementations I looked at when looking for a source of documentation seem to have these and other basic and essential standard features implemented out of the box.