[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add lilypond version predicates/operators (issue 317270043 by addres
From: |
thomasmorley65 |
Subject: |
Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden) |
Date: |
Tue, 14 Feb 2017 13:08:48 -0800 |
On 2017/02/14 21:03:19, thomasmorley651 wrote:
To throw in my own 2cts.
Why not compare strings, looks more straight forward to me.
(define (calculate-version-harm ref-version)
(cond ((string? ref-version) ref-version)
((number-list? ref-version)
(string-concatenate (list-join (map number->string
ref-version) ".")))
(else (ly:error "whatever-massage"))))
(define (version-compare? op v1 v2)
"Compare two versions @var{v1} and @var{v2} with the operator
@var{op}.
The operator would typically be
string=?, string<?, string<=? , string>? , string>=? , etc."
(op (calculate-version-harm v1) (calculate-version-harm v2)))
;; Examples
(write (version-compare? string=? (lilypond-version) (ly:version)))
(write (version-compare? string>? "2.19.57" (ly:version)))
(write (version-compare? string<=? "2.19.57" (lilypond-version)))
The issue I can imagine: probably more expensive, especially with
guilev2
In a ly-file:
$ time lilydevel atest-48.ly
GNU LilyPond 2.19.52
Processing `atest-48.ly'
Parsing...#t#t#f
Success: compilation successfully completed
real 0m1.279s
user 0m1.148s
sys 0m0.128s
Using a build from (not so) recent master, with guile-2.1.6:
$ time lilypond-git atest-48.ly
GNU LilyPond 2.19.55
Import (ice-9 threads) to have access to `call-with-new-thread'.
Import (ice-9 threads) to have access to `current-thread'.
Processing `atest-48.ly'
Parsing...#t#t#f
Success: compilation successfully completed
real 0m5.145s
user 0m5.620s
sys 0m0.120s
Cheers,
Harm
Here the values for Urs' proposal
$ time lilydevel atest-48.ly
GNU LilyPond 2.19.52
Processing `atest-48.ly'
Parsing...#t#f#f
Success: compilation successfully completed
real 0m1.307s
user 0m1.204s
sys 0m0.100s
$ time lilypond-git atest-48.ly
GNU LilyPond 2.19.55
Import (ice-9 threads) to have access to `call-with-new-thread'.
Import (ice-9 threads) to have access to `current-thread'.
Processing `atest-48.ly'
Parsing...#f#f#f
Success: compilation successfully completed
real 0m5.239s
user 0m5.756s
sys 0m0.084s
https://codereview.appspot.com/317270043/
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), (continued)
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), dak, 2017/02/14
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), dak, 2017/02/14
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), git, 2017/02/14
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), dak, 2017/02/14
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), dak, 2017/02/14
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), git, 2017/02/14
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), dak, 2017/02/14
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), thomasmorley65, 2017/02/14
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden),
thomasmorley65 <=
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), thomasmorley65, 2017/02/14
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), paulwmorris, 2017/02/18
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), git, 2017/02/18
- Re: Add lilypond version predicates/operators (issue 317270043 by address@hidden), dak, 2017/02/18