2.1 Current value reference
Calculate the sum of the first 100 odd numbers.
SPL
A | |
---|---|
1 | =to(100) |
2 | =A1.sum(~*2-1) |
A1.sum(~*2-1) is equivalent to A1.(~*2-1).sum().
SQL
SELECT SUM(2 * LEVEL - 1) AS sum_of_odd_numbers
FROM dual
CONNECT BY LEVEL <= 100;
Python
l=[i for i in range(1,101)]
s=pd.Series(l)
odd_sum=s.apply(lambda x:x*2-1).sum()
Example codes for comparing SPL, SQL, and Python
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProcSPL
SPL Learning Material 👉 https://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProc_SPL