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

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 3:43

newLISP sucks

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