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

Pages: 1-

trying somthing

Name: Anonymous 2007-04-30 19:59 ID:r8m60tso

ignore my shit code..

(defun match (template expression &optional bindings)
(cond ((atom expression)
(cond ((atom template)
(if (equal expression template)
(values t bindings)))
((unknownp template)
(let ((new-binding (cons (unknown-variable template) expression)))
(unless (a-list-conflictsp new-binding bindings)
(values t (cons new-binding bindings)))))))
((consp template)
(multiple-value-bind (a-success a-bindings)
(match (car template) (car expression) bindings)
(if a-success
(multiple-value-bind (d-success d-bindings)
(match (cdr template) (cdr expression) a-bindings)
(if d-success
(values t d-bindings))))))))

Name: Anonymous 2007-04-30 20:01 ID:r8m60tso

one question, why doesnt [c0de]     [/c0de] work?

x
     _x

Name: Anonymous 2007-04-30 20:08 ID:r8m60tso

>>2
⠀⠀⠀

Name: Anonymous 2007-04-30 20:11 ID:r8m60tso

(defun⠀match⠀(template⠀expression⠀&optional⠀bindings)
⠀⠀(cond⠀((atom⠀expression)
⠀⠀⠀⠀⠀⠀⠀⠀⠀(cond⠀((atom⠀template)
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(if⠀(equal⠀expression⠀template)
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(values⠀t⠀bindings)))
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀((unknownp⠀template)
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(let⠀((new-binding⠀(cons⠀(unknown-variable⠀template)⠀expression)))
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(unless⠀(a-list-conflictsp⠀new-binding⠀bindings)
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(values⠀t⠀(cons⠀new-binding⠀bindings)))))))
⠀⠀⠀⠀⠀⠀⠀⠀((consp⠀template)
⠀⠀⠀⠀⠀⠀⠀⠀⠀(multiple-value-bind⠀(a-success⠀a-bindings)
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(match⠀(car⠀template)⠀(car⠀expression)⠀bindings)
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(if⠀a-success
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(multiple-value-bind⠀(d-success⠀d-bindings)
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(match⠀(cdr⠀template)⠀(cdr⠀expression)⠀a-bindings)
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(if⠀d-success
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(values⠀t⠀d-bindings))))))))

Name: Anonymous 2007-04-30 20:29 ID:r8m60tso

(defparameter *indentation-character* #\Braille_Pattern_Blank)
(defparameter *tab-width* 8)
 
(defun count-indentation (line)
⠀⠀(let ((indentation-width 0))
⠀⠀⠀⠀(loop
⠀⠀⠀⠀⠀⠀⠀for char in (coerce line 'list)
⠀⠀⠀⠀⠀⠀⠀for indentation-characters from 0
⠀⠀⠀⠀⠀⠀⠀while (or (when (char= #\Space char) (incf indentation-width))
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(when (char= #\Tab char) (incf indentation-width *tab-width*)))
⠀⠀⠀⠀⠀⠀⠀finally (return-from count-indentation
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(values indentation-width indentation-characters)))))
 
(defun format-line (line)
⠀⠀(multiple-value-bind (indentation indent-num-chars) (count-indentation line)
⠀⠀⠀⠀(if (= 0 indentation)
⠀⠀⠀⠀⠀⠀⠀⠀(if (= 0 (length line))
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀" "
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(format nil "~a" line))
⠀⠀⠀⠀⠀⠀⠀⠀(format nil "~a~a"
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(make-string indentation :initial-element *indentation-character*)
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀(subseq line indent-num-chars)))))
 
(with-open-file (stream "prog-format.lisp")
⠀⠀(do ((line (read-line stream) (read-line stream nil :eof)))
⠀⠀⠀⠀⠀⠀((equal line :eof))
⠀⠀⠀⠀(format t "~a~%" (format-line line))))

Name: Anonymous 2007-04-30 20:30 ID:r8m60tso

~a wtf

"~a wtf"

"~a wtf ~a"

Name: Anonymous 2007-04-30 20:50 ID:r8m60tso

owned bitch
sed -e 's/     /        /g' -e 's/\([^ ][^ ]*\)/[cc]\1[\/cc]/' -e 's/^\(  *\)\(.*\)/[code]\1[\/code][aa]\2[\/aa]/' prog-format.lisp

Name: Anonymous 2007-04-30 20:51 ID:r8m60tso

>>7
sed -e 's/this is a tab character/        /g'

Name: Anonymous 2009-01-14 13:49

WHBTE

Name: Anonymous 2009-03-06 9:54

The second variable is   prefixed with v   and when using   the mouse for   too long Morrowind.

Name: Anonymous 2009-03-06 13:33

The same as ab OMG WHITESPACE IS.

Name: Anonymous 2011-02-03 4:50

Name: Sgt.Kabu鶳kimanḍ纄 2012-05-29 1:03

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
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
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