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

Pages: 1-4041-8081-

C/C++

Name: Galilee 2006-08-16 18:26

So my question is simple ; of the two which would be advisable to learn first.

All the C++ books tell me to learn C++ over C ,but on the internet im told that learning C gives better grasps of concepts.

Which should i learn first and why?

Name: Anonymous 2006-08-16 18:40

Learn C first.

Then learn ObjC or D.

Only learn C++ if you're a masochist in need of a job. It's not as bad as Java, but it comes close.

Name: Anonymous 2006-08-16 18:45

>>2

Name: Anonymous 2006-08-16 19:14

>>2

Name: Anonymous 2006-08-17 0:27

i prefer c++ over c just because it has references and the struct initializing thing. that is all.

Name: Anonymous 2006-08-17 1:00

>>2
That pretty much sums it up.

Name: Anonymous 2006-08-17 1:33

c++ rules because of multiple inheritance, which i use extensively, along with template metaprogramming, which i use with multiple inheritance. 

Name: Anonymous 2006-08-17 2:24

>>5
You, sir, like everyone else, prefer C++--.

Take C++, keep the good features (most of which have been passed on to C99), and ditch classes (unless you get ahold of a garbage collector) and the needlessly complex stuff.

Name: Anonymous 2006-08-17 5:21

D makes a very nice substitute to C++--. Its main problem is that it's so new that the language is still in flux, but they finally seem to be making a push for 1.0. If you're a system programmer it's worth playing around with.

Unrelated, but >>7 probably faps to STL and cums over boost. Yeeeeeech.

Name: Anonymous 2006-08-17 8:11

>>9
I read a bit about D and it sounded great for C++--, but I believe I also read it sucks sure it's C improved, it has overloading, and garbage collection, but it's CLOSED SOURCE, which means it's PROPIETARY, or something along those lines. Are there freely available D compilers for Lunix and Win32, and can I build commercial software with them?

Name: Anonymous 2006-08-17 18:23

There are two compilers, GDC (http://dgcc.sourceforge.net/) and DMD (http://www.digitalmars.com/d/download.html).

Both are free (former as in speech, latter as in beer), and can be used to make commercial software. Since both use the same public domain frontend, they have similar bugcounts: http://dstress.kuehne.cn/www/dstress.html

However, the language is still very young. As much as I like it, I don't think you should write anything commercial in it just yet. Risk mitigation and all that.

tl;dr: yes, there are freely available compilers for linux and win32 that you can build commercial software with.

Name: Anonymous 2006-08-17 18:54

>>11
+1 Informative

Name: Anonymous 2006-08-17 19:43

Just because they crammed everything they could think of into it, doesn't make it a good language.

Name: Anonymous 2006-08-17 19:54

>>13 describes C++ perfectly.

Name: Anonymous 2006-08-17 20:39

Can anyone reccomend some good C books :)

Name: Anonymous 2006-08-17 20:41

>>15
K&R's The C Programming Language. Oldie, but goodie.

Name: Anonymous 2006-08-17 20:51

If you read the creator of C++'s page on C++ he mentions that his original idea had things like garbage collection and no pointers.  So basically his actual vision was for something more like java or C#.  As it happened C++ has pointers and no garbage collection....

as for the learning, just learn C++  seriously.  It will be more useful for writing everyday application than C and if you want to do some really low level stuff where C would be better suited... then you'll be able to learn C easy(assuming you've learned C++)

tl;dr

If you can learn one the other is easy to pickup so just go with C++ which you will probably see more code written in, etc.

Name: Anonymous 2006-08-17 21:38

Yes, please do learn C++. That way there will be less competition for the jobs where I don't want to gouge out my eyeballs.

Also, people like >>17 will be your colleages. Just think of all the fun you can have!

Name: Anonymous 2006-08-17 22:17

