Ejemplo n.º 1
0
# *******************************************************************************
#
#    Copyright (c) 2021 David Briant. All rights reserved.
#
# *******************************************************************************

from coppertop.std.structs import tvstruct as _tvstruct
from bones.core.metatypes import BTAtom
from bones.core.types import num, N, tv

adhoc = BTAtom.define('adhoc').setConstructor(_tvstruct)
agg = BTAtom.define('agg').setConstructor(_tvstruct)

ellipsis = type(...)

TBT = BTAtom.define(
    'TBT')  # temporary type to allow  'fred' >> box | pystr - aka to be types
void = BTAtom.define(
    'void'
)  # nothing returned on the stack from this function (should not be assignable)

# NB a 1x1 matrix is assumed to be a scalar, e.g. https://en.wikipedia.org/wiki/Dot_product#Algebraic_definition

vec = (N**num)  # N**num is common so don't name it
matrix = (N**N**num).nameAs('matrix').setNonExclusive
colvec = matrix['colvec'].setNonExclusive
rowvec = matrix['rowvec'].setNonExclusive

I = BTAtom.define('I')
square = BTAtom.define('square')
right = BTAtom.define('right')
Ejemplo n.º 2
0
#
#    Copyright (c) 2021 David Briant. All rights reserved.
#
# *******************************************************************************

import sys
if hasattr(sys, '_TRACE_IMPORTS') and sys._TRACE_IMPORTS: print(__name__)

from bones.core.metatypes import BTAtom as _BTAtom, BType as _BType, weaken as _weaken
_Void = sys._VOID
_ProgrammerError = sys._ProgrammerError
_Missing = sys._Missing

__all__ = []

i8 = _BTAtom.define('i8').setExclusive
u8 = _BTAtom.define('u8').setExclusive
i16 = _BTAtom.define('i16').setExclusive
u16 = _BTAtom.define('u16').setExclusive
i32 = _BTAtom.define('i32').setExclusive
u32 = _BTAtom.define('u32').setExclusive
i64 = _BTAtom.define('i64').setExclusive
u64 = _BTAtom.define('u64').setExclusive
f32 = _BTAtom.define('f32').setExclusive
f64 = _BTAtom.define('f64').setExclusive

T = _BType('T')
for i in range(1, 21):
    t = T.ensure(_BType(f'{i}'))
    locals()[t.name] = t
for o in range(26):