This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is my approach to creating callable objects | |
// that correctly reference their object members, | |
// without messing with prototypes. | |
// A Class that extends Function so we can create | |
// objects that also behave like functions, i.e. callable objects. | |
class ExFunc extends Function { | |
constructor() { | |
// Here we create a dynamic function with `super`, | |
// which calls the constructor of the parent class, `Function`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create a group | |
CREATE ROLE readaccess; | |
-- Grant access to existing tables | |
GRANT USAGE ON SCHEMA public TO readaccess; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
-- Grant access to future tables | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
def odd(n): | |
return True if n == 1 else even(n - 1) | |
def even(n): | |
return False if n == 1 else odd(n - 1) | |
def odd2(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
There is an AST (Abstract syntax tree) in JSON format. | |
AST represents Excel spreadsheet formula. | |
Is it possible in JavaScript to make RPN (Reverse Polish Notation) faster than AST? | |
AST evaluation is recusive and RPN evaluation is iterative. | |
But in any case, AST evaluation is faster despite recursion. | |
I guess that the main problem is in using dynamic js arrays to emulate stack. | |
Would RPN win if it was written in C/C++? | |