Language-Integrated Query (Linq) - Useful functions for working with sets. - Messages
#1 Posted: 4/24/2014 11:03:35 PM
Language-Integrated Query (Linq).
Useful functions for working with sets.
Functions list:
`if(2), `if(3), select(2), select2(2), selectmany(2), join(5), where(2), where2(2), aggregate(2), aggregate(3), take(2), takewhile(2), takewhile2(2), skip(2), first(2), repeat(2), any(2), all(2), contains(2), count(2), batch(2), batch(3), exclude(3), takeevery(2).
Links:
1. LINQ - Language-Integrated Query.
2. morelink - Extensions to LINQ to Objects (jonathan.skeet, ...).
Linq. Examples.sm (37 KiB) downloaded 140 time(s).
Useful functions for working with sets.
Functions list:
`if(2), `if(3), select(2), select2(2), selectmany(2), join(5), where(2), where2(2), aggregate(2), aggregate(3), take(2), takewhile(2), takewhile2(2), skip(2), first(2), repeat(2), any(2), all(2), contains(2), count(2), batch(2), batch(3), exclude(3), takeevery(2).
Links:
1. LINQ - Language-Integrated Query.
2. morelink - Extensions to LINQ to Objects (jonathan.skeet, ...).
Linq. Examples.sm (37 KiB) downloaded 140 time(s).
Russia ☭ forever, Viacheslav N. Mezentsev
5 users liked this post
Serg 8/29/2016 10:47:00 AM, Martin Kraska 4/25/2014 2:52:00 AM, Davide Carpi 4/25/2014 4:47:00 AM, Mike Kaganski 4/25/2014 8:03:00 AM, Radovan Omorjan 4/25/2014 1:28:00 AM
#2 Posted: 4/25/2014 2:59:17 AM
Uni, the way you provide arguments to your functions looks interesting. How is it expected to work, does it really what it should? What are the formal restrictions? This is not even known for ordinary function arguments, thus I wonder how thin the ice is that you are on ;-)
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#3 Posted: 4/25/2014 3:42:57 AM
I totally forgot that this is possible in SMath
[MATH=eng]f(x,`):`(x)^2[/MATH]
[MATH=eng]f(x:6,`(x):x)=36[/MATH]
[MATH=eng]f(y:7,`(x):x+1)=64[/MATH]
Uni used quite unusual character for a function name (`).
I forgot this as well (making a function argument call by value)
[MATH=eng]f(x):line(x:9,x^2,2,1)[/MATH]
[MATH=eng]a:100[/MATH]
[MATH=eng]f(a)=81[/MATH]
[MATH=eng]a=9[/MATH]
Contrary to
[MATH=eng]b:100[/MATH]
[MATH=eng]f(b:b)=81[/MATH]
[MATH=eng]b=100[/MATH]
Regards,
Radovan

[MATH=eng]f(x,`):`(x)^2[/MATH]
[MATH=eng]f(x:6,`(x):x)=36[/MATH]
[MATH=eng]f(y:7,`(x):x+1)=64[/MATH]
Uni used quite unusual character for a function name (`).
I forgot this as well (making a function argument call by value)

[MATH=eng]f(x):line(x:9,x^2,2,1)[/MATH]
[MATH=eng]a:100[/MATH]
[MATH=eng]f(a)=81[/MATH]
[MATH=eng]a=9[/MATH]
Contrary to
[MATH=eng]b:100[/MATH]
[MATH=eng]f(b:b)=81[/MATH]
[MATH=eng]b=100[/MATH]
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#4 Posted: 4/25/2014 4:59:06 AM
Very nice functions Viacheslav 
I think that also contains() should contains a break to maximize the performances.
Sometimes happens :d

I think that also contains() should contains a break to maximize the performances.
WroteI totally forgot that this is possible in SMath
Sometimes happens :d
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 users liked this post
Вячеслав Мезенцев 4/25/2014 5:30:00 AM
#5 Posted: 4/25/2014 5:25:22 AM
LINQ - Language-Integrated Query.
`(...) := (...) - lambda expression. This is an imitation of an implicit function in SMath Studio.
I wrote it for fun. But in this way you can check out the features of the program. I think this will SMath Studio future.
You can add here your own versions of these functions.
The ice is very thin, but it works
I used this technique when solving the ODEs (D(t,x):=...). With regard to the restrictions, I do not see them for now.
These functions should work as vector functions, hiding the use of cycles.
`(...) := (...) - lambda expression. This is an imitation of an implicit function in SMath Studio.
I wrote it for fun. But in this way you can check out the features of the program. I think this will SMath Studio future.
You can add here your own versions of these functions.
The ice is very thin, but it works

