hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Ruby-Lisp Hybrid Pix #

by why in inspect

Wild, here’s another shot of that envisioning of Ruby in the parenthetical, posted by Slyphon earlier today. Definitely nods closer to Ruby than Lisp. Dashes in method names is lovely.

The other shot is here. This Doctor Lion also has a shot of darkened end in his highlighting, if the staircase gives you vertigo.

I guess it’s not really near Lisp at all, though, with code like: (without-punctuation.to_s + '='). It’s no worse than Perl, though. Come to think of it, the only thing that draws me to Perl is its wrongness.

said on 28 Jun 2005 at 21:06

I didn’t want to be accused of plagiarism, so I looked through my irc logs and found that it was “dbrock” on #ruby-lang that posted this picture, so all credit goes to him :)

I’m happy that other people are intrigued by this, I think it’s just great.

said on 29 Jun 2005 at 04:49

is it emacs ? which color-theme do you use ?

said on 29 Jun 2005 at 06:07

who’ll make a vim color theme like that for me? :P

said on 29 Jun 2005 at 06:20

Wow, I’m excited to see this mentioned here. Thanks for spreading the word, slyphon and _why.

Ben, it sure is Emacs. You can grab the color theme here.

andre, it’s your lucky day. There’s a vim color theme available at the same location.

About the hyphens, I think I should point out that my code actually does look like that. I’m using a simple preprocessor to change it into valid Ruby code on the fly. If you think this sounds cool, you can download it here.

I haven’t bothered to make it insert ends automatically, because the Ruby mode for Emacs gets confused by the lack of ends in code like this:

 (def moomin
   (snufkin snork))

So it doesn’t help you in having your code look as Lispy as it does in long-live-the-parens.png. But note that this is already perfectly valid Ruby:

 (def moomin
   (snufkin snork) end)
said on 29 Jun 2005 at 08:52

dbrock: Yay thank you :D

What’s the name of the font you’re using?

said on 29 Jun 2005 at 09:48

It’s based on Lucida Typewriter, but hacked to make everything look nice: tall brackets, symmetrical apostrophe and grave accent, Unicode quotes and dashes, and random other tweaks—I call it Lucy.

But don’t tell anyone, since I guess technically you’re not permitted to make derived works of Lucida Typewriter. Someday I’ll do a clean-room remake. Oh, did I mention it has box-drawing characters so you can play nethack?

said on 29 Jun 2005 at 13:08

Dangerful hacks, dbrock. I’d actually like to see the hyphen hack make it into Ruby. Plus signs I think would be useful as well.

I started using the plus sign as a class method in Hobix, but its precedence keeps it from gobbling up multiple args.

For a few hours, custom types in Hobix looked like this:

 class Sketch < BaseEntry
   + :title
   + :photo
   + :when
   + :medium

   yaml_type "tag:pix.hobix.com,2004:sketch" 
 end

I wish the other operators were available as class methods. Slathered in sucrose!

said on 29 Jun 2005 at 13:54

How did you ever get that to work? Did you redefine Symbol#+@?

said on 29 Jun 2005 at 13:57

Just def Sketch.+.

said on 29 Jun 2005 at 15:17

First of all, something weird is going on with this comment box. Below are two identically typed lines.

def self.+ x ; fail end
def self.+ x ; fail end

In the preview, only the first plus sign appears.

Anyway, I don’t get the Sketch.+ thing. This just gives me :foo.

class Moomin
  def Moomin.+ x ; fail 'yow' end
  + :foo
end

Okay, since all my plus signs seem bent on mysteriously disappearing, I’ll give up trying to write something coherent about this subject now.

said on 29 Jun 2005 at 15:21

Actually, uh, nevermind. Forget everything I said about mysterious disappearences. It turned out fine after all.

said on 29 Jun 2005 at 15:33

No, you’re right. The preview has a grudge against plusses. (Some.)

Yeah, now that I look at it, there’s no way it worked, but I swear it did! Hehe. Anyway, I’m using self._ now.

said on 29 Jun 2005 at 16:00

That’s kinda cool, but… sexps==pain. I don’t want to have to count parentheses like it’s 1970 all over again.

If anything, I’d be in favor if a Python-style indentation mode where everything is the same but you can drop the staircase of ends.

(But the font is very cool, as is the hyphen in identifiers.)

said on 29 Jun 2005 at 16:05

Okay, thanks, that’s actually quite relieving—my brain seems to be basically operational then.

Using an underscore for a method name is interesting, but isn’t that kind of reserved for gettext? :-)

I’d like to have some additional special characters that we can put in method names. The ”?” and ”!” characters are good, but they can only do so much. For example, I like how ”%” is used to mean “internal” in various Lisps. But of course, that wouldn’t work in Ruby. And I like how ”*” is used to mean “prime”—but ”!” fills that role quite okay in Ruby. I don’t know what I’m getting at. Just thinking out loud, I guess.

By the way, what’s up with the self::foo in your code? That’s pretty ideosyncratic, I think! Why not just foo or at least self.foo?

said on 01 Jul 2005 at 00:10

Lookie what we just made work on Polishing Ruby :

class Foo
  _ [:defn, :example, [:args], [:call, [:lit, 1], :+, [:array, [:lit, 1]]]]
end
p Foo.new.example
=&gt; 2
said on 02 Jul 2005 at 12:46

so, from Lisp’s 9 ideas… what would be remaining for Ruby not to be a Lisp subset after implementing this ?

almost nothing, right ?

the uninitiated see also: http://www.paulgraham.com/icad.html

Comments are closed for this entry.