home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #6
/
amigamamagazinepolishissue1998.iso
/
coders
/
jËzyki_programowania
/
logo
/
powerlogo
/
libs
/
lisp
< prev
next >
Wrap
Text File
|
1992-11-05
|
1KB
|
73 lines
; lisp - a library of LISP-like primitives for Power LOGO
; Tony L Belding
if namep "lispnames [ unbury :lispnames ] [ ]
make "remove [
procedure [ [ :card :deck ] ]
; removes all occurences of object CARD from object DECK
if not memberp :card :deck [
op :deck
] [
if = :card first :deck [
op remove :card bf :deck
] [
op fput first :deck remove :card bf :deck
]
]
]
make "delete [
procedure [ [ :card :deck ] ]
; a shortcut for: make "object remove :key :object
; instead use: delete :key "object
; This is not quirky about the first item like LISP delete is.
make :deck remove :card thing :deck
op thing :deck
]
make "push [
procedure [ [ :Item :List ] ]
; push adds an item to the beginning of a list
make :List firstput :Item thing :List
op thing :List
]
make "pop [
procedure [ [ :List ] [ ] [ :Item ] ]
; pop removes the first item from a list
make "Item first thing :List
make :List butfirst thing :List
op :Item
]
make "assoc [
procedure [ [ :key :alist ] ]
; equivalent to LISP ASSOC primitive
; uses a key value to extract a sublist from an association list
if emptyp :alist
[ op [ ] ] [ ]
if ( = :key first first :alist ) [
op first :alist
] [
op assoc :key butfirst :alist
]
]
make "lisp [ procedure [ ] ]
make "lispnames [ lispnames remove delete push pop assoc lisp ]
bury :lispnames
; end of listing