Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in the manual

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Mint Tutorial - Part 0

We learn a recently invented language known as Mint! It is a scripting language that is similar to Ruby and Python.
by Oliver Chu on 30 November 2012

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Mint Tutorial - Part 0

Mint A NEW PROGRAMMING LANGUAGE What is Mint? Mint is a programming
language designed
by Oliver Chu, a student
at UC Berkeley. Which languages are similar? Ruby
JavaScript Getting It ? Navigate the folders in that repository
until you find a ZIP file with the words
"Mint" and "Binaries" in its filename. After that, just
download the ZIP file. How do I edit Mint code? Download Notepad++, and load the Mint.xml file
included in your Mint download into Notepad++.
You will now have syntax highlighting for Mint.

If you're not sure how to do this, see MintGuide.html,
which is also included in your download. print 15 * 14 * 13 Edit To run,
click on RunMint.bat Because 15 * 14 * 13 equals 2730,
you should see 2730 printed
onto the screen. Unlike most programming languages, in Mint implicit multiplication is possible,
just like in mathematics. // The same as 5 * (12 * 12 + 56), which is 1000.
print 5(12(12) + 56)
// These double slashes mark a comment.
// Comments don't affect code.
/* You can use block comments too.
They can span multiple lines. */ Some more math... // The following displays 12.5 on the screen.
print 100 / 8
/* Displays 100 / 8, rounded down.
(we are working on a symbol pair that looks nicer) */
print 100 -/ 8 // Addition and subtraction
print (5 - 2) + (18.56 + (-3.1)) But numbers aren't everything, right? print "Gelatin"
print "Good day, fine sir."
print "\"Life goes on.\"" These three lines will display
3 text values on the screen. Using \" (backslash quote)
inside a text literal will
let you use quotes inside

So that means...
print "x = \"Hi!\""
will display:
x = "Hi!" However... print "\"\"\"This is a triple quote. It is valid syntax in Python.\"\"\"" That looks really ugly. In Python, we say some constructs are Pythonic.
In Mint, good or idiomatic constructs are Minty. It is more idiomatic to use \q instead of \".

print "\q\q\qThis is a triple quote that doesn't hurt your eyes as much.\q\q\q" Add text values together using... plus. "Hello " + "Annie, " + "nice to see you." Text values are actually
called strings.
Strings are sequences of text characters.

"This is a sequence." How do we interact with the user? show "Enter your age: "
userAge = input
print "You are " + userAge + " years old." show is like print, except
it doesn't send you to the
next line down.
input waits for the user
to type in a line of text. Are print and input inverse operations?

Sort of. print is a command that sends
data and displays it on the screen.
input is a command that receives data
that the user types onto the screen.

But input won't undo a print.
For that, use the Linux / Unix
command clear, or the
Windows command cls. In Mint, there are constructs
known as variable assignments. x = 3
y = ":D"
f = 1800 / 2.66 print x + f // Will display 679.6917293233082
// That's just 3 + (1800 / 2.66) a ^ b means a to the power of b.
a % b means the remainder of a divided by b. print 2 ^ 100 // This prints (2 ^ 31) - 1, which is not the same as 2 ^ 100.
import math // We import the math library, which contains BigInt.
print BigInt(2) ^ BigInt(100) // Using BigInt (big integers) produces the correct result. print 8 % 6 // 8 divided by 6 has a remainder of 2. This is getting really boring. Instead of learning about more
operators (yes, there are more symbols that do things to values)...
Let's try to make our own version
of an operator. Let's assume that we pretty
much never use the ^ operator.
Exponentiation is just repeated
multiplication. Edit the file
It's in the same folder
as RunMint.bat
and For now, just change this part:

sub pow(x, y)
return null
end To this...

sub gcd(a, b)
import type
when type(a) == "object"
a = a.value
when type(b) == "object"
b = b.value
when a == 0
return b
when b == 0
return a
return gcd(b % a, a)

sub pow(x, y)
return gcd(x, y)
end And in,
run this code:

sub Number(t)
value = t
return this
print Number(2) ^ Number(100)
print Number(400) ^ Number(256) On the screen,
you should get
2 and 16.
gcd(2, 100) equals 2.
gcd(400, 256) equals 16.

gcd means: greatest common divisor. So now, our ^ operator is no longer
a symbol that only does powers.
We also have a system that will
take the greatest common divisor
of two Number objects.

Believe it or not, ^ will still take
the power of two separate numbers.
However, by wrapping an integer
inside a Number object, we can
do gcd too. What is operator overloading?
What is the sub keyword?
What does when do?
What is return?
How do you define gcd in terms of itself?
What is the end statement?
What is the == operator?
What is the this object?
Actually, what's an object? Obviously, I have explained very little. See you in the second part of this guide! But let's just
take a break
for now.
See the full transcript