11
\$\begingroup\$

You should complete four tasks in a language which:

  • must return no results* when searched for on this (codegolf.se) website, for example ToffeeScript;
  • must have a page listed at Esolang, Rosetta Code or Wikipedia;
  • be a distinct language, rather than a distinct version (e.g. python 2.1 would be valid iff python satisfied the first two criteria).

*The exception being this hit for ToffeeScript.

The four tasks you should complete are:

1) Write a tweetable (<140 characters) description/promotion of your chosen language.

2) Print "Hello World! This is written in <programming language name>."

3) Print all the odd numbers in a user specified range. (e.g. a stdin of 20 25 should return 21 23 25).

4) Write a program which you feel best demonstrates an interesting feature of your chosen language.

Scoring:

  • This is a popularity contest
  • Bonus of 10 points if listed in two of the above directories, 25 if in all three.
  • Score is the summation of votes received at midnight UTC on July 1 2015, plus the bonuses.

Clarifications:

  • Task 1) can be a tweetable program but plain text is also acceptable.
  • Many languages do not have an existing interpreter; solutions to these are fine, but will be taken in good faith.
  • The second criterion for language choice forbids pages whose creation dates after this post. If, for a given language, X, a solution to a problem exists on Rosetta Code but it does not have a distinct page of its own somewhere, it is still acceptable.
\$\endgroup\$
8
  • 4
    \$\begingroup\$ you're talking to programmers, you don't have to say and/or ;) \$\endgroup\$ Commented Jun 11, 2015 at 11:10
  • 2
    \$\begingroup\$ The “must return no results” should be taken literally? For example there is a result for “mond”, but certainly not the same Mond as in the answer. Does it count as result? \$\endgroup\$
    – manatwork
    Commented Jun 11, 2015 at 12:19
  • 2
    \$\begingroup\$ You should probably state that the pages on Esolangs, Rosetta Code or Wikipedia must have existed before this challenge. \$\endgroup\$ Commented Jun 11, 2015 at 12:23
  • 1
    \$\begingroup\$ Could you clarify whether task 1 requires a 140 character program that outputs a description, or just a 140 character description (which is not a program)? \$\endgroup\$ Commented Jun 11, 2015 at 12:56
  • 1
    \$\begingroup\$ I've clarified the points raised here (at least I hope I have!) above \$\endgroup\$ Commented Jun 11, 2015 at 13:33

4 Answers 4

7
\$\begingroup\$

BlooP

Bonus: 10

There are pages for BlooP on Esolangs and Wikipedia. A PPCG search for BlooP returns no results. If you're feeling particularly loopy, you can try it out on repl.it.


Task 1: The Tweet

BlooP: Nothing but bounded loops. ;) #programming #goodtimes

This uses standard Twitter styling including hashtags and emoticons. This would appeal to any Twitter user.*


Task 2: The Hello World

DEFINE PROCEDURE ''GREETING'' [N]:
BLOCK 0: BEGIN
  PRINT['Hello World! This is written in BlooP.']
BLOCK 0: END.

GREETING[0];

As you can see, this is a prime golfing language.*


Task 3: The Odd Numbers

DEFINE PROCEDURE ''IS-ODD'' [N]:
BLOCK 0: BEGIN
  OUTPUT <= 0;
  CELL(0) <= 2;
  LOOP AT MOST N+1 TIMES:
  BLOCK 1: BEGIN
    IF N+1 = CELL(0), THEN:
    BLOCK 2: BEGIN
      OUTPUT <= 1;
      ABORT LOOP 1;
    BLOCK 2: END;
    CELL(0) <= CELL(0) + 2
  BLOCK 1: END;
BLOCK 0: END.

DEFINE PROCEDURE ''ODDS-IN-RANGE'' [A,B]:
BLOCK 0: BEGIN
  CELL(0) = A;
  LOOP AT MOST B TIMES:
  BLOCK 1: BEGIN
    IF CELL(0) > B, THEN:
    ABORT LOOP 1;
    IF IS-ODD[CELL(0)] = 1, THEN:
    PRINT[CELL(0)];
    CELL(0) <= CELL(0) + 1;
  BLOCK 1: END;
BLOCK 0: END.

ODDS-IN-RANGE[20,25];

