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 Lisp's Influence on Ruby
The article doesn't mention Perl at all but it did have some direct influences on Ruby.

Even Ruby's trailing blocks syntax are an homage to Perl's block list subroutines:

  # first Ruby example in article
  users.select { |u| u.admin? }.map(&:email)

  # using Perl's block list
  map {$_->email} grep {$_->is_admin} @users;
draegtun··on Perl's decline was cultural
Yes (de)referencing can be a PITA sometimes but you've probably forgotten that your example code could have been better written like this:

    $hash1->{key1}{key2}
And if `hash1` was a hash (instead of a hashref) then it's just this:

    $hash1{key1}{key2}
The `%{}` de-reference you mention later is only when you have an operation that requires a hash, for eg:

    keys %{$hash1{key1}}
And for kstrauser example later in Python...

    hash1["hash_name"]["array_name"][3]
the equivalent in Perl would be...

    $hash1{hash_name}{array_name}[3]
I find having {} & [] as lookup keys for their types is not only more explicit but also safer/correct.
draegtun··on Red Programming Language
Or in Red's case, Parse - https://www.red-lang.org/2013/11/041-introducing-parse.html
draegtun··on Red Programming Language
Except in homoiconic languages, like Rebol/Red/Lisp, there is no (need for a) new syntax.
draegtun··on Red Programming Language
Or in Rebol/Red it's Parse, a dialect (DSL) that comes with the language - https://www.rebol.com/docs/core23/rebolcore-15.html
draegtun··on John Carmack on inlined code (2014)
You can do this in...

  # perl
  my $x = do {
     …
     5
  };

  ;; Rebol/Red
  x: do [
     …
     5
  ]
draegtun··on GUI Examples – Rye Language
Everything is subjective of course :)

I remember comparing Tcl/Tk with Rebol/View - https://news.ycombinator.com/item?id=7069311

draegtun··on GUI Examples – Rye Language
Hopefully these two links will help:

- Definitional Scoping / Rebol actually does not have scoping at all - https://stackoverflow.com/q/21964110/12195

- Bindology - https://en.wikibooks.org/wiki/Rebol_Programming/Advanced/Bin...

draegtun··on Hallelujah, Leonard Cohen, and a Pulitzer Prize-winning writer's suicide
>> I think Cale is an underrated vocalist

I totally agree and more so on ballards.

The hairs on my back of my neck always stand up when I hear I Keep A Close Watch (especially the M:FANS version [1], but the original Helen of Troy version is also great [2] and there's plenty of wonderful live versions).

[1] https://youtu.be/d7wBvyrao8I [2] https://youtu.be/LoggPfL3dLU

draegtun··on Jiff: Datetime library for Rust
To add to this "A Date with Perl" by David Rolsky (video below is from 2017 but he has same talk going back 10+ years).

https://youtu.be/enr5_FoToiA

draegtun··on Rewriting the Ruby parser
>> It really should be a few lines of code to add an “unless(X) {}” statement to “if(!X) ()” to...

Or even one line :)

Factor...

  : unless ( ? quot -- res ) swap [ drop ] [ call ] if ; inline
Rebol/Red...

  unless: func [expr block] [either expr [] block]
draegtun··on What are the enduring innovations of Lisp? (2022)
Here's a video where Crockford mentions Rebol (and others) being an influence on JSON - https://www.youtube.com/watch?v=-C-JoyNuQJs&t=1233s

I've seen it mentioned on Rebol chatter that Crockford approached Carl Sassenrath (creator of Rebol) to open-source & use Rebol prior to creating JSON. So having a Javascript literal wasn't on Crockford's mind at that point.

NB. Rebol was closed sourced until 2012.

draegtun··on What are the enduring innovations of Lisp? (2022)
It's worth looking at Rebol [1], a language that is also homoiconic which was influenced by Lisp, Forth, Self & Logo and had a big influence on JSON too!

  user: [name: "John Doe" birth-date: 1970-01-01 account-balance: $1000.01]
[1] https://en.wikipedia.org/wiki/Rebol
draegtun··on Ryuichi Sakamoto has died
And Sakamoto would end up being involved in some of those Sylvian solo records.

A fly on the wall video of the 1st album [1] recording sessions was posted couple of years ago [2] which includes bits where you can see Sylvian/Sakamoto working together.

1: https://en.wikipedia.org/wiki/Brilliant_Trees

2: The Berlin Sessions - https://youtu.be/v-X36Xi8i58

draegtun··on What a good debugger can do
>> People pretends Smalltalk doesn't exist?

And Factor and many implementations of Lisp too!

draegtun··on Arturo Programming Language
Arturo was influenced by Rebol which comes with LOOP - http://www.rebol.com/r3/docs/functions/loop.html

