Sorry for the vague subject title, but I could not think of anything
better. Anyhow, is there any Lisp function that returns the name of
the computer that it is executed on. I have a function that uses
sockets to connect to some program, and it would be best if I can have
a function that automatically retrieves the name of the machine. Also,
is there any read function that reads tokens that are separated by
spaces. I know that the read function can do this, but it will also
read an entire parenthetical item as one item, rather than dividing it
into sub-tokens that are separated by spaces. Any built in function?
If not, this will be pretty straightforward to implement using read-
char, but I was just wondering if anything was built in. Thanks.
Also, on a completely separate note, in emacs, how do I enter
arguments to emacs functions? For example there is the following
function:
(ps-print-buffer-with-faces &optional filename)
Ordinarily, I would type M-x ps-print-buffer-with-faces. With no
arguments, output is sent to the printer. I use M-x to enter function.
How can I also add arguments. Although I only mentioned one example, I
would like to know if there is a general way to enter arguments.
Thanks.
One option is using M-: and then typing it in. Normally one can give
these things prefix arguments, but that only allows numbers, I
think. If there's some name you always end up using, why not write a
short elisp function to do it and bind it to a key chord?
Rupert
On Sat, 12 Apr 2008 10:10:37 +0100, Rupert Swarbrick <··········@gmail.com> wrote:
> One option is using M-: and then typing it in. Normally one can give
> these things prefix arguments, but that only allows numbers, I
> think. If there's some name you always end up using, why not write a
> short elisp function to do it and bind it to a key chord?
Correct. It's relatively easy to write an `interactive' wrapper, than
can prompt for the filename and pass it as an argument to another
function:
(defun keramida-ps-print-buffer-with-faces (filename)
(interactive "sFilename: ")
(ps-print-buffer-with-faces filename))
Then you can use `M-x keramida-ps-print-buffer-with-faces', and it
should prompt for a filename before invoking the current implementation
of the `ps-print-buffer-with-faces' command.
Giorgos Keramidas <········@ceid.upatras.gr> writes:
> On Sat, 12 Apr 2008 10:10:37 +0100, Rupert Swarbrick <··········@gmail.com> wrote:
>> One option is using M-: and then typing it in. Normally one can give
>> these things prefix arguments, but that only allows numbers, I
>> think. If there's some name you always end up using, why not write a
>> short elisp function to do it and bind it to a key chord?
>
> Correct. It's relatively easy to write an `interactive' wrapper, than
> can prompt for the filename and pass it as an argument to another
> function:
>
> (defun keramida-ps-print-buffer-with-faces (filename)
> (interactive "sFilename: ")
> (ps-print-buffer-with-faces filename))
>
> Then you can use `M-x keramida-ps-print-buffer-with-faces', and it
> should prompt for a filename before invoking the current implementation
> of the `ps-print-buffer-with-faces' command.
Of course, but in the case of ps-print-buffer-with-faces if you took
the pain of reading the doc, you'd knew that you only have to type C-u
M-x ps-print-buffer-with-faces RET to be asked the file name...
If you don't read the doc, will you read my post?
--
__Pascal Bourguignon__ http://www.informatimago.com/
"Logiciels libres : nourris au code source sans farine animale."
On Sun, 13 Apr 2008 04:23:43 +0200, Pascal Bourguignon wrote:
>Giorgos Keramidas <········@ceid.upatras.gr> writes:
>>On Sat, 12 Apr 2008 10:10:37 +0100, Rupert Swarbrick <··········@gmail.com> wrote:
>>> One option is using M-: and then typing it in. Normally one can give
>>> these things prefix arguments, but that only allows numbers, I
>>> think. If there's some name you always end up using, why not write a
>>> short elisp function to do it and bind it to a key chord?
>>
>> Correct. It's relatively easy to write an `interactive' wrapper, than
>> can prompt for the filename and pass it as an argument to another
>> function:
>>
>> (defun keramida-ps-print-buffer-with-faces (filename)
>> (interactive "sFilename: ")
>> (ps-print-buffer-with-faces filename))
>>
>> Then you can use `M-x keramida-ps-print-buffer-with-faces', and it
>> should prompt for a filename before invoking the current implementation
>> of the `ps-print-buffer-with-faces' command.
>
> Of course, but in the case of ps-print-buffer-with-faces if you took
> the pain of reading the doc, you'd knew that you only have to type C-u
> M-x ps-print-buffer-with-faces RET to be asked the file name...
Ah, you are right of course! I was too hasty to post.
> If you don't read the doc, will you read my post?
Sure. I read *all* your posts, FWIW :-)
In article
<····································@k13g2000hse.googlegroups.com>,
dstein64 <········@gmail.com> wrote:
> Sorry for the vague subject title, but I could not think of anything
> better. Anyhow, is there any Lisp function that returns the name of
> the computer that it is executed on. I have a function that uses
There's no standard function, but I expect just about every
implementation has a custom function for this. Check your documentation.
> sockets to connect to some program, and it would be best if I can have
> a function that automatically retrieves the name of the machine. Also,
> is there any read function that reads tokens that are separated by
> spaces. I know that the read function can do this, but it will also
> read an entire parenthetical item as one item, rather than dividing it
> into sub-tokens that are separated by spaces. Any built in function?
> If not, this will be pretty straightforward to implement using read-
> char, but I was just wondering if anything was built in. Thanks.
No, there's no built-in function for this. Use read-line and then
search for #\space.
--
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE don't copy me on replies, I'll read them in the group ***
Barry Margolin <······@alum.mit.edu> writes:
> In article
> <····································@k13g2000hse.googlegroups.com>,
> dstein64 <········@gmail.com> wrote:
>
>> Sorry for the vague subject title, but I could not think of anything
>> better. Anyhow, is there any Lisp function that returns the name of
>> the computer that it is executed on. I have a function that uses
>
> There's no standard function, but I expect just about every
> implementation has a custom function for this. Check your documentation.
[···@thalassa ~]$ clall '(machine-instance)'
========================================================================
CLISP 2.41 (2006-10-13) (built on thalassa.lan.informatimago.com [192.168.1.198])
Evaluation of
(MACHINE-INSTANCE)
produced nothing on *STANDARD-OUTPUT*
produced nothing on *ERROR-OUTPUT*
produced no error
produced the following vals:
--> "thalassa.informatimago.com [192.168.7.1]"
; loading system definition from
; /usr/share/common-lisp/systems/asdf-binary-locations.asd into
; #<PACKAGE "ASDF0">
; registering #<SYSTEM ASDF-BINARY-LOCATIONS {AEB9471}> as ASDF-BINARY-LOCATIONS
========================================================================
SBCL 1.0.15-gentoo
Evaluation of
(MACHINE-INSTANCE)
produced nothing on *STANDARD-OUTPUT*
produced nothing on *ERROR-OUTPUT*
produced no error
produced the following vals:
--> "thalassa"
========================================================================
pCMU Common Lisp CVS 19c 19c-release + minimal debian patches (19C)
Evaluation of
(MACHINE-INSTANCE)
produced nothing on *STANDARD-OUTPUT*
produced nothing on *ERROR-OUTPUT*
produced no error
produced the following vals:
--> "thalassa"
========================================================================
GNU Common Lisp (GCL) GCL 2.6.7
Evaluation of
(MACHINE-INSTANCE)
produced nothing on *STANDARD-OUTPUT*
produced nothing on *ERROR-OUTPUT*
produced no error
produced the following vals:
--> NIL
========================================================================
ECL 0.9g
Evaluation of
(MACHINE-INSTANCE)
produced nothing on *STANDARD-OUTPUT*
produced nothing on *ERROR-OUTPUT*
produced no error
produced the following vals:
--> "i686"
========================================================================
[···@thalassa ~]$
gcl is not very able. No surprise here. But at least it's conformant.
ecl is wrong. i686 is not an instance, it's a class. It's even an abstract class!
--
__Pascal Bourguignon__ http://www.informatimago.com/
"This statement is false." In Lisp: (defun Q () (eq nil (Q)))
On Apr 12, 4:26 pm, Pascal Bourguignon <····@informatimago.com> wrote:
> ecl is wrong. i686 is not an instance, it's a class. It's even an abstract class!
I have fixed this. In the CVS version ECL now uses various environment
variables and the output of the uname() function, where available.
Juanjo
$ ecl
ECL (Embeddable Common-Lisp) 0.9j (CVS 2008-04-13 20:34)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help. Top level.
> (machine-instance)
"benasque2.local"
> (machine-type)
"i386"
> (machine-version)
NIL
> (software-type)
"Darwin"
> (software-version)
"8.11.1"
Juanjo <·····················@googlemail.com> writes:
> On Apr 12, 4:26 pm, Pascal Bourguignon <····@informatimago.com> wrote:
>> ecl is wrong. i686 is not an instance, it's a class. It's even an abstract class!
>
> I have fixed this. In the CVS version ECL now uses various environment
> variables and the output of the uname() function, where available.
>
> Juanjo
Thank you!
--
__Pascal Bourguignon__ http://www.informatimago.com/
"Debugging? Klingons do not debug! Our software does not coddle the
weak."
dstein64 <········@gmail.com> writes:
> Sorry for the vague subject title, but I could not think of anything
> better. Anyhow, is there any Lisp function that returns the name of
> the computer that it is executed on. I have a function that uses
> sockets to connect to some program, and it would be best if I can have
> a function that automatically retrieves the name of the machine.
(apropos "MACHINE" "CL")
> Also,
> is there any read function that reads tokens that are separated by
> spaces. I know that the read function can do this, but it will also
> read an entire parenthetical item as one item, rather than dividing it
> into sub-tokens that are separated by spaces.
You could flatten the read list.
> Any built in function?
> If not, this will be pretty straightforward to implement using read-
> char, but I was just wondering if anything was built in. Thanks.
Or by disabling the #\( reader macro.
(defvar *readtable-wo-list* (copy-readtable nil))
(defun read-self (stream ch) (declare (ignore stream)) (values (intern (string ch))))
(set-macro-character #\( (function read-self) nil *readtable-wo-list*)
(set-macro-character #\) (function read-self) nil *readtable-wo-list*)
(let ((*readtable* *readtable-wo-list*))
(with-input-from-string (in "a (b c) d) e)")
(loop :for token = (read in nil in)
:until (eq token in)
:collect token)))
--> (A |(| B C |)| D |)| E |)|)
--
__Pascal Bourguignon__ http://www.informatimago.com/
This is a signature virus. Add me to your signature and help me to live.
On Apr 11, 11:50 pm, dstein64 <········@gmail.com> wrote:
> Sorry for the vague subject title, but I could not think of anything
> better. Anyhow, is there any Lisp function that returns the name of
> the computer that it is executed on. I have a function that uses
> sockets to connect to some program, and it would be best if I can have
> a function that automatically retrieves the name of the machine. Also,
> is there any read function that reads tokens that are separated by
> spaces. I know that the read function can do this, but it will also
> read an entire parenthetical item as one item, rather than dividing it
> into sub-tokens that are separated by spaces. Any built in function?
> If not, this will be pretty straightforward to implement using read-
> char, but I was just wondering if anything was built in. Thanks.
Several people have written about implementation-specific functions,
but there are some CL functions that you might find useful (although
their /results/ are still implementation specific).
From http://www.lisp.org/HyperSpec/Body/sec_the_envir_t_dictionary.html
Function LISP-IMPLEMENTATION-TYPE, LISP-IMPLEMENTATION-VERSION
Function SHORT-SITE-NAME, LONG-SITE-NAME
Function MACHINE-INSTANCE
Function MACHINE-TYPE
Function MACHINE-VERSION
Function SOFTWARE-TYPE, SOFTWARE-VERSION
On Lispworks 5.0, OS X 10.4, machine-instance returned the name of my
machine.
And, while not entirely relevant, I was pleased when I first found:
Function USER-HOMEDIR-PATHNAME
//JT
On Apr 12, 5:21 pm, Joshua Taylor <···········@gmail.com> wrote:
> On Apr 11, 11:50 pm, dstein64 <········@gmail.com> wrote:
>
> > Sorry for the vague subject title, but I could not think of anything
> > better. Anyhow, is there any Lisp function that returns the name of
> > the computer that it is executed on. I have a function that uses
> > sockets to connect to some program, and it would be best if I can have
> > a function that automatically retrieves the name of the machine. Also,
> > is there any read function that reads tokens that are separated by
> > spaces. I know that the read function can do this, but it will also
> > read an entire parenthetical item as one item, rather than dividing it
> > into sub-tokens that are separated by spaces. Any built in function?
> > If not, this will be pretty straightforward to implement using read-
> > char, but I was just wondering if anything was built in. Thanks.
>
> Several people have written about implementation-specific functions,
> but there are some CL functions that you might find useful (although
> their /results/ are still implementation specific).
>
> Fromhttp://www.lisp.org/HyperSpec/Body/sec_the_envir_t_dictionary.html
>
> Function LISP-IMPLEMENTATION-TYPE, LISP-IMPLEMENTATION-VERSION
> Function SHORT-SITE-NAME, LONG-SITE-NAME
> Function MACHINE-INSTANCE
> Function MACHINE-TYPE
> Function MACHINE-VERSION
> Function SOFTWARE-TYPE, SOFTWARE-VERSION
>
> On Lispworks 5.0, OS X 10.4, machine-instance returned the name of my
> machine.
>
> And, while not entirely relevant, I was pleased when I first found:
>
> Function USER-HOMEDIR-PATHNAME
>
> //JT
Hi
I have not updated it recently, but that would be what CL-ENVIRONMENT
should be for. Have a look at it in the CLOCC.
Cheers
--
Marco
dstein64 wrote:
> Sorry for the vague subject title, but I could not think of anything
> better. Anyhow, is there any Lisp function that returns the name of
> the computer that it is executed on. I have a function that uses
> sockets to connect to some program, and it would be best if I can have
> a function that automatically retrieves the name of the machine. Also,
> is there any read function that reads tokens that are separated by
> spaces. I know that the read function can do this, but it will also
> read an entire parenthetical item as one item, rather than dividing it
> into sub-tokens that are separated by spaces. Any built in function?
> If not, this will be pretty straightforward to implement using read-
> char, but I was just wondering if anything was built in. Thanks.
If you don't mind using a library:
http://weitz.de/cl-ppcre/
Has a split function that will break on whitespace if you ask it to.
Plus, a good regular expression library will eventually prove useful, so
it won't hurt to learn your way around it now.
P� Tue, 15 Apr 2008 01:12:01 +0200, skrev Jeffrey <·······@comcast.net>:
> dstein64 wrote:
>> Sorry for the vague subject title, but I could not think of anything
>> better. Anyhow, is there any Lisp function that returns the name of
>> the computer that it is executed on. I have a function that uses
>> sockets to connect to some program, and it would be best if I can have
>> a function that automatically retrieves the name of the machine. Also,
>> is there any read function that reads tokens that are separated by
>> spaces. I know that the read function can do this, but it will also
>> read an entire parenthetical item as one item, rather than dividing it
>> into sub-tokens that are separated by spaces. Any built in function?
>> If not, this will be pretty straightforward to implement using read-
>> char, but I was just wondering if anything was built in. Thanks.
>
> If you don't mind using a library:
>
> http://weitz.de/cl-ppcre/
>
> Has a split function that will break on whitespace if you ask it to.
> Plus, a good regular expression library will eventually prove useful, so
> it won't hurt to learn your way around it now.
or just split-sequence
http://www.cliki.net/SPLIT-SEQUENCE
--------------
John Thingstad