The only available operators in BlooP are assignment (<=), addition, multiplication, greater than, less than, and equals. Because of its painfully verbose syntax, it's actually pretty easy to tell what's going on even without a deep understanding of the language.


Task 4: The Interesting

Note: My snippet for this task is subject to change should I come up with something more interesting.

DEFINE PROCEDURE ''MINUS'' [M,N]:
BLOCK 0: BEGIN
  IF M < N, THEN:
  QUIT BLOCK 0;
  LOOP AT MOST M + 1 TIMES:
  BLOCK 1: BEGIN
    IF OUTPUT + N = M, THEN:
    ABORT LOOP 1;
    OUTPUT <= OUTPUT + 1;
  BLOCK 1: END;
BLOCK 0: END.

DEFINE PROCEDURE ''FIB''[N]:
BLOCK 0: BEGIN
  IF N < 1, THEN:
  QUIT BLOCK 0;
  OUTPUT <= 1;
  IF N < 3, THEN:
  QUIT BLOCK 0;
  OUTPUT <= FIB[MINUS[N,1]] + FIB[MINUS[N,2]];
BLOCK 0: END.

FIB[10];

Behold, the Fibonacci numbers.


*May not be true

\$\endgroup\$
5
\$\begingroup\$

jq

None of the 14 results on codegolf.se is about the language. (jq (and uppercase variants) seems to be frequent statement in Pyth.)

There is jq category on Rosetta Code.

You can try it online but some of examples below need latest version 1.5.

Task 1: The Tweet

jq is like sed for JSON; you can use it to process structured data with the same ease that sed, awk, grep and friends let you play with text

(Shamelessly twittified the first paragraph from its site.)

Task 2: The Hello World

bash-4.3$ jq -n -r '"Hello World! This is written in jq."'
Hello World! This is written in jq.

Task 3: The Odd Numbers

bash-4.3$ jq -R 'split(" ") | range(.[0] | tonumber; .[1] | tonumber + 1) | select(. % 2 == 1)' <<< '20 25'
21
23
25

Task 4: The Interesting

