Re: SEXP?

2013-07-01 Thread Thorsten Jolitz
Alexander Burger a...@software-lab.de writes:

Hi Alex,

 I wonder if there is a way in PicoLisp to check if some function
 argument is a SEXP, i.e. if something like a function 'sexp? exists that
 returns T if the argument is a SEXP.

 I'm a bit puzzled by this question. To my understanding, every possible
 expression in PicoLisp is a SEXP. Even auto-quoting expressions like

I'm puzzled too ...

: T
- T

: abc
- abc

: (1 2 3)
- (1 2 3)

 are SEXPs (though it might be argued that the last one is not, since it
 doesn't contain any symbols).

.. and was a bit confused when asking, I probably meant 'list' instead of
SEXP. 

e.g., when I filter function args that are given as unevaluated list,
and should be either names of existing files or Emacs Lisp expressions:

,---
| (filter 'info CmdLineArgs)
`---

,---
| (filter '((X) (not (info X))) CmdLineArgs)
`---

then invalid file names fall into category 'elisp expressions' and cause
errors later on. But its probably better to check the expressions of the
elisp side and this question is kind of obsolete, but thanks anyway. 

 With so many occurences fo SEX in this post, I wonder if it will be
 filtered as SPAM or actually posted in the mailing list 

 Worked :) And NSA will only read read (and not filter) it.

at least I sent it only once and are not classified as spammer now,
hopefully ;)

-- 
cheers,
Thorsten

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


Re: SEXP?

2013-07-01 Thread Alexander Burger
Hi Thorsten,

  I'm a bit puzzled by this question. To my understanding, every possible
  expression in PicoLisp is a SEXP. Even auto-quoting expressions like
 ...
 .. and was a bit confused when asking, I probably meant 'list' instead of
 SEXP. 
 ...
 then invalid file names fall into category 'elisp expressions' and cause
 errors later on. But its probably better to check the expressions of the
 elisp side and this question is kind of obsolete, but thanks anyway. 

In general, there is no way to detect statically whether an s-expression
is executable or not. Something like (a b c d) may not be executable
*now*, because 'a' is not a function, but it may be shortly after.

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


Re: SEXP?

2013-07-01 Thread dexen deVries
On Monday 01 of July 2013 07:39:49 you wrote:
 Hi Thorsten,
 
  I wonder if there is a way in PicoLisp to check if some function
  argument is a SEXP, i.e. if something like a function 'sexp? exists that
  returns T if the argument is a SEXP.


how about (pair 'any) ? basically the opposite of (atom 'any)


-- 
dexen deVries

[[[↓][→]]]

Take care of the luxuries and the necessities will take care of themselves.
-- L. Long

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


Re: SEXP?

2013-07-01 Thread Thorsten Jolitz
dexen deVries dexen.devr...@gmail.com
writes:

 On Monday 01 of July 2013 07:39:49 you wrote:
 Hi Thorsten,
 
  I wonder if there is a way in PicoLisp to check if some function
  argument is a SEXP, i.e. if something like a function 'sexp? exists that
  returns T if the argument is a SEXP.


 how about (pair 'any) ? basically the opposite of (atom 'any)

thats probably what I was looking for, thanks, besides the fact that
Alex is of course right about the difficulties with doing these kind of
tests in a dynamic environment. 

-- 
cheers,
Thorsten

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


Re: SEXP?

2013-07-01 Thread Joe Bogner
Hi Thorsten,

I've used fun? to determine if an argument had the proper form of something
that was executable or if it was data. It may not work in all cases, but it
was sufficient for my use case.  As Alex mentioned, it won't let you know
whether it's actually executable or not. I think of it as having the
potential to be executable.

Joe


On Mon, Jul 1, 2013 at 4:50 AM, Thorsten Jolitz tjol...@gmail.com wrote:

 dexen deVries dexen.devr...@gmail.com
 writes:

  On Monday 01 of July 2013 07:39:49 you wrote:
  Hi Thorsten,
 
   I wonder if there is a way in PicoLisp to check if some function
   argument is a SEXP, i.e. if something like a function 'sexp? exists
 that
   returns T if the argument is a SEXP.
 
 
  how about (pair 'any) ? basically the opposite of (atom 'any)

 thats probably what I was looking for, thanks, besides the fact that
 Alex is of course right about the difficulties with doing these kind of
 tests in a dynamic environment.

 --
 cheers,
 Thorsten

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



Re: SEXP?

2013-07-01 Thread Thorsten Jolitz
Joe Bogner joebog...@gmail.com writes:

Hi Joe,

 I've used fun? to determine if an argument had the proper form of
 something that was executable or if it was data. It may not work in
 all cases, but it was sufficient for my use case.  As Alex mentioned,
 it won't let you know whether it's actually executable or not. I think
 of it as having the potential to be executable.

'fun? would be another possibility, but 'pair is a little bit more
tolerant (returns non-NIL in more cases), and since I apply it on Emacs
Lisp (and not PicoLisp) expressions, this tolerance seems to be a good
thing.

But thanks for the tip anyway!

 On Mon, Jul 1, 2013 at 4:50 AM, Thorsten Jolitz
 tjol...@gmail.com wrote:

 dexen deVries
 dexen.devr...@gmail.com writes:
 
 
  On Monday 01 of July 2013 07:39:49 you wrote:
  Hi Thorsten,
 
   I wonder if there is a way in PicoLisp to check if some function
   argument is a SEXP, i.e. if something like a function 'sexp? exists
 that
   returns T if the argument is a SEXP.
 
 
  how about (pair 'any) ? basically the opposite of (atom 'any)
 
 
 thats probably what I was looking for, thanks, besides the fact that
 Alex is of course right about the difficulties with doing these kind of
 tests in a dynamic environment.
 
 
 
 --
 cheers,
 Thorsten
 
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
 



-- 
cheers,
Thorsten

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