Hacker News new | past | comments | ask | show | jobs | submit login
REBOL Oneliners (rebol.com)
116 points by damir on March 8, 2020 | hide | past | favorite | 52 comments



Back on the Amiga I once found this weird language on Aminet or a ffish disk called "Lava" and it had all these builtin datatype for amazing things like ip addresses, I just could not wrap my head around that. What do you mean? I don't have to write my own token parsers in C that's outrageous! I ran away at first but went back over summer break and it had been renamed Rebol. I used it all through school blowing through programming assignments like they weren't there. Remember once earning 10% of a term's grade in something like 70 chars

It was by far the most enjoyable programming I ever did. But (why does there always have to be that But) using it at work, as I did after school, was a disservice to everyone around me. Hardware - was all 64bit Rebol was still 32bit. Proprietary - brilliant author was from the time before, when that made sense. Co-workers - most neither could, nor wanted to "get it" Rebol sure was not going to help on their resumes.

It tried to go Rebol2->Rebol3 ala perl/python but when a community in the hundreds splinters, there is just not that much left.


By the way Rebol was created by Carl Sassenrath, the designer of the kernel (exec) of Amiga OS.

https://en.m.wikipedia.org/wiki/Carl_Sassenrath


REBOL and its derivative Red seem like cool languages, but I can't get over the fact that it's impossible to bootstrap these free software projects because Red requires REBOL 3, which is self hosting using REBOL 2, which is proprietary.


Red requires Rebol 2, which is proprietary; Red does not require (and, in fact, does not work with) Rebol 3.

