Hi, folks! We need your advice on organizing the standard library. This is the first time we ask to brainstorm for a particular improvement. I hope XOD and you would benefit from it.
Well, we have xod/core
library and it starts to become a pile of trash which is hard to navigate and explore. Some xoders already asked to categorize the nodes. Let’s do it. The idea is to evaporate xod/core
completely by moving its nodes to new libraries.
Question 1: How many libraries should we have instead of single xod/core
Now, 110 nodes are in the development version of XOD. The number will grow, but it’s likely it would stay at the order of hundreds magnitude for a long time. If the categorization should improve search time, the best theoretical results should we achieved when N_cat = sqrt(N_nodes). I.e. the current optimum is ten categories (libraries) or so.
Feel free to comment if you have other thoughts.
Question 2: What are these new libraries?
Here is a proposal:
Node name New path
absolute xod/math/abs
acos xod/math/acos
add xod/math/add
analog-input xod/io/analog-input
and xod/logic/and
any xod/control/any
asin xod/math/asin
atan xod/math/atan
boot xod/time/boot
buffer xod/control/buffer
cast-boolean-to-number xod/logic/to-zero-one
cast-boolean-to-pulse -- should rely on pulse-on-true
cast-boolean-to-string xod/text/format-boolean
cast-number-to-boolean xod/logic/nonzero
cast-number-to-string -- should rely on xod/text/format-number
ceil xod/math/ceil
clip xod/math/clip
clock xod/time/clock
concat xod/list/concat
concat-3 -- [1]
concat-4 -- [1]
concat-5 -- [1]
concat-6 -- [1]
console-log xod/debug/console-log
constant-boolean xod/core/constant
constant-number -- [2]
constant-string -- [2]
constrain xod/math/constrain
continuously xod/time/continuously
continuously-pausable -- should be merged into `continuously`
cos xod/math/cos
count xod/control/count
cube xod/math/cube
debounce-boolean xod/time/debounce
defer-boolean xod/control/defer
defer-number -- [2]
defer-pulse -- [2]
defer-string -- [2]
delay xod/time/delay
digital-input xod/io/digital-input
digital-output xod/io/digital-output
discretize-2 xod/math/discretize
discretize-3 -- [2]
discretize-4 -- [2]
divide xod/math/divide
duty-to-time xod/time/duty-to-time
equal xod/math/equal
fade xod/control/fade
flip-flop xod/control/flip-flop
flip-n-times xod/time/flip-n-times
floor xod/math/floor
format-number xod/text/format-number
gate xod/control/gate
gate-boolean -- [2]
gate-number -- [2]
gate-pulse -- [2]
gate-string -- [2]
greater xod/math/greater
i2c-begin-transmission xod/io/i2c-begin-transmission
i2c-end-transmission xod/io/i2c-end-transmission
i2c-read xod/io/i2c-read
i2c-request xod/io/i2c-request
i2c-request-bytes-6 xod/io/i2c-fetch-packet
i2c-send-byte xod/io/i2c-send-packet
i2c-send-bytes-2 -- [1]
i2c-write xod/io/i2c-write
if-else xod/logic/if-else
if-else-string -- [2]
less xod/math/less
log-10 xod/math/log-10
log-bx xod/math/log-bx
log-e xod/math/log-e
map-clip-range xod/math/map-clip
map-range xod/math/map
modulo xod/math/modulo
multiply xod/math/multiply
nand xod/logic/nand
nor xod/logic/nor
not xod/logic/not
nth-number-2 xod/list/nth
nth-number-3 -- [2]
nth-number-4 -- [2]
or xod/logic/or
pi xod/math/pi
pow xod/math/pow
pulse-on-change xod/control/pulse-on-change
pulse-on-false xod/control/pulse-on-false
pulse-on-true xod/control/pulse-on-true
pwm-output xod/io/pwm-output
round xod/math/round
saw-wave xod/time/saw-wave
saw-wave-map xod/math/map-saw
select xod/control/select
sin xod/math/sin
sine-wave xod/time/sine-wave
sine-wave-map xod/math/map-sin
sqrt xod/math/sqrt
square xod/math/square
square-wave xod/time/square-wave
subtract xod/math/subtract
system-time xod/time/time
tan xod/math/tan
time-to-duty xod/time/time-to-duty
timer xod/time/timer
to-percent xod/text/to-percent
tri-wave xod/time/tri-wave
tri-wave-map xod/math/map-tri
watch xod/debug/watch
word-to-number xod/bits/word-to-number
xor xod/logic/xor
¹ Arity would be eradicated in future versions by using lists
² Nodes that differ only in types would be generalized using generic types in future versions
If we’d sort the list above by the new path column and remove the nodes which should go:
Node name New path
word-to-number xod/bits/word-to-number
any xod/control/any
buffer xod/control/buffer
count xod/control/count
defer-boolean xod/control/defer
fade xod/control/fade
flip-flop xod/control/flip-flop
gate xod/control/gate
pulse-on-change xod/control/pulse-on-change
pulse-on-false xod/control/pulse-on-false
pulse-on-true xod/control/pulse-on-true
select xod/control/select
constant-boolean xod/core/constant
console-log xod/debug/console-log
watch xod/debug/watch
analog-input xod/io/analog-input
digital-input xod/io/digital-input
digital-output xod/io/digital-output
i2c-begin-transmission xod/io/i2c-begin-transmission
i2c-end-transmission xod/io/i2c-end-transmission
i2c-request-bytes-6 xod/io/i2c-fetch-packet
i2c-read xod/io/i2c-read
i2c-request xod/io/i2c-request
i2c-send-byte xod/io/i2c-send-packet
i2c-write xod/io/i2c-write
pwm-output xod/io/pwm-output
concat xod/list/concat
nth-number-2 xod/list/nth
and xod/logic/and
if-else xod/logic/if-else
nand xod/logic/nand
cast-number-to-boolean xod/logic/nonzero
nor xod/logic/nor
not xod/logic/not
or xod/logic/or
cast-boolean-to-number xod/logic/to-zero-one
xor xod/logic/xor
absolute xod/math/abs
acos xod/math/acos
add xod/math/add
asin xod/math/asin
atan xod/math/atan
ceil xod/math/ceil
clip xod/math/clip
constrain xod/math/constrain
cos xod/math/cos
cube xod/math/cube
discretize-2 xod/math/discretize
divide xod/math/divide
equal xod/math/equal
floor xod/math/floor
greater xod/math/greater
less xod/math/less
log-10 xod/math/log-10
log-bx xod/math/log-bx
log-e xod/math/log-e
map-range xod/math/map
map-clip-range xod/math/map-clip
saw-wave-map xod/math/map-saw
sine-wave-map xod/math/map-sin
tri-wave-map xod/math/map-tri
modulo xod/math/modulo
multiply xod/math/multiply
pi xod/math/pi
pow xod/math/pow
round xod/math/round
sin xod/math/sin
sqrt xod/math/sqrt
square xod/math/square
subtract xod/math/subtract
tan xod/math/tan
cast-boolean-to-string xod/text/format-boolean
format-number xod/text/format-number
to-percent xod/text/to-percent
boot xod/time/boot
clock xod/time/clock
continuously xod/time/continuously
debounce-boolean xod/time/debounce
delay xod/time/delay
duty-to-time xod/time/duty-to-time
flip-n-times xod/time/flip-n-times
saw-wave xod/time/saw-wave
sine-wave xod/time/sine-wave
square-wave xod/time/square-wave
system-time xod/time/time
time-to-duty xod/time/time-to-duty
timer xod/time/timer
tri-wave xod/time/tri-wave
So, we have nine libraries:
-
xod/bits
— bitwise operations, bit shifts, bit masks, low-level data packing -
xod/control
— the nodes to store the state and control the execution flow -
xod/debug
— nodes to monitor the program, set breakpoints, adjust parameters -
xod/io
— very basic hardware-native input and output -
xod/lists
— operations on vectors/lists -
xod/logic
— boolean operations -
xod/math
— the algebra from a school -
xod/text
— operations on strings of text -
xod/time
— time-signal generators
Does it looks OK?
Question 3: Does xod/control
looks like a new pile?
Intuitively I feel when a node should fall into a particular lib. But that’s not a case for xod/control
. Can someone suggest an alternative or a strong metaphor?
BTW, should debounce
and delay
belong to time
or they should be in control
?
Question 4: Where we should put the constant
node?
There’s no xod/core
anymore, it lost the home One solution is to have something called xod/atoms
instead of current xod/patch-nodes
and put it there. Is it OK?
Question 5: Should we use widely adopted abbreviations for names?
-
divide
→div
-
subtract
→sub
-
multiply
→mul
-
absolute
→abs
If so, where should we stop?
-
modulo
→mod
? -
constant
→const
? -
greater
→gt
? -
time
→t
? -
i2c-send-packet
→i2c-snd-pk
?
Looking forward for your thoughts!