Symbol:
Filter:
Classes | Core

Symbol : Object

a unique name for something
Source: Symbol.sc

Description

A symbol, like a String, is a sequence of characters. Unlike strings, two symbols with exactly the same characters will be the exact same object. Symbols are optimized for recreating the same symbol over and over again. In practice, this means that symbols are best used for identifiers or tags that are only meaningful within your program, whereas you should use a string when your characters are really processed as text data. Use symbols to name things, use strings for input and output.

Good uses of symbols include symbolic constant values and Dictionary keys.

Symbols are represented syntactically as literals which are described in Literals: Symbols.

Creating a Symbol

A symbol can be written by surrounding characters by single quotes (may include whitespace):

'foo bar'

Or by a preceding backslash (then it may not include whitespace):

\foo

A String can be converted into a symbol:

"arbeit".scramble.asSymbol;

Class Methods

Inherited class methods

Instance Methods

Testing

.isClassName

Answer whether the symbol can be a class name. This does not say if the class exists.

.isMetaClassName

Answer whether the symbol can be meta class name. This does not say if the class exists.

.isSetter

Answer whether the symbol has a trailing underscore.

.isPrimitiveName

Answer whether the symbol is a valid primitive name

.isPrefix(other)

Answer whether the symbol is a prefix of another one

.isIdentifier

Return true if the symbol is a valid variable name, or equivalently a valid method name in the two most common method call syntaxes (foo.bar() and bar(foo)). A valid identifier contains only alphanumeric characters and underscores, and the first character must be a lowercase letter.

.isBinaryOp

Return true if the symbol is a valid binary operator. A valid binary operator contains only the symbols !@%&*-+=|<>?/, does not start with '//' or '/*', and is not the string '='.

Conversion

.asString(limit: 512)

From superclass: Object

Convert to a String

.asInteger

Convert to an Integer

.asClass

Answer the Class named by the receiver.

.asSetter

Return a symbol with a trailing underscore added.

.asGetter

Return a symbol with a trailing underscore removed.

.ascii

return the ascii codes as an array

.asSpec

Convert to a ControlSpec

.asTuning

Convert to a Tuning

.asScale

Convert to a Scale

Environments

Symbols are used as keys to look up objects in dictionaries and environments, but also in arrays. See IdentityDictionary, Environment, Event

.envirPut(aValue)

put a value to the current environment using receiver as key

.envirGet

return a value from the current environment using receiver as key

Discussion:

Math

Symbols respond to all unary and binary math operations by returning themselves. The result of any math operation between a Number or other math object and a Symbol is to return the Symbol. This allows for example operations on lists of notes which contain 'rest's to preserve the rests.

Pseq([1, 3, \rest, 2, 4] + 8);

.applyTo(firstArg ... args)

Use the symbol as a method selector and perform the message on firstArg, with args as arguments. This is used for mixing functions with method selectors (see also: Function).

Discussion:

Synthesis

Inside SynthDefs and UGen functions, symbols can be used to conveniently specify control inputs of different rates and with lags (see: NamedControl, ControlName, and Control).

.kr(val, lag, fixedLag: false, spec)

Return a control rate NamedControl input with a default value (val), and if supplied, with a lag. If val is an array, the control will be multichannel. A ControlSpec provided to the spec parameter will be written into the spec metadata for the current synth.

Discussion:

.ar(val, lag, spec)

Return an audio rate NamedControl input with a default value (val), and if supplied, with a lag. If val is an array, the control will be multichannel.

.ir(val, spec)

Return an initialization rate NamedControl input with a default value (val). If val is an array, the control will be multichannel.

.tr(val, spec)

Return a TrigControl input with a default value (val). If val is an array, the control will be multichannel.

Discussion:

Extensions by wslib

.asNote(cents)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-asNote.sc

Returns:

Returns a Note whose MIDI pitch matches the given note name

Inherited instance methods

Undocumented instance methods

*

+

++(aString)

-

/

<(aNumber)

<=(aNumber)

>(aNumber)

>=(aNumber)

.abs

.acos

.ampdb

.archiveAsCompileString

.asActionFunc(action, extra, startVal)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Extensions/Various/ActionFunc.sc

.asBinOpString

.asColor(alpha: 1)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/SVGFile/extVarious-SVGFile.sc

.asCompileString

.asDefName

