From: William Bland
Subject: Rather useful unix utility
Date: 
Message-ID: <pan.2005.07.28.05.19.55.758445@abstractnonsense.com>
http://abstractnonsense.org/cgi-bin/trac.cgi/wiki/ClUtils

A few quick examples:

···@bills-laptop ~ $ cl:+ 1 2 3
6
···@bills-laptop ~ $ # How big are outbound TCP buffers?
···@bills-laptop ~ $ netstat -n | grep tcp | awk '{print $3}' | cl:+
162
···@bills-laptop ~ $ cat numbers
1 2 3
4 5
6
···@bills-laptop ~ $ cl:mapcar -f "(lambda (x) (* x x))" list -b list < numbers
1
4
9
16
25
36


Enjoy!

Best wishes,
	Bill.
From: Rob Warnock
Subject: Re: Rather useful unix utility
Date: 
Message-ID: <guqdnSRQ7pnG8nHfRVn-jQ@speakeasy.net>
William Bland  <·······@abstractnonsense.com> wrote:
+---------------
| http://abstractnonsense.org/cgi-bin/trac.cgi/wiki/ClUtils
...
| ···@bills-laptop ~ $ cl:+ 1 2 3
| 6
+---------------

I have something similar, a wrapper script I use to run CMUCL.
When given command-line arguments it instead treats it as just a
single sexpr to REP (no L).

    % cmu + 1 2 3
    6
    % 

But for some reason [terminal cuteness?] I also have it symlinked
from ~/bin/= (yes, a bare "=" is a legal Unix file name), so what
I usually type is more like this [and, yes, as you've noticed, when
trying to enter sub-exprs the shell quoting can rapidly become an
*enormous* pain]:

    % = + 1 2 3
    6
    % = expt 2 100
    1267650600228229401496703205376
    % = mapcar "(lambda (x) (* x x))" "(iota 5)"
    (0 1 4 9 16)
    % = values "(* 2 4)" "(+ 1 5)"
    8
    6
    % = - 0x47fea 0x47fdc
    14
    %

[Oh, yeah, there's a "0" reader macro that gets turned on in that case,
so I can cut'n'paste numbers from hardware debugging sessions. Doing "0x"
numbers was easy; *not* messing up "0.123" was much harder; and I gave up
on not botching symbols whose names start with "0" (oops).]

+---------------
| ···@bills-laptop ~ $ # How big are outbound TCP buffers?
| ···@bills-laptop ~ $ netstat -n | grep tcp | awk '{print $3}' | cl:+
| 162
+---------------

But in the case, why not just type this??  ;-}  ;-}

    % netstat -n | grep tcp | awk '{sum += $3 } END {print $3}'
    47
    % 


-Rob

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607