Re: PicoLisp assembler in JavaScript?

2012-03-07 Thread Jakob Eriksson


On March 7, 2012 at 8:30 AM Alexander Burger a...@software-lab.de wrote:

 Hi Jon,

  How many percent (very roughly) of the PicoLisp functions are depending on
  this 'native' function? If it's less than say 10%, one could probably find
  an alternative solution for these natives, or just ignore them. I'm only
  guessing.

 The interpreter itself doesn't depend on 'native' at all. The base
 system runs fine without it.

 Only add-ons like floating point math, or the OpenGL library, do need
 it.


I think PicoLisp is plenty fun and useful also without these addons.
Floating point could be reimplemented in other ways if really needed.

best regards,
Jakob
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: ClassField and Chart

2012-03-07 Thread Alexander Burger
Hi Konrad,

 I have a few questions regarding the class Field.
 
 1) can I use it in a chart and if so what should I set the first

Yes. A '+ClassField' refers to an object's class, so it makes sense in a
chart holding a list of objects.


 argument to I know this should be the object that I want the class of.

In a chart, you can in general access the data of the current line with
the 'curr' function.

For example, if we take your model from the previous mail

   (class +Master +Entity)
   (rel children (+List +Link) (+Child))
   (rel name (+String))  # I added a 'name' to have more useful data

and have a form holding a '+Master' object, we might build a chart for
the children, one object per line:

   (gui '(+E/R +Chart) '(children : home obj) 5
  '((This) (list NIL This (: nm)))
  car )
   (table NIL NIL
  '(NIL (NIL Class) (NIL Name))
  (do 6
 (row NIL
(gui 1 '(+ChoButton) '(choMaster (field 1)))
(gui 2 '(+ClassField) '(curr)
   '((Armour +Armour +Item) (Weapon +Weapon +Item )) )
(gui 3 '(+TextField))
(gui 4 '(+DelRowButton))
(gui 5 '(+BubbleButton)) ) )
  (scroll 6 T)

This assumes you have a typical 'choMaster' function to find/select
master objects (because otherwise you can't fill the chart).

Note: If you have a newer PicoLisp (= 3.0.9.3), you can simplify the
second column

(gui 1 '(+ChoButton) '(choMaster (field 1)))
to

(choMaster 1)


 2) my instances have prefix classes, so what would be the correct
 syntax for name class mapping list is it
 '((Armour +Armour +Item) (Weapon +Weapon +Item ))

Yes. I used that above.

 '((Armour (+Armour +Item)) (Weapon (+Weapon +Item)))

and not this one. The CDR of each element should give the type (i.e.
list of classes).


 3) what should I put in the above list of options for Form rows that are 
 empty?

I'm not sure if I correctly understand the question. Enpty rows are no
problem for the chart, but other parts of the application code should be
prepared to handle NIL elements in the list. If you don't want to handle
it in the app, you can also make a '+Val' prefix to the '+Chart' and
filter the NIL elements.

   (gui '(+E/R +Val +Chart) '(children : home obj)
  '((L) (filter bool L))
  5

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: ClassField and Chart

2012-03-07 Thread Alexander Burger
On Thu, Mar 08, 2012 at 08:24:02AM +0100, Alexander Burger wrote:
 
(gui '(+E/R +Chart) '(children : home obj) 5
   '((This) (list NIL This (: nm)))
   car )
(table NIL NIL
   '(NIL (NIL Class) (NIL Name))
   (do 6
  (row NIL
 (gui 1 '(+ChoButton) '(choMaster (field 1)))
 (gui 2 '(+ClassField) '(curr)
'((Armour +Armour +Item) (Weapon +Weapon +Item )) )
 (gui 3 '(+TextField))
 (gui 4 '(+DelRowButton))
 (gui 5 '(+BubbleButton)) ) )
   (scroll 6 T)

Obvoiusly, '(: nm)' in the chart's get function should be '(: name)'.


Then, if you want the name to be editable in the chart, you can change
the above to

   ...
   (gui '(+E/R +Chart) '(children : home obj) 5
  '((This) (list NIL This This))
  car )
   ...
   '((Armour +Armour +Item) (Weapon +Weapon +Item )) )
(gui 3 '(+Obj +TextField) '(name +Master) 30)
(gui 4 '(+DelRowButton))
   ...

That is, you pass the object 'This' instead of just the name '(: name)'
to the chart field, and make the field an '+Obj' field (holding an
object instead of just plain text).

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe