Transforming a list structure in Softanza

51 views
Skip to first unread message

Mansour Ayouni

unread,
Nov 20, 2022, 8:57:10 PM11/20/22
to The Ring Programming Language
Hello All,

Softanza is made by design to support data analytics and data science applications.

Usually data preparation is required to transform the structure of the data so it becomes computable by whatever statistic or machine learning algorithm we need to use...

In this example, I show you how it is easy to transform a hybrid list of numbers and pairs of numbers, to a pure list of pairs of numbers. Hence, the following list: [ 0, 2, 0, 3, [1,2] ], would become: [ [ 0, 0 ], [ 2, 2 ], [ 0, 0 ], [ 3, 3 ], [ 1, 2 ] ].


As you see, the existent pairs are left as they are ([1,2] here), and each number is duplicated inside a list of two items: 0 becomes [0, 0], 2 becomes [2, 2] and so one.


To do it in Softanza, we will translate the logic above into near-natural language code, using the PerformW() function that executes a conditional action on each item of the list, and RepeatedInAPair() that turns a value into a pair of that value!


Here is the code, it's just self-explanatory:

o1 = new stzList([ 0, 2, 0, 3, [1,2] ]) 
o1.PerformW(
        :do = '{ @item = Q(@item).RepeatInAPair() }',
        :if = '{ Q(@item).IsANumber() }'
)
? @@S(o1.Content())
#--> [ [ 0, 0 ], [ 2, 2 ], [ 0, 0 ], [ 3, 3 ], [ 1, 2 ] ]

And here is the sample running in my Ring NotePad: 

image.png
All the best,
Mansour

Mahmoud Fayed

unread,
Nov 22, 2022, 5:35:03 PM11/22/22
to The Ring Programming Language
Hello Mansour

Thanks for sharing, but the sample looks like a rare case (not common in practical)
Building the library around many of these cases, will consume a lot of your time and delay the release date without getting too much benefit

You are doing a work of art, which is GREAT and I am looking for it to be in a usable state ASAP

Suggestions

(1)  Have a different look at the library and determine the important features and separate it from the rare features, and in the first release just focus on the important features. Since the library is written in Ring, it's better to provide the first release then get contributions from others Instead of going a long way alone, where you end up with a huge library that have many features and no one uses it except you because of the huge learning curve

(2) Instead of sending messages in the Group about the library - It's more important to improve the README.md file in GitHub:  https://github.com/mayouni/SoftanzaLib and update the package (for ringpm) - And write the documentation along the development

(3) Don't use simple examples that doesn't demonstrates the power of the library - Your example could be written in a Ring code like this without any library!

aList = [ 0, 2, 0, 3, [1,2] ]
for item in aList
    if isNumber(item) newItem = [item,item]   item=newItem ok
next

And if the developer need this in many parts of the project - A simple function will be written
It's just the knowledge about (for in loop) and (isNumber() function)

No need to know PerformW() function, or @item and Q(@item) or :do or :if
And you still use isANumber() method in your example

This is not attractive (The library is too much better than this)

Greetings,
Mahmoud

Mansour Ayouni

unread,
Nov 22, 2022, 7:19:58 PM11/22/22
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

Thank you for this mail. It helps in clarifying things to you relying on your patience and your big heart.

Thanks for sharing,
Thank you to you for your kind words.

but the sample looks like a rare case (not common in practical)
Yes, from the perspective of a basic algorithmic need. But for those who have experience with data analytics applications, and starve to writing complex scripts dumpty with for loops and if/thens, to clean the data and transform it to usable data structures... They know that this is so common in practice.

Data analytics, along with text processing applications, is one of my main target domains of  Softanza, because this is what I'm doing in practice in my professional work.

You are doing a work of art, which is GREAT and I am looking for it to be in a usable state ASAP
Thank you Mahmoud! I'm totally aware of that. And please note that I'm working just on that, and that the samples I'm posting are not new additions as you may think. I'm taking time, that's true, but please think of the time it takes you before you decide to deliver your next PWCT release... Same here.

Have a different look at the library and determine the important features and separate it from the rare features
Thank you for this advice. Months ago, 44 classes were moved out of focus (in the FUTURE folder). The remaining ones form the core of the library I'm working on.

It's better to provide the first release then get contributions from others
 Yes, contributions will be welcomed. And I'm working on the foundation to enable just that.

where you end up with a huge library that have many features and no one uses it except you 
I'm providing this project as a contribution to Ring, but I will not be disappointed if I will be its sole user and maybe I should explain to you why...

Softanza and the upcoming libraries I'll be working on after it, are part of a life-long project of developing a computational model for one of the most interesting texts in human-kind history, the Holy Quran.

Many of the features are designed to undertake computer-driven explorations of the quranic universe, both at the linguistic/semantic level, the formal/logical level, and the statistical/symbolic level.

