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

Pages: 1-

[λ] /prog/ challenge -1 [λ]

Name: Anonymous 2012-08-07 19:21

Write a function f where for any integer x, x + 1 = f(f(f(x))), but x, f(x) and f(f(x)) are mutually different.

Name: (λ λ λ) 2012-08-07 19:25

(define (f x) (+ x 1/3))

Name: Anonymous 2012-08-07 19:37

>>1
that requires first defining what (x, y) + 1 does.

Name: Anonymous 2012-08-07 19:48

>>3
You definitely misread that.

Name: Anonymous 2012-08-07 19:51

x, x + 1 = f(f(f(x)))
Here you have f returning a tuple of two values. Since you compose f with itself, x must be a tuple of two values.

Name: Anonymous 2012-08-07 22:27

(defun f (x)
  (cond ((numberp x) (write-to-string x))
        ((stringp x) (intern x))
        (t           (1+ (read-from-string (symbol-name x))))))

Name: Anonymous 2012-08-08 2:40

mutually different is jew doublespeak

Name: Anonymous 2012-08-08 5:53

>>3
According to the standard rules*, (x, y) + 1 = (x + 1, y + 1) By the way, note that x and y must be pairs themselves.
___________
[*] http://en.wikipedia.org/wiki/Surreal_numbers

Name: Anonymous 2012-08-08 8:02

I think >>1 means this:
x∈Z: x+1=f(f(f(x))) ∧ x≠f(x) ∧ x≠f(f(x)) ∧ f(x)≠f(f(x))

Name: Anonymous 2012-08-08 9:03

i don't get it

Name: >>1 2012-08-08 12:43

>>9
I do. There are no code tags on that comma, it's not part of the equations surrounding it.

Name: Anonymous 2012-08-08 19:34

>>9
People can hate the syntax all day, but this is unambiguous.

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