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

Pages: 1-4041-

gLAMOROUS! eXTRAORDINAIRE!

Name: TRUE TRUTH EXPERT !!TthtFzrtPXElUy7 2009-11-19 15:38

hELLO AND WELCOME TO TRUE TRUTH EXPERT INTERNET PERSONA AND EXTRAVAGANJA EXTRAORDINOIR POST OF TODAY.


(map 'string #'(lambda (x) (if (eq x (char-upcase x)) (char-downcase x) (char-upcase x))) (format nil "~@(~A~)" "gLAMOROUS! eXTRAORDINAIRE!"))

Name: Leah Culver !1LEahRIBg. 2009-11-19 16:45

Tripfags + Lisp thread

(define (atom? n)
  (not (or (null? n)
           (pair? n))))

(define (flatten l)
  (cond ((null? l) '())
        ((atom? l) (list l))
        (else
         (apply append (map flatten l)))))

Name: Anonymous 2009-11-19 16:53

Wait so it just upcases a string?? I don't understand. What does this... How do I...

Just fucking learn haskell. this lisp shit is getting on my nerves. That code is obfuscating itself. What's this giant fucking lambda doing in the middle of my semi-readable statement?

Name: Anonymous 2009-11-19 16:57

>>5
I suggest you read closer and look at the historical record of tRUE TRUTH EXPERT. If all he wanted to do was upcase a string, he would have used string-upcase

Name: Anonymous 2009-11-19 17:22

>>4
ジェスト
Didn't you mean: “ジャスト”??

Name: Anonymous 2009-11-19 18:29

>>7
Didn't you mean: ザパメ ポソ パカリラ

Name: Anonymous 2009-11-19 22:53

>>1
nick@nick-desktop:~$ sudo apt-get install gcl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  emacs22 emacs22-bin-common emacs22-common emacsen-common xaw3dg
Suggested packages:
  emacs22-el gcl-doc
The following NEW packages will be installed:
  emacs22 emacs22-bin-common emacs22-common emacsen-common gcl xaw3dg
0 upgraded, 6 newly installed, 0 to remove and 51 not upgraded.
Need to get 68.1MB/68.1MB of archives.
After this operation, 223MB of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.

Name: Anonymous 2009-11-19 23:15

>>10
The fuck you think that 300Gb drive is for !!!
Install that shit you pussyfag

Name: Anonymous 2009-11-20 0:53

>>9
ubuntu user that cares about disk space
You probably have > 8GiB of porn content, delete a loli vid and you'll be able to afford apt-get emacs you pedoubanto fag.

Name: Anonymous 2009-11-20 2:03

Just fucking learn haskell. this lisp shit is getting on my nerves.
is haskell really worth it? being a lispnik I was under the impression MY language can solve everything elegantly. (this is a serious question)

Name: Anonymous 2009-11-20 2:13

>>13
I've heard a lot of this religious yada yada, but experience has taught me that you can't have pros without cons and vice versa; if static languages are that terrible as you claim they're bound to be good in at least one domain of problems. What's hasklol good at?

Name: Anonymous 2009-11-20 2:19

>>13-san has obviously never written any fast applications in his life.

Name: Anonymous 2009-11-20 2:23

>>15

We believe you, thousands wouldn't! We believe your every word!
We believe you, thousands couldn't! We believe each word we heard!

Name: Anonymous 2009-11-20 2:38

>>3

;;; nicely looking but conses a bit
(defun flatten (list)
  (mapcan #'(lambda (e) (if (consp e) (flatten e) (list e))) list))

;;; about 1.5 times as faster as the previous one, but uglier
(defun flatten (e)
  (let (r)                                   
    (labels ((rec (x)
               (cond
                 ((consp x)                 
                  (rec (car x))
                  (let ((y (cdr x)))
                    (when y (rec y))))
                 (t (push x r)))))
      (rec e)
      (nreverse r))))


>>9
Who the hell uses GCL, that's some non-standard crappy implementation. However, I'd say if you put everything together, it will take a few hundred MB: Emacs, SLIME, Paredit, a couple Lisp implementations like SBCL, CCL, CLISP, a lot of ASDF libraries that you might want to use... takes about 600mb here including the installation tarballs, and various temporary files. If I only take into account installation tarballs, it's about ~50MB for the basics, libraries not included. Who cares about HDD space these days anyway? I have a couple of TB, and most of it is wasted by all kinds of media, software barely takes any space at all compared to that.

Name: Anonymous 2009-11-20 3:42

>>13
You'd be surprised to know how many bugs can be avoided with a static type system. That is, if you weren't a troll.

Name: Anonymous 2009-11-20 4:44

>>18
That depends on the implementation of the type system. There's languages with a static type system that require type declarations(strong typing), and yet a lot of bugs are still possible, on the other hand you have dynamic languages like Lisp which have incredibly advanced condition systems and allow dispatching on types and other fancy things, which make them very flexible and avoid many errors which can happen in loosely typed languages like PHP. Static type systems used by Haskell and ML are interesting, and they are indeed somewhat safe (as long as the programmer knows what they're doing), but they also present limits in the way one thinks about various concepts, limits which are not present in languages like Lisp. I think either language has its place and is useful for various problem domains, and there's no "right" or "wrong", it all depends on the problem and the way the programmer reasons about it.

Name: Anonymous 2009-11-20 7:37

>>17
I hope you realize this can be done in O(n) time/memory in C.

Name: Anonymous 2009-11-20 7:44

>>20
I hope you realize your mum sucks nigger beards

Name: Anonymous 2009-11-20 7:47

>>20
Anything you can do in C, I can do in Lisp (albeit, some things may not be portable, but the same is true for some C code).

Name: Anonymous 2009-11-20 7:50

>>20
I imagine that it is possible to do in O(n) time/memory in both Scheme and Common Lisp, but it still wouldn't be as pretty as >>3

Name: Anonymous 2009-11-20 8:06

>>22
Anything you can do in lisp I can do in C and it WILL be portable
>>23
I imagine that it is possible to do in O(n) time/memory in both Scheme and Common Lisp, but it still wouldn't be as pretty as C.

sorry, lisp lost.

Name: Anonymous 2009-11-20 8:18

>>24
I guess it's time to put up or shut up

Name: Anonymous 2009-11-20 8:33

>>24
What >>25 said. Most of the things you can do in C, you can do in Lisp portably, but not all things, the same is true for C. Prettyness is in the eye of the beholder, what you may find pretty in C, someone might find very ugly, the same goes for Lisp or any other language. If you wish to continue in this pointless pissing match, provide some code example, then we can discuss.

Name: Anonymous 2009-11-20 8:53

Here's a first draft that I think fits the bill. The tag at the beginning of the return list is just so I don't deal with the empty case, but can be removed rather simply. It returns a mutable list, but you could always call mlist->list if you wanted to.
(require scheme/mpair)
(define (flatten lst)
  (let* ((return-list (mlist 'retlist))
         (end-pointer return-list))
    (define (add! l)
      (set-mcdr! end-pointer (mcons l '()))
      (set! end-pointer (mcdr end-pointer)))
    (define (helper l)
      (cond ((null? l) (void))
            ((pair? l) (helper (car l))
                       (helper (cdr l)))
            (else (add! l))))
    (helper lst)
    (mcdr return-list)))

Name: Anonymous 2009-11-20 9:51

I am not going to provide source code because I don't feel like typing over and over again the same shit I learned years ago about data structures. Here's just the essential:


list *flatten(tree *t) {
    size_t atomnodes = t->atoms;
    list *r = alloc_list(atomnodes);
    assert(r);
    /* in order macro */
    iter_IO(t, atomnodes, {list_iset(r, iter_it, iter_obj);});
    return r;
}

iter_IO introduces two variables, iter_it which refers to the number of atoms encountered thusfar and iter_obj which refers to the atom itself. list_iset implements O(logn) write access for any listnode by saving each reference and subscript as value-key pairs respectively, in a hashtable.

Name: Anonymous 2009-11-20 10:01

>>28
You still don't get it. Being a C programmer is like having a scat fetish. Lisp transcends sexual pleasure or sexual reproduction for that matter. It is just Lisp.

Name: Anonymous 2009-11-20 10:16

>>30
Lisp transcends sexual pleasure or sexual reproduction for that matter.

weasel words for 'virginity'

Name: Anonymous 2009-11-20 10:18

>>17's second implementation is fairly fast, it just traverses the tree, and pushes the nodes into a list, then reverses the list. It could be made even faster by replacing PUSH/NREVERSE idiom with a more elaborate WITH-COLLECTORS or COLLECTING macro (which keeps a tail pointer), but I've done the benchmarks, and it seems PUSH/NREVERSE is actually faster for small lists, since WITH-COLLECTOR(S) introduces a small overhead:


CL-USER> (time (flatten '(1 2 3 4 (a b c (d (e (f (g h j) k) 9 8) 7) 6 ()))))
Evaluation took:
  0.000 seconds of real time
  0.000000 seconds of total run time (0.000000 user, 0.000000 system)
  100.00% CPU
  3,285 processor cycles
  0 bytes consed

This is reasonably fast for me.

>>29
One point proven here is that while things are possible to do in C, the coder is much lazier to implement everything himself, or he can choose to oversimplify the problem in some way to make it more manageable to solve (I was looking over a book containing various problems used in compsci competitions throughout the world, and I noticed almost all problems have artificial limits imposed upon them so they would be easier solved in C or Pascal or whatever teaching language they had, things like saying there would be no more than 100 items in the input, so the programmer could just use an static array). Sure, I can do everything I can do in Lisp in C, but I have to say, I'm feeling much lazier to write C code than Lisp, since I have to reinvent the wheel a lot of the time, even if I reuse my own libraries. A Lisp programmer is much more likely to be willing to solve a problem, in this thread we have 4 flatten implementations in Lisp/Scheme, and one incomplete C one.

Name: Anonymous 2009-11-20 15:51

Lisp is cosmologically disgusting
what?

Name: Anonymous 2009-11-20 23:17

>>35
Good to hear toilet fishcakes.

Name: Anonymous 2009-11-21 8:54


CMUCL {cl-user}> "lisp ended programming innovation"
"lisp ended programming innovation"
CMUCL {cl-user}> (map 'string #'(lambda (x) (if (eq x (char-upcase x)) (char-downcase x) (char-upcase x))) (format nil "~@(~A~)" *))
"lISP ENDED PROGRAMMING INNOVATION"


you know it's true.

Name: Anonymous 2009-11-21 9:02

>>38
Not entirely true, for example, if we had stopped with Lisp we would never have experienced Haskells type system.

Name: Anonymous 2009-11-21 10:00

>>39
Can't you use defgenerics with builtin CLOS types?

Name: Anonymous 2009-11-21 10:08

>>41
I don't know, quite frankly, I was just trying to offset some of my Smug Scheme Weenie emissions for the week.

Name: Anonymous 2009-11-21 11:40

>>40
static typing = premature optimization.
EXPERT REASONING

Name: Anonymous 2009-11-21 12:14

>>43
I won't spend time explaining anything to you, if you don't accept the truth then seek it and find out for youself.

Name: Anonymous 2009-11-21 12:27

>>44
EXPERTLY CONVENIENT

Name: Anonymous 2010-12-06 10:15

Are you GAY?
Are you a Haskell Programmer?
Are you a Raging Animu Fanboi?

If you answered "Yes" to all of the above questions, then /praque/ might be exactly what you've been looking for!

Name: Anonymous 2011-02-03 3:52

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