Tell me more ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

This is not exactly a programming challenge, but a programming-related word challenge. If this is not fit for the site then feel free to close.


As the title said, the challenge is to write the longest sentence by only using the keywords of 1 programming language.

For instance, using the keywords of C++, it is possible to write this sentence:

do not try this float

What can you come up with?

share|improve this question
7  
Shakespeare should be good for this en.wikipedia.org/wiki/… – gnibbler Jan 9 at 4:26
Are repetitions allowed? – elssar Jan 9 at 7:07
3  
@elssar Yes, so long as you don't abuse them along the lines of en.wikipedia.org/wiki/…. – Pubby Jan 9 at 7:10
Is the score the total number of words, or just unique words? – Sir_Lagsalot Jan 9 at 22:13
@Sir_Lagsalot Total number. – Pubby Jan 9 at 23:27
show 2 more comments

9 Answers

up vote 18 down vote accepted

Mathematica 100 words (or slightly fewer, if repeats are not counted)

Here's a start. All standard words in Mathematica begin with upper case. this includes I, the square root of negative 1.

On Sunday, And For All Times-- Assuming, On Opening Clear Dynamic Interactive Notebooks For Setting Contours, I Do Not Translate Missing Blue Arrays Which Span Temporary, Asynchronous, And Invisible Characters, Nor Do I Remove Undefined Arrowheads With Editable And Sound Outer Orange Roots Which Magnify Shallow Names Together With False Attributes (Because Most Axes Split Full Inner Kernels In Reverse Order)-- And While I Animate Undefined Quiet Ticks, I Begin With Tolerance And Operate On All Manual Matrices, Interleaving Circle With Cylinder, Boxed Skeleton With Compiled Cuboid, Red Cross With Nearest Timing Pattern, And Join Repeated Unique White Links With Heads ...


In case anyone is interested, here are 500+ words recognized by Mathematica (no additional libraries required). (Just ignore the backslashes.) They are not all keywords, but experienced Mathematica programers will know and have used just about all of them.


