P. 1
PicoLisp by Example

PicoLisp by Example

|Views: 4,236|Likes:
Published by tj64
More than 600 PicoLisp solutions for Rosetta Code programming tasks from a wide range of topics, written by Alexander Burger (the creator of PicoLisp) himself - plus the complete PicoLisp function reference. Learn a fascinating programming language that maximises expressive power while minimizing complexity 'by Example'.
More than 600 PicoLisp solutions for Rosetta Code programming tasks from a wide range of topics, written by Alexander Burger (the creator of PicoLisp) himself - plus the complete PicoLisp function reference. Learn a fascinating programming language that maximises expressive power while minimizing complexity 'by Example'.

More info:

Published by: tj64 on Aug 23, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

08/09/2014

pdf

text

original

Create two classes Point(x,y) and Circle(x,y,r) with a polymorphic function
print, accessors for (x,y,r), copy constructor, assignment and destructor and
every possible default constructors

(class +Point)
# x y

(dm T (X Y)
(=: x (or X 0))
(=: y (or Y 0)) )

(dm print> ()
(prinl "Point " (: x) "," (: y)) )

(class +Circle +Point)
# r

(dm T (X Y R)
(super X Y)
(=: r (or R 0)) )

(dm print> ()

(prinl "Circle " (: x) "," (: y) "," (: r)) )

(setq

P (new ’(+Point) 3 4)
C (new ’(+Circle) 10 10 5) )

(print> P)
(print> C)

Output:

Point 3,4
Circle 10,10,5

18 Rosetta Code Tasks starting with P

693

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->