11 October 2009

Nihongo Verb Conjugations

It’s nearly been two weeks since I last attended my Japanese class. The first instance was when I woke up, the rain was just pouring hard. That was when Typhoon Ondoy ravaged my country. Although the classes continued but my classmates told me they got stranded inside the campus. The second instance was I didn’t know that classes at all levels were suspended because of Typhoon Pepeng. I was surprised when I went to school and all I can see were security guards on their duty.

Last Saturday, it was a good thing that we had classes. But the funny thing was there were only four of us who attended. Where are the other seven? Prolly assumed that there were no class. Okay enough talking and let me share with you our lessons last saturday.

Sensei taught us how to write the days of the week in Kanji. After that, we moved on to Verb Conjugations. It was then that I finally understood how the verbs are being transformed.

Japanese verbs take various shapes. There were three (3) forms introduced: dictionary forms, present-tense affirmative forms, and present-tense negative forms. Sensei was kind enough to introduce a different outline for verb conjugations since the book that we’re using was quite confusing.

Verb 3 Form: These the irregular verbs suru (する, to do) and kuru (くる, to come). You just have to memorize these two.

Verb 2 Form: These are verbs that end in -ru. Known as -ru verbs.

eg.

たべる – taberu - to eat

みる – miru - to watch

Verb 1 Form: These are the erbs with all other endings. Known as the -u verbs.

eg.

1. ~ う

かう – kau – to buy

いう – iu – to say

いう – su’u – to smoke [たばこを]

2. ~ く

かく – kaku – to write
きく – kiku – to listen

3. ~ぐ

いそぐ – isogu – to hurry

およぐ – oyogu – to swim

4. ~す

はなす – hanasu – to speak

5. ~つ

まつ – matsu – to wait
もつ – motsu – to carry/bring

6. ~ぬ

しぬ – shinu – to die

7. ~ぶ

あそぶ – asobu – to play

8. ~む

よむ – yomu – to read

9. ~る [-aru, -oru, -uru]

とる – toru – to take

うる – uru – to sell

ある – aru – to exist

Verb 2 Exceptions:

1. かえる – kaeru – to go home
2. はいる – hairu – to enter
3. きる – kiru – to cut
4. はしる- hashiru – to run
5. しる – shiru – to know
6. ちる – chiru – to fall
7. ましる – mashiru – to mix

ます (-masu) Form:

1. For V3, memorize:

する(suru) ー》 します(shimasu)
くる(kuru) ー》 きます(kimasu)

2. For V2, change る (ru) ー》 ます (masu):

たべる (taberu) ー》 たべます (tabemasu)
みる (miru) ー》 みます (mimasu)

3. For V3, change the final syllable to i-ending, then add ます (masu):

asdfasdf

Exercsies:

のむ ー》 のみます
きく ー》 ききます
みる ー》 みます
する ー》 します
はなす ー》 はなします
いく ー》 いきます
くる ー》 きます
かえる ー》 かえります
ねる ー》 ねます
よむ ー》 よみます
おきる ー》 おきます
べんきょうする ー》 べんきょうします

Oh, here’s the Kanji for the days of the week:

Sunday: 日曜日 (nichiyoubi)

Monday: 月曜日 (getsuyoubi)

Tuesday: 火曜日 (kayoubi)

Wednesday: 水曜日(suiyoubi)

Thursday: 木曜日 (mokuyoubi)

Friday: 金曜日 (kinyoubi)

Saturday: 土曜日 (doyoubi)

Sorry I can’t illustrate the stroke steps but I guess that should suffice. Till next week! :)

5 October 2009

How To Install Common Lisp on Ubuntu

It’s been nearly two weeks since I started learning Lisp. I must say that before you start doing something, you need to know where to start. As my old friend Confucius told me, “A journey of a thousand miles, begins with a single step.” So there, I’ll be posting here how to get started with Lisp by setting up your own working environment.

Operating System:

I am running Ubuntu 9.04 Jaunty on top of my Windows 7 via Sun VirtualBox. You can download Sun Virtual box here and setup your virtual machine. If you’re already on Ubuntu then that’s fine, leave it as is. After all is being done already, just type the following:

  1. Type ’sudo apt-get install sbcl’ (or alternatively ’sudo apt-get install cmucl’)
  2. Type ’sbcl’ in the terminal. (or alternatively type ‘cmucl’)
  3. You will see an asterisk (*) if you have successfully installed it.
  4. You can also test it by typing, ‘(print “Hello World!”)’ in the terminal.

Example:

ridvan@ridvan-vm:~$ sudo apt-get install sbcl
(you will see some installation messages here, just continue installing)
                      ... ... .... ... ...

ridvan@ridvan-vm:~$ sbcl
This is SBCL 1.0.18.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (print "Hello World!")

"Hello World!"
"Hello World!"
*

You can actually choose which interpreter to use, either sbcl and cmucl. The two have pros and cons actually.

For the SBCL (Steel Bank Common Lisp), the advantage is you can make use of the ‘trace’ function properly. The drawback is that some I/O functions don’t seem to behave the way they should be.

Examples:
Farenheit to Celsius converter (f-to-c.lisp).
Power (power.lisp).

I/O functionality:

* (load "f-to-c.lisp")

T
* (f-to-c)

200
Please enter Fahrenheit temperature:
200 degrees Fahrenheit is 93.333336 degrees Celsius
280/3
*

Trace Function:

* (load "power.lisp")

T
* (trace power)

(POWER)
* (power 2 3)
  0: (POWER 2 3)
    1: (POWER 2 2)
      2: (POWER 2 1)
      2: POWER returned 2
    1: POWER returned 4
  0: POWER returned 8
8
*

For the CMUCL (Carnegie Mellon University Common Lisp), the advantage is that the I/O functions are behaving well whilst the ‘trace’ function does not. Even if your code is not tail-recursive, it does not show the step-by-step process of the recursive call.

I/O functionality:

* (load "f-to-c.lisp")

; Loading #p"/home/ridvan/Projects/lisp/f-to-c.lisp".
T
* (f-to-c)

Please enter Fahrenheit temperature: 200

200 degrees Fahrenheit is 93.333336 degrees Celsius
280/3
*

Trace Function:

* (load "power.lisp")

; Loading #p"/home/ridvan/Projects/lisp/power.lisp".
T
* (trace power)

(POWER)
* (power 2 3)

  0: (POWER 2 3)
  0: POWER returned 8
8
*

Now that you’ve seen some of my observations on both interpreters, it really depends to you which one you should use. But if you’re going to ask me, I’d say it depends. It depends on what you wanted to achieve. If you want to trace your recursions, go use sbcl. If you want to have clean and neat inputting, go use cmucl. Personally, I use SBCL more often since I trace my codes more often.

So there, setting up lisp on your working environment is very easy. Enjoy Lisp! :)