{Abort, Above, Abs, Accumulate, Accuracy, AddTo, After, Alignment, \ All, Alternatives, Analytic, And, Animate, Animator, Annotation, \ Annuity, Antialiasing, Antisymmetric, Apart, Appearance, Append, \ Apply, Array, Arrays, Arrow, Arrowheads, Assert, Assuming, \ Assumptions, Asynchronous, Attributes, Automatic, Axes, Axis, Back, \ Background, Backslash, Backward, Band, Baseline, Because, Beep, \ Before, Begin, Below, Binarize, Binomial, Blank, Blend, Block, Blur, \ Bookmarks, Booleans, Bottom, Bounds, Boxed, Bra, Break, Button, Byte, \ Cancel, Cap, Cases, Cashflow, Catch, Ceiling, Cell, Cells, Censoring, \ Center, Character, Characters, Check, Checkbox, Chop, Circle, Clear, \ Clip, Clock, Close, Closed, Closing, Coarse, Coefficient, Collect, \ Colon, Colorize, Column, Commonest, Compile, Compiled, Complement, \ Complex, Compose, Composition, Compress, Condition, Cone, Congruent, \ Conjunction, Connect, Constant, Constants, Context, Contexts, \ Continue, Contours, Control, Convergents, Convolve, Copyable, \ Correlation, Cot, Count, Covariance, Cross, Cumulant, Cup, Curl, \ Cycles, Cylinder, Darker, Date, Debug, Decrement, Default, Defer, \ [Degree], Deinitialization, Deletable, Delimiter, Delimiters, \ Denominator, Deploy, Deployed, Depth, Derivative, Diagonal, Dialog, \ Diamond, Differences, Dilation, Dimensions, Direction, Directive, \ Disjunction, Disk, Dispatch, Display, Distribute, Distributed, \ Dithering, Divide, Dividers, Divisible, Divisors, Do, Dot, Down, \ Drop, Dynamic, Editable, Eigenvalues, Element, Eliminate, Empty, \ Enabled, Encode, End, Enter, Epilog, Equal, Equivalent, Evaluator, \ Except, Exists, Exit, Expand, Expectation, Exponent, Export, \ Expression, Extract, Factor, Factorial, Fail, False, File, Filling, \ Find, First, Fit, Flat, Flatten, Floor, Fold, Font, For, Forward, \ Frame, Front, Full, Function, Gather, General, Generic, Get, Graph, \ Graphics, Greater, Grid, Hash, Head, Heads, Histogram, Hold, Hue, \ Hyperlink, Hyphenation, I, Identity, If, Image, Implies, In, \ Increment, Inherited, Inner, Input, Insert, Inset, Install, Integer, \ Integers, Integral, Integrate, Interactive, Interleaving, Interval, \ Invisible, Item, Join, Joined, Kernels, Label, Labeled, Large, \ Larger, Last, Latitude, Launch, Left, Legended, Length, Less, Level, \ Lighting, Limit, Line, Links, List, Listable, Listen, Literal, \ Locked, Log, Longest, Longitude, Magnification, Magnify, Majority, \ Manipulate, Manual, Map, Masking, Material, Matrices, Maximize, Mean, \ Median, Medium, Menu, Mesh, Message, Messages, Method, Minimize, \ Minors, Missing, Modal, Mode, Modular, Module, Modulus, Moment, \ Monday, Monitor, Most, Mouseover, Multinomial, Multiplicity, \ Multiselection, Names, Nearest, Needs, Negative, Nest, Next, None, \ Nor, Norm, Normal, Normalize, Not, Notebook, Notebooks, Null, Number, \ Numerator, Off, Offset, On, Opacity, Open, Opening, Operate, \ Optional, Options, Or, Order, Ordering, Orderless, Orthogonalize, \ Out, Outer, Over, Overflow, Paclet, Pane, Panel, Paneled, \ Parallelize, Parameter, Parenthesize, Part, Partition, Paste, Path, \ Pattern, Pause, Permutations, Permute, Perpendicular, [Pi], \ Piecewise, Pivoting, Placed, Placeholder, Plain, Play, Plot, Plus, \ Point, Polygon, Polynomials, Position, Positive, Power, Precedence, \ Precedes, Precision, Prefix, Prepend, Previous, Print, Probability, \ Projection, Prolog, Properties, Property, Proportion, Protect, \ Protected, Pruning, Put, Pyramid, Quantile, Quantity, Quartics, \ Quartiles, Queueing, Quiet, Quit, Quotient, Radon, Random, Range, \ Raster, Rasterize, Rational, Rationals, Read, Real, Reap, Record, \ Rectangle, Reduce, Refine, Refresh, Reinstall, Release, Remove, \ Removed, Repeated, Replace, Resampling, Rescale, Residue, Resolve, \ Rest, Return, Reverse, Riffle, Right, Root, Roots, Rotate, Round, \ Row, Rule, Saturday, Save, Saveable, Scale, Scaled, Scan, Scrollbars, \ Select, Selection, Sequence, Series, Set, Setbacks, Setter, Setting, \ Shading, Shallow, Share, Sharpen, Short, Show, Sidebar, Sign, \ Signature, Simplify, Skeleton, Skip, Slot, Smaller, Socket, Solve, \ Sound, Sow, Spacer, Spacings, Span, Speak, Sphere, Splice, Split, \ Square, Stack, Star, Streams, String, Stub, Subfactorial, Subgraph, \ Subscripted, Subset, Subtract, Sum, Superset, Surd, Syntax, Table, \ Take, Tally, Temporary, Text, Texture, Therefore, Thread, Threshold, \ Through, Ticks, Times, Timing, Together, Toggle, Toggler, Tolerance, \ Tooltip, Top, Total, Trace, Tracers, Translate, Transpose, True, \ Tube, Tuples, Undefined, Underlined, Underscript, Unequal, Uninstall, \ Union, Unique, Unitize, Unset, Up, Variables, Vertical, Wedge, \ Weights, Which, While, Whitespace, With, Word, Write}

