Remove unnecessary functions from module
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from smnp.module.iterable.function import combine, map, get
|
||||
from smnp.module.iterable.function import map, get
|
||||
|
||||
functions = [ combine.function, map.function ]
|
||||
functions = [ map.function ]
|
||||
methods = [ get.function ]
|
||||
@@ -1,18 +0,0 @@
|
||||
from functools import reduce
|
||||
|
||||
from smnp.function.model import Function
|
||||
from smnp.function.signature import varargSignature
|
||||
from smnp.type.model import Type
|
||||
from smnp.type.signature.matcher.type import ofTypes
|
||||
|
||||
_signature = varargSignature(ofTypes(Type.LIST))
|
||||
def _function(env, vararg):
|
||||
if len(vararg) == 1:
|
||||
return vararg[0]
|
||||
|
||||
combined = reduce(lambda x, y: x.value + y.value, vararg)
|
||||
return Type.list(combined)
|
||||
|
||||
|
||||
function = Function(_signature, _function, 'combine')
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
from smnp.function.model import CombinedFunction, Function
|
||||
from smnp.function.signature import signature
|
||||
from smnp.note.model import Note
|
||||
from smnp.type.model import Type
|
||||
from smnp.type.signature.matcher.type import ofType
|
||||
|
||||
_signature1 = signature(ofType(Type.INTEGER))
|
||||
def _function1(env, upper):
|
||||
return Type.list([ Type.integer(i) for i in range(upper.value + 1)])
|
||||
|
||||
|
||||
_signature2 = signature(ofType(Type.INTEGER), ofType(Type.INTEGER))
|
||||
def _function2(env, lower, upper):
|
||||
return Type.list([ Type.integer(i) for i in range(lower.value, upper.value + 1)])
|
||||
|
||||
|
||||
_signature3 = signature(ofType(Type.INTEGER), ofType(Type.INTEGER), ofType(Type.INTEGER))
|
||||
def _function3(env, lower, upper, step):
|
||||
return Type.list([ Type.integer(i) for i in range(lower.value, upper.value + 1, step.value)])
|
||||
|
||||
|
||||
_signature4 = signature(ofType(Type.NOTE), ofType(Type.NOTE))
|
||||
def _function4(env, lower, upper):
|
||||
return Type.list([Type.note(n) for n in Note.range(lower.value, upper.value)])
|
||||
|
||||
|
||||
# TODO
|
||||
# signature5 = range(note lower, note upper, integer step) OR step = "diatonic" | "chromatic" | "augmented" | "diminish"
|
||||
|
||||
function = CombinedFunction(
|
||||
'range',
|
||||
Function(_signature1, _function1),
|
||||
Function(_signature2, _function2),
|
||||
Function(_signature3, _function3),
|
||||
Function(_signature4, _function4),
|
||||
)
|
||||
@@ -1,4 +1,4 @@
|
||||
from smnp.module.string.function import concat, stringify
|
||||
from smnp.module.string.function import stringify
|
||||
|
||||
functions = [ concat.function ]
|
||||
functions = []
|
||||
methods = [ stringify.function ]
|
||||
@@ -1,11 +0,0 @@
|
||||
from smnp.function.model import Function
|
||||
from smnp.function.signature import varargSignature
|
||||
from smnp.type.model import Type
|
||||
from smnp.type.signature.matcher.type import ofType
|
||||
|
||||
_signature = varargSignature(ofType(Type.STRING))
|
||||
def _function(env, vararg):
|
||||
return Type.string("".join([ arg.value for arg in vararg ]))
|
||||
|
||||
|
||||
function = Function(_signature, _function, 'concat')
|
||||
Reference in New Issue
Block a user