4,727 karma · joined August 5, 2008
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
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 >> 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.htmlFor eg.
>> type? https://www.example.com/foo.html#bar
== url!
>> type? https://www.example.com/foo.cgi?bar=1&baz=2
== url!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;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...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
; 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.htmlAdditional references: http://rebol.info/ | https://github.com/r3n
csv_data_to_maps([Head | Lines]) ->
lists:map(fun(L) -> maps:from_list(lists:zip(Head, L)) end, Lines). 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)]
]
]
]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
]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]
]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!
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...
And I would add Rebol & Red.
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)
P-Q4
Ken padded this out to 8 characters.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
https://github.com/metaeducation/ren-c
In fact there was a Rebol conference only last month - http://2019.reb4.me/
- 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.
Perl removed CGI from its core back in 2014 - https://perl5.git.perl.org/perl.git/commitdiff/e9fa5a80
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
== 8Couple of other terms i've seen...
* Pidgin - An attempt to get away from DSL ambiguity!
* Slang - This is what Perl6 calls them