Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

Ceylon to Tiny lispTiny lisp, 76

shared void run(){print("(q((x)(s ``process.readLine()else""``(s 0 x))))");}

This produces (after reading a line of input) output like (q((x)(s 5(s 0 x)))), which evaluates in Tiny Lisp to ((x) (s 5 (s 0 x))), a function which takes an argument x, subtracts it from 0, and subtracts the result from 5. (Yeah, this is how one adds in Tiny Lisp, there is only a subtraction function build in. Of course, one could define an addition function first, but this would be longer.)

You can use it like this as an anonymous function:

((q((x)(s 5(s 0 x)))) 7)

(This will evaluate to 12.)

Or you can give it a name:

(d p5 (q((x)(s 5(s 0 x)))))
(p5 7)

Corrections and Golfing Hints from DLosc, the author of Tiny Lisp.

Ceylon to Tiny lisp, 76

shared void run(){print("(q((x)(s ``process.readLine()else""``(s 0 x))))");}

This produces (after reading a line of input) output like (q((x)(s 5(s 0 x)))), which evaluates in Tiny Lisp to ((x) (s 5 (s 0 x))), a function which takes an argument x, subtracts it from 0, and subtracts the result from 5. (Yeah, this is how one adds in Tiny Lisp, there is only a subtraction function build in. Of course, one could define an addition function first, but this would be longer.)

You can use it like this as an anonymous function:

((q((x)(s 5(s 0 x)))) 7)

(This will evaluate to 12.)

Or you can give it a name:

(d p5 (q((x)(s 5(s 0 x)))))
(p5 7)

Corrections and Golfing Hints from DLosc, the author of Tiny Lisp.

Ceylon to Tiny lisp, 76

shared void run(){print("(q((x)(s ``process.readLine()else""``(s 0 x))))");}

This produces (after reading a line of input) output like (q((x)(s 5(s 0 x)))), which evaluates in Tiny Lisp to ((x) (s 5 (s 0 x))), a function which takes an argument x, subtracts it from 0, and subtracts the result from 5. (Yeah, this is how one adds in Tiny Lisp, there is only a subtraction function build in. Of course, one could define an addition function first, but this would be longer.)

You can use it like this as an anonymous function:

((q((x)(s 5(s 0 x)))) 7)

(This will evaluate to 12.)

Or you can give it a name:

(d p5 (q((x)(s 5(s 0 x)))))
(p5 7)

Corrections and Golfing Hints from DLosc, the author of Tiny Lisp.

add quoting
Source Link

Ceylon to Tiny lisp, 76

shared void run(){print("(q((x)(s ``process.readLine()else""``(s 0 x))))");}

This produces (after reading a line of input) output like (q((x)(s 5(s 0 x)))), which evaluates in Tiny Lisp to ((x) (s 5 (s 0 x))), a function which takes an argument x, subtracts it from 0, and subtracts the result from 5. (Yeah, this is how one adds in Tiny Lisp, there is only a subtraction function build in. Of course, one could define an addition function first, but this would be longer.)

You can use it like this as an anonymous function:

((q((x)(s 5(s 0 x)))) 7)

(This will evaluate to 12.)

Or you can give it a name:

(d p5 (q((x)(s 5(s 0 x)))))
(p5 7)

Corrections and Golfing Hints from DLosc, the author of Tiny Lisp.

Ceylon to Tiny lisp, 76

shared void run(){print("(q((x)(s ``process.readLine()else""``(s 0 x))))");}

This produces output like (q((x)(s 5(s 0 x)))), which evaluates in Tiny Lisp to ((x) (s 5 (s 0 x))), a function which takes an argument x, subtracts it from 0, and subtracts the result from 5.

You can use it like this as an anonymous function:

((q((x)(s 5(s 0 x)))) 7)

(This will evaluate to 12.)

Or you can give it a name:

(d p5 (q((x)(s 5(s 0 x)))))
(p5 7)

Corrections and Golfing Hints from DLosc, the author of Tiny Lisp.

Ceylon to Tiny lisp, 76

shared void run(){print("(q((x)(s ``process.readLine()else""``(s 0 x))))");}

This produces (after reading a line of input) output like (q((x)(s 5(s 0 x)))), which evaluates in Tiny Lisp to ((x) (s 5 (s 0 x))), a function which takes an argument x, subtracts it from 0, and subtracts the result from 5. (Yeah, this is how one adds in Tiny Lisp, there is only a subtraction function build in. Of course, one could define an addition function first, but this would be longer.)

You can use it like this as an anonymous function:

((q((x)(s 5(s 0 x)))) 7)

(This will evaluate to 12.)

Or you can give it a name:

(d p5 (q((x)(s 5(s 0 x)))))
(p5 7)

Corrections and Golfing Hints from DLosc, the author of Tiny Lisp.

add quoting
Source Link

Ceylon to Tiny lisp, 7576

shared void run(){print("(q((x) (s ``process.readLine()else""`` (s 0 x))))");}

This produces output like (q((x) (s 5 (s 0 x)))), which is aevaluates in Tiny Lisp to ((x) (s 5 (s 0 x))), a function which takes an argument x, subtracts it from 0, and subtracts the result from 5.

(To actually You can use it like this as an anonymous function, you'll first have:

((q((x)(s 5(s 0 x)))) 7)

(This will evaluate to quote it12.)

Or you can give it a name:

(d p5 (q((x)(s 5(s 0 x)))))
(p5 7)

Corrections and Golfing Hints from DLosc, the author of Tiny Lisp.

Ceylon to Tiny lisp, 75

shared void run(){print("((x) (s ``process.readLine()else""`` (s 0 x)))");}

This produces output like ((x) (s 5 (s 0 x))), which is a Tiny Lisp function which takes an argument x, subtracts it from 0, and subtracts the result from 5.

(To actually use this function, you'll first have to quote it.)

Ceylon to Tiny lisp, 76

shared void run(){print("(q((x)(s ``process.readLine()else""``(s 0 x))))");}

This produces output like (q((x)(s 5(s 0 x)))), which evaluates in Tiny Lisp to ((x) (s 5 (s 0 x))), a function which takes an argument x, subtracts it from 0, and subtracts the result from 5.

You can use it like this as an anonymous function:

((q((x)(s 5(s 0 x)))) 7)

(This will evaluate to 12.)

Or you can give it a name:

(d p5 (q((x)(s 5(s 0 x)))))
(p5 7)

Corrections and Golfing Hints from DLosc, the author of Tiny Lisp.

Source Link
Loading