Re: pilrc?

2015-08-23 Thread Erik Gustafson
Hi Alex,

first of all, thanks Erik for the nice Unnest article!


Of course!


 In fact, there is a function 'pil' for that. It can be used to access
 files in .pil/ in the user's home directory.


Must you always come up with the most convenient and elegant solutions to
these sorts of things before the rest of us get around to even thinking
about them? Sheesh.


 So you might create a file ~/.pil/rc, and then load it upon startup with

(load (pil rc))


This will be perfect :)


 Also, note the 'rc' function, the poor man's database.


Noted! Thanks for the write-up.


Re: pilrc?

2015-08-23 Thread Alexander Burger
Hi Erik + Andreas,

first of all, thanks Erik for the nice Unnest article!


  what's the canonical way to customize the default 'pil' environment?
  I'd like to have some of my own utilities and other goodies loaded when I 
  start up.
  Can I just stick the necessary calls to (load) in .pilrc? :)
 
 I'm not aware of any .pilrc mechanics, search in mailing list also
 yields nothing, though such a mechanic might exist. I don't think this
 is the case.

In fact, there is a function 'pil' for that. It can be used to access
files in .pil/ in the user's home directory.

So you might create a file ~/.pil/rc, and then load it upon startup with

   (load (pil rc))


Also, note the 'rc' function, the poor man's database. It allows you
to conveniently maintain config values in a file:

   : (rc (pil rc) 'a 1)  # The file ~/.pil/rc is automatically created
   - 1

   : (rc (pil rc) 'b 2)
   - 2

   : (rc (pil rc) 'a)
   - 1

   : (in (pil rc) (echo))
   ((b . 2) (a . 1))

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


pilrc?

2015-08-22 Thread Erik Gustafson
I feel like I've seen the answer to this somewhere in the past when I was
just a baby PicoLisper, but can't seem to find it now. Anyway, what's the
canonical way to customize the default 'pil' environment? I'd like to have
some of my own utilities and other goodies loaded when I start up. Can I
just stick the necessary calls to (load) in .pilrc? :)

Thanks!


RE: pilrc?

2015-08-22 Thread andreas
 what's the canonical way to customize the default 'pil' environment?
 I'd like to have some of my own utilities and other goodies loaded when I 
 start up.
 Can I just stick the necessary calls to (load) in .pilrc? :)

I'm not aware of any .pilrc mechanics, search in mailing list also yields 
nothing, though such a mechanic might exist. I don't think this is the case.

Have a look in your picolisp directory, within @bin/ there are the files 
'picolisp' and 'pil. 'picolisp' is the actual binary generated by building 
picolisp.
You usually start the picolisp repl by executing 'pil', watch it in a text 
editor and you can see it is actually a simple script using the #! mechanism to 
start the 'picolisp' binary, followed by loading a few files from @lib/.
Those files are considered standard, globales and functions defined in those 
files is also mentioned in the official reference, opposite to other 
functionality hiding within the @lib/ directory.

So the answer to your question is probably to just craft a customized variant 
of the pil file, e.g. leaving out @lib/db.l if you don't have any use for the 
whole database functionality.
Of course you could also customize it in a way to load a .pilrc in your home 
folder, e.g.

(let Rc (pack (sys HOME) /.pilrc)
   (when (info Rc)
   (load Rc) ) )

thought this might end in an error when .pilrc happens to exist but is a 
directory, so maybe you want to do:

(let Rc (pack (sys HOME) /.pilrc)
   (when (num? (car (info Rc)))
   (load Rc) ) )


Regards,
beneroth