Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


2 Pages12>
Options
Go to last post Go to first unread
Offline uni  
#1 Posted : 25 April 2014 06:03:35(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

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):
Linq. Examples.sm (38kb) downloaded 98 time(s).
uni attached the following image(s):
2014-04-26 02-05-06 Менеджер расширений.png
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 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)

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline mkraska  
#2 Posted : 25 April 2014 09:59:17(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

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 ;-)
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline omorr  
#3 Posted : 25 April 2014 10:42:57(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
I totally forgot that this is possible in SMath Shok

f(x,`):`(x)^2

f(x:6,`(x):x)=36

f(y:7,`(x):x+1)=64

Uni used quite unusual character for a function name (`).

I forgot this as well (making a function argument call by value) Shok


f(x):line(x:9,x^2,2,1)

a:100
f(a)=81
a=9

Contrary to


b:100
f(b:Cool=81
b=100

Regards,
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!"
Offline Davide Carpi  
#4 Posted : 25 April 2014 11:59:06(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
Very nice functions Viacheslav Good

I think that also contains() should contains a break to maximize the performances.


Originally Posted by: omorr Go to Quoted Post
I totally forgot that this is possible in SMath Shok

Sometimes happens Biggrin

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
thanks 1 user thanked Davide Carpi for this useful post.
on 25/04/2014(UTC)
Offline uni  
#5 Posted : 25 April 2014 12:25:22(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

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 Good 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
thanks 1 user thanked uni for this useful post.
on 25/04/2014(UTC)
Offline uni  
#6 Posted : 25 April 2014 13:30:30(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

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):
2014-04-25 17-15-58 SMath Studio Desktop - [Linq.sm].png
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 25/04/2014(UTC)
Offline mikekaganski  
#7 Posted : 25 April 2014 15:17:32(UTC)
mikekaganski


Rank: Advanced Member

Groups: Registered
Joined: 17/01/2013(UTC)
Posts: 296
Man
Russian Federation
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
thanks 2 users thanked mikekaganski for this useful post.
on 25/04/2014(UTC),  on 25/04/2014(UTC)
Offline uni  
#8 Posted : 25 April 2014 15:58:34(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Updated. aggregate() - fixed.
uni attached the following image(s):
2014-04-25 18-57-10 SMath Studio Desktop - [Linq.sm].png
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 25/04/2014(UTC)
Offline RFreund  
#9 Posted : 25 April 2014 18:34:29(UTC)
RFreund


Rank: Advanced Member

Groups: Registered
Joined: 25/09/2013(UTC)
Posts: 325
United States
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.
Offline uni  
#10 Posted : 25 April 2014 19:27:11(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

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
thanks 1 user thanked uni for this useful post.
on 25/04/2014(UTC)
Offline Davide Carpi  
#11 Posted : 25 April 2014 19:52:33(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
Location: Italy

Was thanked: 1329 time(s) in 875 post(s)
Originally Posted by: RFreund Go to Quoted Post
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
Offline uni  
#12 Posted : 26 April 2014 00:49:29(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

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):
2014-04-26 03-47-40 SMath Studio Desktop - [Linq. Plot.sm].png
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 2 users thanked uni for this useful post.
on 26/04/2014(UTC),  on 26/04/2014(UTC)
Offline uni  
#13 Posted : 26 April 2014 01:57:58(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Plot example.

File Attachment(s):
Linq. Plot.sm (8kb) downloaded 40 time(s).
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 2 users thanked uni for this useful post.
on 26/04/2014(UTC),  on 26/04/2014(UTC)
Offline uni  
#14 Posted : 26 April 2014 02:22:45(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
selectmany example.

File Attachment(s):
Linq. selectmany.sm (8kb) downloaded 42 time(s).
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 26/04/2014(UTC)
Offline uni  
#15 Posted : 26 April 2014 03:43:19(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
ODE plot.

File Attachment(s):
Linq. ODE plot.sm (11kb) downloaded 44 time(s).
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 2 users thanked uni for this useful post.
on 26/04/2014(UTC),  on 26/04/2014(UTC)
Offline uni  
#16 Posted : 26 April 2014 15:24:15(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Updated. join(5) added.
File Attachment(s):
Linq. join.sm (9kb) downloaded 42 time(s).
uni attached the following image(s):
2014-04-26 19-18-40 SMath Studio Desktop - [Linq. join.sm].png
Russia ☭ forever
Viacheslav N. Mezentsev
Offline uni  
#17 Posted : 26 April 2014 19:00:06(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Updated. batch(2), batch(3) added.
File Attachment(s):
Linq. batch.sm (10kb) downloaded 41 time(s).
uni attached the following image(s):
2014-04-26 21-58-08 SMath Studio Desktop - [Linq. batch.sm].png
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 26/04/2014(UTC)
Offline Davide Carpi  
#18 Posted : 27 April 2014 19:47:38(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,647
Man
Italy
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

File Attachment(s):
shortcuts.zip (1kb) downloaded 39 time(s).
shortcuts_exe.zip (794kb) downloaded 39 time(s).
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline uni  
#19 Posted : 28 April 2014 12:16:52(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,494
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
MC15 works much faster.
File Attachment(s):
Mathcad - Linq.pdf (71kb) downloaded 77 time(s).
Russia ☭ forever
Viacheslav N. Mezentsev
Offline kilele  
#20 Posted : 29 April 2014 16:59:54(UTC)
kilele


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

File Attachment(s):
charsbar.zip (2kb) downloaded 46 time(s).
Users browsing this topic
Guest
2 Pages12>
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.