SlideShare una empresa de Scribd logo
1 de 39
Descargar para leer sin conexión
introduction to


102 - MemeScript
                           Prerequisites

                           101 - Hello Meme IDE
1




Contents
2    MemeScript Example                         21   Naming Conventions
3    Meme IDE Function Editor                   22   Defining an Address Record
4    Primitive Types                            23   Adding List of Addresses to Person
5    Declaring Integer Variables                24   Creating a Person Record
6    Declaring Decimal Variables                25   ‘Dot’ Notation
7    Declaring Boolean Variables                26   String Concatenation
8    Declaring Strings                          27   String Comparison
9    Default Initializations                    28   String Utilities
10   Pre-defined Complex Types                  29   Collections
11   IF                                         30   INSERT
12   IF/ELSE                                    31   Collections and {}
13   IF/ELSEIF/ELSE                             32   Removing from a Collection
14   WHILE                                      33   Date and Time Types
15   FOR                                        34   Date and Time Arithmetics
16   Arithmetic                                 35   Date and Time Utilities
17   Logical Operations                         36   Date Formatting
18   Dataspace                                  37   Time Formatting
19   Defining a ‘Person’ Record                 38   Other Free Tutorials
20   Adding Attributes to the ‘Person’ Record
2




MemeScript Example
   var x = 10;

   var y = 20;

   var z : Integer;

   z = x + y;

   notify(z);
3




Meme IDE Function Editor
4




Primitive Types
•	
 Integer 10, -234

•	
 Decimal 1.23

•	
 String “ABC”

•	
 Boolean true, false
5




Declaring Integer Variables
Local variables within functions


var x : Integer;
var x2 = 1;
6




Declaring Decimal Variables
var d : Decimal(2);
var d2 = 1.23;
7




Declaring Boolean Variables
var b : Boolean;
var b2 = true;
8




Declaring Strings
var s : String;
var s = “abc”;
9




Default Initializations
•	String - empty string “”
•	Integer and Decimal – 0
•	Boolean – false
10




Pre-defined Complex Types
•	 Date – day, month, year
•	 Time – hour, minute, second
•	 Duration – hour, minute, second
•	 Timestamp
11




IF
var a = 15;
if (a > 10)
{
  notify(“A is big”);
}
12




IF / ELSE
var a = 15;
if (a > 10)
{
  notify(“A is big”);
}
else
{
  notify(“A is small”);
}
13




IF / ELSEIF / ELSE
var a = 15;
if (a > 10)
{
  notify(“A   is big”);
}
elseif (a >   5)
{
  notify(“A   is medium sized”);
}
else
{
  notify(“A   is small”);
}
14




WHILE
var x = 0;
while (x < 10)
{
  x++;
  // do other things
}
15




FOR
var names : String[];
append(names, “Simon”);
append(names, “Graham”);
append(names, “Joe”);
for (name in names)
{
  notify(name);
}
16




Arithmetic
var c = 20;
f = c * (9.0 / 5.0) + 32;
notify(f);
17




Logical Operators
var x = 10;
if ((x > 10) and not (x > 20))
{
  notify(“x is middle sized”);
}
18




Dataspace
19



Defining a ‘Person’ Record
20



Adding Attributes to the ‘Person’ Record
21




Naming Conventions
Record Type Names
•	 bumpy case with initial uppercase,
     e.g. Person or EmployeeDetails

Attribute names in records
•	 bumpy case with initial lowercase
     e.g. name or firstName
22




Defining an Address Record
23




Adding List of Addresses to Person
24




Creating a Person Record
var p : Person;
var a : Address;
a.line1 = “12 High St”;
a.zip = “PA 12345”;
p.name = “Simon”;
p.tel = “1234567”;
append(p.addresses, a);
25




‘Dot’ Notation
notify(p.addresses[0].line1);

p.addresses[0].line1 = “13 High St”
26




String Concatenation

var   s1 = “The Start”
var   s2 = “The Middle”
var   s3 = “The End”
var   result = s1 + “, “ + s2 + “, “ + s3 + “. “
+ 3   + “ parts.”;


The Start, The Middle, The End. 3 parts.
27




