Subject: Re: Scripting with Visual Basic Clone
From: sam th (firstname.lastname@example.org)
Date: Thu Jun 29 2000 - 00:04:46 CDT
-----BEGIN PGP SIGNED MESSAGE-----
On Thu, 29 Jun 2000, Tomasz Wegrzanowski wrote:
> This isn't true Scheme is easy to learn.
> For example, adding 2 + 2
> People tend to think it is 2 + 2, not + 2 2 nor 2 2 +.
> There are of course more such problems.
OK, I've been challenged.
Scheme Syntax in a few simple rules.
1) All expressions are surrounded by parenthesis.
Example: (func arg1 arg2)
2) Everything is prefix.
Example (+ 1 2) - this evaluates to 3
3) Bind some name to some value with define.
Example: (define pi 3.14159)
This works for functions too.
4) Return a function with lambda. Arguments come after the lambda.
Example: This returns a function that squares its argument.
(* x x))
5) Conditionals with cond
6) Create a literal with '
Example '(1 2 3) returns (1 2 3)
These are the basic rules of Scheme syntax. There are important, more
complicated, and very useful additons, but lots can be done with these,
and the following primitive (defined for you) functions.
first - returns the first part of a list (first '(a b c)) -> a
rest - returns the list without the first part (rest '(a b c)) -> (b c)
and, or, equal? - self-explanatory
+, -, / - integer ops
display - outputs args to screen eg (display (first '(1 2 3)))
I challenge anyone to reduce another language to as few rules. (other
LISP derivatives excluded).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org
-----END PGP SIGNATURE-----
This archive was generated by hypermail 2b25 : Wed Jun 28 2000 - 23:03:29 CDT