Re: PicoLisp Speaks Your Language

2016-09-03 Thread Anas Drak
Thanks for the solution given !
In my way more than 540 lines of code would be written.
Using your solution less than 10 are more than enough!
Your way is 54 times better than mine...
Respect Alex!
Respect!


On Fri, Sep 2, 2016 at 9:02 AM, Alexander Burger 
wrote:

> Hi Anas,
>
> > PicoLisp Speaks Your Language:
> > How to translate PicoLisp functions into your language.
> > http://pico-lisp.blogspot.gr/p/picolisp-translations.html
>
> Thanks! Interesting idea! :)
>
>
> Note that there is a more general way of changing the names in PicoLisp.
>
> Instead of defininig *new* functions with the new names
>
>(setq pon (copy setq))
>
> you could also *rename* the symbols themselves. This has the advantage
> that not only newly written programs appear in this language, but also
> all functions already loaded into the system (further files to be loaded
> must be in the new language then).
>
>
> Now, renaming can be done with the 'name' function. Because an internal
> symbol cannot be renamed, it must be first uninterned and then interned
> again. So you could do
>
>(mapc
>   '((Sym Name)
>  (zap Sym)
>  (name Sym Name)  # Rename the symbol
>  (intern Sym) )
>   '(setq let print println if if2 ...)
>   '(pon pon-local imprime imprime-nl si si2 ...) )
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: PicoLisp Speaks Your Language

2016-09-02 Thread Alexander Burger
Hi Anas,

> PicoLisp Speaks Your Language:
> How to translate PicoLisp functions into your language.
> http://pico-lisp.blogspot.gr/p/picolisp-translations.html

Thanks! Interesting idea! :)


Note that there is a more general way of changing the names in PicoLisp.

Instead of defininig *new* functions with the new names

   (setq pon (copy setq))

you could also *rename* the symbols themselves. This has the advantage
that not only newly written programs appear in this language, but also
all functions already loaded into the system (further files to be loaded
must be in the new language then).


Now, renaming can be done with the 'name' function. Because an internal
symbol cannot be renamed, it must be first uninterned and then interned
again. So you could do

   (mapc
  '((Sym Name)
 (zap Sym)
 (name Sym Name)  # Rename the symbol
 (intern Sym) )
  '(setq let print println if if2 ...)
  '(pon pon-local imprime imprime-nl si si2 ...) )

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