String Comparison
var s1 = “String 1”;
var s2 = “String ONE”;
if (s1 == s2)
{
  notify(“Yes”);
}
28




String Utilities
•	 Boolean startsWith(sourceString, matchString)
•	 Boolean endsWith(sourceString, matchString)
•	 String subString(sourceString, startPos, length)
•	 Integer size(sourceString)
•	 String toLower(sourceString)
•	 String toUpper(sourceString)
•	 String trim(sourceString)
•	 String replaceAll(sourceString, matchString, replacementString)
•	 String replaceFirst(sourceString, matchString, replacementString)
•	 String replaceLast(sourceString, matchString, replacementString)
29




Collections
var people : Person[];
var names : String[];
append(names, “Simon”);
append(names, “Graham”);
30




INSERT
var people : Person[];
var names : String[];
append(names, “Simon”);
append(names, “Graham”);
insert(names, “Joe”, 0);
31




Collections and []
var people : Person[];
var fred : Person;
simon.name = “Simon”;
simon.tel = “12345”;
people.append(simon);
var graham : Person;
graham.name = “Simon”;
graham.tel = “12345”;
people.append(graham);

people.remove(simon);
32




Removing from a Collection
var people : Person[];
var simon : Person;
simon.name = “Simon”;
simon.tel = “12345”;
people.append(simon);
var graham : Person;
graham.name = “Simon”;
graham.tel = “12345”;
people.append(graham);

notify(people[1].name);
33




Date and Time Types
•	 Date - day, month, year
•	 Time - hour, minute, second
•	 Duration - hour, minute, second
•	 Timestamp
34




Date and Time Arithmetic
var t : Time;
t = timeNow();

var dt : Duration;
dt.hour = 1;
t = addTime(t, dt);
35




Date and Time Utilities
•	 dateNow()
•	 timeNow()
•	 setDate(Date, year, month, day)
•	 setTime(Time, hour, min, sec)
•	 addDays(Date, days)
•	 dayOfWeek(Date)
•	 monthOfYear(Date)
•	 formatDate(Date, formatString)
•	 formatTime(Time, formatString)
•	 formatTimestamp(Timestamp, String)
36




Date Formatting
Code      Description                                          Result
d          Day of the month without leading zero               “1”
dd         Day of the month with leading zero                  “01”
ddd        The localised name for the day of the week          “Sunday”
m          Month of the yearwithout leading zero               “1”
mm         Month of the year with leading zero                 “01”
mmm        The localised short (3 letter) name for the month   “Jan”
mmmm       The localised full name for the month               “January”
yy         The year as two digits                              “10”
yyyy       The year as four digits                             “2010”

var today : Date;
today = dateNow();
formatDate(today, “mmm d, yyyy”);
“January 1, 2011”
37




  Time Formatting
Code       Description                                    Example Result
HHH        Hour in 24 hour format with leading zero       19
HH         Hour in 24 hour format with leading zero       08
H          Hour in 12 hour format without leading zeros   8
MM         Minute with leading zero                       05
M          Minute without leading zero                    5
SS         Seconds with leading zero                      09
S          Seconds without leading zero                   9
PP         am/pm indicator                                am


  var t : Time;
  t = timeNow();
  formatTime(t, “HH:MM:SS PP”);

  “12:34:10 am”
38




Please check   www.memeapps.com for more free tutorials in the developers center
Level one:

101 - Hello World Hello Meme IDE

102 - Introduction to MemeScript Language
103 - Meme IDE Fundamentals


201 - Records and Record Types
202 - Designing Business Apps
203 - Advanced MemeScript

301 - MemeApps and Communications
302 - MemeApps advanced User Interfaces
303 - MemeApps and Persistence

Más contenido relacionado

Similar a MemeScript Language

Ur Domain Haz Monoids DDDx NYC 2014
Ur Domain Haz Monoids DDDx NYC 2014Ur Domain Haz Monoids DDDx NYC 2014
Ur Domain Haz Monoids DDDx NYC 2014Cyrille Martraire
 
Why learn new programming languages
Why learn new programming languagesWhy learn new programming languages
Why learn new programming languagesJonas Follesø
 
Slides Vba Mamb
Slides Vba MambSlides Vba Mamb
Slides Vba Mambmaretec
 
Introduction to programming - class 11
Introduction to programming - class 11Introduction to programming - class 11
Introduction to programming - class 11Paul Brebner
 
A scrupulous code review - 15 bugs in C++ code
A scrupulous code review - 15 bugs in C++ codeA scrupulous code review - 15 bugs in C++ code
A scrupulous code review - 15 bugs in C++ codePVS-Studio LLC
 
(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and ProtobufGuido Schmutz
 
Reducing Development Time with MongoDB vs. SQL
Reducing Development Time with MongoDB vs. SQLReducing Development Time with MongoDB vs. SQL
Reducing Development Time with MongoDB vs. SQLMongoDB
 
Well Grounded Python Coding - Revision 1 (Day 1 Slides)
Well Grounded Python Coding - Revision 1 (Day 1 Slides)Well Grounded Python Coding - Revision 1 (Day 1 Slides)
Well Grounded Python Coding - Revision 1 (Day 1 Slides)Worajedt Sitthidumrong
 
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)Worajedt Sitthidumrong
 
The Ring programming language version 1.6 book - Part 25 of 189
The Ring programming language version 1.6 book - Part 25 of 189The Ring programming language version 1.6 book - Part 25 of 189
The Ring programming language version 1.6 book - Part 25 of 189Mahmoud Samir Fayed
 
Learning to code with Python! (Microsoft Virtual Academy).pptx
Learning to code with Python! (Microsoft Virtual Academy).pptxLearning to code with Python! (Microsoft Virtual Academy).pptx
Learning to code with Python! (Microsoft Virtual Academy).pptxJoshuaJoseph70
 
Learning to code with Python! (MVA).pptx
Learning to code with Python! (MVA).pptxLearning to code with Python! (MVA).pptx
Learning to code with Python! (MVA).pptxJoshuaJoseph70
 
Instruction Set Architecture: MIPS
Instruction Set Architecture: MIPSInstruction Set Architecture: MIPS
Instruction Set Architecture: MIPSPrasenjit Dey
 
The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31Mahmoud Samir Fayed
 
Transitioning from SQL to MongoDB
Transitioning from SQL to MongoDBTransitioning from SQL to MongoDB
Transitioning from SQL to MongoDBMongoDB
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScriptGarth Gilmour
 
The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212Mahmoud Samir Fayed
 

Similar a MemeScript Language (20)

Ur Domain Haz Monoids DDDx NYC 2014
Ur Domain Haz Monoids DDDx NYC 2014Ur Domain Haz Monoids DDDx NYC 2014
Ur Domain Haz Monoids DDDx NYC 2014
 
Why learn new programming languages
Why learn new programming languagesWhy learn new programming languages
Why learn new programming languages
 
Slides Vba Mamb
Slides Vba MambSlides Vba Mamb
Slides Vba Mamb
 
P2 2017 python_strings
P2 2017 python_stringsP2 2017 python_strings
P2 2017 python_strings
 
Python
PythonPython
Python
 
Introduction to programming - class 11
Introduction to programming - class 11Introduction to programming - class 11
Introduction to programming - class 11
 
A scrupulous code review - 15 bugs in C++ code
A scrupulous code review - 15 bugs in C++ codeA scrupulous code review - 15 bugs in C++ code
A scrupulous code review - 15 bugs in C++ code
 