From extension in /SuperCollider/Contents/Resources/SCClassLibrary/Common/Control/asDefName.sc

.asFloat

.asLayoutElement

From extension in /SuperCollider/Contents/Resources/SCClassLibrary/Common/GUI/Base/ext-asLayoutElement.sc

.asSymbol

.asWarp(spec)

.asWebColorString(default)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/SVGFile/extVarious-SVGFile.sc

.asin

.atan

.atan2

.bilinrand

.bitAnd

.bitHammingDistance

.bitNot

.bitOr

.bitXor

.blend

.buildForProxy

From extension in /SuperCollider/Contents/Resources/SCClassLibrary/JITLib/ProxySpace/wrapForNodeProxy.sc

.ceil

.codegen_UGenCtorArg(stream)

.coin

.cos

.cosh

.cpsmidi

.cpsoct

.dbamp

.degrad

.degreeToKey

.distort

.doComplexOp

.doListOp(aSelector, aList)

.doNumberOp

.doSignalOp

.drawIcon(rect ... args)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Drawing/extDrawIcon.sc

.even

.exp

.exprand

.firstIsLower

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/SVGFile/extVarious-SVGFile.sc

.firstIsUpper

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/SVGFile/extVarious-SVGFile.sc

.firstToLower

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/SVGFile/extVarious-SVGFile.sc

.firstToUpper

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/SVGFile/extVarious-SVGFile.sc

.floor

.frac

.gcd

.guiClass

From extension in /SuperCollider/Contents/Resources/SCClassLibrary/Common/GUI/tools/guicrucial/gui.sc

.hammingDistance(that)

.hanWindow

.help

.hertz

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/Ctk/Ctk classes/PitchClass.sc

.hypot

.hypotApx

.isBasicOperator

From extension in /SuperCollider/Contents/Resources/SCClassLibrary/JITLib/ProxySpace/extStoreOn.sc

.isMap

.isPrimitive

.isRest

.isSymbolWS

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Lang/Improvements/extSymbol-isSymbol.sc

.isValidExtension

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/File management/extString-fileManagement.sc

.keynum

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/Ctk/Ctk classes/PitchClass.sc

.lcm

.leftShift

.linrand

.log

.log10

.log2

.makeScale(type: 'major', startNote, endNote)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.makeScaleCps(type: 'major', startNote, endNote)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.makeScaleMidi(type: 'major', startNote, endNote)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.makeScaleName(type: 'major', startNote, endNote)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.matchOSCAddressPattern(addressPattern)

.max

.midicps

.midiratio

.min

.mod

.namecps(cents)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.namemidi(cents)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.namename(cents, sign)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.namevoicetype(type, language: 'en', filter)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.neg

.note

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/Ctk/Ctk classes/PitchClass.sc

.noteAccidental

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/Ctk/Ctk classes/PitchClass.sc

.noteName

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/Ctk/Ctk classes/PitchClass.sc

.noteOctave

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/Ctk/Ctk classes/PitchClass.sc

.octcps

.odd

.openDocument(selectionStart: 0, selectionLength: 0)

From extension in /SuperCollider/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Collections/StringPlusGUI.sc

.p(default: 0, env)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Patterns/PenvirGet.sc

.pc

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/Ctk/Ctk classes/PitchClass.sc

.penFill(rect)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Extensions/extGradient-fill.sc

.performBinaryOpOnSomething

.pitchClass

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/Ctk/Ctk classes/PitchClass.sc

.pow

.primitiveIndex

.proxyControlClass

From extension in /SuperCollider/Contents/Resources/SCClassLibrary/JITLib/ProxySpace/wrapForNodeProxy.sc

.raddeg

.ramp

.rand

.rand2

.ratiomidi

.rectWindow

.rightShift

.round

.roundUp

.rrand

.scurve

.sign

.sin

.sinh

.softclip

.specialIndex

.sqrt

.sum3rand

.tan

.tanh

.testnamemidi(ifTrue: true, ifFalse: false, cents: 0)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.toLower

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/SVGFile/extVarious-SVGFile.sc

.toUpper

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/SVGFile/extVarious-SVGFile.sc

.triWindow

.trunc

.trynamecps(cents, default: 'C3')

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.trynamemidi(cents, default: 'C3')

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.trynamename(cents, sign, default)

From extension in /Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Main Features/Note/extVarious-midiname.sc

.unsignedRightShift

.welWindow