Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results for golfscript Search options user 194
8
votes
Access to the whole stack GolfScript is a stack-based language, but access to all but the top three items on the stack is limited to <integer>$ to copy the nth item. It would be useful to have …
answered Dec 31 '13 by Peter Taylor
7
votes
55 chars {~.0<"-"*\abs 10.?..3$@%+`-1%~`)[3-]1$,!!*+-1%@@/\++}:F Negative numbers are a bit of a pain - responsible for about 13 chars of the 55. Trailing 0s are handled by using a 1 to stand for t …
answered Apr 6 '11 by Peter Taylor
11
votes
Shorter built-ins Single-character aliases for all of the built-in commands which don't have them. I would use base a lot more if it were just B.
answered Dec 31 '13 by Peter Taylor
6
votes
Change the lexer GolfScript's lexer treats a Ruby identifier (anything which matches the regex [_a-zA-Z][_a-zA-Z0-9]*) as a single token. If it instead treated [a-zA-Z]+ as a token that would free up …
answered Dec 31 '13 by Peter Taylor
8
votes
To address a specific subquestion: How to best convert a string into an array of ASCII codes and back? Which operations do this as a side effect? What's the best way to dump the characters in a st …
answered Sep 20 '12 by Peter Taylor
6
votes
Wrapping the top item of the stack into an array Is there a nice way to transform ... x into ... [x]? For full generality, the best option appears to be 4 chars. However, in certain special case …
answered Oct 20 '12 by Peter Taylor
4
votes
Limited transliteration To address a specific subquestion: given a string, what's the best way to perform a tr? E.g. tr/ABC/abc/ If all of the characters in the string will be affected, this is quit …
answered Jun 8 '12 by Peter Taylor
9
votes
Combined div-mod This is a bit more niche than some of the suggestions, but when working on number-theoretic programs I frequently find myself wanting an operation which pops two integers a and b fro …
answered Dec 31 '13 by Peter Taylor
6
votes
If your program mysteriously breaks, check your variables I just spent a while debugging an apparently correct program which used ! as a variable (on the grounds that I wasn't going to use it again). …
answered Jul 8 '12 by Peter Taylor
3
votes
Regex support The lack of regex support has always struck me as odd in a language designed for golfing. It would be great to have <string> <string> <string> y (aka tr, using Perl's one-char alias f …
answered Dec 31 '13 by Peter Taylor
5
votes
GolfScript (23 chars) ~.{2*2/~}%{$}%.&,@@+,-) Assumes input format using GolfScript array notation and quoted (or integral) coordinates. E.g. $ golfscript codegolf11738.gs <<<END [["0" "0"] ["1 … 7 11] [6 7 11] [3 4 10]] END 2 (Online equivalent) or $ golfscript codegolf11738.gs <<<END [[0 0] [1 0] [0 1] [1 2]] [[0 1 2] [1 2 3]] END 0 (Online equivalent) …
answered May 21 '13 by Peter Taylor
8
votes
CJam (56 55 53 chars) / GolfScript (64 chars) CJam: "P1"q~,>{_1&3*+_*24+48/}%_:e>2b,\2_$#f+2fbz(,@@:~~]N* GolfScript: "P1"\~,>{.1&3*+.*24+48/}%.$-1=2base,\{2.$?+2base}%zip(,@@{~}/]n* Both … produce output in NetPBM format, and they're essentially ports of each other. Dissection CJam GolfScript Explanation "P1" "P1"\ NetPBM header q …
answered Apr 23 '15 by Peter Taylor
5
votes
GolfScript (31 25 24 chars) ])~{{~3%}%.{)3%}%2,@++}* With thanks to Ilmari Karonen for pointing out that my original trs/permutations could be shortened by 6 chars. By decomposing them as a … . This outputs the peg moved from (numbered 0, 1, 2) and the peg moved to. The spec doesn't say to which peg to move, so it moves to peg 1. E.g. $ golfscript hanoi.gs <<<"3" 01021201202101 …
answered May 11 '12 by Peter Taylor
2
votes
GolfScript (24 chars) ~](;3/{$}%:^1/{^\/,2=},, Online demo This relies on the triangle sides being GolfScript literals of the same type (and hence sortable): it would work equally well with strings. …
answered Feb 3 '14 by Peter Taylor
1
vote
GolfScript (15 chars) Pick any one of {):x,{.*x<},,(} {:x,{).*x>!},,} {.,\{1$)/<}+,,} {,.,{1$)/<}+,,} I've followed the other GolfScript answers in interpreting "You can name your function … anything you like" as meaning "You may leave a block which does the job on the stack". These are currently the shortest GolfScript answers which correctly handle inputs 0 and 1. Online demo …
answered Sep 3 '14 by Peter Taylor

15 30 50 per page