I was thinking about an abreviated syntax for pathname operations and
thought something like
foo/<file>.lisp
(where anything between <>'s is interpreted as a regular lisp form)
would be nice, since it already resembles everybody's psuedocode
this code*
http://paste.lisp.org/display/23569
creates the basic functionality by relying on PARSE-NAMESTRING:
CL-USER> (let ((x "foo")
(y "bar"))
#!/baz/<x>/biz.<y>)
#P"/baz/foo/biz.bar"
16
;it's not exactly efficient in it's current state
CL-USER> (quote #!/baz/<x>/biz.<y>)
(PARSE-NAMESTRING
(CONCATENATE 'STRING "/baz/"
(LET ((#:G152 X))
(IF (PATHNAMEP #:G152) (NAMESTRING #:G152) #:G152))
"/biz."
(LET ((#:G153 Y))
(IF (PATHNAMEP #:G153) (NAMESTRING #:G153) #:G153))))
;<>'s can be excaped inside the pathname or lisp form
CL-USER> #!/baz/\<x\>/biz.\<y\>
#P"/baz/<x>/biz.<y>"
16
any any comments/feedback/suggestions would be greatly appreciated
thanks
Nick
[*] - see http://www.franz.com/~jkf/ifstar.txt for IF* if you don't
have it
········@gmail.com writes:
> I was thinking about an abreviated syntax for pathname operations and
> thought something like
>
> foo/<file>.lisp
>
> (where anything between <>'s is interpreted as a regular lisp form)
> would be nice, since it already resembles everybody's psuedocode
I've never seen that.
Sometimes I've seen foo/${file}.lisp or just foo/$file
> CL-USER> (let ((x "foo")
> (y "bar"))
> #!/baz/<x>/biz.<y>)
>
> #P"/baz/foo/biz.bar"
#! is unfortunately already taken for unix scripts: #!/usr/bin/clisp
> [...]
> any any comments/feedback/suggestions would be greatly appreciated
You could just use any generic string interpolating package. You can
use strings everywhere you can use pathname designators...
> [*] - see http://www.franz.com/~jkf/ifstar.txt for IF* if you don't have it
No, thank you.
--
__Pascal Bourguignon__ http://www.informatimago.com/
"You cannot really appreciate Dilbert unless you read it in the
original Klingon"
pascal b. ha escribo:
> > foo/<file>.lisp
> >
> > (where anything between <>'s is interpreted as a regular lisp form)
> > would be nice, since it already resembles everybody's psuedocode
>
> I've never seen that.
> Sometimes I've seen foo/${file}.lisp or just foo/$file
ok, maybe just my psuedocode ;-)
> > CL-USER> (let ((x "foo")
> > (y "bar"))
> > #!/baz/<x>/biz.<y>)
> >
> > #P"/baz/foo/biz.bar"
>
> #! is unfortunately already taken for unix scripts: #!/usr/bin/clisp
>
ok, this was just the char I typed when I was writing it, the question
was about the <> syntax
> > [...]
> > any any comments/feedback/suggestions would be greatly appreciated
>
> You could just use any generic string interpolating package. You can
> use strings everywhere you can use pathname designators...
yes, #?"foo/${file}.lisp" is actually a nice alternative... there is
still the matter of those three extra chars though... just tmtowtdi
Nick