Skip to main content
4 votes
Accepted

Dump stack to array

An unmatched ] command will make the entire stack into an array. 1 2 3 4 ] -> [1 2 3 4]
Esolanging Fruit's user avatar
2 votes

lastIndexOf in CJam

Splitting is sometimes a good way to do this. E.g. e# Stack: ... haystack needle a/);S*, With variants, such as removing the a...
Peter Taylor's user avatar
  • 43.1k
2 votes

Tips for golfing in CJam

Understand How Array Literals Work The [ and ] characters in CJam are not part of any special syntax; they are operators. What ...
Esolanging Fruit's user avatar
2 votes

Tips for golfing in CJam

Modify an element instead of deleting it If you need the sum of a list except for the last element, increased by T, instead of: W<:+T+ You can use: ...
jimmy23013's user avatar
1 vote

Tips for golfing in CJam

Index into an array, use a default value or run code if not in range This could be done using a single character: j. For example, this code would output ...
jimmy23013's user avatar
1 vote

Tips for golfing in CJam

Check if array contains sub-array Note: If you're only looking for a single element use jimmy's method. If you want to see if an array contains a specific sub-array, use ...
geokavel's user avatar
  • 6,676

Only top scored, non community-wiki answers of a minimum length are eligible