However, Rebol 3 (and it's active descendant Ren-C) bootstraps itself; it does not require Rebol 2.


You've probably forgotten but at one stage the red.r script was ported to ren-c.


For what it's worth, only 1/4 of the toolchain (Red → Red/System compiler and Red/System → native compiler + loader/linker) depends on Rebol2, which in turn is 90% compatible with Red.


Red will be self hosted at some point. I know they're working towards it, so it shouldn't put you off forever.


This language just looks super cool. It's a shame it's sort of dead. Red (the spiritual successor) isn't ready for production yet.


It's been really active; you can hop on their gitter and get a feel for where development is at (the sorts of things that are getting attention). I wouldn't use it for a production load, but it's ready enough for writing internal or personal tooling in.

(And edit to say, I think some of the core team got pretty far into the blockchain rabbit hole at some point, so that may have derailed more mainstream efforts)


Red died the minute they announced they were going to launch their own crypto currency.


That's a rather bold claim. What you call cryptocurrency is an ERC-20 token intended for experimenting with community economy (e.g. tipping contributors, voting for features, app market, etc). It's an untrodden path and the idea is quite interesting in its own way.

Regardless of the blockchain involvement, I encourage everyone to stay open-minded and judge the project on its technical merits.


So the cryptocurrency stuff isn't at all part of the language or stdlib?


What makes you think it is? There are plans to offer a lightweight console module for the Ethereum scheme and C3 dialect, but since there's very little interest in this branch of development from the community (and a lot of skepticism with nay-saying) it's not a priority.


I don't think it is, I (and I assume many developers) just want to stay far away from anything cryptocurrency-related.


It believe it had a restrictive license which was a showstopper for a programming language. The current version is Apache(?), but it might be too late.


Rebol2 was closed source, and is no longer maintained. Red has a non-restrictive license.


Low number of users doesn't mean dead. A Rebol 3 version now compiles to wasm. You can check the interpreter running in a browser at hostilefork.com/media/shared/replpad-js/


Red is pretty awesome. Last I tried it out, it was not ready for graphics work on Linux.


GTK backend is in a fairly good state, albeit lives in a separate development branch (which you are encouraged to check out).

https://www.reddit.com/r/redlang/comments/dzobh0/latest_gtk_...

https://static.red-lang.org/dl/branch/GTK/linux/red-latest

https://gitter.im/red/GTK


Logo on steroids.


I've spent the best part of 2000 programming with REBOL until I made the switch to the early builds of MacOS X and moved to program using LiveCode. REBOL remains one of my most fond memories of being a developer. So much power in such a little language.

I wish REBOL 2 was still being developed and its GUI was updated to latest trends. I'd switch back to it in a heartbeat. I'm quite excited about Red and been playing with it occasionally.


Over the years I have used 20+ languages, starting with CobolC and Watfor, and now python is my daily driver. Rebol is by far the most enjoyable language I have ever used, very similar to Smalltalk and Lisp. More productive than any other system out there and a very small footprint. The language is unbelievably versatile as you can overload any word and create your own mezzanine functions super quickly. The drawback are that you can really messup if you are not careful. Another thing is that compiling is out of the question as the self modifying code possibilities of this language make it truly dynamic. Carl did a marvellous job on this language. The design is impeccable. If you like messaging then this is THE language.


Compiling is not entirely out of the question: Red (Rebol's descendant) handles static compilation where it can and delegates the rest to the interpreter.


Its a very impressive show of one-liners, I love how expressive the language is. I wonder however, how easy it would be to extend compared to something like Lisp. If these idioms for parsing html weren't built-in, what would a Rebol implementation of those funcs look like?


First programming language I learned, back around 2000. I still use it often for my personal projects.


The syntax looks kind of odd - it feels a bit like trying to read lisp without the parentheses. Seems like a very expressive language though based on the number of characters needed to get stuff done


IIRC I read somewhere that Rebol is homoiconic but not sure.


It is. For example, in the third example:

  foreach file load %./ [if not dir? file [write/binary join ftp://user:pass@example.com/ file read/binary file]]
Those two sets of [ ] are the block! datatype, which is an array-like type. "foreach" is a function that takes an identifier and two block!s ("load" returns a block!), executing the second for each one in the first.

Quick example showing it:

  >> something: [print val]
  == [print val]
  >> foreach val [1 2 3] something
  1
  2
  3
  >> append something [+ 3]       
  == [print val + 3]
  >> foreach val [1 2 3] something
  4
  5
  6
The second example in the oneliners kinda shows this as well, but I suppose it's not obvious without knowing more of the language. The outer block! is actually a separate dialect being passed to the layout function as data, that the layout function parses and handles. What's normally thought of as rebol is called the "do dialect", because that's how you run a block! as code:

  >> X: [print 1 + 2]
  == [print 1 + 2]
  >> do X
  3
  >> X/3
  == +
  >> X/3: to-word {*}
  == *
  >> X  
  == [print 1 * 2]
  >> do X
  2


Thanks.


Curious ones can find a brief explanation of this core idea in a Github wiki (shameless plug!).

https://github.com/red/red/wiki/%5BDOC%5D-How-Red-works:-a-b...


Thanks.


I’m really encouraged that REBOL has made it to the front page of Hacker News. Hopefully that will translate into more contributors to the REBOL and Red projects.


Looks really interesting. Anyone able to get this to work on Catalina? I'm getting "bad CPU type in executable" for both the PPC and Intel versions.


PPC definitely won't work on Catalina. PPC support was dropped from macOS years ago.

The Intel binary is 32-bit only. Catalina will only run 64-bit binaries.

    $ file rebol 
    rebol: Mach-O executable i386


Does anyone else think cutting off 32-bit support basically killed off what remained appealing about the Mac that differentiated it from being just a “desktop iOS iPad in the iCloud ecosystem”?

I lost access to so much cherished stuff that I am currently evaluating a switch to Ubuntu 20.04


Of all the tiny papercuts I've suffered on macOS over the last five years, I don't miss 32-bit apps at all.

Must have just gotten lucky, but literally nothing stopped working when I migrated to a new Catalina machine. Ok I had to do some jimmying to get Keybase back, but that wasn't a 32/64-bit issue, that was weird kext permissions stuff.


I guess it depends what you use the computer for.

Pretty much 90% of my Steam games that had Mac versions, suddenly did not work. And there was no warning, because most of them weren't currently installed (so the catalina installer didn't warn); I just got a cross through them after upgrading.

"Mac gaming" wasn't something I did that much anymore, but I had a lot of attachment to certain games (some which of course "I totally intended to replay one day") and suddenly they became unavailable.

Many older apps I still ran now and then, stopped working.

I kept my S.O. on Mojave so that I wouldn't be forced to upgrade her Office suite to the subscription model Microsoft is pushing.

Etc.


Not really. I'm mostly on Debian, only using OSX for photo editting and some development, but I honestly didn't realize 32-bit desktop apps were still a thing.

I understand the frustration, though. Apple's spent the last 5 years or so dropping features I care about and breaking things important to me, across my iPhone, iPad, and MBP.


well, ubuntu is also dropping support for 32-bit. they tried to a little while ago and got a lot of backlash so they're supporting for a bit longer, but it's only a matter of time.


I think they're dropping support for installation on 32-bit machines, not the 32-bit libraries needed to run 32-bit software on a 64-bit OS.


The former already happened. In this case it was the latter. this would have ruined wine right when stream was beginning to make running games with wine easy.


Oh, thanks!


There are r3 alpha builds for PPC and x64 from rebolsource.net but they're from 2013. There are sometimes daily builds of renc which are uploaded to S3 including x64 OSX from Travis-ci.


Why would you even try the PPC version on Catalina? Snow Leopard (from 2009) was the last mac os to support ppc.

The intel version is i386. 32bit, which is not supported on Catalina either/


Probably because they don't have a Snow Leopard machine left.


Looks a little like FORTH, but with batteries included.


The idea of a one-liner is sort of silly when applied to functional programming. Every lisp expression, for example, no matter how long in editor space, is logically a single line.


It's only silly if you don't apply a reasonable character limit in your definition.

I would say < 80 is definitely a one-liner, < 100 is more-or-less a one-liner, < 120 is really pushing it. After that, you're cheating. Even Java style guides cut you off after 120.

12 of these "one-liners" fail even the most permissive of these criteria, but, y'know, YMMV. None are over 140.


> None are over 140.

Their limit is at the top of the page:

> 2. How long is a line? Here, we limited users to 132 chars. It's the old line printer standard.


To me all (complex) one liners are bad : they're hard to read and they don't manage errors.

I'd rather go through 5 lines of simple statements than try to decipher a "clever" one liner.

From the fine article : > Open a GUI, read web page, sent it as email

You really want to do that in one line ?


sending someone a link via email is a relatively common task.

why would it be undesirable to write short code that can do that?


Not undesirable, just odd to make a big deal about it. Like making a big deal about Unix pipes. Yeah, when they were invented, okay. Nowadays ... old hack.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: