HNHacker News
TopNewBestAskShowJobs

draegtun

4,727 karma · joined August 5, 2008

/I3az/

blog - http://transfixedbutnotdead.com

work - http://www.draegtun.com

twitter - http://twitter.com/draegtun

LinkedIn - http://www.linkedin.com/in/draegtun

github - https://github.com/draegtun

cpan - https://metacpan.org/author/DRAEGTUN

submissionscomments
draegtun··on A trick to have arbitrary infix operators in Python
I remember seeing the original Activestate post and porting it to Perl. But it was 12 years ago so took me a while to find it :)

https://gist.github.com/draegtun/540493

draegtun··on Weird Languages
I think its more correct to call Red (currently) an incomplete Rebol variant but with loftier ambitions due to its Red/System & toolchain.
draegtun··on Are dynamic languages going to replace static languages? (2003)
Ditto for Rebol & Red.

For eg.

  >> code: load "foreach n [1 2 3 4] [print n * 2]"
  == [foreach n [1 2 3 4] [print n * 2]
  ]

  >> type? code
  == block!

  >> do code
  2
  4
  6
  8
draegtun··on Are dynamic languages going to replace static languages? (2003)
Rebol / Red also have a reader though in its terminology it could be called a "loader". See LOAD function - http://rebol.com/docs/words/wload.html
draegtun··on Malicious PyPI packages stealing credit cards and injecting code

  >> I am not aware of any languages or ecosystems that do this...
Rebol was designed with such a feature - http://www.rebol.com/docs/words/wsecure.html
draegtun··on Most URLs are syntactically valid JavaScript code
You can have fragments (and so forth) with Rebol/Red URLs.

For eg.

  >> type? https://www.example.com/foo.html#bar
  == url!
  
  >> type? https://www.example.com/foo.cgi?bar=1&baz=2
  == url!
draegtun··on Most URLs are syntactically valid JavaScript code
I don't think you can make that or any URL into valid syntactic Perl code.

But maybe you're thinking of this - https://metacpan.org/pod/Acme::URL

  use Acme::URL;
  
  print https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label;
draegtun··on Most URLs are syntactically valid JavaScript code
And in Rebol & Red URL's are syntactically valid datatypes (literals): http://www.rebol.com/r3/docs/datatypes/url.html

For eg. in Red console:

    >> read https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
    
    == {<!DOCTYPE html><html lang="en-US" prefix="og: https://ogp.me/ns#"><head><me...
draegtun··on Show HN: Work with CSV files using SQL. For data scientists and engineers
Perl DBD::CSV module is a classic in this genre (first version is from 1998) - https://metacpan.org/pod/DBD::CSV
draegtun··on Python 3.9
Perl has been on a 12 month development cycle so some years (since perl 5.12 i think which would be from 2010).

I seems to have worked out well but they only support the two most recent (stable) versions - https://perldoc.perl.org/perlpolicy#MAINTENANCE-AND-SUPPORT

draegtun··on NestedText, a nice alternative to JSON, YAML, TOML
Which in turn has more than a passing resemblance to Rebol...

  ; Comments!!!
 
  ; An Array with no commas!
  greatDocumentaries: [
      'earthlings.com
      'forksoverknives.com
      'cowspiracy.com
  ] 
 
  importantFacts: [

      ; Multi-Line Strings! Without Quote Escaping!

      emissions: {Livestock and their byproducts account for at least 32,000 million tons of carbon
  Goodland, R Anhang, J. “Livestock and Climate Change: What if the key actors in climate change we
  WorldWatch, November/December 2009. Worldwatch Institute, Washington, DC, USA. Pp. 10–19.
  http://www.worldwatch.org/node/6294}
 
      landuse: {Livestock covers 45% of the earth’s total land.
  Thornton, Phillip, Mario Herrero, and Polly Ericksen. “Livestock and Climate Change.” Livestock E
  https://cgspace.cgiar.org/bitstream/handle/10568/10601/IssueBrief3.pdf}
 
      burger: {One hamburger requires 660 gallons of water to produce – the equivalent of 2 months’
  Catanese, Christina. “Virtual Water, Real Impacts.” Greenversations: Official Blog of the U.S. EP
  http://blog.epa.gov/healthywaters/2012/03/virtual-water-real-impacts-world-water-day-2012/
  “50 Ways to Save Your River.” Friends of the River.
  http://www.friendsoftheriver.org/site/PageServer?pagename=50ways}
 
      milk: {1,000 gallons of water are required to produce 1 gallon of milk.
  “Water trivia facts.” United States Environmental Protection Agency.
  http://water.epa.gov/learn/kids/drinkingwater/water_trivia_facts.cfm#_edn11}
 
      more: http://cowspiracy.com/facts
  ]
Some references: https://en.wikipedia.org/wiki/Rebol | http://www.rebol.com/article/0108.html
draegtun··on REBOL Shell Interface
The best branch to follow is https://github.com/metaeducation/ren-c

Additional references: http://rebol.info/ | https://github.com/r3n

draegtun··on A History of Clojure [pdf]
Opps... a superfluous parenthesis sneaked into Erlang code there!!

  csv_data_to_maps([Head | Lines]) ->
    lists:map(fun(L) -> maps:from_list(lists:zip(Head, L)) end, Lines).
draegtun··on A History of Clojure [pdf]
Here it is in Erlang, which is another language which forces you not to think in loops:

  csv_to_maps([Head | Lines]) ->
      lists:map(fun(L) -> maps:from_list(lists:zip(Head), L)) end, Lines).
Another language which works differently is Rebol:

  csv-to-maps: func [csv-data] [
      map-each line next csv-data [map zipmap first csv-data line]
  ]
Whats interesting about above is that `first csv-data` will be re-evaluating on each `map-each` sequence. Of course you can assign to variable beforehand. Alternatively because code-is-data and vice-versa you can use COMPOSE it inline:

  csv-to-maps: func [csv-data] [
      map-each line next csv-data compose [map zipmap (first csv-data) line]
  ]
:)

NB. Rebol doesn't come with ZIPMAP so here's a definition for above to work:

    zipmap: func [keys vals] [
        collect [
            forall keys [
                keep reduce [keys/1 vals/(index? keys)]
            ]
        ]
    ]
draegtun··on Beauty of Tcl/Tk in one tweet
@9214 pointed you to Linux GTK builds of Red. My example was tested in macOS so haven't tried it on Linux but you'll need GTK & 32bit compatibility libraries installed for it to work.

Rebol/View as always worked on Linux though you will also need 32bit compat + Freetype libraries - https://stackoverflow.com/questions/34524169/rebol-2-stopped...

And there's a 64-bit Rebol 3 with R3-GUI from Atronix, which should only need Freetype library installed - https://www.atronixengineering.com/downloads

The VID has changed a little bit over time. Here's the example in Rebol2 View...

    Rebol []

    view layout compose [
        across
        text (rejoin [{The sum of } figs: [1 2 3 4] { is: }])
        answer: text {......}
        return
        button "Push me to calculate" 200x20 [
            answer/text: to-string sum figs
            show answer
        ]   
    ] 
And here it is in Rebol 3 / R3-GUI...

    load-gui

    view compose [
        hgroup [
            text (rejoin [{The sum of } figs: [1 2 3 4] { is: }])
            answer: text {......}
            return
            button "Push me to calculate" on-click [
                set-face answer to-string sum figs
            ]
        ]
    ]
Both scripts above worked fine on my Ubuntu 18 Linux.

NB. Rebol doesn't come with a SUM function so here's one defined...

    sum: func [s /local total] [
        total: 0
        forall s [total: total + s/1]
        total
    ]
draegtun··on Beauty of Tcl/Tk in one tweet
I prefer Rebol or Red VID dialect.

Here's the same code in Red VID...

    Red []

    view compose [
        text (rejoin [{The sum of } figs: [1 2 3 4] { is: }])
        answer: text {}
        return
        button "Push me to calculate" on-click [answer/text: to-string sum figs]
    ]
draegtun··on Pros and Cons of Nim
>> Metaprogramming: Nim's metaprogramming ability is second only to Lisp[0], ...

There are some other languages that have metaprogramming abilities equal to Lisp. For eg. Rebol, Red & Forth.

I think some people would also consider Prolog and Smalltalk to be in the same ballpark.

And there are languages that would also claim to be second only to Lisp, for eg. Julia, Elixir, Raku/Perl6 and probably some others to!

draegtun··on John Cale’s inventive retrospection (2017)
>> and Rufus Wainwright sings on the soundtrack for the animated film “Shrek”—that most people recognize.

And interestingly it's the John Cale version of Hallelujah used in the Shrek film :)

But due to licensing issues it was changed to Wainright's version on the soundtrack album! - https://en.wikipedia.org/wiki/List_of_songs_featured_in_Shre...

draegtun··on It's not what programming languages do, it's what they shepherd you to
> what other languages [...] give you the freedom to change the language and/or create DSL's [...]

And I would add Rebol & Red.

draegtun··on Lisp Comes of Age (1980)
I would add Rebol & Erlang.
draegtun··on Ask HN: What is the most beautiful piece of code you've ever read?
Just to clarify it's Rebol 2 (Core/etc) that is closed source.

Rebol 3 is open-sourced along with the GUI (R3-GUI)....

* https://github.com/rebol/rebol

* https://github.com/metaeducation/ren-c (community fork)

* https://github.com/zsx/r3-gui (Atronix fork)

draegtun··on Ken Thompson's Unix Password
Actually in descriptive notation the move would have been:

    P-Q4
Ken padded this out to 8 characters.
draegtun··on Julia v1.2
Perl/CPAN has been doing this for years - http://cpantesters.org/page/about.html

Here's an example of a CPAN module (Moose) which is tested against every release of Perl (going back to 5.8.3 from 2004) against multiple OS/Platforms - http://matrix.cpantesters.org/?dist=Moose

draegtun··on We Made Amiga, They Fucked It Up (2015)
While Carl hasn't blogged for a while there are plenty of gems to look back at on his blog: http://www.rebol.com/cgi-bin/blog.r
draegtun··on We Made Amiga, They Fucked It Up (2015)
There is still a small community working on the open-sourced Rebol 3:

https://github.com/metaeducation/ren-c

https://github.com/r3n

https://forum.rebol.info

In fact there was a Rebol conference only last month - http://2019.reb4.me/

draegtun··on We Made Amiga, They Fucked It Up (2015)
Curecode (https://www.curecode.org/rebol3/) is no longer used. Everything was moved to Github a few years ago - https://github.com/rebol/rebol-issues/issues
draegtun··on Web Programming with Continuations (2002) [pdf]
It should be noted that the owner/author of this website (https://thelackthereof.org/ and not the posted PDF) wrote a Perl continuations based web library/framework called Continuity.

- https://thelackthereof.org/Continuity

- https://metacpan.org/pod/Continuity

Shame it is no longer under development. Found it very handy & enjoyable using it for projects in the past (by itself and sometimes with Squatting framework built on top of it). Hats off to Brock (https://news.ycombinator.com/threads?id=awwaiid) for the great work creating Continuity.

draegtun··on PEP 594 – Removing dead batteries from Python's standard library
You have to keep moving forward with the times!

Perl removed CGI from its core back in 2014 - https://perl5.git.perl.org/perl.git/commitdiff/e9fa5a80

draegtun··on TXR – A Programming Language for Convenient Data Munging
> ... also allows you to define new operators ... I'm not sure about Rebol/Red - I had only passing contact with it long ago

You couldn't in Rebol 2. But you can in Rebol 3 (Ren/C branch) and Red.

For eg, lets take Rebol/Red `multiply` function and provide an infix operator for it (ie. replicating the `*` infix operator)...

Rebol 3 (Ren/C):

  >> multiply 2 4
  == 8
  
  >> x: enfix :multiply 
  
  >> 2 x 4
  == 8
Red:

  >> x: make op! :multiply
  == make op! [[
      "Returns the product of two values" 
      value1 [number! char! pair! tuple! ...
  
  >> 2 x 4
  == 8
draegtun··on About V, the language Volt is written in
I thought Lisps called them "dialects" (same as in Rebol / Red).

Couple of other terms i've seen...

* Pidgin - An attempt to get away from DSL ambiguity!

* Slang - This is what Perl6 calls them

← PreviousPage 2 of 34Next →