HN user

draegtun

4,727 karma

/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

Posts479
Comments1,030
View on HN
blog.usejournal.com 6y ago

Solving Embarrassingly Obvious Problems in Erlang (2019)

draegtun
1pts0
www.e-dejong.com 7y ago

Wisdom from the past in Software Development

draegtun
2pts0
re-factor.blogspot.com 7y ago

Factor 0.98 now available

draegtun
1pts0
www.red-lang.org 8y ago

Red Roadmap Updates

draegtun
3pts0
9214.github.io 8y ago

Beyond Good and Evil and 13th MDisk

draegtun
1pts0
www.red-lang.org 9y ago

Entering the World of Macros

draegtun
22pts0
jeffreykegler.github.io 9y ago

Parsing: an expanded timeline

draegtun
2pts0
alistapart.com 10y ago

Prototypal Object-Oriented Programming Using JavaScript

draegtun
1pts0
blog.hostilefork.com 10y ago

Rebol vs. Lisp Macros

draegtun
7pts1
howivim.com 10y ago

How I Vim – Damian Conway

draegtun
5pts0
www.bbc.co.uk 10y ago

The takeaway worker who set up a fast-growing IT firm

draegtun
4pts0
medium.com 10y ago

Lessons learned from open source communities

draegtun
8pts1
medium.com 10y ago

Understanding Rebol Series

draegtun
2pts0
www.bbc.co.uk 10y ago

Boy, 15, arrested in Northern Ireland over TalkTalk hack

draegtun
3pts2
prog21.dadgum.com 10y ago

If You Haven't Done It Before, All Bets Are Off

draegtun
13pts0
allisonrandal.com 11y ago

The Future of Open Source

draegtun
7pts0
schplog.schmorp.de 11y ago

Emulating Linux MIPS in Perl – Part 1: ELF loader

draegtun
77pts13
uscii.hostilefork.com 11y ago

USCII: Character Codes with Meaning

draegtun
14pts8
prog21.dadgum.com 11y ago

Stop the Vertical Tab Madness (2010)

draegtun
85pts63
www.research-live.com 11y ago

Mobile Internet to overtake fixed broadband in two years (UK)

draegtun
1pts0
www.research-live.com 11y ago

Apple replaces Google as world's most valuable brand

draegtun
2pts0
www.independent.co.uk 11y ago

How much are you worth? This tool can tell you by looking at your CV

draegtun
3pts3
www.bbc.co.uk 11y ago

What will the future of programming look like?

draegtun
3pts0
perltricks.com 11y ago

Parsing Perl 5 POD with Perl 6

draegtun
8pts0
prog21.dadgum.com 11y ago

Are You Sure?

draegtun
2pts2
www.effectiveperlprogramming.com 11y ago

Perl v5.18 adds character class set operations

draegtun
3pts0
prog21.dadgum.com 11y ago

Life Is More Than a Series of Cache Misses

draegtun
13pts0
www.nu42.com 11y ago

Trend analysis at the shallow end of the pool

draegtun
2pts0
blog.newrelic.com 11y ago

Going Beyond Grep for Searching Source Code (ack | ag)

draegtun
5pts1
www.red-lang.org 11y ago

Dream big, work hard and make it happen (Red gets VC investment)

draegtun
6pts0

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;

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.

> 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]

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

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.

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.

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

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]
    ]

> 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"]
    ]

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.