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

Pages: 1-

NEED LIST OF R5RS EXPRESSIONS N PROCEDURES

Name: Anonymous 2012-10-01 2:32

Gonna hunt each one down n kill

Name: Anonymous 2012-10-01 4:54

(call/cc call/cc)

Name: Anonymous 2012-10-01 4:54

(define list (lambda lambda lambda))

Name: Anonymous 2012-10-01 9:53

(defun compose (f g)
  (lambda (x)
    (funcall f (funcall g x))))
(defun flip (f)
  (lambda (x y)
    (funcall f y x)))
(defun reduced (f)
  (lambda (x)
    (reduce f x :from-end t)))
(defun curry (f x)
  (lambda (y)
    (funcall f x y)))
(defun mapped (f)
  (lambda (xs)
    (map 'list f xs)))

(setf (symbol-function 'sum-of-squares) (compose (reduced #'+) (mapped (curry (flip #'expt) 2))))

Point-free style in Lisp works but the syntax is disgusting and it has terrible performance. It wouldn't be any better in Scheme. Lisp fails because it ultimately gives too much freedom to the programmer: the only way to fix this is to introduce some reader macros and restrict the function manipulators i.e. embedding J inside Lisp and give up a lot of orthogonality.

Name: Anonymous 2012-10-01 13:46

>>4
Why would you use point-free style?

Name: Anonymous 2012-10-01 15:26

>>5
point-free style
Is this better?
(defun compose (f g . ())
  (lambda (x . ())
    (funcall f (funcall g x . ()) . ()) . ()) . ())
(defun flip (f . ())
  (lambda (x y . ())
    (funcall f y x . ()) . ()) . ())
(defun reduced (f . ())
  (lambda (x . ())
    (reduce f x :from-end t . ()) . ()) . ())
(defun curry (f x . ())
  (lambda (y . ())
    (funcall f x y . ()) . ()) . ())
(defun mapped (f . ())
  (lambda (xs . ())
    (map 'list f xs . ()) . ()) . ())

Name: Anonymous 2012-10-01 15:29

>>6
That isn't how you construct cons cells!

Name: Anonymous 2012-10-01 15:36

>>7
Sure but is that not how Abelson construct cons cells?

Name: Anonymous 2012-10-01 15:47

>>8
Smoke less and go to bed.

Name: Anonymous 2012-10-01 16:41

>>9
I can't go to bed, I have work to do.

Name: Anonymous 2012-10-01 18:38

Bag of dubs

Name: Anonymous 2012-10-02 8:53

There are no jews. Please continue with this programming-related discussion.

Name: Anonymous 2012-10-02 10:01

>>12
std::cout << "This is Radio Israel. It's 11:00 o'clock -- but for you, 10:45.";

Name: Anonymous 2012-10-02 10:15

>>13
This made my morning.  Thanks.

Name: Anonymous 2012-10-02 10:51

>>13
I don't get it.

Name: Anonymous 2012-10-02 11:01

>>15
Think of it as money instead of time.

Name: Anonymous 2012-10-02 16:15

>>4
>>6
Those aren't R5RS.

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