fixes recurring bug

dev
Bill 2 years ago
parent 31d823ac89
commit 3120763966

@ -499,17 +499,17 @@ def prompt(running = lambda:True, next = lambda:input('> '), state = None):
rm(state) rm(state)
exit() exit()
elif q.startswith('sh'): elif q.startswith('sh'):
from distutils.spawn import find_executable from shutil import which
qs = re.split(r'[ \t]', q) qs = re.split(r'[ \t]', q)
shells = ('zsh', 'bash', 'sh', 'fish', 'cmd', 'pwsh', 'powershell', 'csh', 'tcsh', 'ksh') shells = ('zsh', 'bash', 'sh', 'fish', 'cmd', 'pwsh', 'powershell', 'csh', 'tcsh', 'ksh')
shell_path = '' shell_path = ''
if len(qs) > 1 and qs[1] in shells: if len(qs) > 1 and qs[1] in shells:
shell_path = find_executable(qs[1]) shell_path = which(qs[1])
if shell_path: if shell_path:
os.system(shell_path) os.system(shell_path)
else: else:
for sh in shells: for sh in shells:
shell_path = find_executable(sh) shell_path = which(sh)
if shell_path: if shell_path:
os.system(shell_path) os.system(shell_path)
break break

@ -75,6 +75,15 @@ public:
this->name = name; this->name = name;
} }
template<template <typename> class VT, typename T> template<template <typename> class VT, typename T>
void initfrom(VT<T>&& v, const char* name = "") {
ty = types::Types<_Ty>::getType();
this->size = v.size;
this->capacity = v.capacity;
this->container = (_Ty*)(v.container);
this->name = name;
v.capacity = 0;
}
template<template <typename> class VT, typename T>
void initfrom(const VT<T>& v, const char* name = "") { void initfrom(const VT<T>& v, const char* name = "") {
ty = types::Types<_Ty>::getType(); ty = types::Types<_Ty>::getType();
this->size = v.size; this->size = v.size;

@ -18,3 +18,14 @@ INSERT INTO t VALUES(4, 'B', 80)
SELECT * FROM t SELECT * FROM t
FUNCTION myCov(x, y) {
center_x := x - avg(x);
center_y := y - avg(y);
num := sum(center_x * center_y);
denom := sqrt(sum(center_x * center_x)) * sqrt(sum(center_y * center_y));
num / denom
}
select myCov(1,2);

@ -1,10 +0,0 @@
FUNCTION myCov(x, y) {
center_x := x - avg(x);
center_y := y - avg(y);
num := sum(center_x * center_y);
denom := sqrt(sum(center_x * center_x)) * sqrt(sum(center_y * center_y));
num / denom
}
select myCov(1,2);
Loading…
Cancel
Save