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

Damn it /prog/

Name: Anonymous 2009-07-27 14:50

I wrote some actual programmes when you were down. Please don't leave me again.

Name: Anonymous 2009-07-27 19:18

Anyone with basic BBCode knowledge could do it, another example

(define (circlejerk format-list sentence)
  (define fl (list->mlist format-list))
  (set-mcdr! (mlast-pair fl) fl) ;make list circular XD
  (let loop ((f fl) (l (split sentence)))
    (if (null? l)
        ""
        (string-append ((mcar f) (car l))
                       " "
                       (loop (mcdr f) (cdr l))))))

>(circlejerk (list b i o u) "This is one shitty thread if you know what I mean ;)")

This is one shitty thread if you know what I mean ;)

On a side note, is there any better way of doing this
(define (list-split l pos)
  (if (< pos 0)
      (error "pos not a non-negative integer")
      (let ((head '()))
        (let loop ((tail l) (index pos))
          (cond ((= index 0) (list (reverse head)
                                   tail))
                ((null? tail) (error "List not long enough"))
                (else
                 (set! head (cons (car tail) head))
                 (loop (cdr tail) (- index 1))))))))

It obviously splits a list into a two sublists at a given position, but it just doesn't feel very schemey to me.

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