However there are some differences...

  loop 10 [
      print "hello"   ;; prints "hello" 10 times
  ]

  repeat n 10 [
      print n         ;; prints 1 to 10
  ]

  forever [
     print "hello"    ;; print "hello" forever!
  ]
draegtun··on How Brian Eno Created Ambient 1: Music for Airports
David Sylvian & Holger Czukay produced two wonderful ambient albums together in the 80s...

Plight & Premonition - https://en.wikipedia.org/wiki/Plight_%26_Premonition

Flux + Mutability - https://en.wikipedia.org/wiki/Flux_%2B_Mutability

Couple of articles about their collaboration: https://pitchfork.com/reviews/albums/david-sylvian-holger-cz... | https://thequietus.com/articles/24916-david-sylvian-holger-c...

draegtun··on RCE via GitHub import
Yes they used to be called Associative Arrays. I think the change occurred between Perl4 & Perl5.

In Programming Perl it says "Associative Arrays" in 1st edition and "Hashes (Associative Arrays)" in 2nd edition.

NB. 2nd edition was the first to cover Perl5

draegtun··on Why doesn't Bash’s ‘set -e’ do what I expected? (2021)
Tcl would be a good choice here - https://www.tcl.tk/man/tcl8.5/tutorial/Tcl26.html
draegtun··on Why Is The Guitar Tuned Like It Is?
Also see "Ostrich" tuning used by Lou Reed / The Velvet Underground - https://en.wikipedia.org/wiki/Ostrich_guitar
draegtun··on I Just Can't Kick Lisp
The REPLs that come with Lisp, Smalltalk & Factor are in a different league.

There's probably a few different reasons to why but one thing that the 3 i've listed above all have in common is that they have image-based environments. So thats probably one of the top reasons why they have superior REPLs.

draegtun··on What makes a good REPL? (2017)
Well if we're creating a list then I would also add Factor, which provides a full graphical REPL with code browsing, help/docs system, step-thru & interactive debugger, full data/state inspection and much more.
draegtun··on Six programming languages I’d like to see
Perl has dynamic scoping (along with lexical scoping).
draegtun··on Six programming languages I’d like to see
And Rebol.

Arguments sent as `[blocks]` are always unevaluated but you can also explictly set a function argument to not be evaluated...

    f: func ['a] [
        print ["you gave me: " a]
        print ["and this is what it evaluates to:" get a]
    ]

    val: "hi!"

    f val
Outputs:

  you gave me:  val
  and this is what it evaluates to: hi!
And the function body is mutable...

    f: func [a] [
        print a
    ]

    f 10   ;; => 10

    append second :f [* 2]

    f 10   ;; => 20
draegtun··on Rulex – A new, portable, regular expression language
Also have a look at PARSE in Rebol & Red - http://www.rebol.com/docs/core23/rebolcore-15.html

This is how your example would look like in PARSE rule...

  1 3 [{What is your } ["name" | "quest" | "favourite colour"] "?" opt space]
draegtun··on The First Lisp Compiler
Also same for Rebol & Red.

And its easy to view the source code from the console (REPL). Some examples from Rebol2...

    >> source func

    func: func [
        "Defines a user function with given spec and body."
        [catch]
        spec [block!] {Help string (opt) followed by arg words (and opt type and string)}
        body [block!] "The body block of the function"
    ][
        throw-on-error [make function! spec body]
    ]


    >> source source

    source: func [
        "Prints the source code for a word."
        'word [word!]
    ][
        prin join word ": "
        if not value? word [print "undefined" exit]
        either any [native? get word op? get word action? get word] [
            print ["native" mold third get word]
        ] [print mold get word]
    ]
draegtun··on What Is JSON Patch?
>> It's yet another poor re-implementation of S-expressions and Lisp.

Or alternatively Rebol, which was one of the inspirations to JSON.

With Rebol you could write these patches like this:

    patch [
        replace /baz: "boo"
        add /hello: ["world"]
        remove /foo
    ]

    patch [
        add /biscuits/1: [name: "Ginger Nut"]
    ]
draegtun··on Common Lisp Resources
Perl does have lambdas...

  my $double = sub {$_[0] * 2};
  $double->(5);
draegtun··on Melody – a language that compiles to regular expressions
I like using `parse` in Rebol / Red - http://www.rebol.com/r3/docs/functions/parse.html

Here's the parse rule for Batman:

  [
      16 "na"
      2 [space "batman"]
  ]
And complete example for the Semantic version:

    digit: charset "1234567890"

    if parse "0.2.5" [
        opt "v"
        copy major [some digit]
        "."
        copy minor [some digit]
        "."
        copy patch [some digit]
    ][
        print [major minor patch]
    ]
draegtun··on Rails is not written in Ruby
> This unique feature of Ruby has been leveraged by DHH back when he created Ruby on Rails framework

This isn't unique to Ruby and is possible in other languages.

For eg. in Smalltalk you could create this DSL...

    1 day ago.
Page 1 of 34Next →