These functions should work as vector functions, hiding the use of cycles.
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Davide Carpi 4/25/2014 9:42:00 AM
#7 Posted: 4/25/2014 8:17:32 AM
I have a feature request: please allow MULTIPLE thanks to uni! (Well, on second thought, I'm afraid I could break my left muse button then...)
С уважением,
Михаил Каганский
2 users liked this post
#9 Posted: 4/25/2014 11:34:29 AM
I'm not sure if it is worth your time to explain but what is this?
Why is it beneficial?
Sorry for my ignorance.
Why is it beneficial?
Sorry for my ignorance.
#10 Posted: 4/25/2014 12:27:11 PM
It's not so easy for me to explain what is it for. I must implement basic functions, then it will be possible to show by examples why it maybe useful.
Moreover, it is quite complicated examples. With their help, you can test the Smath Studio.
Moreover, it is quite complicated examples. With their help, you can test the Smath Studio.
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Davide Carpi 4/25/2014 1:00:00 PM
#11 Posted: 4/25/2014 12:52:33 PM
WroteI'm not sure if it is worth your time to explain but what is this?
Why is it beneficial?
Sorry for my ignorance.
LINQ is for C# a write less/do more extension (like jQuery for javascript); in a short expression there are lot of basic instructions.
here you can found a good overview of LINQ; because was born to handle in a better way databases in C# (even if today is like a programming language itself), it's a good project also to use it with SMath's matrices (a database in the end is only a matrix with types fixed for each column)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#14 Posted: 4/25/2014 7:22:45 PM
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Davide Carpi 4/25/2014 9:10:00 PM
#16 Posted: 4/26/2014 8:24:15 AM
Russia ☭ forever, Viacheslav N. Mezentsev
#17 Posted: 4/26/2014 12:00:06 PM
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Davide Carpi 4/26/2014 12:29:00 PM
#18 Posted: 4/27/2014 12:47:38 PM
An high-productively hint to anyone that want to use this useful extension but (like me) does not have a keyboard with the backtick/backquote (grave accent) symbol:
1. Download the AutoHotKey free tool (full-installation or portable, both for 32 and 64 bit machines) (link)
2. Unzip and launch the script attached here (with the portable app you can drag the file over the executable)
This script enable the following shortcuts:
- hold down the Windows Key and press ' to produce the backtick `
- hold down the Windows Key and press numbers to produce numpad numbers (this is useful on notebook w/o numpad)
Best regards,
Davide
P.S. the script can be customized to change the keys combinations and can be launched automatically on windows startup.
edit: the 2nd attachment "shortcuts_exe.zip" is a portable executable compiled from the script that enable the features described above without downloading the tool and the script.
shortcuts_exe.zip (793 KiB) downloaded 78 time(s).
1. Download the AutoHotKey free tool (full-installation or portable, both for 32 and 64 bit machines) (link)
2. Unzip and launch the script attached here (with the portable app you can drag the file over the executable)
This script enable the following shortcuts:
- hold down the Windows Key and press ' to produce the backtick `
- hold down the Windows Key and press numbers to produce numpad numbers (this is useful on notebook w/o numpad)
Best regards,
Davide
P.S. the script can be customized to change the keys combinations and can be launched automatically on windows startup.
edit: the 2nd attachment "shortcuts_exe.zip" is a portable executable compiled from the script that enable the features described above without downloading the tool and the script.
shortcuts_exe.zip (793 KiB) downloaded 78 time(s).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#19 Posted: 4/28/2014 5:16:52 AM
Russia ☭ forever, Viacheslav N. Mezentsev
#20 Posted: 4/29/2014 9:59:54 AM
Hi, I've seen the autohotkey script shared by Davide in this thread and thought that this .ahk might be of interest for someone, place the mouse over the screen top to bring it up. You can add other symbols by editing the script.
charsbar.zip (1 KiB) downloaded 87 time(s).
charsbar.zip (1 KiB) downloaded 87 time(s).
-
New Posts
-
No New Posts