Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-8081-

Huffman Tree in LISP

Name: Anonymous 2010-12-30 1:10


huff xs -> xs.sort.{[x@xs ys:_:@{l=>l.lhd!=x}]=>[[x@xs] @ys.rec]}
           |> map x~>[x.len x.lhd] |> sort by={a b => a|0 < b|0}
           |> {[x]=>x|1;[a b @xs]=>nins a|0+b|0 [a|1 b|1] xs |> rec}
           |> {bs x=>[[x bs]]; bs [a b]=>conc rec,[@bs 0],a rec,[@bs 1],b} []

usage example:

(repl "huff \"The algorithm for generating a Huffman tree is very simple.\"")
((\y (0 0 0 0 0))   (\h (0 0 0 0 1))   (\m (0 0 0 1))   
 (\n (0 0 1 0))     (\t (0 0 1 1))     (\f (0 1 0 0))   
 (\g (0 1 0 1))     (\e (0 1 1))       (\u (1 0 0 0 0 0))
 (\v (1 0 0 0 0 1)) (\. (1 0 0 0 1 0)) (\H (1 0 0 0 1 1))
 (\T (1 0 0 1 0 0)) (\p (1 0 0 1 0 1)) (\l (1 0 0 1 1)) 
 (\o (1 0 1 0 0))   (\s (1 0 1 0 1))   (\a (1 0 1 1))   
 (\i (1 1 0 0))     (\r (1 1 0 1))     (\Space (1 1 1))  )

Name: Anonymous 2010-12-30 1:12

VALID PERL CODE

Name: Anonymous 2010-12-30 1:45

>>2
Try doing it in C/C++/Java, infindel!

Name: Anonymous 2010-12-30 1:51

With C++ it goes like that...

typedef { SimpleType, CompoundType } TypeOfNode;                         //<<<
class Node {
    private:                                                             //<<<
        TypeOfNode nodeType;                                             //<<<
    protected:
        int freq;
    public:
        Node() : nodeType(TypeOfNode nodetype) : nodeType(nodetype) { }  //<<<
        int getFreq(){
            return freq;
        }
        virtual char getChar() = 0;
        virtual Node * getLeft() = 0;
        virtual Node * getRight() = 0;
        void TransverseNodes(Node * thisNode);
};

class Simple_Node : public Node {
    private:
        char element;
    public:
        char getChar(){
            return element;
        }
 
        Simple_Node(char ch, int count) : Node(SimpleNode) { //<<<
            //Default freq is 1
            freq = count + 1;
            element = ch;
        }
 
        Node * getLeft(){
            return NULL;
        }
 
        Node * getRight(){
            return NULL;
        }
};

...

Name: Anonymous 2010-12-30 2:33

>>3
HuffmanTree t = new HuffmanTree(inputString);

Name: Anonymous 2010-12-30 2:49

>>5
define "HuffmanTree"

Name: Anonymous 2010-12-30 2:54

>>6
Definitions of huffman tree on the Web:

    * In computer science and information theory, Huffman coding is an entropy encoding algorithm used for lossless data compression. ...
      en.wikipedia.org/wiki/Huffman_tree

Name: Anonymous 2010-12-30 3:03

>>7
C++ understands "Definitions of huffman tree on the Web"?

Name: Anonymous 2010-12-30 4:03

>>8
C++ understand nothing, it is a language not a living being.
You are a very strange fellow.

Name: Anonymous 2010-12-30 4:54

>>1
It's... beautiful. It has an operator for everything like Perl 6.

Name: Anonymous 2010-12-30 6:51

>>10
That may be, but it also expresses a higher code density than Perl6 could achieve. This is what makes haskal so mena.

Name: Anonymous 2010-12-30 6:57

>>9
Lisp understands something, because it mutates like it is living!

Name: Anonymous 2010-12-30 8:22

I just found that semantics of `by` keyword to `sort` should be changed to column selector, instead of comparator, so with a little rethinking code got compressed into 3 lines of 80 columns each.

huff xs -> xs.sort.{[x@xs ys:_:@(nb x)]=>[[xs.len+1 x] @ys.rec]}
           |> sort by=0 |> {[x]=>x|1;[a b @xs]=>nins a|0+b|0 [a|1 b|1] xs|>rec}
           |> {bs x=>[[x bs]]; bs [a b]=>conc rec,[@bs 0],a rec,[@bs 1],b} []

Name: Anonymous 2010-12-30 8:26

>>13
Note, that the last line just converts tree to more readable linear form, so it is unrelated to actual computation.

