scheme¶
Tools for modeling Scheme datastructures used in LilyPond.
Classes
Scheme |
Abjad model of Scheme code. |
SchemeAssociativeList |
Abjad model of Scheme associative list. |
SchemeColor |
Abjad model of Scheme color. |
SchemeMoment |
Abjad model of Scheme moment. |
SchemePair |
Abjad model of Scheme pair. |
SchemeSymbol |
Abjad model of Scheme symbol. |
SchemeVector |
Abjad model of Scheme vector. |
SchemeVectorConstant |
Abjad model of Scheme vector constant. |
SpacingVector |
Abjad model of Scheme spacing vector. |
-
class
abjad.scheme.
Scheme
(value=None, force_quotes=None, quoting=None, verbatim=None)¶ Abjad model of Scheme code.
A Scheme boolean value:
>>> scheme = abjad.Scheme(True) >>> print(format(scheme)) ##t
A nested Scheme expession:
>>> scheme = abjad.Scheme([ ... ('left', (1, 2, False)), ... ('right', (1, 2, 3.3)), ... ]) >>> print(format(scheme)) #((left (1 2 #f)) (right (1 2 3.3)))
A list:
>>> scheme_1 = abjad.Scheme([1, 2, 3]) >>> scheme_2 = abjad.Scheme((1, 2, 3)) >>> format(scheme_1) == format(scheme_2) True
Scheme wraps nested variable-length arguments in a tuple.
A quoted Scheme expression:
>>> scheme = abjad.Scheme((1, 2, 3), quoting="'#") >>> print(format(scheme)) #'#(1 2 3)
Use the
quoting
keyword to prepend Scheme’s various quote, unquote, unquote-splicing characters to formatted output.A Scheme expression with forced quotes:
>>> scheme = abjad.Scheme('nospaces', force_quotes=True) >>> print(format(scheme)) #"nospaces"
Use this in certain override situations when LilyPond’s Scheme interpreter treats unquoted strings as symbols instead of strings. The string must contain no whitespace for this to work.
A Scheme expression of LilyPond functions:
>>> function_1 = 'tuplet-number::append-note-wrapper' >>> function_2 = 'tuplet-number::calc-denominator-text' >>> string = abjad.Scheme('4', force_quotes=True) >>> scheme = abjad.Scheme([function_1, function_2, string]) >>> abjad.f(scheme) abjad.Scheme( [ 'tuplet-number::append-note-wrapper', 'tuplet-number::calc-denominator-text', abjad.Scheme( '4', force_quotes=True, ), ] )
>>> print(format(scheme)) #(tuplet-number::append-note-wrapper tuplet-number::calc-denominator-text "4")
A Scheme lambda expression of LilyPond function that takes a markup with a quoted string argument. Setting verbatim to true causes the expression to format exactly as-is without modifying quotes or whitespace:
>>> string = '(lambda (grob) (grob-interpret-markup grob' >>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))' >>> scheme = abjad.Scheme(string, verbatim=True) >>> abjad.f(scheme) abjad.Scheme( '(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))', verbatim=True, )
>>> print(format(scheme)) #(lambda (grob) (grob-interpret-markup grob #{ \markup \musicglyph #"noteheads.s0harmonic" #}))
More examples:
>>> abjad.Scheme(True) Scheme(True)
>>> abjad.Scheme(False) Scheme(False)
>>> abjad.Scheme(None) Scheme(None)
>>> abjad.Scheme('hello') Scheme('hello')
>>> abjad.Scheme('hello world') Scheme('hello world')
>>> abjad.Scheme([abjad.Scheme('foo'), abjad.Scheme(3.14159)]) Scheme([Scheme('foo'), Scheme(3.14159)])
>>> abjad.Scheme([ ... abjad.SchemePair(('padding', 1)), ... abjad.SchemePair(('attach-dir', -1)), ... ]) Scheme([SchemePair(('padding', 1)), SchemePair(('attach-dir', -1))])
Scheme takes an optional
quoting
keyword, for prepending quote/unquote ticks:>>> str(abjad.Scheme(['fus', 'ro', 'dah'], quoting = "',")) "',(fus ro dah)"
__str__ of abjad.Scheme returns the abjad.Scheme formatted value without the hash mark, while format(Scheme) returns the formatted value with the hash mark, allowing for nested abjad.Scheme expressions:
>>> scheme = abjad.Scheme(['fus', 'ro', 'dah'], quoting = "'") >>> str(scheme) "'(fus ro dah)"
>>> format(scheme) "#'(fus ro dah)"
Scheme attempts to format Python values into abjad.Scheme equivalents:
>>> format(abjad.Scheme(True)) '##t'
>>> format(abjad.Scheme(False)) '##f'
>>> format(abjad.Scheme(None)) '##f'
>>> format(abjad.Scheme('hello world')) '#"hello world"'
>>> format(abjad.Scheme([1, 2, 3])) '#(1 2 3)'
>>> format(abjad.Scheme([ ... abjad.SchemePair(('padding', 1)), ... abjad.SchemePair(('attach-dir', -1)), ... ], ... quoting="'", ... )) "#'((padding . 1) (attach-dir . -1))"
Attributes Summary
__format__
Formats scheme. __str__
Gets string representation of Scheme object. force_quotes
Is true when quotes should be forced in output. format_embedded_scheme_value
Formats embedded Scheme value
.format_scheme_value
Formats value
as Scheme would.lilypond_color_constants
quoting
Gets Scheme quoting string. value
Gets value. verbatim
Is true when formatting should format value absolutely verbatim. Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
__format__
(format_specification='')¶ Formats scheme.
Scheme LilyPond format:
>>> scheme = abjad.Scheme('foo') >>> format(scheme) '#foo'
Scheme storage format:
>>> abjad.f(scheme) abjad.Scheme( 'foo' )
Return type: str
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Class & static methods
-
static
format_embedded_scheme_value
(value, force_quotes=False)¶ Formats embedded Scheme
value
.Return type: str
-
static
format_scheme_value
(value, force_quotes=False, verbatim=False)¶ Formats
value
as Scheme would.Some basic values:
>>> abjad.Scheme.format_scheme_value(1) '1'
>>> abjad.Scheme.format_scheme_value('foo') 'foo'
>>> abjad.Scheme.format_scheme_value('bar baz') '"bar baz"'
>>> abjad.Scheme.format_scheme_value([1.5, True, False]) '(1.5 #t #f)'
Strings without whitespace can be forcibly quoted via the
force_quotes
keyword:>>> abjad.Scheme.format_scheme_value( ... 'foo', ... force_quotes=True, ... ) '"foo"'
Set verbatim to true to format value exactly (with only hash preprended):
>>> string = '(lambda (grob) (grob-interpret-markup grob' >>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))' >>> abjad.Scheme.format_scheme_value(string, verbatim=True) '(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))'
Hash symbol at the beginning of a string does not result in quoted output:
>>> string = '#1-finger' >>> abjad.Scheme.format_scheme_value(string) '#1-finger'
Return type: str
Read-only properties
-
-
class
abjad.scheme.
SchemeAssociativeList
(value=None)¶ Abjad model of Scheme associative list.
>>> scheme_alist = abjad.SchemeAssociativeList([ ... ('space', 2), ... ('padding', 0.5), ... ]) >>> abjad.f(scheme_alist) abjad.SchemeAssociativeList( [ abjad.SchemePair(('space', 2)), abjad.SchemePair(('padding', 0.5)), ] )
>>> print(format(scheme_alist)) #'((space . 2) (padding . 0.5))
Scheme associative lists are immutable.
Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Class & static methods
-
static
(
Scheme
).format_scheme_value
(value, force_quotes=False, verbatim=False)¶ Formats
value
as Scheme would.Some basic values:
>>> abjad.Scheme.format_scheme_value(1) '1'
>>> abjad.Scheme.format_scheme_value('foo') 'foo'
>>> abjad.Scheme.format_scheme_value('bar baz') '"bar baz"'
>>> abjad.Scheme.format_scheme_value([1.5, True, False]) '(1.5 #t #f)'
Strings without whitespace can be forcibly quoted via the
force_quotes
keyword:>>> abjad.Scheme.format_scheme_value( ... 'foo', ... force_quotes=True, ... ) '"foo"'
Set verbatim to true to format value exactly (with only hash preprended):
>>> string = '(lambda (grob) (grob-interpret-markup grob' >>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))' >>> abjad.Scheme.format_scheme_value(string, verbatim=True) '(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))'
Hash symbol at the beginning of a string does not result in quoted output:
>>> string = '#1-finger' >>> abjad.Scheme.format_scheme_value(string) '#1-finger'
Return type: str
Read-only properties
-
-
class
abjad.scheme.
SchemeColor
(value=None, force_quotes=None, quoting=None, verbatim=None)¶ Abjad model of Scheme color.
>>> abjad.SchemeColor('ForestGreen') SchemeColor('ForestGreen')
>>> note = abjad.Note("c'4") >>> scheme_color = abjad.SchemeColor('ForestGreen') >>> abjad.override(note).note_head.color = scheme_color >>> abjad.show(note)
Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Class & static methods
-
static
(
Scheme
).format_scheme_value
(value, force_quotes=False, verbatim=False)¶ Formats
value
as Scheme would.Some basic values:
>>> abjad.Scheme.format_scheme_value(1) '1'
>>> abjad.Scheme.format_scheme_value('foo') 'foo'
>>> abjad.Scheme.format_scheme_value('bar baz') '"bar baz"'
>>> abjad.Scheme.format_scheme_value([1.5, True, False]) '(1.5 #t #f)'
Strings without whitespace can be forcibly quoted via the
force_quotes
keyword:>>> abjad.Scheme.format_scheme_value( ... 'foo', ... force_quotes=True, ... ) '"foo"'
Set verbatim to true to format value exactly (with only hash preprended):
>>> string = '(lambda (grob) (grob-interpret-markup grob' >>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))' >>> abjad.Scheme.format_scheme_value(string, verbatim=True) '(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))'
Hash symbol at the beginning of a string does not result in quoted output:
>>> string = '#1-finger' >>> abjad.Scheme.format_scheme_value(string) '#1-finger'
Return type: str
Read-only properties
-
-
class
abjad.scheme.
SchemeMoment
(duration=(0, 1))¶ Abjad model of Scheme moment.
Initializes with two integers:
>>> abjad.SchemeMoment((2, 68)) SchemeMoment((2, 68))
Scheme moments are immutable.
Attributes Summary
__eq__
Is true when argument
is a scheme moment with the same value as that of this scheme moment.__ge__
Return a >= b. __gt__
Return a > b. __hash__
Hashes scheme moment. __le__
Return a <= b. __lt__
Is true when argument
is a scheme moment with value greater than that of this scheme moment.duration
Gets duration of Scheme moment. Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
__eq__
(argument)¶ Is true when
argument
is a scheme moment with the same value as that of this scheme moment.>>> abjad.SchemeMoment((2, 68)) == abjad.SchemeMoment((2, 68)) True
Otherwise false:
>>> abjad.SchemeMoment((2, 54)) == abjad.SchemeMoment((2, 68)) False
Return type: bool
-
__ge__
(other, NotImplemented=NotImplemented)¶ Return a >= b. Computed by @total_ordering from (not a < b).
-
__gt__
(other, NotImplemented=NotImplemented)¶ Return a > b. Computed by @total_ordering from (not a < b) and (a != b).
-
__le__
(other, NotImplemented=NotImplemented)¶ Return a <= b. Computed by @total_ordering from (a < b) or (a == b).
-
__lt__
(argument)¶ Is true when
argument
is a scheme moment with value greater than that of this scheme moment.>>> abjad.SchemeMoment((1, 68)) < abjad.SchemeMoment((1, 32)) True
Otherwise false:
>>> abjad.SchemeMoment((1, 68)) < abjad.SchemeMoment((1, 78)) False
Return type: bool
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Class & static methods
-
static
(
Scheme
).format_scheme_value
(value, force_quotes=False, verbatim=False)¶ Formats
value
as Scheme would.Some basic values:
>>> abjad.Scheme.format_scheme_value(1) '1'
>>> abjad.Scheme.format_scheme_value('foo') 'foo'
>>> abjad.Scheme.format_scheme_value('bar baz') '"bar baz"'
>>> abjad.Scheme.format_scheme_value([1.5, True, False]) '(1.5 #t #f)'
Strings without whitespace can be forcibly quoted via the
force_quotes
keyword:>>> abjad.Scheme.format_scheme_value( ... 'foo', ... force_quotes=True, ... ) '"foo"'
Set verbatim to true to format value exactly (with only hash preprended):
>>> string = '(lambda (grob) (grob-interpret-markup grob' >>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))' >>> abjad.Scheme.format_scheme_value(string, verbatim=True) '(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))'
Hash symbol at the beginning of a string does not result in quoted output:
>>> string = '#1-finger' >>> abjad.Scheme.format_scheme_value(string) '#1-finger'
Return type: str
Read-only properties
-
duration
¶ Gets duration of Scheme moment.
>>> abjad.SchemeMoment((2, 68)).duration NonreducedFraction(2, 68)
Return type: NonreducedFraction
-
-
class
abjad.scheme.
SchemePair
(value=(None, None))¶ Abjad model of Scheme pair.
Initializes from two values:
>>> abjad.SchemePair(('spacing', 4)) SchemePair(('spacing', 4))
REGRESSION:
Right-hand side string forces quotes:
>>> scheme_pair = abjad.SchemePair(('font-name', 'Times')) >>> format(scheme_pair) '#\'(font-name . "Times")'
Right-hand side nonstring does not force quotes:
>>> scheme_pair = abjad.SchemePair(('spacing', 4)) >>> format(scheme_pair) "#'(spacing . 4)"
Attributes Summary
__format__
Formats Scheme pair. left
Gets left value. right
Gets right value. Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
__format__
(format_specification='')¶ Formats Scheme pair.
>>> scheme_pair = abjad.SchemePair((-1, 1))
>>> format(scheme_pair) "#'(-1 . 1)"
>>> abjad.f(scheme_pair) abjad.SchemePair((-1, 1))
Return type: str
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Class & static methods
-
static
(
Scheme
).format_scheme_value
(value, force_quotes=False, verbatim=False)¶ Formats
value
as Scheme would.Some basic values:
>>> abjad.Scheme.format_scheme_value(1) '1'
>>> abjad.Scheme.format_scheme_value('foo') 'foo'
>>> abjad.Scheme.format_scheme_value('bar baz') '"bar baz"'
>>> abjad.Scheme.format_scheme_value([1.5, True, False]) '(1.5 #t #f)'
Strings without whitespace can be forcibly quoted via the
force_quotes
keyword:>>> abjad.Scheme.format_scheme_value( ... 'foo', ... force_quotes=True, ... ) '"foo"'
Set verbatim to true to format value exactly (with only hash preprended):
>>> string = '(lambda (grob) (grob-interpret-markup grob' >>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))' >>> abjad.Scheme.format_scheme_value(string, verbatim=True) '(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))'
Hash symbol at the beginning of a string does not result in quoted output:
>>> string = '#1-finger' >>> abjad.Scheme.format_scheme_value(string) '#1-finger'
Return type: str
Read-only properties
-
-
class
abjad.scheme.
SchemeSymbol
(symbol='cross')¶ Abjad model of Scheme symbol.
>>> scheme = abjad.SchemeSymbol('cross') >>> scheme SchemeSymbol('cross')
>>> print(format(scheme)) #'cross
Attributes Summary
symbol
Gets symbol string. Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Class & static methods
-
static
(
Scheme
).format_scheme_value
(value, force_quotes=False, verbatim=False)¶ Formats
value
as Scheme would.Some basic values:
>>> abjad.Scheme.format_scheme_value(1) '1'
>>> abjad.Scheme.format_scheme_value('foo') 'foo'
>>> abjad.Scheme.format_scheme_value('bar baz') '"bar baz"'
>>> abjad.Scheme.format_scheme_value([1.5, True, False]) '(1.5 #t #f)'
Strings without whitespace can be forcibly quoted via the
force_quotes
keyword:>>> abjad.Scheme.format_scheme_value( ... 'foo', ... force_quotes=True, ... ) '"foo"'
Set verbatim to true to format value exactly (with only hash preprended):
>>> string = '(lambda (grob) (grob-interpret-markup grob' >>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))' >>> abjad.Scheme.format_scheme_value(string, verbatim=True) '(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))'
Hash symbol at the beginning of a string does not result in quoted output:
>>> string = '#1-finger' >>> abjad.Scheme.format_scheme_value(string) '#1-finger'
Return type: str
Read-only properties
-
-
class
abjad.scheme.
SchemeVector
(value=[])¶ Abjad model of Scheme vector.
Scheme vector of boolean values:
>>> scheme = abjad.SchemeVector([True, True, False]) >>> scheme SchemeVector(True, True, False)
>>> print(format(scheme)) #'(#t #t #f)
Scheme vector of symbols:
>>> scheme = abjad.SchemeVector(['foo', 'bar', 'blah']) >>> scheme SchemeVector('foo', 'bar', 'blah')
>>> print(format(scheme)) #'(foo bar blah)
Scheme vectors and Scheme vector constants differ in only their LilyPond input format.
Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Class & static methods
-
static
(
Scheme
).format_scheme_value
(value, force_quotes=False, verbatim=False)¶ Formats
value
as Scheme would.Some basic values:
>>> abjad.Scheme.format_scheme_value(1) '1'
>>> abjad.Scheme.format_scheme_value('foo') 'foo'
>>> abjad.Scheme.format_scheme_value('bar baz') '"bar baz"'
>>> abjad.Scheme.format_scheme_value([1.5, True, False]) '(1.5 #t #f)'
Strings without whitespace can be forcibly quoted via the
force_quotes
keyword:>>> abjad.Scheme.format_scheme_value( ... 'foo', ... force_quotes=True, ... ) '"foo"'
Set verbatim to true to format value exactly (with only hash preprended):
>>> string = '(lambda (grob) (grob-interpret-markup grob' >>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))' >>> abjad.Scheme.format_scheme_value(string, verbatim=True) '(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))'
Hash symbol at the beginning of a string does not result in quoted output:
>>> string = '#1-finger' >>> abjad.Scheme.format_scheme_value(string) '#1-finger'
Return type: str
Read-only properties
-
-
class
abjad.scheme.
SchemeVectorConstant
(value=[])¶ Abjad model of Scheme vector constant.
Scheme vector constant of boolean values:
>>> scheme = abjad.SchemeVectorConstant([True, True, False]) >>> scheme SchemeVectorConstant(True, True, False)
>>> print(format(scheme)) #'#(#t #t #f)
Scheme vectors and Scheme vector constants differ in only their LilyPond input format.
Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Class & static methods
-
static
(
Scheme
).format_scheme_value
(value, force_quotes=False, verbatim=False)¶ Formats
value
as Scheme would.Some basic values:
>>> abjad.Scheme.format_scheme_value(1) '1'
>>> abjad.Scheme.format_scheme_value('foo') 'foo'
>>> abjad.Scheme.format_scheme_value('bar baz') '"bar baz"'
>>> abjad.Scheme.format_scheme_value([1.5, True, False]) '(1.5 #t #f)'
Strings without whitespace can be forcibly quoted via the
force_quotes
keyword:>>> abjad.Scheme.format_scheme_value( ... 'foo', ... force_quotes=True, ... ) '"foo"'
Set verbatim to true to format value exactly (with only hash preprended):
>>> string = '(lambda (grob) (grob-interpret-markup grob' >>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))' >>> abjad.Scheme.format_scheme_value(string, verbatim=True) '(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))'
Hash symbol at the beginning of a string does not result in quoted output:
>>> string = '#1-finger' >>> abjad.Scheme.format_scheme_value(string) '#1-finger'
Return type: str
Read-only properties
-
-
class
abjad.scheme.
SpacingVector
(basic_distance=0, minimum_distance=0, padding=12, stretchability=0)¶ Abjad model of Scheme spacing vector.
>>> vector = abjad.SpacingVector(0, 0, 12, 0)
>>> abjad.f(vector) abjad.SpacingVector( abjad.SchemePair(('basic-distance', 0)), abjad.SchemePair(('minimum-distance', 0)), abjad.SchemePair(('padding', 12)), abjad.SchemePair(('stretchability', 0)) )
Use to set paper block spacing attributes:
>>> staff = abjad.Staff("c'8 d'8 e'8 f'8") >>> lilypond_file = abjad.LilyPondFile.new(staff) >>> vector = abjad.SpacingVector(0, 0, 12, 0) >>> lilypond_file.paper_block.system_system_spacing = vector
Special methods
-
(
AbjadValueObject
).__copy__
(*arguments)¶ Copies Abjad value object.
Returns new Abjad value object.
-
(
AbjadValueObject
).__eq__
(argument)¶ Is true when all initialization values of Abjad value object equal the initialization values of
argument
.Returns true or false.
-
(
AbjadValueObject
).__hash__
()¶ Hashes Abjad value object.
Returns integer.
-
(
AbjadObject
).__repr__
()¶ Gets interpreter representation of Abjad object.
Returns string.
Class & static methods
-
static
(
Scheme
).format_scheme_value
(value, force_quotes=False, verbatim=False)¶ Formats
value
as Scheme would.Some basic values:
>>> abjad.Scheme.format_scheme_value(1) '1'
>>> abjad.Scheme.format_scheme_value('foo') 'foo'
>>> abjad.Scheme.format_scheme_value('bar baz') '"bar baz"'
>>> abjad.Scheme.format_scheme_value([1.5, True, False]) '(1.5 #t #f)'
Strings without whitespace can be forcibly quoted via the
force_quotes
keyword:>>> abjad.Scheme.format_scheme_value( ... 'foo', ... force_quotes=True, ... ) '"foo"'
Set verbatim to true to format value exactly (with only hash preprended):
>>> string = '(lambda (grob) (grob-interpret-markup grob' >>> string += r' #{ \markup \musicglyph #"noteheads.s0harmonic" #}))' >>> abjad.Scheme.format_scheme_value(string, verbatim=True) '(lambda (grob) (grob-interpret-markup grob #{ \\markup \\musicglyph #"noteheads.s0harmonic" #}))'
Hash symbol at the beginning of a string does not result in quoted output:
>>> string = '#1-finger' >>> abjad.Scheme.format_scheme_value(string) '#1-finger'
Return type: str
Read-only properties
-