Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Activity for Zakk‭

Type On... Excerpt Status Date
Comment Post #284049 From [this](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf): > — removed the `gets` function (`<stdio.h>`)
(more)
almost 2 years ago
Comment Post #286394 > Write a **full** program Does that mean using only the code section of some try-it-online tool? > writes another program Does that mean generting an executable/script file? Or only printing the program is enough? > The length of each program must tend toward infinity as the sequence con...
(more)
almost 2 years ago
Comment Post #284611 You can shorten your code by comparing `x*y` against `4`: ``` java x->y->x*y==4?5:x+y ``` There are 3 possibilities: $$x=2,y=2 \Longrightarrow x \times y = 5 \text{ as of the rules}$$ $$x=1,y=4 \Longrightarrow x + y = 5 \text{ still a valid result}$$ $$x=4,y=1 \Longrightarrow x + y = 5 ...
(more)
about 2 years ago
Comment Post #286370 Thank you for your suggestions! The use of an array was a nice trick.
(more)
about 2 years ago
Comment Post #286359 > If Lua has such a thing, you can use it without reservation. I guess yes. If you call this a first-class function: ``` f = function(m,n)for i=0,m*n-1 do _=(i%n==0)and print()or io.write(i,' ')end end ``` So I will use it from now onwards. > I'll add this in a Meta post later, but the...
(more)
about 2 years ago
Comment Post #286360 Okay, I will change that.
(more)
about 2 years ago
Comment Post #286359 I've put the function definition in the header section. I don't know if this is allowed or not. I see a lot of people doing that, putting only the relevent part/expression in the code section. Here is the full function, 78 bytes: ``` lua function f(m,n)for i=0,m*n-1 do _=(i%n==0)and print()or ...
(more)
about 2 years ago
Comment Post #286311 Though both of `s:gsub` and `for..in` versions are equal in length, the former can be one byte shorter, because sticking an `s` to `0` doesn't make the Lua interpreter unhappy, contrary to sticking an `f` to `0`. ``` _=0s:gsub('.',function(c)_=({d=_-1,i=_+1;s=_*_})[c]or print(_)or _ _=({[256]=0,[...
(more)
about 2 years ago
Comment Post #286311 > ```_=(_==256or _<0)and 0or _``` You are right. > Tables to the rescue ^^ Man! That's just brilliant! Again, thanks for pointing this out. Btw, I am really curious about how much experience you have with Lua.
(more)
about 2 years ago
Comment Post #286301 Clever solution! Thanks!
(more)
about 2 years ago
Comment Post #286301 > If your function never runs, then clearly it won't have a runtime error :) @#53196 So calling `f()` is not necessary... If so, I will remove it.
(more)
about 2 years ago
Comment Post #286301 @#56271 You are right! It can be shortened (and it prints `nil nil`). Strange how I missed this one out. Anyways, thanks (once more) for pointing this out!
(more)
about 2 years ago
Comment Post #286301 > You can shorten your for-loop No, I can't. Shortening it the way you did results in omitting the `in` keyword. This obviously goes against the rule of including **all** language keywords. > and save a few spaces on the numerical constants Yes, that's true. I will edit my answer. Thanks (ag...
(more)
about 2 years ago
Comment Post #286300 Thanks! I will edit the code.
(more)
about 2 years ago