Name: Anonymous 2010-12-30 8:32

So... where's the Lisp?

Name: Anonymous 2010-12-30 8:54

Anyway, this `by` keyword is pretty neat...

(repl "class Person name age")
no
NIL
(repl "persons=:[10++(Person name=['Jacob 'Ethan 'Michael 'Isabella 'Emma 'Olivia].rand age=90.rand)]")
([:Person name=Jacob age=73]  [:Person name=Olivia age=21]
 [:Person name=Olivia age=59] [:Person name=Jacob age=16]
 [:Person name=Jacob age=49]  [:Person name=Olivia age=78]
 [:Person name=Emma age=13]   [:Person name=Ethan age=29]
 [:Person name=Michael age=2] [:Person name=Ethan age=32] )
NIL
(repl "sort by=age persons")
([:Person name=Michael age=2] [:Person name=Emma age=13] 
 [:Person name=Jacob age=16]  [:Person name=Olivia age=21]
 [:Person name=Ethan age=29]  [:Person name=Ethan age=32]
 [:Person name=Jacob age=49]  [:Person name=Olivia age=59]
 [:Person name=Jacob age=73]  [:Person name=Olivia age=78])
NIL
(repl "sort by=name persons")
([:Person name=Emma age=13]   [:Person name=Ethan age=29]
 [:Person name=Ethan age=32]  [:Person name=Jacob age=73]
 [:Person name=Jacob age=16]  [:Person name=Jacob age=49]
 [:Person name=Michael age=2] [:Person name=Olivia age=21]
 [:Person name=Olivia age=59] [:Person name=Olivia age=78])

Name: Anonymous 2010-12-30 9:40

>>16
EXPERT HASQL PROGRAMMER

Name: Anonymous 2010-12-30 13:28

>>15
His language (the one he invented) is supposedly written on top of CL, but he refuses to give it a name, and instead posts "*whatever in LISP" threads.

Name: Anonymous 2010-12-30 15:56

>>18
The language name is ``in LISP''.

Name: Anonymous 2010-12-30 19:29

>>19
on LISP

Name: Anonymous 2010-12-30 20:28

Huffman Tree in C++

function huff(str) {
    var f = {}, cs = str.split(''), h = new MinHeap(), r = [];
    cs.forEach(function (c) {f[c] |= 0; f[c]++});
    for (c in f) h.push([f[c], c]);
    while (h.length > 1)
        h.push((function (x, y) [x[0] + y[0], [x, y]])(h.pop(), h.pop()));
    (function (e, p) {var [f, c] = e; if (c instanceof Array) { let s = arguments.callee; s(c[0], p + '0'); s(c[1], p + '1') } else r.push([c, p]);})(h.pop(), '');
    return r;
}

usage example:
huff("The algorithm for generating a Huffman tree is very simple.");

[["y","00000"],  [".","000010"], ["H","000011"],
 ["f","0001"],   ["g","0010"],   ["m","0011"],
 ["n","0100"],   ["t","0101"],   ["e","011"],
 ["T","100000"], ["p","100001"], ["u","100010"],
 ["v","100011"], ["h","10010"],  ["l","10011"],
 ["o","10100"],  ["s","10101"],  ["a","1011"],
 [" ","110"],    ["i","1110"],   ["r","1111"]]

Name: Anonymous 2010-12-30 20:35