In such a high challenge, a solo programmer who has no institutional or financial support from anybody, can not but go slowly and take time in achieving every step.

because of the huge learning curve
Actually, there is a little learning curve in Softanza. The rule is simple: think of the problem naturally, and then translate it in near-natural code. That's it.

The group of users I'm working with are very happy with it, and none of them is a plain old programmer.

Instead of sending messages in the Group about the library
I'm sorry if you feel like I am spamming the world with my messages; this was never my aim. My aim, like you could find in all the examples I posted, was to share a different perspective on solving algorithmic problems with a near-natural code, enabled by Softanza.

For sure, I'll be reviewing this choice.

It's more important to improve the README.md file
Yes this is important, indeed.

And write the documentation along the development
I'm doing just this. The content I'm posting in the group is mainly part of the documentation that I thought it would be useful to share with you.

Don't use simple examples that doesn't demonstrates the power of the library
You may be right. I would say that giving simple examples is good but insufficient to demonstrate the need for using a powerful function like PerfomW().

I have some samples that show how this function solves a problem that takes 18 lines of Ring code, containing 1 class, 2 functions, and 5 instances of for loops, with only one 1 to 3 lines of code.

No need to know PerformW() function, or @item and Q(@item) or :do or :if
These keywords are part of a very easy macro-language for writing conditional code in Softanza. Learning them takes no more than 10 minutes. Using them avoids for loops entirely from the codebase. It enables the programmer to embrace the copy-on-write discipline without a hassle. To cite just a few.

This is not attractive (The library is too much better than this)
Thank you for your kind words! The ...W() series of functions, when you get them and understand their use, are one of the most powerful features in the library.

Hopefully, the documentation will clarify all of that.

Sincerly,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ring-lang/a87c8d84-0738-4e18-adad-2a14710cda4fn%40googlegroups.com.

Mahmoud Fayed

unread,
Nov 22, 2022, 8:18:52 PM11/22/22
to The Ring Programming Language
Hello Mansour

>> "I'm taking time, that's true, but please think of the time it takes you before you decide to deliver your next PWCT release... Same here."

The situation is different, You don't need to apply the same strategy used for PWCT 2
PWCT already exist (First generation from 1.0 to 1.9) - During this generation, many releases are developed in short time to get early feedback
Spending too much time in PWCT 2.0 is not a problem, because we already have PWCT 1 - And the ideas are already tested
And I hope that PWCT 2.0 will not suffer from the Second-system effect: https://en.wikipedia.org/wiki/Second-system_effect

In Softanza, What I am suggesting is doing what I have already did for PWCT 1

>> "can not but go slowly and take time in achieving every step."

You can go faster with the help of others, once You shared Softanza in GitHub, I tried to contribute, Also other members in the group tried to help in testing it
My suggestions about the README.md & Documentation - Is just for this (To be able to contribute and promote the library)

>> "I'm sorry if you feel like I am spamming the world with my messages; this was never my aim."
Ring is your project, You are a member in Ring Team, and Ring Group is your group, You have the complete freedom and permissions to post about anything and The point is : I am interested in your project and I am reading every message your write, and I try to reply with my point of view to help the project go forward faster

When I talked about writing README.md is more important than posting the Group
I mean the effort is similar, but by doing this we can take a step forward and announce the project in Ring Website (News Section)
I was waiting for this from long time, once I reviewed the samples that you shared in the group from long time
I know you have everything ready to write a great readme file & nice documentation the cover the ready features

You already did a GREAT WORK, You don't have to do to much more to shape it in a ready produce (Useful Features + Documentation + Testing)

And finally these are just (suggestions) because I like the project and I care about it, And I think you already did nice things that can be released (No need to wait more or still the loop of adding more features) - This library after testing & good documentation will be a nice replacement for StdLib that comes with Ring

Greetings,
Mahmoud

Mansour Ayouni

unread,
Nov 22, 2022, 8:39:06 PM11/22/22
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud!

You are right. Things must be packaged and shared quickly...

l'll manage that.

All the best.
Mansour.

Bert Mariani

unread,
Nov 22, 2022, 9:59:26 PM11/22/22
to The Ring Programming Language
Hello Mansour

Softanza seems to be a Huge project with loads of Features.
The suggestion is to release a Basic and Compact version 1.0 with a limited number of Features, at first (quick rollout) 
This will get interested people to learn it, use it, test it, and report any bugs.
Additional Features can be added it subsequent versions.  
(Avoiding software bloat. Many powerful apps have removed rarely used features. ex. Excel))

Mansour Ayouni

unread,
Nov 23, 2022, 3:29:59 AM11/23/22
to Bert Mariani, The Ring Programming Language
Hello Bert,
You are right. All I'm focusing on is just 30% of what was planned initially. Hopefully the first release can be packaged soon.
All the best,
Mansour

Reply all
Reply to author
Forward
0 new messages