SMath Studio Forum
»
SMath Studio
»
Samples
»
Language-Integrated Query (Linq)
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
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, ...). Edited by user 28 October 2014 20:41:26(UTC)
| Reason: Not specified File Attachment(s): uni attached the following image(s): |
Russia ☭ forever Viacheslav N. Mezentsev |
5 users thanked uni for this useful post.
|
on 25/04/2014(UTC), on 25/04/2014(UTC), on 25/04/2014(UTC), on 25/04/2014(UTC), on 29/08/2016(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
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 ;-) |
|
|
|
|
Rank: Administration Groups: Registered, Advanced Member Joined: 23/06/2009(UTC) Posts: 1,740 Was thanked: 318 time(s) in 268 post(s)
|
I totally forgot that this is possible in SMath f(x,`):`(x)^2 f(x:6,`(x):x)=36f(y:7,`(x):x+1)=64Uni used quite unusual character for a function name (`). I forgot this as well (making a function argument call by value) f(x):line(x:9,x^2,2,1)a:100f(a)=81a=9Contrary to b:100f(b:=81b=100Regards, Radovan Edited by user 25 April 2014 11:01:24(UTC)
| Reason: Not specified |
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!" |
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,647 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
Very nice functions Viacheslav I think that also contains() should contains a break to maximize the performances. Originally Posted by: omorr I totally forgot that this is possible in SMath Sometimes happens Edited by user 25 April 2014 12:03:27(UTC)
| Reason: Not specified |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
1 user thanked Davide Carpi for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
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. |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Updated. Small improvements. P.S. Here, the aggregate function is implemented not correctly. Edited by user 25 April 2014 15:25:32(UTC)
| Reason: Not specified uni attached the following image(s): |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 17/01/2013(UTC) Posts: 296 Location: Khabarovsk, Russia Was thanked: 151 time(s) in 107 post(s)
|
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...) |
Best regards, Mike Kaganski |
2 users thanked mikekaganski for this useful post.
|
on 25/04/2014(UTC), on 25/04/2014(UTC)
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Updated. aggregate() - fixed. uni attached the following image(s): |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 25/09/2013(UTC) Posts: 325 Location: IL Was thanked: 19 time(s) in 17 post(s)
|
I'm not sure if it is worth your time to explain but what is this? Why is it beneficial? Sorry for my ignorance.
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
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. Edited by user 25 April 2014 19:35:50(UTC)
| Reason: Not specified |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,647 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
Originally Posted by: RFreund I'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) Edited by user 25 April 2014 19:58:55(UTC)
| Reason: Not specified |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Updated. Unfortunatelly, nested queries not supported. Edited by user 26 April 2014 00:52:25(UTC)
| Reason: Not specified uni attached the following image(s): |
Russia ☭ forever Viacheslav N. Mezentsev |
2 users thanked uni for this useful post.
|
on 26/04/2014(UTC), on 26/04/2014(UTC)
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Plot example. |
Russia ☭ forever Viacheslav N. Mezentsev |
2 users thanked uni for this useful post.
|
on 26/04/2014(UTC), on 26/04/2014(UTC)
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
selectmany example. |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
ODE plot. |
Russia ☭ forever Viacheslav N. Mezentsev |
2 users thanked uni for this useful post.
|
on 26/04/2014(UTC), on 26/04/2014(UTC)
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Updated. join(5) added. File Attachment(s): uni attached the following image(s): |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Updated. batch(2), batch(3) added. File Attachment(s): uni attached the following image(s): |
Russia ☭ forever Viacheslav N. Mezentsev |
1 user thanked uni for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,647 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
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. Edited by user 27 April 2014 21:15:22(UTC)
| Reason: Not specified |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
|
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 30/03/2011(UTC) Posts: 393
Was thanked: 132 time(s) in 113 post(s)
|
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. Edited by user 29 April 2014 17:02:29(UTC)
| Reason: Not specified
|
|
|
|
SMath Studio Forum
»
SMath Studio
»
Samples
»
Language-Integrated Query (Linq)
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.