(define huff (lambda (str) '(("y" . "00000") ("." . "000010") ("H" . "000011") ("f" . "0001") ("g" . "0010") ("m" . "0011") ("n" . "0100") ("T" . "100000") (p . "100001") ("u" . "100010") ("v" . "100011") ("h" . "10010") ("l" . "10011") ("o" . "10100") ("s" . "10101") ("a" . "1011") (" " . "110") ("i" . "1110") ("r" . "1111"))))

Usage example:
(huff "The algorithm for generating a Huffman tree is very simple.")

This runs in constant time and space.

Name: Anonymous 2010-12-30 20:39

>>21
while (h.length > 1) h.push((function (x, y) [x[0] + y[0], [x, y]])(h.pop(), h.pop()));
looks like assembly code to me.

Name: Anonymous 2010-12-30 20:41

>>21
forEach(function (c) {f[c] |= 0; f[c]++});
looks like haskal code to me.

Name: Anonymous 2010-12-30 20:51

>>24
No, this code is pretty sepples, but JavaScript has operator for everything, just like Perl.  The "|="-smile probably checks if Heap element isnt NIL.

Name: Anonymous 2010-12-30 20:57

>>25
JavaScript doesn't have the sub infix:<`fibs`>{1,1,*+*...^*>=100} operator.

Name: Anonymous 2010-12-30 21:00

>>26
I feel sorry for JS, it isnt cutting-edge enough :-(

Name: Anonymous 2010-12-30 21:01

>>25
``operator for everything'' refers to Perl6, which has hundreds upon hundreds of builtin operators (plus the option to define more).  Supporting little more than the typical C ops doesn't count.

Name: Anonymous 2010-12-30 21:06

>>28
I know that because I invented and forced that meme (seriously).

Name: Anonymous 2010-12-30 21:11

>>29
It's still relatively new, I wouldn't call it a meme just yet. Please post the source to the BBCode, though, it's much less obnoxious than some of the others.

Name: Anonymous 2010-12-30 21:14

SexpCode:
{b.u.i.o.s.m.sup.sub.code everything}{i !}
BBCode:
[b][u][i][o][s][m][sup][sub][code]everything[/sub][/sup][/m][/s][/o][/i][/u][/b]![/code]

Name: Anonymous 2010-12-30 21:26

>>31
I missed an [aa]
{b.u.i.o.s.m.aa.sup.sub.code everything}{i !}
[b][u][i][o][s][m][aa][sup][sub][code]everything[/code][/sub][/sup][/aa][/m][/s][/o][/i][/u][/b][i]![/i]

Test: everything!

Name: Anonymous 2010-12-30 23:40

>>21
This is not Sepples; notice the |= operator

Name: Anonymous 2010-12-31 3:03

>>33
Sepples has a |= operator, silly.

Name: Anonymous 2010-12-31 3:25

>>34
In Sepples |= does bitwise OR-ing, but to make >>21 code work, it needs to be logical OR.

Name: Anonymous 2010-12-31 3:32

>>35
Anyway, in my Lisp-dialect, addition treats NIL as 0, so I can write

length [x@xs] -> 1+xs.length

or, to simulate >>21 style, just

ncng c ?+1 f

ncng is a primitive operation for binary-searching and modification sorted b-tree lists in log2(n).

Name: Anonymous 2010-12-31 3:45

>>36

(repl "do cs:[] (fe (ncng ? ?+1 !cs) \"The algorithm for generating a Huffman tree is very simple.\") cs")
((\Space 9) (\. 1) (\H 1) (\T 1) (\a 4) (\e 7)
 (\f 3)     (\g 3) (\h 2) (\i 4) (\l 2) (\m 3)
 (\n 3)     (\o 2) (\p 1) (\r 5) (\s 2) (\t 3)
 (\u 1)     (\v 1) (\y 1)                     )

Name: Anonymous 2010-12-31 6:48

>>36
primitive operation for binary-searching
I'm sure Perl6 doesn't have an operator for that.

Name: Anonymous 2010-12-31 6:55

>>38
Internaly lists are implemented as trees, so most operations on them (like catenation and cutting) are primitive, just like "car" and "cdr" in traditional lisps.

Name: Anonymous 2010-12-31 6:58

Another example (taken from Wikipedia SQL article)

join a b by=0 -> fold {r x=>keep ?.by==x.by b |> map [x ?] |> conc r} [[]@a]


(repl "class Employee name departmentId
class Department name departmentId

employees =: (map [n i]~>(Employee name=n departmentId=i)
                  [['Rafferty 31] ['Jones 33] ['Steinberg 33]
                   ['Robinson 34] ['Smith 34] ['John no]])

departments =: (map [n i]~>(Department name=n departmentId=i)
                    [['Sales 31] ['Engineering 33] ['Clerical 34] ['Marketing 35]])

join employees departments by=departmentId |> map [a b]~>#(`:` $a.name $b.name)")
no
no
([:Employee name=Rafferty departmentId=31]
 [:Employee name=Jones departmentId=33]
 [:Employee name=Steinberg departmentId=33]
 [:Employee name=Robinson departmentId=34]
 [:Employee name=Smith departmentId=34]
 [:Employee name=John departmentId=no])
([:Department name=Sales departmentId=31]
 [:Department name=Engineering departmentId=33]
 [:Department name=Clerical departmentId=34]
 [:Department name=Marketing departmentId=35])
(Rafferty:Sales    Jones:Engineering Steinberg:Engineering
 Robinson:Clerical Smith:Clerical                         )

Name: Anonymous 2010-12-31 7:08

>>39
BTW, traditional Lisp also have these `assoc` and `getf` for treating lists as namespaces, but they are slow!

Name: Anonymous 2010-12-31 7:51

>>41
If you're dealing with large association lists, you might as well use a hashtable or something more efficient, however for tiny ones, an alist would be faster.

Name: Anonymous 2010-12-31 8:35

>>42
Hashtables are inconvenient as you cant process them like lists.

"It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures." -- Alan Perlis

Name: Anonymous 2010-12-31 8:39

>>43
Perl fixed this problem.

Name: Anonymous 2010-12-31 8:40

Consider memory latency.  You can compute a hash with only one memory request and then some arithmetic which would likely be quicker than another memory access, so two requests are to be performed to fetch a value (more if you use buckets and there are collisions) while with assoc list you can only get the first value with two requests (or with one request if it is stored linearly)

Name: Anonymous 2010-12-31 8:53

>>44
How?

Name: Anonymous 2010-12-31 8:54

>>45
Premature optimization is the root of all evil.

Name: Anonymous 2010-12-31 8:56

>>46
my @a = qw/key1 val1 key2 val2/;
my %h = @a;


or at least I think so. You may have to do some coercion but a hash is basically an array with keys at even indices and values at odd indices.

Name: Anonymous 2010-12-31 8:58

>>48
It is a usual hashtable boilerplate, not a list. And what are these "my @" and "my %"? Make me unsee!

Name: Anonymous 2010-12-31 9:34

>>49
Oh no, non-alphanumeric symbols in symbol names! Next you'll be complaining about whitespace being syntactically significant in Haskell and Python.

Name: Anonymous 2010-12-31 10:08

>>49
Are you serious? Get out.

Name: Anonymous 2010-12-31 10:21

>>50>>51
Enjoy your static typing.

Name: Anonymous 2010-12-31 10:48

>>52
my %h = @a;
Yes, of course.

Name: Anonymous 2010-12-31 11:01

>>53
You should steal type inference engine from Haskell people, then you can omit %@

Name: Anonymous 2010-12-31 11:13

>>40
Stop calling it repl, idiot. Write a proper repl or rename this function to rep.

Name: Anonymous 2010-12-31 11:46

>>55
Long time ago it was real REPL, now it is implemented in hosted language itself, like follow

e:m:loop expr -> {=>do $expr (rec)}
repl -> (read).eval.pp.loop


but I'm to lazy to change names with semantics.

Name: Anonymous 2010-12-31 11:47

together with semantics
self fix

Name: Anonymous 2010-12-31 14:33

i'll skip coke this year

Name: Anonymous 2010-12-31 19:52

>>44
Perl fixes everything!

Name: Anonymous 2011-01-01 3:52

>>1
Looks like shit. You should be ashamed for writing such unreadable code.

Name: Anonymous 2011-01-01 23:56

>>60
You should be ashamed of loving Pascal.

Name: Anonymous 2011-01-01 23:58

Just for fags, I've a readable version, it looks verbose as fuck

uses crt;
type
  ana= record
   sayi, ytree :integer;
   dur, yer    :byte;
  end;
var
  A:array[1..50] of ana; Tree:array[1..512] of integer;
  binary_dizi:array[1..10] of byte; toplam_dizi:array[1..200] of byte;
  i,j,k,l,m,n,t,z,top,t_d:integer; ch:char;
 
Procedure oku;
begin
 write('Size of array:');read(n);
 for i:=1 to n do
  begin
   read(A[i].sayi);
  end;
end;
 
Procedure BubbleSort;
var yedek:integer;
begin
  for i:=1 to n-1 do
   for j:=1 to n-i do
     if A[j].sayi > A[j+1].sayi then
      begin
       yedek:=A[j].sayi;
       A[j].sayi:=A[j+1].sayi;
       A[j+1].sayi:=yedek;
      end;
end;
 
Procedure Huffman_Tree;
begin
{******************Total Array**********************}
 for i:=1 to 50 do a[i].dur:=0;
 i:=1; z:=0;
 while z=0 do
  begin
   top:=A[i].sayi+A[i+1].sayi;
   k:=i+1;
   t:=0;
   while t=0 do
     if (A[k].sayi<top)and(A[k].sayi<>0) then
           inc(k)
         else
          begin
           for  l:=n+1 downto k+1 do
            begin
             A[l].sayi:=A[l-1].sayi;
             A[l].dur:=A[l-1].dur;
            end;
           A[k].sayi:=top;
           A[k].dur:=1;
           t:=1;
           inc(n);
           A[k].yer:=i;
          end;
   inc(i,2);
   if A[i+1].sayi=0 then z:=1;
  end;
{------------------ Total Array ----------------------}
 
{******************Huffman Tree**********************}
 Tree[1]:=A[n].sayi;A[n].ytree:=1;
 Tree[2]:=A[A[n].yer].sayi;  A[A[n].yer].ytree:=2;
 Tree[3]:=A[A[n].yer+1].sayi;A[A[n].yer+1].ytree:=3;
 for i:=n-1 downto 1 do
   if A[i].dur=1 then
    begin
     j:=A[i].ytree;
     t:=A[i].yer;
     Tree[j+j]:=A[t].sayi;
     A[t].ytree:=j+j;
     Tree[j+j+1]:=A[t+1].sayi;
     A[t+1].ytree:=j+j+1;
    end;
{------------------Huffman Tree ----------------------}
end;
 
Procedure binary;
var yedek:integer;
begin
{******************Binary Code**********************}
 for i:=1 to n do
  begin
   if A[i].dur=0 then
     begin
      j:=A[i].ytree;
      k:=0;
      while j>1 do
       if (j mod 2)=0 then
         begin
          j:=j div 2;
          inc(k);
          binary_dizi[k]:=0;
         end
        else
         begin
          j:=(j-1) div 2;
          inc(k);
          binary_dizi[k]:=1;
         end;
      inc(k);
      binary_dizi[k]:=1;
      t:=k;
      for j:=1 to (k div 2) do
        begin
         yedek:=binary_dizi[j];
         binary_dizi[j]:=binary_dizi[t];
         binary_dizi[t]:=yedek;
         t:=t-1;
        end;
      write(A[i].sayi:3,'. number´s equivalent: ');
      for j:=1 to k do
       begin
        write(binary_dizi[j]);
        inc(t_d);
        toplam_dizi[t_d]:=binary_dizi[j];
       end;
      writeln;
     end;
  end;
{------------------Binary Code----------------------}
end;
 
Procedure TotalArray;
begin
 writeln(' Total array...');
 for i:=1 to t_d do write(Toplam_dizi[i]); writeln;
end;
 
Procedure decode;
begin
{******************Conversion from Binary to number**********************}
 
 writeln('From above array original numbers are generated...');
 i:=2; j:=1;
 while i<=t_d do
  begin
   if Toplam_dizi[i]=0 then
      j:=j+j
     else
      j:=j+j+1;
   if (Tree[j+j]=0)and(Tree[j+j+1]=0) then
      begin
       writeln('Number:', Tree[j]);
       inc(i);
       j:=1;
      end;
   inc(i);
  end;
{------------------ Conversion from Binary to number----------------------}
end;
 
BEGIN
 clrscr;
 oku;
 BubbleSort;
 Huffman_Tree;
 t_d:=0;
 binary;
 TotalArray;
 decode;
 repeat ch:=readkey; until ch=#27; {Press Esc for exit}
END.

Name: Anonymous 2011-01-02 0:09

J, the one of most cryptic and succinct languages in existence, still requires a good amout of code compared to 3 lines of >>13

http://rosettacode.org/wiki/Huffman_coding#J

hc=: 4 : 0 
 if. 1=#x do. y
 else. ((i{x),+/j{x) hc (i{y),<j{y [ i=. (i.#x) -. j=. 2{./:x end.
)
 
hcodes=: 4 : 0
 assert. x -:&$ y           NB. weights and words have same shape
 assert. (0<:x) *. 1=#$x    NB. weights are non-negative
 assert. 1 >: L.y           NB. words are boxed not more than once
 w=. ,&.> y                 NB. standardized words
 assert. w -: ~.w           NB. words are unique
 t=. 0 {:: x hc w           NB. minimal weight binary tree
 ((< S: 0 t) i. w) { <@(1&=)@; S: 1 {:: t
)

   ;"1":L:0(#/.~ (],.(<'    '),.hcodes) ,&.>@~.)'this is an example for huffman encoding'
 t    0 1 0 1 0
 h    1 1 1 1 1
 i    1 0 0 1 
 s    0 0 1 0 
      1 0 1   
 a    1 1 0 0 
 n    0 0 0   
 e    1 1 0 1 
 x    0 1 0 1 1
 m    0 0 1 1 
 p    0 1 1 0 0
 l    0 1 1 0 1
 f    1 1 1 0 
 o    0 1 0 0 
 r    0 1 1 1 0
 u    0 1 1 1 1
 c    1 0 0 0 0
 d    1 0 0 0 1
 g    1 1 1 1 0

Name: Anonymous 2011-01-02 4:02

>>63
You can remove the asserts, you know.

Name: Anonymous 2011-01-02 4:32

>>63
And both are a pain to read, and most likely a pain to write and debug. I'd rather take something which is easy to write and easy to understand/debug than some unreadable mess.

Name: Anonymous 2011-01-02 4:39

>>65
The >>13 code was pretty easy to write and required no debugging. It uses a stream processing approach, just like Unix BASH language ("|>" stands for usual "|" from bash), so I can easily decompose it into several simplier functions at expense of making it more verbose.

Name: Anonymous 2011-01-02 4:48

BTW, as anyone, who readed SICP, knows, you can use stream-processing for everything, if your Lisp-system supports generated lists with memoization.

Name: Anonymous 2011-01-02 4:51

>>67
So, one can even replace Unix with Lisp, making Lisp a self-sufficient operating system.

Name: Anonymous 2011-01-02 5:41

So is this a Lisp-1 or a Lisp-2?

Name: Anonymous 2011-01-02 6:01

>>69
Lisp-1, as I like to use lambdas a lot and dont like funcall'ing manually.

Name: Anonymous 2011-01-02 6:50

>>68
LISP Machines.

Name: Anonymous 2011-01-02 8:08

>>71
LMs supported IPC using generated lists?

Name: Anonymous 2011-01-02 8:11

Common Lisp (CL was used on LMs, isnt it?) uses these ugly "Gray Streams", that cant be uniformly processed as ordinary lists.

Name: Anonymous 2011-01-02 8:42

>>73
On LM's they used ZetaLisp (also known as Lisp Machine Lisp). ZL, and some other Lisps (including Scheme) contributed a lot to the development of ANSI Common Lisp. Common Lisp was created to unify current popular Lisp implementations, and given the package system, it's not that hard (or at least, they tried to make it that way) to take a CL-like dialect and mold it into a standards-compliant CL, so Genera/OpenGenera (Lisp Machine's OS) supported CL after standardization, and various newer parts of it were indeed written in CL instead of ZetaLisp. I'd say that if you know CL, you can read ZetaLisp without much trouble, at least if you try to read OpenGenera's source code, it's quite readable and an interesting piece of code to study. There are some major differences between CL and ZL, especially in the object system as ZL was made before CLOS (relatively new), so they mostly use the Flavours dialect for OO.

As for Gray Streams, they're not in the CL standard, but were proposed as a means of extending the streams using CLOS (similar to how MOP extends CLOS using CLOS). Gray streams kind of fall out naturally out of the design of CL, so I had no trouble at all using them, although most of the time I'm using other people's extensions which use gray streams (for things like in-memory streams, or streams which allow one to grab the data from disk or memory and then interpret it in some way, for example parsing unicode or various foreign encodings). Gray streams are mostly good, but they miss a few generic functions which one might find very useful, but those are supported (along with Gray Streams) by most major CL implementations, so it's not a big deal.

Name: Anonymous 2011-01-02 9:26

>>74
You cant `mapcar` or `filter` gray streams.

Name: Anonymous 2011-01-02 9:29

>>75
Neither one can mapcar strings of arrays.

Name: Anonymous 2011-01-02 9:59

>>75
>>76
my other mapcar is a mdrcdr

Name: Anonymous 2011-01-02 10:06

U MENA mdpcdr.

Name: Anonymous 2011-01-02 10:17

gay streams

Name: Anonymous 2011-01-02 11:17

>>75
Actually you can easily make a stream class which filters (one way or both ways, if it's read/write) elements in a stream. Some libraries provide you with such functionality (portably), but you can easily implement it yourself. I don't see why I would want to mapcar it since it's not a list, and in general, lists are not an efficient way to store a stream (memory usage can be high, not very fast, seeking only works in one direction, unless you use a doubly linked list, but even then, it costs a lot of memory accesses). I use what's more suitable for the job, and using linked lists to store binary files or strings is rarely suitable. Lazy lists are a bit better, but they do come with costs as well. If you want to implement transparent encoding/compression/encryption/whatever, there are plenty of ways to do this using standard CL + gray streams (or use a library which already does it for you).

Name: Anonymous 2011-01-02 11:47

abr abr cdbr
i wanna reach out and grab her

Don't change these.
Name: Email:
Entire Thread Thread List