share|improve this answer
7  
Suddenly, I think Mathematica has too many keywords. – GigaWatt Jan 9 at 17:00
You may have a point. In Mathematica, everything is an expression and all symbols, such as the times-sign, are names when expressed in full, i.e.. long form, e.g. Times. I found 332 common English words in Mathematica. This does not include compound words such as AppendTo nor names of functions, of which there are literally thousands (but they are not really English words). – David Carraher Jan 9 at 17:54
332 was the count a few hours ago. I checked, and there are well over 500 English words acceptable for using in Mathematica programs. – David Carraher Jan 9 at 23:22
@dude Many Option and Color names aren't in your list ... you could add up another 300, I guess :) – belisarius Jan 12 at 14:52
1  
Aren't most of these identifiers, not keywords? – Geoff Reedy Jan 14 at 17:38
show 2 more comments

C++, 25 unique words, 28 total

True friend, do goto register for this new short public class for private auto operator (while inline, return this signed template), else break & void this long volatile union.

share|improve this answer
good answer! It was extremely amusing! – Pranit Bauva Jan 12 at 8:26

While making sentences is not really my strong suite, here goes nothing -

Python 20 words

Finally, continue with import and raise global yield while class lambda is in break and try and print exec pass.

To help with checking, I wrote some code to check whether the words are in the keyword list or not.

from keyword import kwlist
from re import findall

def kwcheck(sentence):
    """Check whether all the words of a sentence are Python keywords"""
    words= findall(r'\w+', sentence)
    for word in words:
        if word.lower() not in kwlist:
            return False
    return True, len(words)

if __name__ == '__main__':
    sen= raw_input("Enter your sentence: ")
    print kwcheck(sen)
share|improve this answer
1  
+1 for the checking code! – Sanjay Manohar Jan 9 at 23:42

c#, 17 words

This looks like pretty reasonable technical mumbo-jumbo.
I guess it can be extended a bit.
foreach is a bit stretching the rules.
Used this keyword list.

Try explicit operator, in case implicit string foreach virtual struct is as unsafe as this volatile lock.

share|improve this answer

Ruby, 41 words

True self, do not begin class break, end class break, ensure class break, redo and redo class break, retry class break, rescue class break, or yield class break, until next class end (or next class module or next class return), or else!

That's just using words listed as actual keywords. There are a lot of other words that act like keywords because they're methods of the kernel or instance methods of Class.

A cheesier approach would start

Do not def "alias","begin","break",...

share|improve this answer

Factor - 109

"Take my-world and with happy? make items to-do. Pause. Self not happy?"

"Yes<<."

"From oldies?"

"Yes>>. Self sad."

"Haversin, listen, each and every formula become oldies. Become not sad, do-something greater-from-last. Or . My-arch self is_gold<<. Change-is_gold. Go-back where your_event_mask<< make happy? future. Fulfill promise of self. Remember-definition, light are-copies-of happy?"

"Sweetest-day near>> me?. Handle-me, handle-me. Sad self. Home not near>>. Home not near>> at all. Out-of-memory. Sad self, old<< self. Most near>> ones left self long ago."

"Haversin, change-known self. No sad, Haversin. Become happy? Forget what<< keep self from happy? My-arch self want>> self be> not sad. Before leave, remember-error."

"Not remember-error! Error not! My-array has-entry? not of error! Leave error!"

"Smart-if remember-error."

A lot of these are stretches, but it somewhat tells a story, so it makes up for that.

share|improve this answer

Common Lisp

:In :Common :Lisp :a :keyword :is :simply :a :symbol :which :has :the :KEYWORD :home :package :which :is :true :of :all :symbols :starting :with :a :colon :so :you :can :construct :arbitrarily :long :sentences. :Do :I :win?

This, for example:

(every #'keywordp '(:In :Common :Lisp :a :keyword :is :simply :a :symbol :which :has :the :KEYWORD :home :package :which :is :true :of :all :symbols :starting :with :a :colon :so :you :can :construct :arbitrarily :long :sentences. :Do :I :win?))

Evaluates to T

See http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_k.htm

share|improve this answer

The Importance of Education

-- by A. Coder Guy (written in Python)

Continue class, except if class is not for you.  
With no class, raise and assert!  Or yield, pass,
and break.  Try and continue!  Or - finally - return from class.
share|improve this answer

ECMA

A bit of broken English due to the fact that ECMA reserved words contain neither conjunctions nor more than one conjugation of verb. It's really an imperative language!

Do try this new typeof case, with this default catch function.

In this case, break in with this switch. If catch break, return with this new switch; finally throw in with this new function.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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