(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf(Big) Data Serialization with Avro and Protobuf
(Big) Data Serialization with Avro and Protobuf
 
Reducing Development Time with MongoDB vs. SQL
Reducing Development Time with MongoDB vs. SQLReducing Development Time with MongoDB vs. SQL
Reducing Development Time with MongoDB vs. SQL
 
Well Grounded Python Coding - Revision 1 (Day 1 Slides)
Well Grounded Python Coding - Revision 1 (Day 1 Slides)Well Grounded Python Coding - Revision 1 (Day 1 Slides)
Well Grounded Python Coding - Revision 1 (Day 1 Slides)
 
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
Well Grounded Python Coding - Revision 1 (Day 1 Handouts)
 
The Ring programming language version 1.6 book - Part 25 of 189
The Ring programming language version 1.6 book - Part 25 of 189The Ring programming language version 1.6 book - Part 25 of 189
The Ring programming language version 1.6 book - Part 25 of 189
 
Learning to code with Python! (Microsoft Virtual Academy).pptx
Learning to code with Python! (Microsoft Virtual Academy).pptxLearning to code with Python! (Microsoft Virtual Academy).pptx
Learning to code with Python! (Microsoft Virtual Academy).pptx
 
Learning to code with Python! (MVA).pptx
Learning to code with Python! (MVA).pptxLearning to code with Python! (MVA).pptx
Learning to code with Python! (MVA).pptx
 
Instruction Set Architecture: MIPS
Instruction Set Architecture: MIPSInstruction Set Architecture: MIPS
Instruction Set Architecture: MIPS
 
The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31The Ring programming language version 1.5 book - Part 3 of 31
The Ring programming language version 1.5 book - Part 3 of 31
 
Transitioning from SQL to MongoDB
Transitioning from SQL to MongoDBTransitioning from SQL to MongoDB
Transitioning from SQL to MongoDB
 
Python training for beginners
Python training for beginnersPython training for beginners
Python training for beginners
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
 
The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212The Ring programming language version 1.10 book - Part 22 of 212
The Ring programming language version 1.10 book - Part 22 of 212
 

Último

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 

Último (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 

MemeScript Language

  • 1. introduction to 102 - MemeScript Prerequisites 101 - Hello Meme IDE
  • 2. 1 Contents 2 MemeScript Example 21 Naming Conventions 3 Meme IDE Function Editor 22 Defining an Address Record 4 Primitive Types 23 Adding List of Addresses to Person 5 Declaring Integer Variables 24 Creating a Person Record 6 Declaring Decimal Variables 25 ‘Dot’ Notation 7 Declaring Boolean Variables 26 String Concatenation 8 Declaring Strings 27 String Comparison 9 Default Initializations 28 String Utilities 10 Pre-defined Complex Types 29 Collections 11 IF 30 INSERT 12 IF/ELSE 31 Collections and {} 13 IF/ELSEIF/ELSE 32 Removing from a Collection 14 WHILE 33 Date and Time Types 15 FOR 34 Date and Time Arithmetics 16 Arithmetic 35 Date and Time Utilities 17 Logical Operations 36 Date Formatting 18 Dataspace 37 Time Formatting 19 Defining a ‘Person’ Record 38 Other Free Tutorials 20 Adding Attributes to the ‘Person’ Record
  • 3. 2 MemeScript Example var x = 10; var y = 20; var z : Integer; z = x + y; notify(z);
  • 5. 4 Primitive Types • Integer 10, -234 • Decimal 1.23 • String “ABC” • Boolean true, false
  • 6. 5 Declaring Integer Variables Local variables within functions var x : Integer; var x2 = 1;
  • 7. 6 Declaring Decimal Variables var d : Decimal(2); var d2 = 1.23;
  • 8. 7 Declaring Boolean Variables var b : Boolean; var b2 = true;
  • 9. 8 Declaring Strings var s : String; var s = “abc”;
  • 10. 9 Default Initializations • String - empty string “” • Integer and Decimal – 0 • Boolean – false
  • 11. 10 Pre-defined Complex Types • Date – day, month, year • Time – hour, minute, second • Duration – hour, minute, second • Timestamp
  • 12. 11 IF var a = 15; if (a > 10) { notify(“A is big”); }
  • 13. 12 IF / ELSE var a = 15; if (a > 10) { notify(“A is big”); } else { notify(“A is small”); }
  • 14. 13 IF / ELSEIF / ELSE var a = 15; if (a > 10) { notify(“A is big”); } elseif (a > 5) { notify(“A is medium sized”); } else { notify(“A is small”); }
  • 15. 14 WHILE var x = 0; while (x < 10) { x++; // do other things }
  • 16. 15 FOR var names : String[]; append(names, “Simon”); append(names, “Graham”); append(names, “Joe”); for (name in names) { notify(name); }
  • 17. 16 Arithmetic var c = 20; f = c * (9.0 / 5.0) + 32; notify(f);
  • 18. 17 Logical Operators var x = 10; if ((x > 10) and not (x > 20)) { notify(“x is middle sized”); }
  • 21. 20 Adding Attributes to the ‘Person’ Record
  • 22. 21 Naming Conventions Record Type Names • bumpy case with initial uppercase, e.g. Person or EmployeeDetails Attribute names in records • bumpy case with initial lowercase e.g. name or firstName
  • 24. 23 Adding List of Addresses to Person
  • 25. 24 Creating a Person Record var p : Person; var a : Address; a.line1 = “12 High St”; a.zip = “PA 12345”; p.name = “Simon”; p.tel = “1234567”; append(p.addresses, a);
  • 27. 26 String Concatenation var s1 = “The Start” var s2 = “The Middle” var s3 = “The End” var result = s1 + “, “ + s2 + “, “ + s3 + “. “ + 3 + “ parts.”; The Start, The Middle, The End. 3 parts.
  • 28. 27 String Comparison var s1 = “String 1”; var s2 = “String ONE”; if (s1 == s2) { notify(“Yes”); }
  • 29. 28 String Utilities • Boolean startsWith(sourceString, matchString) • Boolean endsWith(sourceString, matchString) • String subString(sourceString, startPos, length) • Integer size(sourceString) • String toLower(sourceString) • String toUpper(sourceString) • String trim(sourceString) • String replaceAll(sourceString, matchString, replacementString) • String replaceFirst(sourceString, matchString, replacementString) • String replaceLast(sourceString, matchString, replacementString)
  • 30. 29 Collections var people : Person[]; var names : String[]; append(names, “Simon”); append(names, “Graham”);
  • 31. 30 INSERT var people : Person[]; var names : String[]; append(names, “Simon”); append(names, “Graham”); insert(names, “Joe”, 0);
  • 32. 31 Collections and [] var people : Person[]; var fred : Person; simon.name = “Simon”; simon.tel = “12345”; people.append(simon); var graham : Person; graham.name = “Simon”; graham.tel = “12345”; people.append(graham); people.remove(simon);
  • 33. 32 Removing from a Collection var people : Person[]; var simon : Person; simon.name = “Simon”; simon.tel = “12345”; people.append(simon); var graham : Person; graham.name = “Simon”; graham.tel = “12345”; people.append(graham); notify(people[1].name);
  • 34. 33 Date and Time Types • Date - day, month, year • Time - hour, minute, second • Duration - hour, minute, second • Timestamp
  • 35. 34 Date and Time Arithmetic var t : Time; t = timeNow(); var dt : Duration; dt.hour = 1; t = addTime(t, dt);
  • 36. 35 Date and Time Utilities • dateNow() • timeNow() • setDate(Date, year, month, day) • setTime(Time, hour, min, sec) • addDays(Date, days) • dayOfWeek(Date) • monthOfYear(Date) • formatDate(Date, formatString) • formatTime(Time, formatString) • formatTimestamp(Timestamp, String)
  • 37. 36 Date Formatting Code Description Result d Day of the month without leading zero “1” dd Day of the month with leading zero “01” ddd The localised name for the day of the week “Sunday” m Month of the yearwithout leading zero “1” mm Month of the year with leading zero “01” mmm The localised short (3 letter) name for the month “Jan” mmmm The localised full name for the month “January” yy The year as two digits “10” yyyy The year as four digits “2010” var today : Date; today = dateNow(); formatDate(today, “mmm d, yyyy”); “January 1, 2011”
  • 38. 37 Time Formatting Code Description Example Result HHH Hour in 24 hour format with leading zero 19 HH Hour in 24 hour format with leading zero 08 H Hour in 12 hour format without leading zeros 8 MM Minute with leading zero 05 M Minute without leading zero 5 SS Seconds with leading zero 09 S Seconds without leading zero 9 PP am/pm indicator am var t : Time; t = timeNow(); formatTime(t, “HH:MM:SS PP”); “12:34:10 am”
  • 39. 38 Please check www.memeapps.com for more free tutorials in the developers center Level one: 101 - Hello World Hello Meme IDE 102 - Introduction to MemeScript Language 103 - Meme IDE Fundamentals 201 - Records and Record Types 202 - Designing Business Apps 203 - Advanced MemeScript 301 - MemeApps and Communications 302 - MemeApps advanced User Interfaces 303 - MemeApps and Persistence