Re: (path @lib/) does not work with local installation?

2013-09-16 Thread Alexander Burger
Hi Thorsten,

 Ok, but then the question remains how to get (in a program) the absolute
 path to the PicoLisp installation the programs runs in when you assume a
 local installation was invoked - but you have no idea how?
 
 I thought about combining (cmd) and (path ...), but that doesn't help either

How about (pwd) and (path ...)?

   : (pack (pwd) / (path @lib/misc.l))

If a local installation is invoked, then the path must be relative to
the current working directory.


A minor drawback is that the resulting path may contain .., e.g.:

   $ ../../pil +
   : (path @lib/misc.l)
   - ../../lib/misc.l

   : (pack (pwd) / (path @lib/misc.l))
   - /bla/laber/picoLisp/foo/bar/../../lib/misc.l


To make it practically useful, it should work transparently for both
local and global installations. For that, I would recommend:

   : (let P (path @lib/misc.l)
  (or
 (pre? / P)
 (pack (pwd) / P) ) )

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


(path @lib/) does not work with local installation?

2013-09-15 Thread Thorsten Jolitz

Hi Alex, Hi List,

with my global PicoLisp installation ($ pil +) function

,---
| (path @lib/)
`---

does work as expected:

,--
| : (pwd) - /home/tj
`--
,
| : (path @lib/)
| - /usr/lib/picolisp/lib/
`

but trying the same in a local installation does not work:

,
| [tj@hostname picoLisp]$ ./pil +
| : (path @lib/)
| - lib/
| : (pwd)
| - /home/tj/git/iorg/picoLisp
`

changing the PWD does not help either:

,-
| : (pwd)
| - /home/tj
| : (path @lib/)
| - lib/
`-

Is this a bug, or am I doing something wrong?

--
cheers,
Thorsten

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


Re: (path @lib/) does not work with local installation?

2013-09-15 Thread Alexander Burger
Hi Thorsten,

 with my global PicoLisp installation ($ pil +) function
 
 ,---
 | (path @lib/)
 `---
 
 does work as expected:
 
 ,
 | [tj@hostname picoLisp]$ ./pil +
 | : (path @lib/)
 | - lib/
 | : (pwd)
 | - /home/tj/git/iorg/picoLisp
 `
 
 changing the PWD does not help either:
 
 ,-
 | : (pwd)
 | - /home/tj
 | : (path @lib/)
 | - lib/
 `-
 
 Is this a bug, or am I doing something wrong?

No, in fact this is the intended behavior of how the PicoLisp I/O
functions expand the @.

The value is determined from how it was invoked. If you call it with

   $ ../../foo/bar/pil +

then @ expands to ../../foo/bar/, and if you call it as

   $ /home/tj/git/iorg/picoLisp/pil +

then @ will be /home/tj/git/iorg/picoLisp/.

As a special convenicence, ./ is optimized to nothing ;-)


All this behavior does not in any way depend what your PWD is at that
moment. Only how PicoLisp was invoked.

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