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

Prog Challenge, Easy!

Name: sage 2012-12-29 5:13

Implement https://dis.4chan.org/read/prog/1356634826/25 more elegantly.


(defun 3ml-cgi-decode ()
  (let ((stream (if (string-equal "get" request-method)
            (make-string-input-stream query-string)
          *standard-input*))
    (symbols ()))
    (with-open-stream (output (make-string-output-stream))
      (loop for char = (read-char stream nil nil)
      do (case char
           (#\= (push (intern (string-upcase (get-output-stream-string output)))
              symbols))
           ((nil #\&) (when symbols
                (setf (symbol-value (first symbols)) (get-output-stream-string output))))
           (#\+ (write-char #\space output))
           (#\% (let* ((nib1 (read-char stream nil nil))
               (nib2 (read-char stream nil nil))
               (code (+ (* 16 (digit-char-p nib1 16))
                    (digit-char-p nib2 16))))
              (write-char (code-char code) output)))
           (t (write-char char output)))
      while char))
    (setf *cgi-variables* symbols)))

Name: Anonymous 2012-12-30 7:46

>>19
Rather than writing y = f(x), you'd write f(X,Y), and rather than writing y = f(g(x)), you'd write g(X,T), f(T,Y).
Interesting, and it makes sense. Does it work out fine for larger structures?

And in some cases it's actually possible for prolog to give you the preimage of a value, like in f(X,3), although that generally doesn't work out.
Yeah, like SHA256(X,"..."). This brings me to an interesting question; how exactly are the possibilities resolved? It sounds to me like a very simple query could take longer than the heat death of the universe.

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