• Keine Ergebnisse gefunden

5.2 Funktionen in Lisp

N/A
N/A
Protected

Academic year: 2021

Aktie "5.2 Funktionen in Lisp"

Copied!
3
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

F1 Modellierung und Programmierung 2

Abteilung für Bild- und Signalverarbeitung

Listenoperationen

(quote A) = 'A = A

Betrachte Argument als Konstante, nicht als Name oder Funktion!

quote (+ 6 5) = (+ 6 5)

(car '(A B C)) = A

Gib das erste Element einer Liste zurück!

(cdr '(A B C)) = (B C)

Entferne das erste Element aus einer Liste!

(cons 'A '(B C)) = (A B C)

Füge den ersten Parameter als erstes Element in die Liste ein!

5.2 Funktionen in Lisp

(2)

F2 Modellierung und Programmierung 2

Abteilung für Bild- und Signalverarbeitung

Bedingungen und Vergleiche

(atom 'A) = t (atom '(a b)) = nil Ist der Parameter ein Atom?

(eq 'A 'A) = t (eq '(a b) '(a b c) = nil Sind beide Parameter gleich?

(cond (<Bedingung> 'B) (t 'C))

Falls Bedingung wahr, gib B zurück! Sonst gib C zurück!

(cond ((atom '(A)) 'B) (t 'C)) = C ;(A) ist kein Atom sondern eine Liste!

(> <Zahl1> <Zahl2>)

Falls Zahl1 größer als Zahl2, gib t zurück, sonst nil!

(> 5 2) = t (> -3 7) = nil

>= < <= /=

Weitere Vergleiche von Zahlen.

5.2 Funktionen in Lisp

(3)

F3 Modellierung und Programmierung 2

Abteilung für Bild- und Signalverarbeitung

Arithmetik

(+ <Zahl1> <Zahl2>)

Addiere Zahl1 und Zahl2!

(+ 5 2) = 7

- * / mod

Subtraktion, Multiplikation, Division und Rest bei ganzzahliger Division.

5.2 Funktionen in Lisp

Referenzen

ÄHNLICHE DOKUMENTE

set lispval.. This type is used mainly by arrays of general lisp objects. Value cells are created with the ptr function. The access time for an element of a

A value of Everywhere (:everywhere) causes the compiler to generate type declarations using both declare and the forms.. A the form is used wherever a declare form is

It returns a temporary pvar containing in each active processor the arc hyperbolic tangent in radians of the corresponding value of numeric-pvar. The

It returns a temporary pvar containing in each active processor the arc sine in radians of the corresponding value of numeric-pvar. Similarly, the asinh!l function calculates the

Thinking Machines Corporation does not assume any liability arising from the application or use of any information or product described herein.. Connection Machine is a

All the new language features mentioned in these release notes and detailed iIi the Supplement to the *Lisp Reference Manual, Version 5.0, are supported by the *Lisp

on page 33 of the Supplement to the * Lisp Reference Manual version 5.0, and see the documentation for ·slicewise in these release notes,

The *Lisp interpreter runs on top of either Lucid Common Lisp or Symbolics Common Lisp and executes *Lisp code on the Connection Machine in an interpretive manner. 5.1