RUBY vs COMMON LISP

On Aug 1, 8:55 pm, [email protected] (Pascal J. Bourguignon)
wrote:

Don’t you realize how ugly Ruby syntax is?

Here is in 150 lines of lisp, a simplified lisp reader that is able to
read all the lisp syntax needed to write it.

Try to parse Ruby syntax in Ruby and see how useless a language it is.

I much prefer CL to Ruby, but this argument is useless. How many lines
of code do you need to read Brainfuck in Brainfuck?

(If you wanted to show the inferiority of Ruby to Common Lisp, the
shootout makes a much more compelling argument)

On Sun, Aug 2, 2009 at 11:00 AM, fft1976[email protected] wrote:

On Aug 1, 8:55 pm, [email protected] (Pascal J. Bourguignon)
wrote:

Try to parse Ruby syntax in Ruby and see how useless a language it is.

I much prefer CL to Ruby, but this argument is useless. How many lines
of code do you need to read Brainfuck in Brainfuck?

Yes indeed. Ruby, thankfully, is designed to be nice to humans, not to
parsers.

martin

El Domingo, 2 de Agosto de 2009, fft1976
escribió:> > #\vt)))

character (simple-readtable-macro-characters readtable))
description)) (error “#\~C is not a dispatching macro character”
description))) (setf (gethash character
(defun simple-reader-dispatching-macro (character stream)
(defvar character-names (list (cons “SPACE” (code-char 32))
(let ((object (read-char stream)))
(defun simple-parse-token (buffer)
(list ‘quote (simple-read stream)))
(loop
(declare (ignore character))
nil readtable) (simple-set-macro-character #’ (function
(defun simple-read (&optional (stream standard-input) (eof-error-p t)
:adjustable t :fill-pointer 0) :for ch = (peek-char nil stream nil
#\space)
:initially (vector-push-extend char buffer)
:until (or (position ch (simple-readtable-whitespaces
simple-readtable)) (not (nth-value 1 (simple-get-macro-character ch))))
:do (vector-push-extend (read-char stream eof-error-p eof-value) buffer)
:finally (return (funcall (simple-readtable-parse-token
simple-readtable) buffer))))))
(eof-error-p (error 'end-of-file :stream stream))
(t eof-value))))

Is the above a language or a list of home tasks?

This is a vapid, silly discussion. Use whatever language you wish, but
please don’t bore the rest of us with it.

Once you work out self parsing to your satisfaction, count the number of
angels that can dance on the head of a pin.

2009/8/2 Iñaki Baz C. [email protected]

(whitespaces #(#\space #\tab #\newline #\linefeed #\return #\page
non-terminating-p (readtable simple-readtable)) (setf (gethash
description
description)
't)
(coerce contents 'vector)))
(defun simple-read-character-dmacro (char subchar stream)
object)))
(defun simple-read-quote-macro (character stream)
(defun simple-read-string-macro (character stream)

(simple-set-macro-character #\( (function simple-read-list-macro)

stream)))) (if object (first object) (simple-read stream eof-error-p
:finally (return (funcall (simple-readtable-parse-token


Regards,

Ken

Seek wisdom through disbelief

fft1976 [email protected] writes:

,+[-.,+]
$ bf reader.bf < reader.bf

Your 150 lines don’t look very impressive now, do they?

Ruby < Lisp <<< BF!

I specified a syntactic reader. Not just a reader. READ-SEQUENCE, or
a loop on READ-CHAR is trivial both in Ruby and in Lisp.

Building a data structure isomorphe to the syntax of the language is
less trivial. First you will have to think about how to build an
abstract data structure in BF. Have fun!

On Mon, Aug 3, 2009 at 10:20 AM, Pascal J.
Bourguignon[email protected] wrote:

$ cat > reader.bf
,+[-.,+]
$ bf reader.bf < reader.bf

Your 150 lines don’t look very impressive now, do they?

Ruby < Lisp <<< BF!

I specified a syntactic reader. Not just a reader. READ-SEQUENCE, or
a loop on READ-CHAR is trivial both in Ruby and in Lisp.
I personally think that LISP is beautiful and LISP code is ugly(1), I
also believe this is not the right place to post lisp code unless all
you want to do is to post lisp code.
I do not recall that somebody told you this already; well we all did
in indirect ways but maybe it is a good decision to tell you.
And if you disagree, why not post to pastie or gist and give the link
a prominent warning “LISP code ahead”.
On second thoughts the warning might not be necessary in your case :wink:

Cheers
Robert

(1) I am aware that ugly just means that my mind is not used to it.
However this will probably hold for many folks on this list, so please
forgive my somehow bold statement.
R.

On Aug 1, 10:26 pm, fft1976 [email protected] wrote:

Ruby:
I much prefer CL to Ruby, but this argument is useless. How many lines
;;;;SYSTEM: Common-Lisp
;;;; to read most of CL syntax.
;;;;
;;;; PURPOSE. See the GNU General Public License for more details.
dispatching-macro-characters)
(values (character-description-reader-macro description)
&optional (readtable simple-readtable))
(let ((description (gethash character (simple-readtable-macro-characters readtable))))

(declare (ignore char subchar))
object)))
(defun simple-read-quote-macro (character stream)
(defun simple-read-string-macro (character stream)

(simple-set-macro-character #\( (function simple-read-list-macro)     nil readtable)

(defun simple-read (&optional (stream standard-input) (eof-error-p t) eof-value)
:for ch = (peek-char nil stream nil #\space)

(with-open-file (input “simple-reader.lisp”)
(loop
:for sexp = (simple-read input nil input)
:until (eq sexp input)
:do (pprint sexp) (terpri)))


Pascal B.

By the way, here is in 1 line of BF, a complete BF reader that is able
to
read all the BF syntax needed to write it:

,+[-.,+]

Here’s how to try it:

$ sudo apt-get install bf
$ cat > reader.bf
,+[-.,+]
$ bf reader.bf < reader.bf

Your 150 lines don’t look very impressive now, do they?

Ruby < Lisp <<< BF!

sometimes i just wish i had that big red delete button to remove
endless,
totally worth- and pointless discussions from the face of the earth…

Don’t you realize how ugly Ruby syntax is?

Don’t you realize this is a ruby mailing list? if you hate the syntax –
go
make your own friggin’ language and stop bugging other people. your
definition of beauty doesn’t have to be everybody’s. After all, this is
not
soviet russia or nazi germany here…

hopefully a supreme being will soon intervene and remove this pointless
thread from the space-time continuum… :wink:

Fabian S. wrote:

Don’t you realize this is a ruby mailing list? if you hate the syntax – go
make your own friggin’ language and stop bugging other people. your
definition of beauty doesn’t have to be everybody’s. After all, this is not
soviet russia or nazi germany here…

hopefully a supreme being will soon intervene and remove this pointless
thread from the space-time continuum… :wink:

poof Look, it’s Godwin!

Joel VanderWerf [email protected] writes:

Fabian S. wrote:

Don’t you realize this is a ruby mailing list? if you hate the syntax – go
make your own friggin’ language and stop bugging other people. your
definition of beauty doesn’t have to be everybody’s. After all, this is not
soviet russia or nazi germany here…

hopefully a supreme being will soon intervene and remove this pointless
thread from the space-time continuum… :wink:

poof Look, it’s Godwin!

LOL

Just when I was about to get frustrated with someone extending the
thread by saying the thread should stop, I saw your post :slight_smile:

On Mon, Aug 3, 2009 at 12:36 PM, Fabian
Streitel[email protected] wrote:

sometimes i just wish i had that big red delete button to remove endless,
totally worth- and pointless discussions from the face of the earth…

Ah, how long has man debated the meaning of beauty, and truth for that
matter?

To quote Ben Franklin from “Poor Richard’s Almanac”

Beauty, like supreme dominion
Is but supported by opinion


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

On Aug 3, 1:19 am, [email protected] (Pascal J. Bourguignon)
wrote:

$ cat > reader.bf
,+[-.,+]
$ bf reader.bf < reader.bf

Your 150 lines don’t look very impressive now, do they?

Ruby < Lisp <<< BF!

I specified a syntactic reader. Not just a reader.

It is a syntactic reader. BF’s syntax is just a sequence of
characters. If you throw in illegal characters, the behavior is
“undefined”. Lisp’s syntax is more complicated: it’s a tree of
identifiers (in its idealized form; of course, Common Lisp had to fuck
it up). Ruby’s and Python’s syntaxes are even more complicated.

The above was to illustrate the wrongness of your argument that the
length of a self-parser determines the usefulness of the language.
Hell, I know that BF can be a little too awesome.

By the way, Python’s syntax is much better than Ruby’s. Dollar signs
in front of variables? WTF were the designers smoking? That’s like
Perl! Haven’t you learned your lesson?

Python’s syntax might even be better than Lisp’s, but it’s certainly
harder to parse.

On Aug 3, 7:51 pm, fft1976 [email protected] wrote:

read all the BF syntax needed to write it:
Your 150 lines don’t look very impressive now, do they?

The above was to illustrate the wrongness of your argument that the
length of a self-parser determines the usefulness of the language.
Hell, I know that BF can be a little too awesome.

By the way, Python’s syntax is much better than Ruby’s. Dollar signs
in front of variables? WTF were the designers smoking? That’s like
Perl! Haven’t you learned your lesson?

Python’s syntax might even be better than Lisp’s, but it’s certainly
harder to parse.- Hide quoted text -

Go away, troll.

[This is cross-posted; I recommend that no one else follow up.]

Carl B.

Of course you don’t like it when I point out just how wrong you are.

IIRC you didn’t parse ruby syntax in ruby. You thus didn’t point out
how wrong “you” was – apart from the fact that CB, who you’re
addressing in your previous mail, most likely is a different person
than PJB, who you’re citing. So why exactly did you post this to ruby-
talk? Just to show off some brainfuck code?

On Aug 4, 1:06 pm, fft1976 [email protected] wrote:

Of course you don’t like it when I point out just how wrong you are.

No, we don’t like it when you try to drag comp.lang.python into
whatever the hell it is you think you’re doing.

On Aug 3, 8:02 pm, Carl B. [email protected] wrote:

read all the BF syntax needed to write it:
Your 150 lines don’t look very impressive now, do they?

Go away, troll.

[This is cross-posted; I recommend that no one else follow up.]

Carl B.

Lispers were having fun badmouthing other languages for no good
reason:

“”"
Don’t you realize how ugly Ruby syntax is?

Here is in 150 lines of lisp, a simplified lisp reader that is able to
read all the lisp syntax needed to write it.

Try to parse Ruby syntax in Ruby and see how useless a language it
is.
“”"

http://groups.google.com/group/comp.lang.lisp/msg/52dde974d504ad54

Of course you don’t like it when I point out just how wrong you are.