Random Access?

2017-03-24 Thread Christopher Howard
Hi list. I noticed that when I evaluate

(list (box) (box) (box))

I get

($177760526373112 $177760526373114 $177760526373116)

Where each memory location is two more than the previous. I am wondering
if this behavior is guaranteed to always be the case, the implication
being one could have random access to any cell provided he knew the
address of the first cell.

-- 
https://qlfiles.net
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Method undefined - why?

2017-03-24 Thread Alexander Burger
Hi Thorsten,

> (class 1 ...)
> (dm ...)
> (dm ...)
> 
> (class 2 ...)
> (dm ...)
> (dm ...)
> 
> The reader seems to remember which class was defined last, and
> associates the following methods to that class.

Not the reader, but the 'class' function:

   (de class Lst
  (let L (val (setq *Class (car Lst)))
 (def *Class
...

It remembers that class in the '*Class' global.

So the 'class' function is not absolutely necessary.


> Would you rather write the classical definitions to a file and then load
> that?

No, it is perfectly legal to build the class structures manually as you did. The
class definition in your first mail was correct.

What was missing was only the definition for methods like 'hi>'. Without them,
'hi>' is just a symbol with value 'NIL', so that calling it like

   : (hi> Obj)
   !? (hi> Obj)
   hi> -- Undefined
   ?

naturally gives an "Undefined" error. This has nothing to do with classes and
OOP. Instead, you could send the message to 'Obj' explicitly with

   (send 'hi> Obj)

or

   (try 'hi> Obj)


Defining with 'dm' just takes care to set the proper function definition for
the symbol 'hi>'. Instead, you could also do

   (setq hi> meth)

or perhaps better

   (def 'hi> meth)

Now also a call like (hi> Obj) works.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Documenting PicoLisp code?

2017-03-24 Thread Joh-Tob Schäg
Either comments inside the code.# Like that

Transistent Symbols at the beginn of the funtion.
(de power (N E)
  "Calculates the exponent in a wastefull manner"
  (apply '* (need E N)))

I have not seen another approach in Picolisp yet
Am 24.03.2017 04:15 schrieb "Christopher Howard" <
christopher.how...@qlfiles.net>:

> Hi list. How does one document his picolisp code? Has anybody developed
> any cool markup systems for use with picolisp?
>
> --
> https://qlfiles.net
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>