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

Pages: 1-

Do you hate Lisp-1?

Name: Anonymous 2010-12-14 23:04

One namespace is not enough for you in your Scheme?
You want to experiment the pleasure of being cummed inside by multiple namespaces?
From today, /prog/ can bring Lisp-n multi-faggotry directly to your Scheme environment!.

With the most advanced technologies available, we managed to produce the ultimate [b]Multi-Namespace [i]Scheme[i] Environment[/b]!

You need just to put these macros in your favourite Scheme interpreter .init file or in your source code, and then the magic will be done!

(define sym
  (lambda (f-slot v-slot)
    (lambda (z a)
      (case z
        ((fun) f-slot)
        ((var) v-slot)
        ((fun!) (set! f-slot a))
        ((var!) (set! v-slot a))))))
(define symtable
  (lambda ()
    (let ((t (make-hash)))
      (define getter
        (lambda (s)
          (lambda (x)
            (let ((g (hash-ref t x #f)))
              (if g (g s #f) g)))))
      (define fun
        (getter 'fun))
      (define var
        (getter 'var))
      (define function!
        (lambda (x y)
          (cond ((hash-ref t x #f) => (lambda (g) (g 'fun! y)))
                (else (hash-set! t x (sym y #f))))))
      (define variable!
        (lambda (x y)
          (cond ((hash-ref t x #f) => (lambda (g) (g 'var! y)))
                (else (hash-set! t x (sym #f y))))))
      (lambda (z a b)
        (case z
          ((fun) (fun a))
          ((var) (var a))
          ((fun!) (function! a b))
          ((var!) (variable! a b)))))))
(define st (symtable))
(define I (lambda(x)x))
(define errorf (lambda xs (error (apply format xs))))
(define gfslot
  (lambda (f)
    (cond ((st 'fun f #f) => I)
          (else (errorf "reference to a function before its definition: ~a" f)))))
(define gvslot
  (lambda (v)
    (cond ((st 'var v #f) => I)
          (else (errorf "reference to a variable before its definition: ~a" v)))))
(define dfn
  (lambda (f b)
    (st 'fun! f b)))
(define dvr
  (lambda (v a)
    (st 'var! v a)))
(define-syntax function
  (syntax-rules ()
    ((function f)
     (gfslot 'f))))
(define-syntax variable
  (syntax-rules ()
    ((variable v)
     (gvslot 'v))))
(define-syntax defun
  (syntax-rules ()
    ((defun f (a ...) b ...)
     (dfn 'f (lambda (a ...) b ...)))
    ((defun f a b ...)
     (dfn 'f (lambda a b ...)))))
(define-syntax defvar
  (syntax-rules ()
    ((defvar v e)
     (dvr 'v e))))
(define-syntax funcall
  (syntax-rules ()
    ((funcall f a ...)
     (apply (function f) (list a ...)))))


Now you can declare and call functions exactly like a Lisp-n faggot!!

(defun fact (n)
  (if (zero? n) 1
      (* n (funcall fact (sub1 n)))))
(funcall fact 5)
; => 120


Try it now for free at dis.4chan.org/prog/.

Name: Anonymous 2010-12-14 23:19

I don't use Lisp because I am not a faggot.

Name: Anonymous 2010-12-14 23:32

Shouldn't that be:

(defun fact (n)
  (if (zero? n) 1
      (* n (funcall 'fact (sub1 n)))))
(funcall 'fact 5)

Can you write:

(defun (list . list) list)

(equivalent of CL's (defun list (&rest list) list))
in your version of Scheme? (I haven't read the code yet)
The whole point in Lisp-2's is to keep variable names and function names separate. (However, CL is actually a Lisp-n since you have so many namespaces(classes, properties, structures, types, and so on), and the user can also define their own.)

Name: Anonymous 2010-12-14 23:36

>>3
(defun list list list) is (defun list (&rest list) list), it doesn't support lambdas, it sucks and WHBT

Name: Anonymous 2010-12-14 23:47

>>3
Shouldn't that be:
(funcall 'fact 5)

It would make lambdas simpler, but it would be ugly. (Where a lambda would be an anonymous symbol with just the function slot set)

Name: Anonymous 2010-12-15 0:07

>>1
Implement an utterly useless toylanguage called "Nirvana", and be an epic IRL Troll

Name: Anonymous 2010-12-15 0:17

>>6
Why looking for Nirvana when you can have SATORI?

Name: Anonymous 2010-12-15 0:48

>>7
The message appeared in the wrong thread. Moving on!

Name: Anonymous 2010-12-25 4:15

Name: Anonymous 2011-02-04 11:38

Name: Anonymous 2011-02-04 16:40


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