The ~/.mozilla/firefox/*.default/extensions.json file containing information about the installed Firefox extensions has 0 newlines in 171 Kb on JSON data, which makes it somehow difficult to read.

Pretty print the JSON data:

bash-4.3$ jq '' ~/.mozilla/firefox/*.default/extensions.json

Doh. 8000++ lines are too long, so pass it to pager, but keep the highlighting:

bash-4.3$ jq -C '' ~/.mozilla/firefox/*.default/extensions.json | less -r

Ouch. How many extensions are there anyway?

bash-4.3$ jq '.addons | length' ~/.mozilla/firefox/*.default/extensions.json
58

Ok, but some of them are disabled. How many exactly?

bash-4.3$ jq '[.addons[] | select(.active | not)] | length' ~/.mozilla/firefox/*.default/extensions.json
7

Some of them are quite abandoned and not work with current Firefox anymore:

bash-4.3$ jq -r '.addons[] | [.defaultLocale.name, (.targetApplications[] | select(.id == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"))] | select(.[1].maxVersion | gsub("[^\\d.]"; "") | tonumber < 38.0) | .[0]' ~/.mozilla/firefox/*.default/extensions.json
Unity Desktop Integration
Unity Websites integration
Ubuntu Firefox Modifications

(This later is not true. For some reason extensions.json contains other version ranges than the extensions' install.rdf. But that is not jq's fault anyway.)

\$\endgroup\$
5
\$\begingroup\$

Mond*

  • * Searching for 'Mond' gives one result (this answer notwithstanding), but it's a false positive and doesn't actually mention the language.
  • Rosetta Code page. This was actually created after the challenge was posted, however a solution to the QuickSort task has existed since September 2014.
  • Although mond looks very similar to JavaScript (indeed, it's quite easy to write Mond/JS polyglots), it is not a subset, superset, or re-implementation. It is its own distinct language.

Try it in your browser

Full disclosure: I'm involved with the development and design process of Mond to a degree and have personally implemented several major language features including user-defined operators which are demonstrated in tasks 3 & 4.

Task #1

The pipeline operator (|>) is syntax sugar that transforms the function call on the right-hand side to a function call with the value on the left-hand side inserted as the first argument. foo |> bar() is the same as bar( foo ).

"Simple, elegant scripting language implemented in C# for .NET/Mono" |> printLn();

Task #2

"Hello World! This is written in Mond." |> printLn();

Task #3

The code for this task assumes several things:

  1. The range of numbers will be entered on a single line
  2. The upper and lower bounds will be separated by a single space
  3. The numbers given are integers in base-10 and contain only the chars 0-9

Try it here

// parse a string to a number
fun toNumber( str ) {
    var n = 0, pow = str.length();

    for( var i = 0; i < str.length(); ++i )
        n += ( str.charCodeAt( i ) - 48 ) * ( 10 ** --pow );

    return n;
}

fun map( arr, fn ) {
    var ret = [ ];

    foreach( var item in arr )
        fn( item ) |> ret.add();

    return ret;
}

// user-defined operator to create an upper-bound inclusive range a-la Ruby
// (i.e. 1 .. 5 produces [ 1, 2, 3, 4, 5 ])
seq( .. )( start, end ) {
    for( var i = start; i <= end; ++i )
        yield i;
}

// read a line from STDIN, trim leading and trailing whitespace,
// split the string to an array, map the array to parse all strings to numbers.
var nums = readLn().trim().split( " " ) |> map( toNumber );

// nums[0] .. nums[1] makes use of the user-defined operator declared on line 22.
// nums[0] is the lower bound, nums[0] is the upper bound.
foreach( var n in nums[0] .. nums[1] ) {
    if( n % 2 != 0 ) printLn( n );
}

Task #4

This task demonstrates user-defined operators, which allow the programmer to define any arbitrary operator (so long as it doesn't already exist) just like a function, and use it as they would any other operator. They come in unary and binary flavours.

Try it here.

// forward function compositing user-defined operator.
// the function on the right-hand side is called with
// the result of the function on the left-hand side.
fun( >>> )( fn1, fn2 ) {
    return fun( ...args ) {
        return fn1( ...args ) |> fn2();
    };
}

// the mythical "goes down to" operator of legend.
// a lazy sequence that returns all numbers starting from 'hi'
// down to (and including) 'lo'
seq( --> )( hi, lo ) {
    for( var i = hi; i >= lo; --i )
        yield i;
}

seq map( iterable, callback ) {
    foreach( var item in iterable )
        yield item |> callback();
}

// doubles the value of n
fun double( n ) -> n *  2;

// squares the value of n (** is the power operator, a-la Python or Ruby)
fun square( n ) -> n ** 2;

// gets the sequence for 10 down to 0, passes it into
// map, which maps it through the composited function of
// double and square, which first doubles the given value
// then squares it.
var nums = ( 10 --> 0 ) |> map( double >>> square );

foreach( var n in nums )
    printLn( n );
\$\endgroup\$
4
  • 4
    \$\begingroup\$ It's only listed on Rosetta Code, how does it get a 25-pt bonus? \$\endgroup\$
    – Scimonster
    Commented Jun 11, 2015 at 14:16
  • \$\begingroup\$ @Scimonster My interpretation of the scoring bonuses is that the language needs to have 0 search results, be listed on one of: Rosetta Code, Esolang, or Wikipedia, and be a distinct language to qualify for the 25 points. If I'm wrong and the only criteria is that it must have pages on Rosetta Code, Esolang, and Wikipedia, I'll edit accordingly. \$\endgroup\$
    – Tony Ellis
    Commented Jun 11, 2015 at 21:09
  • \$\begingroup\$ No, the 3 things you listed are criteria for being allowed in the challenge at all. It qualifies for the 10 point bonus if, say, Wikipedia and Rosetta Code both list it. The 25 point bonus is if it's on Rosetta, Esolang, and Wikipedia. \$\endgroup\$
    – Scimonster
    Commented Jun 11, 2015 at 21:16
  • \$\begingroup\$ @Scimonster I see, my mistake. I've updated my answer. \$\endgroup\$
    – Tony Ellis
    Commented Jun 11, 2015 at 21:25
4
\$\begingroup\$

ooc

Yeah, I'm about a month late. So what???

Task 1

ooc is a programming language that compiles down to C99 that has an elegant syntax, and supports both high- and low-level development.

135 bytes! That was close!

Also, fake bonus points for ooc's insanely cool ASCII-art logo:

           +(NNhBBhss+'                  ~+'(sNBND=~.         
           -(=NDhNN+=+=' .   .  .    . .+='+~DNND+=.          
           .+-DBDDh+(D-<'      .....  -<+ (=~DNh+<(           
            '+<NNNB=~=z-(<-<<(+('-'~<<=- .+'sBNh~+            
             (~=NNND+=DB~(-.    . .    ...(=BNB+s--      ALL YOUR 
             .=-=DBDz-'~. .   ..'. .... '  '~s<<szh<.         
               <(~'. .  .  ..sD='-~'-'-DDs.. . .~sD(     CODEBASE  
            . ~+'  '  .-(-..sBNB~(~~+=hNNNz'<<z='-z(               
           . .=. -DDz<~s~  'BNNN=~+<shNNNND(sNNNh~(+    ARE BELONG
            .=<.(NNNNDDs. (hhs+=s=hNDNNBNBBs<BNND<<=.             
            .'-'~sNNs((- .''. ' -~NNDz+((~---~sB<'''.     TO US!
                '=(++(-..  . ...-~+B~'....'.''-+(     .             
                -=z<<'.. .'-...'-~hz~-'.''''-~-<=                     
                 .~+~s~  ~z<~'-'--hN=~((~'---(~~z~                    
                   (+<-.'+=''''~(+=Bz--~(((=+s+~(s                     
  IT'S OVER      . '+-..~<----~-+(sBNh+zBNNBNh+<z'                     
                   .<-'--''(<~=B=hDDD=<<<++=++<=.                   
  9000 BUGS!     .. s~..'h=++ss=D<<~+B(<(+<=Nz=+                     
                    +'.''+NNDN(+z(((sB<((s+hNh<+             
                   .= -~(~(zDNz+z+zhNDz=szhhBz++.       MADNESS?        
                   '+. ss<'~=NBNBBDzBzhshDD=+<<-                   
                   -= . +s~-(+==hhDBNBDDs==hz+<     THIS! IS! LLAMA!
                 '(<-  . '~~(<+<=+<sz=+sshzs(..               
                .+<.    '('-~(((((<++(<<((= .                 
                 .--.. ....'.'.'.'..''..'-..

Task 2

"Hello, world!" println()

Task 3

import text/StringTokenizer
import structs/ArrayList
input := stdin readLine() split(' ', false)
(begin, end) := (input[0] toInt(), input[1] toInt())
for (i in begin..end+1) {
    if (i % 2 != 0) { "%d " printf(i) }
}
println()

Pretty straightforward implementation. Also, this showcases an interesting aspect of ooc: method calls use spaces as delimiters, not dots. For instance, notice stdin readLine() split(' ', false) above. In most languages, that would be written as stdin.readLine().split(' ', false), but ooc reserves that for call chaining (scroll down to the code example).

Task 3

This showcases my favorite ooc feature: type matching. It's like pattern matching. In an OO language. Awesome.

import structs/ArrayList
import math/Random

Animal: abstract class {
    makeNoise: abstract func
}

Sheep: class extends Animal {
    init: func
    makeNoise: func {
        "Baaaaaaa!" println()
    }
}

Wolf: class extends Animal {
    init: func
    makeNoise: func {
        "Hooooowl!" println()
    }
}

animals := [Sheep new(), Sheep new(), Sheep new()] as ArrayList<Animal>
badNumber := Random randRange(0, 3)
animals[badNumber] = Wolf new()
animal: Animal

"Enter a number between 0 (inclusive) and 3 (exclusive)" println()
inputNumberString := stdin readLine()
for (chr in inputNumberString) {
    if (!(chr.digit?())) {
        "NUMBER, not CHARACTER! Can't you read!?" println()
        exit(1)
    }
}
inputNumber := inputNumberString toInt()
try {
    animal = animals[inputNumber]
} catch (e: OutOfBoundsException) {
    "I said a number between one and three, you idiot!" println()
    exit(1)
}
"Animal noise:" println()
animal makeNoise()
match (animal) {
    case sheep: Sheep => { "It's a stupid, annoying sheep!" println() }
    case wolf: Wolf => { "AHH! A WOLF! You got eaten. :/ R.I.P." println() }
}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.