The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: bakul@bitblocks.com (Bakul Shah)
Subject: [TUHS] lisp challenge
Date: Fri, 16 Feb 2018 15:49:35 -0800	[thread overview]
Message-ID: <20180216234950.67D80156E9AD@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Fri, 16 Feb 2018 14:28:35 -0800." <20180216222835.GC27574@mcvoy.com>

On Fri, 16 Feb 2018 14:28:35 -0800 Larry McVoy <lm at mcvoy.com> wrote:
> On Fri, Feb 16, 2018 at 02:05:09PM -0800, Bakul Shah wrote:
> > 
> > If you want to do more of an apples to apples comparison, you
> > should pick a brand new problem not known to be solved in
> > either C or Lisp so that both sides start at the same point!
> 
> Nope.  It's my challenge and it stands as I stated it.  People said
> I was wrong when I said Lisp was perceived as slow.  I picked a 
> perfectly reasonable example of a common problem (text processing),
> gave a benchmark, gave a pointer to how the C program was made fast,
> and asked for a lisp program that even comes close.

By issuing this challenge you automatically "win" as no one is
going to take up your challenge and spend the kind of time
that was needed to optimize GNU grep.  Very clever of you! But
if you are serious, it is only fair that both sides start with
a clean slate.

Here's a somewhat related problem: Consider trees with zero or
more integers as leaves.  For example, ((1 2)3(4 (5 () 6))).
A file contains 0 or more such trees.  Write a tree-grep to
find and print trees with matching fringes. For example:

.*3.*5.* matches the above tree
.*(3).* doesn't as there is no subtree with 3 as its sole leaf
.*(.*2)[2,3].* also matches
.*(.*2.+).* doesn't as 2 is the last leaf and we want at least one more
.*(4#(.*().*).*).* matches -- (4...) contains (.*().*) 0 or more levels down.

. is any, * is 0 or more, + is 1 or more, # is like ** in zsh.
[...] is used to specify alternatives.  e.g {0-5,11-23, 99-}.
Assume unsigned ints.

#(5.*) says there is some subtree with 5 as the first leaf.

Syntax needs to be refined to be able to exactly specify
the shape one wants.

For extra credit also generate a tree-sed!

> I'm more than willing to be wrong, that's how I learn.  But the proof
> here is to show up with a pure lisp grep that is fast as the C version.
> I'm no lisp expert, not by any stretch, but I've never seen a lisp
> program that out performed a well written C program.

http://www.ffconsultancy.com/ocaml/ray_tracer/languages.html

Has a comparison of several languages used for implementing
raytracing. Harrop's graph is weird but for 32bit word
machines Stalin comes close to g++ results.


  parent reply	other threads:[~2018-02-16 23:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-16 21:01 Larry McVoy
2018-02-16 21:03 ` Larry McVoy
2018-02-16 22:05 ` Bakul Shah
2018-02-16 22:28   ` Larry McVoy
2018-02-16 22:53     ` Donald ODona
2018-02-16 23:01       ` Arthur Krewat
2018-02-16 22:56     ` Arthur Krewat
2018-02-16 23:02       ` Larry McVoy
2018-02-16 23:18       ` Toby Thain
2018-02-16 23:41         ` Larry McVoy
2018-02-16 23:49     ` Bakul Shah [this message]
2018-02-16 23:34 ` Andy Kosela
2018-02-16 23:44 Noel Chiappa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180216234950.67D80156E9AD@mail.bitblocks.com \
    --to=bakul@bitblocks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).