>>17
I SWEAR TO FUCKING GOD HOW FUCKING HARD IS IT TO CALL "DELETE" WHEN YOU ARE DONE WITH MEMORY, AND CREATE AND USE DESTRUCTORS.  IT'S COMPUTER PROGRAMMING, NOT FUCKING ROCKET SCIENCE OR BRAIN SURGERY.  FUCKING WHINEY "WAHH WAHH NO AUTOMATIC GARBAGE COLLECTION" NOOBS!

Name: Anonymous 2006-08-18 5:40

>>16
Anonymous approves!

>>17
If he knows C++, he BETTER KNOW C LIKE HIS FUCKING HOME, otherwise he's bound to fail.

>>18
Anonymous agrees, even if it's wicked.

>>19
When you overload =, have several references (which you shouldn't have to know about because of encapsulation), need to create and possibly return temporary copies, etc. what the fuck am I doing, this is an obvious troll.

Name: Anonymous 2006-08-18 15:53

AFDSAFSFASD

Name: Anonymous 2006-08-18 17:57

bump lol

Name: Anonymous 2006-08-19 5:39

>>20
OK, STILL, OVERLOADING OPERATORS, ETC. AND ALL THAT BS.  THAT IS WHY THERE ARE CONSTRUCTORS AND DESTRUCTORS.  PUT new IN THE CONSTRUCTOR AND delete IN THE DESTRUCTOR.  HOW FUCKING GODDAMN HARD IS THAT?

Name: Anonymous 2006-08-19 6:16

>>23
Some reading (a few hundred posts) is in order: http://groups.google.com.au/group/comp.lang.c++.moderated/browse_frm/thread/84253d37f970dd2b?hl=en&; It starts getting interesting around post 20 or so.

tl;dr: RAII ain't all that.

Name: Anonymous 2006-08-19 22:54

bump

Name: Anonymous 2006-08-19 23:44

>>24
Can you please make a slightly longer tl;dr version?

Name: Anonymous 2006-08-20 5:36

>>1

If you are a complete programming noob (javascript and that kind of shit don't really count), go with C++ first and try using C for file I/O. It's fairly common to do this. C++ isn't Java, but the syntax will help you out should you choose to get into Java later on.

Eclipse w/ CDT is a nice IDE to work with, try it out and good luck.

Name: Anonymous 2006-08-20 8:56

It's fairly common to do this. C++ isn't Java, but the syntax will help you out should you choose to get into Java later on.
Why would you want to do either of them?

That's like learning how to eat shit and drink piss when there's decent food only two tables over. Spare yourself.

Name: Anonymous 2006-08-20 10:02

You'll learn most of C in the process of learning C++.  Don't sweat the differences.

In fact, most C++ books and classes teach C more than C++ anyhow.

Name: Anonymous 2006-08-20 10:49

Name: Anonymous 2006-08-20 15:24 (sage)

>>28
is unemployed and lives in his parents dark basement

Name: 28 2006-08-20 18:26 (sage)

I'm gainfully employed, have been for years, and none of my jobs ever needed C++, Java, .NET, or whatever swill >>31 has been suffering through.

There are plenty of great jobs out there. It's not my fault if you can't find them (but thanks for leaving them for awesome old me!).

Name: Anonymous 2006-08-21 0:00

>>32

and may I know what language you have worked with?

PS: Don't reply with HTML is a programming language

Name: 28 2006-08-21 1:45 (sage)

In order: assembler, Perl, C, Python.

They once had me working with some legacy VB, which was ugly, but only for a short while.

Name: Anonymous 2006-08-21 18:44

Bump

Name: Anonymous 2006-08-21 22:28

* Learn C.
* Learn about object orientated programming.
* Implement object orientation in C.
* Decide: Do I really need C++?
* ...
* PROFIT!

Name: Anonymous 2006-08-21 22:40

>>34
So basically all the work you have done is insignificant.

Name: Anonymous 2006-08-22 2:30

>>37
If I get paid, and enjoy myself, why should I care if you think it's "significant"?

Enjoy your miserable life writing "significant" code in something enterprisey, Mr. Cog.

Name: Anonymous 2006-08-22 2:32

>>37
So basically all the posts you have written are trolls. If you think only Java and C++ is significant, then please continue thinking so; you'll be covering the jobs I don't want. We need people like you to satisfy professional enterprise scalable web 2.0 best practices design patterns glue managers.

I'm not >>34 BTW.

Name: Anonymous 2006-08-22 4:53

professional enterprise scalable web 2.0 best practices design patterns glue manager
If I ever have an office, I so want to make the plaque say that. Quoted 4tw.

Name: Anonymous 2006-08-22 5:34

>>40

are you a manager?

Name: Anonymous 2006-08-22 10:08

>>41
Do I have an office?

Actually, do I have a fine secretary I can tryst with? D:

There are no managers on 4chon.

Name: Anonymous 2006-08-22 11:53

>>42

Managers? in MY 4chan?
its more likely than you think

FREE MANAGER CHECK

Name: Anonymous 2006-08-22 12:42

>>42
Oops... If managers are getting fuck secretaries, I'll start spurting buzzwords right now.

>>43
Lol

Name: Anonymous 2006-08-23 14:43

bump

Name: Anonymous 2006-08-23 16:24

what is a buzzword :S?

Name: Anonymous 2006-08-23 18:09

>>46
The abstract base class for all components in any given enterprise system.

Name: Anonymous 2006-08-25 17:56

>>47

In english plz? :(

Name: Anonymous 2006-08-25 19:00

Smart Pointers.

Who needs garbage collection anyway?

Name: Anonymous 2006-08-25 20:24 (sage)

Name: Anonymous 2006-08-26 11:35

>>47
Truth

Name: Anonymous 2006-08-26 18:13

:(

Name: Anonymous 2006-08-27 20:51

Bump

Name: Anonymous 2006-08-28 18:27

:( anymore advice?

Name: Anonymous 2006-08-29 14:10

Learn C first, because it is easier. If you actually manage to learn C then you're prepared to tackle C++.

Name: Anonymous 2006-08-29 14:16

Learn C++ first, it may take a little longer than C, but once you know C++ you can learn C in under an hour.

Name: Anonymous 2006-08-29 16:54

>>55
>>56
lol conflicting advice

Name: Anonymous 2006-08-29 19:22

>>56's way is to learn to win a marathon, then jogging for 5 minutes will be easy.

Name: Anonymous 2006-08-29 19:40

it may take a little longer than C

lol

Name: Anonymous 2006-08-29 20:18

>>58
If you honestly think it is that hard to learn a programming language, you need to stay far far far away from computers.

Name: Anonymous 2006-08-30 4:09 (sage)

>>60

alot of noobs call themselves "programmers" after "hello world".

Name: Anonymous 2006-08-30 6:53

>>60 has never done anything in C++ beyond the typical "hello world".

Read the moderated C++ newsgroups some time. C++ is the ultimate agglutinative language, and therefore is a bitch to learn well. Most "C++ programmers" aren't.

Name: Anonymous 2006-08-30 12:16

>>62
C++ is easy, noob.

Name: Anonymous 2006-08-30 17:03

>>62
i've made scene graphed based game engines, shells, raytracers, etc.  the c++ newsgroups have nothing to do with the difficulty of learning the language.  because c++ is so popular, there are plenty of c++ programmers with too much time on their hands, so they discuss every minute detail of the language on the newsgroups.

Name: Anonymous 2006-08-30 18:29

i've made scene graphed based game engines
"Scene graphed"? Nice.

And how did your "scene graphed" have anything to do with using C++ well?

the c++ newsgroups have nothing to do with the difficulty of learning the language
Oh yes it does. If it was a simple language, there would be little to argue over. This is pretty obvious, guy.

Name: Anonymous 2006-08-30 19:38

>>65
LOL LETS MAKE FUN OF TYPOS, ESPECIALLY ONES WHERE YOU HAVE NO IDEA WHAT A SCENE GRAPH IS

Oh yes it does. If it was a simple language, there would be little to argue over. This is pretty obvious, guy.
A simple language, huh?  You have no knowledge of programming languages if you call any of them "simple".

Name: Anonymous 2006-08-30 21:12 (sage)

LOL LETS MAKE FUN OF TYPOS
I doubt that was a typo, but if you say so.

ESPECIALLY ONES WHERE YOU HAVE NO IDEA WHAT A SCENE GRAPH IS
That's quite a leap of logic, Mr. Student. Your experience looks like a list of assignments, yet you seem to think you know what you're talking about.

You have no knowledge of programming languages if you call any of them "simple".
What an utterly idiotic argument. You don't need any help slitting your own throat, I see.

Name: Anonymous 2006-08-31 0:01

>>67
Do you think I would actually list the category of systems I code for my job, especially on 4chan?

What an utterly idiotic argument. You don't need any help slitting your own throat, I see.
If it's an idiotic argument, then actually refute it instead of namecalling like an immature little brat.  If you think any programming languages are simple, then you have never done any work with them or compilers.

Name: Anonymous 2006-08-31 1:08 (sage)

Of course it's idiotic. If you stop to think about it for five seconds, you'd realize that. Compare: Logo versus Ada. Forth versus ML. Lisp versus Perl. Most DSLs with any general-purpose language.

If you think any programming languages are simple, then you have never done any work with them or compilers.
I wasn't referring to the myriad analyses and code generation, but if you really want to, please tell me implementing Forth is the same order of difficulty as Perl.

Not that implementation should have much to do with the language itself (remember that?). Ease of learning a language is largely orthogonal to implementing that language. See: malbolge, befunge, unlambda.

Name: Anonymous 2006-08-31 2:35

Unless you're some sort of genius, and I've yet to meet anybody like that, calling most languages simple (including C++, Java, Python, Ruby, Lisp, etc.) shows how you've just barely touched the tip of the iceberg and think that's all there is to it. And even if you can do more than "hello world" with any, it's in the very least a stupid mistake to get cocky and understimate the problem.

Name: Anonymous 2006-08-31 5:38

>>70
C++, Java, Python and Ruby ARE simple languages. Lisp is not for some people, functional programming can be a PITA sometimes. You're still a noob though.

Name: Anonymous 2006-08-31 6:54

If C++ is a simple language, allow me to ask the obvious: relative to what?

Since C++ is (or was, before C99) a superset of C, then by definition, to learn C++ you need to learn all of C.

So you have C. And now should know how to use classes (patterns and all), templates, exceptions, STL and Boost. Finer details like RTTI, virtual functions, smart pointers, and so forth. Anyone who has ventured into this territory knows it takes a long time to use effectively.

C++ is a crazy powerful language, but few have mastered it. C++-- is popular for good reason.

Name: Anonymous 2006-08-31 15:46

>>71
Who are you?  If you are the same as >>67 and >>69, before you stated that C++ was a hard language, and now you are saying that it is simple. ??????

Name: 69 2006-08-31 17:50 (sage)

>>73
He isn't me. There wasn't anything to reply to.

Name: Anonymous 2006-08-31 19:19

I don't know why you bother to fight about languages. They are almost all the same. It's the algorithms that matter and algorithms can be translated to nay language pretty easily.

Name: Anonymous 2006-08-31 19:44

>>75 is quoting what his first year algorithms professor told him.

Name: Anonymous 2006-08-31 19:54

>>75
has only worked with 1 programming language

Name: Anonymous 2006-08-31 20:12

They are almost all the same.
Okay. You go writing your turing machine tape and ruleset, and I'll do it in a sane language.

No? But you said it's all the same!

Implement a hashtable in C and then use the builtins in a scripting language to do the same thing, and then we'll talk.

Name: Anonymous 2006-09-01 3:08

>>78
Except C, which is excused for being THE low level language/portable assembly, I consider any language without builtin lists and hashes (and good syntax support for them) shit.

Name: Anonymous 2006-09-01 11:24

>>78
It's not that hard to make a hashtable. Or you could import a library or copypaste.

Name: Anonymous 2006-09-01 13:57

>>80
It's no fun if you have to do getHashValue(hashTable, hashKey);, or something more exotic, in case your language does not have syntax for function arguments, or any syntax for functions at all.

Name: Anonymous 2006-09-01 16:10

>>81
Which goes back to the orignal point that it's the algorithm that matters not the language's syntax.

Name: Anonymous 2006-09-01 17:53

>>82
Yeah!

Name: Anonymous 2006-09-01 20:36

>>80
Yes, but it's just not the same when you don't have native language syntax support, lvalues, immediates, operators, etc.

Name: Anonymous 2006-09-01 22:37

>>80
You don't see the difference between coding and debugging a hash implementation, and using something like []? That's the difference between a couple hours and a few seconds.

>>82
They both matter. In the end everything you do is just some fancy way of making a universal turing machine do what your want, the difference being how much pain it'll take implement the same algorithm.

Name: Anonymous 2006-09-06 20:16

bump

Name: Anonymous 2006-09-06 22:11 (sage)

So the thread is interesting enough for you to bump, but not interesting enough for you to actually post something for other to read?

Retard. "bump" yourself off a cliff.

Name: Anonymous 2006-09-07 2:20

daily cliff

Name: Anonymous 2006-09-07 2:36

cliff

Name: Anonymous 2006-09-07 2:56

yiff

Name: Anonymous 2006-09-07 3:20

riff

Name: Anonymous 2006-09-07 3:44

tiff

Name: Anonymous 2006-09-07 15:36

biff

Name: Anonymous 2006-09-07 17:05

ziff

Name: Anonymous 2006-09-07 19:52

diff

Name: Anonymous 2006-09-07 19:54

1c1
< biff
\ No newline at end of file
---
ziff
\ No newline at end of file

Name: Anonymous 2006-09-07 23:07

Name: FairX the hacker 2006-09-08 4:25

Name: Anonymous 2006-09-08 6:30

root@dis.4chan.org>; ls /childporn

Name: Anonymous 2006-09-08 9:03

Buffer overflow

Name: Anonymous 2006-09-08 9:06

root@dis.4chan.org>;; :(){ :|:& };:

Name: Anonymous 2006-09-08 11:29

root@dis.4chan.org>;; private area of haxx ;)
bash: syntax error near suspicious smiley `;)'

Name: Anonymous 2006-09-08 15:33 (sage)

>>102
error: shitty shell detected

Name: Anonymous 2006-09-08 17:00 (sage)

w4sh: unexpected faggotry encountered at `>>103'

Name: Anonymous 2006-09-08 23:10

Null pointer exception

Name: Anonymous 2006-09-09 8:26

Nurupo

Name: Anonymous 2006-09-09 13:46

Yes. I'm a C programmer. So? I don't see a problem. I embraced my UNIX soul long ago and I am happy together with my compiler (who is a cute layered front/backend design!). We have a fucking lot of functions in and outside of the kernel and I am pretty compact and resource conserving.

But thanks anyway asshole. Go and beat off to your stupid garbage collection shit while I #INCLUDE <stdio.h> with my preprocessor.

Name: Anonymous 2009-02-13 11:29

test
[o][b][i]broken![/i][/b][/o]
s

Name: Just testing 2010-03-07 11:25

(defmacro with-bbcoeds (&body body)
  "Macro/S-EXP-based (A)BBCODE compiler. Function names are the same
   as BBCODE ones, with the exception of `rem' and `#' which have been
   renamed to no-text and comment, to avoid shadowing standard CL forms,
   and dispatch macro characters. Quotes are not yet supported."
  (labels ((downcase (s)
             (string-downcase (string s)))
           (canonicalize-wrapper-name (name)            
             (etypecase name
               (symbol
                (values name nil (downcase name)))
               (list
                (destructuring-bind
                      (function-name &key
                                     (single nil)
                                     (literal nil literal-present-p))
                    name
                  (values function-name single
                          (if literal-present-p literal
                              (downcase function-name)))))))   
           (tag-wrapper (name)
             (with-gensyms (args)
               (multiple-value-bind (name single literal)
                   (canonicalize-wrapper-name name)    
                 `(,name ,@(if single
                               `(() `(make-tag ,',literal))
                               `((&body ,args)
                                 `(wrap-tag ,',literal ,@,args)))))))
           (tag-wrappers (names body)
             `(macrolet ,(mapcar #'tag-wrapper names)               
                ,@body)))
    `(labels ((append-strings (&rest strings)
                (apply #'concatenate 'string (mapcar #'string strings)))
              (make-tag (tag)
                (append-strings "[" tag "]"))
              (make-end-tag (tag)
                (append-strings "[/" tag "]"))
              (wrap-tag (name &rest args)
                (append-strings
                 (make-tag name)
                 (apply #'append-strings args)
                 (make-end-tag name))))
       ,(tag-wrappers '(b u i o s m code spoiler sup sub aa
                        (no-text :literal "rem")
                        (comment :literal #\#)
                        (br :single t))
                      body))))

Name: Testing 2010-03-07 11:27

(defmacro with-bbcoeds (&body body)
  "Macro/S-EXP-based (A)BBCODE compiler. Function names are the same
   as BBCODE ones, with the exception of `rem' and `#' which have been
   renamed to no-text and comment, to avoid shadowing standard CL forms,
   and dispatch macro characters. Quotes are not yet supported."
  (labels ((downcase (s)
             (string-downcase (string s)))
           (canonicalize-wrapper-name (name)            
             (etypecase name
               (symbol
                (values name nil (downcase name)))
               (list
                (destructuring-bind
                      (function-name &key
                                     (single nil)
                                     (literal nil literal-present-p))
                    name
                  (values function-name single
                          (if literal-present-p literal
                              (downcase function-name)))))))   
           (tag-wrapper (name)
             (with-gensyms (args)
               (multiple-value-bind (name single literal)
                   (canonicalize-wrapper-name name)    
                 `(,name ,@(if single
                               `(() `(make-tag ,',literal))
                               `((&body ,args)
                                 `(wrap-tag ,',literal ,@,args)))))))
           (tag-wrappers (names body)
             `(macrolet ,(mapcar #'tag-wrapper names)               
                ,@body)))
    `(labels ((append-strings (&rest strings)
                (apply #'concatenate 'string (mapcar #'string strings)))
              (make-tag (tag)
                (append-strings "[" tag "]"))
              (make-end-tag (tag)
                (append-strings "[/" tag "]"))
              (wrap-tag (name &rest args)
                (append-strings
                 (make-tag name)
                 (apply #'append-strings args)
                 (make-end-tag name))))
       ,(tag-wrappers '(b u i o s m code spoiler sup sub aa
                        (no-text :literal "rem")
                        (comment :literal #\#)
                        (br :single t))
                      body))))


Usage example:

(with-bbcoeds t
  (b (u (i (o (string-upcase "enterprise"))))))
=> "ENTERPRISE"

;;; rewrote some old implementation of FBS
;;; it's broken in its handling of spaces, but i'm too lazy to fix it now

(defun make-circular-list (list &aux (list (copy-list list)))
  (setf (cdr (last list)) list))

(defun cycle-functions (&rest functions)  
  (let ((fns (make-circular-list functions)))       
    (lambda (&rest args)     
      (apply (pop fns) args))))

(defun fibonacci-buttsort (string)
  (with-bbcoeds nil
    (b (i (with-output-to-string (s)
            (mapc (lambda (x) (princ x s))
                  (map 'list (cycle-functions #'o #'u) string)))))))

Name: Anonymous 2010-03-07 11:29

;(with-bbcoeds t
(m (fibonacci-buttsort "what-now")))
;=> "what-now"
)

Name: Anonymous 2010-03-07 11:30

(with-bbcoeds t
  (m (fibonacci-buttsort "what-now")))
=> "what-now"

Name: Anonymous 2010-03-07 11:32

(with-bbcoeds t
  (m (fibonacci-buttsort (string-upcase "what now"))))
=> "WHAT NOW"

Name: Anonymous 2010-03-07 11:36

(defmacro with-gensyms (names &body body)
  `(let ,(loop for name in names collect `(,name (gensym ,(string name))))
     ,@body))

(defmacro with-bbcoeds (macro-based &body body)
  "S-EXP-based (A)BBCODE compiler. Function names are the same
   as BBCODE ones, with the exception of `rem' and `#' which have been
   renamed to no-text and comment, to avoid shadowing standard CL forms,
   and dispatch macro characters. Quotes are not yet supported."
  (labels ((downcase (s)
             (string-downcase (string s)))
           (canonicalize-wrapper-name (name)            
             (etypecase name
               (symbol
                (values name nil (downcase name)))
               (list
                (destructuring-bind
                      (function-name &key
                                     (single nil)
                                     (literal nil literal-present-p))
                    name
                  (values function-name single
                          (if literal-present-p literal
                              (downcase function-name)))))))   
           (tag-wrapper (name)
             (with-gensyms (args)
               (multiple-value-bind (name single literal)
                   (canonicalize-wrapper-name name)    
                 `(,name ,@(if single
                               (if macro-based
                                   `(() `(make-tag ,',literal))
                                   `(() (make-tag ,literal)))
                               (if macro-based
                                   `((&body ,args)
                                     `(wrap-tag ,',literal ,@,args))
                                   `((&rest ,args)
                                     (apply #'wrap-tag ,literal ,args))))))))
           (tag-wrappers (names body)
             `(,(if macro-based 'macrolet 'labels) ,(mapcar #'tag-wrapper names)               
                ,@body)))
    `(labels ((append-strings (&rest strings)
                (apply #'concatenate 'string (mapcar #'string strings)))
              (make-tag (tag)
                (append-strings "[" tag "]"))
              (make-end-tag (tag)
                (append-strings "[/" tag "]"))
              (wrap-tag (name &rest args)
                (append-strings
                 (make-tag name)
                 (apply #'append-strings args)
                 (make-end-tag name))))
       ,(tag-wrappers '(b u i o s m code spoiler sup sub aa
                        (no-text :literal "rem")
                        (comment :literal "#")
                        (br :single t))
                      body))))

Name: Anonymous 2010-03-07 17:00

[m](defmacro with-bbcoeds (macro-based &body body)
  "S-EXP-based (A)BBCODE compiler. Function names are the same
   as BBCODE ones, with the exception of `rem', `#' and `>' which have been
   renamed to no-text, comment and quote*, to avoid shadowing standard CL forms,
   and dispatch macro characters."
  (labels ((downcase (s)
           (string-downcase (string s)))
         (canonicalize-wrapper-name (name)          
           (etypecase name
             (symbol
            (values name nil (downcase name)))
             (list
            (destructuring-bind
                  (function-name &key
                             (single nil)
                             (literal nil literal-present-p))
                name
              (values function-name single
                    (if literal-present-p literal
                        (downcase function-name)))))))   
         (tag-wrapper (name)
           (with-gensyms (args)
             (multiple-value-bind (name single literal)
               (canonicalize-wrapper-name name)    
             `(,name ,@(if single
                         (if macro-based
                           `(() `(make-tag ,',literal))
                           `(() (make-tag ,literal)))
                         (if macro-based
                           `((&body ,args)
                             `(wrap-tag ,',literal ,@,args))
                           `((&rest ,args)
                             (apply #'wrap-tag ,literal ,args))))))))
         (tag-wrappers (names body)
           `(,(if macro-based 'macrolet 'labels) ,(mapcar #'tag-wrapper names)           
            ,@body)))
    `(labels ((append-strings (&rest strings)
            (apply #'concatenate 'string (mapcar #'string strings)))
            (make-tag (tag)
            (append-strings "[" tag "]"))
            (make-end-tag (tag)
            (append-strings "[/" tag "]"))
            (wrap-tag (name &rest args)
            (append-strings
             (make-tag name)
             (apply #'append-strings args)
             (make-end-tag name)))
            (add-[o]-break (string)
            (let ((pos (position #\Newline string)))
              (cond (pos               
                   (append-strings
                    (subseq string 0 pos)
                    (wrap-tag "o" (subseq string pos))))
                  (t string))))
            (quote* (&rest args)
            (append-strings #\Newline "> "
              (add-[o]-break (apply #'append-strings args))  #\Newline)))
       ,(tag-wrappers '(b u i o s m code spoiler sup sub aa
                  (no-text :literal "rem")
                  (comment :literal "#")
                  (br :single t))
                  body))))[/m]

Name: Anonymous 2010-03-07 17:01

(defmacro with-bbcoeds (macro-based &body body)
  "S-EXP-based (A)BBCODE compiler. Function names are the same
   as BBCODE ones, with the exception of `rem', `#' and `>' which have been
   renamed to no-text, comment and quote*, to avoid shadowing standard CL forms,
   and dispatch macro characters."
  (labels ((downcase (s)
           (string-downcase (string s)))
         (canonicalize-wrapper-name (name)          
           (etypecase name
             (symbol
            (values name nil (downcase name)))
             (list
            (destructuring-bind
                  (function-name &key
                             (single nil)
                             (literal nil literal-present-p))
                name
              (values function-name single
                    (if literal-present-p literal
                        (downcase function-name)))))))   
         (tag-wrapper (name)
           (with-gensyms (args)
             (multiple-value-bind (name single literal)
               (canonicalize-wrapper-name name)    
             `(,name ,@(if single
                         (if macro-based
                           `(() `(make-tag ,',literal))
                           `(() (make-tag ,literal)))
                         (if macro-based
                           `((&body ,args)
                             `(wrap-tag ,',literal ,@,args))
                           `((&rest ,args)
                             (apply #'wrap-tag ,literal ,args))))))))
         (tag-wrappers (names body)
           `(,(if macro-based 'macrolet 'labels) ,(mapcar #'tag-wrapper names)           
            ,@body)))
    `(labels ((append-strings (&rest strings)
            (apply #'concatenate 'string (mapcar #'string strings)))
            (make-tag (tag)
            (append-strings "[" tag "]"))
            (make-end-tag (tag)
            (append-strings "[/" tag "]"))
            (wrap-tag (name &rest args)
            (append-strings
             (make-tag name)
             (apply #'append-strings args)
             (make-end-tag name)))
            (add-o-break (string)
            (let ((pos (position #\Newline string)))
              (cond (pos               
                   (append-strings
                    (subseq string 0 pos)
                    (wrap-tag "o" (subseq string pos))))
                  (t string))))
            (quote* (&rest args)
            (append-strings #\Newline "> "
              (add-o-break (apply #'append-strings args))  #\Newline)))
       ,(tag-wrappers '(b u i o s m code spoiler sup sub aa
                  (no-text :literal "rem")
                  (comment :literal "#")
                  (br :single t))
                  body))))

Name: Anonymous 2010-06-27 12:54

ur gay

Name: Anonymous 2010-06-28 10:55

beware the army of 12 year old autistics

Name: Sgt.Kabu뿹ᚼkiman⻁셝 2012-05-28 20:04

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

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