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

Pages: 1-

My contribution to /prog/

Name: Anonymous 2008-04-15 2:19


; bbcode.nlsp (inb4 "newlisp is teh gay")
; An attempt to minimize BBCode failures.
; example:
; (bbcode "This is normal text," (b (u (i "THIS IS ENTERPRISE TEXT."))))
; =>
; "This is normal text, [b][u][i]THIS IS ENTERPRISE TEXT.[/i][/u][/b]"

(define (to-bbcode arg)
  (if (and (list? arg)
           (> (length arg) 0))
      (string "[" (first arg) "]"
              (bbcode-join (1 arg))
              "[/" (first arg) "]")
      (string arg)))

(define (bbcode-join lst)
  (join (map to-bbcode lst) " "))

(define-macro (bbcode)
  (bbcode-join (args)))

Name: Anonymous 2008-04-15 2:38

I know exactly how many posters here will use your contribution.

Name: Anonymous 2008-04-15 2:53


>>2
Is it five?

Name: Anonymous 2008-04-15 2:56

〉〉3
No。

Name: Anonymous 2008-04-15 3:43

newLISP sucks

Name: Anonymous 2008-04-15 14:40

; bbcode.nlsp (inb4 "newlisp is teh gay")
; An attempt to minimize BBCode failures.
; example:
; (bbcode "This is normal text," (b (u (i "THIS IS ENTERPRISE TEXT."))))
; =>
; "This is normal text, THIS IS ENTERPRISE TEXT."

(define (to-bbcode arg)
  (if (and (list? arg)
           (> (length arg) 0))
      (string "[" (first arg) "]"
              (bbcode-join (1 arg))
              "[/" (first arg) "]")
      (string arg)))

(define (bbcode-join lst)
  (join (map to-bbcode lst) " "))

(define-macro (bbcode)
  (bbcode-join (args)))

Name: Anonymous 2008-04-15 17:22

newLISP RULES
>>5

Name: Anonymous 2008-04-15 17:41

10 GOTO 10

Name: Anonymous 2008-04-15 17:41

>>7
Dynamically scoped variables FAIL!

Name: Anonymous 2008-04-15 18:03

>>9
People who dislike dynamic scope are likely the same people who dislike non-garbage-collection; they're too lazy to keep track of their variables. Dynamic scope can actually be very powerful if used correctly. newLISP has contexts, too, if you really want to modularize things.

Name: Anonymous 2008-04-15 18:08

>>8
∧_∧   /‾‾‾‾
 ( ゚Д゚) < redditards! not again!
 (⊃ \⊃ \____
  \  )ρ
   く く

Name: Anonymous 2008-04-15 22:06

Documented and using contexts.


;; @module bbcode
;; @author Anonymous
;; @description An attempt to minimize BBCode failures.
;; @version 2008-04-15
;;
;; The idea behind this is similar to the idea of representing XML as
;; S-Expressions. BBCode is basically just a bastardized form of HTML, so it can
;; be easily transformed to and from an S-Expression.
;;
;; BBCode tags must be LIFO, and some (idiots) accidentally place their tags
;; out-of-order. This simple module helps ensure that tags are placed correctly
;; by taking an S-Expression of the desired BBCode, and outputing the BBCode.

(context 'bbcode)

;; @syntax (bbcode:to-bbcode <arg>)
;; @param <arg> A list or single argument to convert into a BBCode string.
;; @return A BBCode string.
;;
;; If <arg> is a list, then the first item of that list is taken to be a BBCode
;; tag, and the rest of the list is joined together with 'bbcode-join', which
;; calls 'to-bbcode' on each item.
;;
;; If <arg> is not a list, then the string form of it is simply returned.
(define (to-bbcode arg)
  (if (and (list? arg)
           (> (length arg) 0))
      (string "[" (sym (first arg)) "]"
              (bbcode-join (rest arg))
              "[/" (sym (first arg)) "]")
      (string arg)))

;; @syntax (bbcode:bbcode-join <lst>)
;; @param <lst> A list of items, possibly even other lists.
;; @return A space-separated string of the BBCode string values of the list.
;;
;; 'to-bbcode' is called on each item to get the BBCode representation of an
;; item.
(define (bbcode-join lst)
  (join (map to-bbcode lst) " "))

;; @syntax (bbcode <args>)
;; @param <args> Any number of arguments.
;; @return A BBCode representation of an S-Expression.
;;
;; @example
;; (bbcode (b (u (i "ENTERPRISE TEXT."))))
;; =>
;; "[b][u][i]ENTERPRISE TEXT.[/i][/u][/b]"
(define-macro (bbcode:bbcode)
  (bbcode-join (args)))

Name: Anonymous 2008-04-16 2:36

THIS IS ENTERPRISE TEXT.

Name: Anonymous 2008-04-16 3:19

     ∧_∧   / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ( ´∀`) < COOL Free Ringtones! watch?v=3Y0Nel7cH3s     /    |    \________     / .| / "⌒ヽ |.イ |
   __ |   .ノ | || |__
  .    ノく__つ∪∪   \
   _((_________\
    ̄ ̄ヽつ ̄ ̄ ̄ ̄ ̄ ̄ | | ̄
   ___________| |
    ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| |

Name: Anonymous 2010-12-09 16:43

Name: Anonymous 2010-12-17 1:34

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Sgt.Kabukiman 2012-05-22 3:32

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

Name: Anonymous 2012-05-22 7:12

Rei.

Name: Anonymous 2013-04-04 19:51

Thank god for these sweet, sweet dubs.

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