Welcome to the Dictionary of Programming Languages, a compendium
of computer coding methods assembled to provide information and
aid your appreciation for computer science history.
Browse the dictionary by clicking on a section:
A
B
C
D
E
F
G
H
I
JK
L
M
N
O
P
QR
S
T
UV
WXYZ+
Get a full dump of the dictionary:
List of Names
Short Form
Full Form
class ACCOUNT feature
balance: INTEGER;
owner: PERSON;
minimum_balance: INTEGER is 1000
open (who: PERSON) is
-- Assign the account to owner who.
do
owner := who
end
deposit (sum: INTEGER) is
-- Deposit sum into the account.
do
add (sum)
end
withdraw (sum: INTEGER) is
-- Withdraw sum from the account.
do
add (-sum)
end
may_withdraw (sum: INTEGER): BOOLEAN is
-- Is there enough money to withdraw sum?
do
Result := (balance >= sum + minimum_balance)
end
feature {NONE}
add (sum: INTEGER) is
-- Add sum to the balance.
do
balance := balance + sum
end
end -- class ACCOUNT
;; Simple Elisp example
(defconst date-pattern-1
"\\(1?[0-9]\\)/\\([123]?[0-9]\\)/\\([0-9][0-9]\\)"
"Regexp for one style of data string")
(defun replace-all-dates ()
"Replace 1/27/93 dates with 27-1-93 dates"
(interactive)
(let ((mcount 0))
(while (re-search-forward date-pattern-1 nil t)
(replace-match "\\2-\\1-\\3" nil nil)
(setq mcount (+ 1 mcount)))
(message (format "Replaced %d dates" mcount)))
)
-module(sort).
-export([sort/1]).
sort([]) -> [];
sort([Pivot|Rest]) ->
{Smaller, Bigger} = split(Pivot, Rest),
lists:append(sort(Smaller), [Pivot|sort(Bigger)]).
split(Pivot, L) ->
split(Pivot, L, [], []).
split(Pivot, [], Smaller, Bigger) ->
{Smaller, Bigger};
split(Pivot, [Hd|Tl], Smaller, Bigger) when Hd < Pivot ->
split(Pivot, Tl, [Hd|Smaller], Bigger);
split(Pivot, [Hd|Tl], Smaller, Bigger) when Hd >= Pivot ->
split(Pivot, T, Smaller, [Hd|Bigger]).
Alternative version using Erlang 4.4 features:
-module(sort).
-export([sort/1]).
sort([Pivot|T]) ->
sort([ X || X <- T, X < Pivot]) ++ [Pivot] ++
sort([ X || X <- T, X >= Pivot]);
sort([]) -> [].
MODULE Lambda.
CONSTRUCT Person/0.
FUNCTION Jane, Mary, John: One -> Person.
FUNCTION Mother : Person * Person -> Boolean.
Mother(x,y) =>
x=Jane & y=Mary.
FUNCTION Wife : Person * Person -> Boolean.
Wife(x,y) =>
x=John & y=Jane.
FUNCTION PrimitiveRel : (Person * Person -> Boolean) -> Boolean.
PrimitiveRel(r) =>
r=Mother \/ r=Wife.
FUNCTION Rel : (Person * Person -> Boolean) -> Boolean.
Rel(r) =>
PrimitiveRel(r) \/
(SOME [r1,r2]
(r = LAMBDA [u] (SOME [z] (r1(Fst(u),z) & r2(z,Snd(u)))) &
PrimitiveRel(r1) & PrimitiveRel(r2))).
module AVERAGE:
input INCREMENT_AVERAGE(integer);
output AVERAGE_VALUE(integer);
var TOTAL := 0, NUMBER := 0, : integer in
every immediate INCREMENT_AVERAGE do
TOTAL := TOTAL + ? INCREMENT_AVERAGE;
NUMBER := NUMBER + 1;
emit AVERAGE_VALUE (TOTAL / NUMBER)
end
end.
-- Prime sieve benchmark, adapted from Euphoria 2.0beta demos
constant ON = 1, OFF = 0, SIZE = 5000, BATCH = 20
function sieve()
sequence flags
integer prime, start, count, still_prime
count = 0
flags = repeat(ON, SIZE)
for i = 1 to SIZE do
still_prime = flags[i]
if still_prime then
prime = 2 * i
prime = prime + 1
start = prime + i
for k = start to SIZE by prime do
flags[k] = OFF
end for
count = count + 1
end if
end for
return count
end function
atom t, cycles, p
cycles = 0
t = time()
while time() < t + 30 do -- test for 30 seconds
for iter = 1 to BATCH do
p = sieve()
end for
cycles = cycles + BATCH
end while
t = time() - t
printf(1, "%6.1f sieves per second\n", cycles / t)
Descriptions in this dictionary are ©1997-99 Neal Ziring. Some examples copyright of their respective authors. Some technologies and languages are trademarked. Permission to copy descriptions is granted as long as authorship credit is preserved.
Comments on this dictionary, corrections and suggestions, are all welcome. Please use email, the address is ziring@home.com
[Ziring MicroWeb Home] [Dictionary Start] [Sign Guestbook]
Dictionary and script maintained by Neal Ziring, last major modifications 3/18/98. Most recent additions to dictionary and master list, 1/00.