Google グループは Usenet の新規の投稿と購読のサポートを終了しました。過去のコンテンツは引き続き閲覧できます。
Dismiss

Test your Scheme implementation :)

閲覧: 0 回
最初の未読メッセージにスキップ

Antti Huima

未読、
2001/12/10 9:20:182001/12/10
To:
This works under Chez Scheme:

(define the-procedure
(let-syntax((l(syntax-rules()((l((x(y ...))...)b ...)(let-syntax((x
(syntax-rules()y ...))...) b ...)))))(l('(('(a b ...)(lambda a b
...)))`((`(a b c)(if a b c))(`(a)(car a))),((,(a b)(set! a b))(,(a)(cdr
a))),@((,@z(call-with-current-continuation z))))'((ls)('((s)('((i)
('((d)('((j)('((c)('((p)('((l)('(()(l l))))'((k)`((pair?,(p))('((c)
,(p(append,(,(p))(d c)))(k k))(c`(p)`(,(p))c))`(p)))))(cons(d)(map d
ls))))'((x y c),@'((-)(s x y null? - s)(j x y c)))))'((x y
c)('((q)('((f)(cons`(q)(c((f x)x)((f y)y)c)))'((h)`((eq? q h)'((x),(x))
i)))),@'((-)(s x y'((z)(>=`(z)(sqrt(*`(x)`(y)))))- s))))))list))
'((z)z)))'((x y p k l),@'((-)`((p x)(k y)(l y x'((z)`((p z)-(- #f)))k
l)))))))))

Q1: Does it work under your favourite Scheme?

Q2: What does the procedure do?

The procedure is original work by me and I don't consider it neither a
good Scheme procedure nor an excellently obfuscated one.

Regards,

--
Antti Huima

Bo Forslund

未読、
2001/12/10 12:16:352001/12/10
To:
Antti Huima wrote:

> Q2: What does the procedure do?
>
> The procedure is original work by me and I don't consider it neither a
> good Scheme procedure nor an excellently obfuscated one.
>

You don't know what Your "original work" does, and hope someone else would
know?

Jim White

未読、
2001/12/11 1:25:412001/12/11
To:
"Antti Huima" <ahu...@divergence.tcs.hut.fi> wrote in message
news:7qpu5nc...@divergence.tcs.hut.fi...

> This works under Chez Scheme:
> ...

> Q1: Does it work under your favourite Scheme?

Kawa does accept it.

> Q2: What does the procedure do?

It is obfuscated far beyond my limited ability to comprehend it (even when
pretty printed). The only input I can come up with that doesn't result in a
type error just returns the the parameter.

jim
----------------------------------------------------------------
James P. White Pagesmiths' home is http://www.pagesmiths.com
Live free http://www.ushistory.org/franklin/quotable/quote04.htm
Try Kawa, the Java-based Scheme http://www.gnu.org/software/kawa


Antti Huima

未読、
2001/12/11 2:43:272001/12/11
To:
Bo Forslund <bo.fo...@abc.se> writes:

I hope that this was a troll and that I thus provide you extra vibes
by answering it. The code was written by me.

--
Antti Huima

Oliver Bandel

未読、
2001/12/10 17:24:222001/12/10
To:

It produces error-messages by the scheme-interpreter...
...and we have to debug it...

Antti Huima

未読、
2001/12/13 3:59:362001/12/13
To:
Antti Huima <ahu...@divergence.tcs.hut.fi> writes:

> This works under Chez Scheme:
>

> ...


>
> Q1: Does it work under your favourite Scheme?
>
> Q2: What does the procedure do?

Answers:

A1: It should be R5RS-compliant.

A2: It is a procedure for sorting a list of non-negative reals:

(the-procedure '(5 1 3 9)) ==> (1 3 5 9)

--
Antti Huima

Jim White

未読、
2001/12/13 11:41:552001/12/13
To:
"Antti Huima" <ahu...@divergence.tcs.hut.fi> wrote in message
news:7qg06fc...@divergence.tcs.hut.fi...

> Antti Huima <ahu...@divergence.tcs.hut.fi> writes:
>
> > This works under Chez Scheme:
> >
> > ...
> >
> > Q1: Does it work under your favourite Scheme?
> >
> > Q2: What does the procedure do?
>
> Answers:
>
> A1: It should be R5RS-compliant.

Well, yes, Kawa is "mostly" R5RS compliant.

> A2: It is a procedure for sorting a list of non-negative reals:
>
> (the-procedure '(5 1 3 9)) ==> (1 3 5 9)

Heh. Too funny. The only tests I did with lists of numbers happened to be
in sequence, so it appeared to me to simply return the list.

#|kawa:2|# (the-procedure '(9834 304 2373 1 23 3 2 32983 23 2 324))
(1 2 2 3 23 23 304 324 2373 9834 32983)

#|kawa:3|# (the-procedure '(9834 304 2373 1 23 3
98349384938498349839747473947938493483948934893843947478347090823982
2 32983 983498349834 423 2 9873498374983743 479398888798749384798
398479387498374893749834738488793847834 324))
(1 2 2 3 23 304 324 423 2373 9834 32983 983498349834 9873498374983743
479398888798749384798 398479387498374893749834738488793847834
98349384938498349839747473947938493483948934893843947478347090823982)

Bruce Lewis

未読、
2001/12/13 12:04:562001/12/13
To:
Antti Huima <ahu...@divergence.tcs.hut.fi> writes:

> Answers:
>
> A1: It should be R5RS-compliant.

Unlike for Jim White, Kawa did not accept the code for me.

Unbound symbol pair?,

According to R5RS 7.7.1, a comma is not a delimiter, so Kawa is within
its rights to lex it as a single token. Of course, since a comma is not
a standard identifier character, Chez Scheme is within its rights to lex
it as it does.

Fixing that, I got similar errors with commas, ticks and backticks.

> A2: It is a procedure for sorting a list of non-negative reals:
>
> (the-procedure '(5 1 3 9)) ==> (1 3 5 9)

Once spaces had been inserted at appropriate points, Kawa did run the
procedure correctly. I didn't try it in Kawa when I first saw
call/cc. I assumed that obfuscated Scheme code would use captured
continuations. Kawa only partially supports continuations, but that was
enough for this example.

--
(for-each (lambda (str) (display (string-append (make-string (- 40
(quotient (string-length str) 2)) #\space) str)) (newline)) '(""
"Bruce Lewis" "MIT 1990" " http://brl.sourceforge.net/
")) ; I rarely read mail sent to brl...@yahoo.com

Shriram Krishnamurthi

未読、
2001/12/15 11:09:112001/12/15
To:
Antti Huima <ahu...@divergence.tcs.hut.fi> writes:

> This works under Chez Scheme:

Works fine out-of-the-box in DrScheme, too.

Seems to sort lists of numbers in increasing order, in some wacky way.

Shriram

新着メール 0 件