00:00 - 20:0020:00 - 00:00

12:33 AM

Hey @Downgoat @ASCII-only you might find this useful: github.com/JuliaLang/openlibm

Anonymous
@quartata Last commit was by Alex :P

yes how do you think I found it

Anonymous
A normal interest in Julia, not founded in stalking a friend? :P

@Mego But that's bash calling Perl

12:39 AM
@Mego he follows me on GH, I follow him on GH. he starred it. perfectly normal.
not at all creepy
no
now if I say
covered my room in pictures of his dog
which I definitely have not done
then maybe that would be crossing a line

It's a string literal in bash, but just code in Perl

Anonymous
@Pavel Oh, in that case, the Perl code does nothing, and $? evaluates to the exit code of the last command (the Perl invocation). @Mego I realize it does nothing, but why does it parse properly Anonymous Why wouldn't it? That has to be a syntax or name error, no? Anonymous 12:41 AM Oh, because of the quotes Anonymous Beats me Probably name error No sigil, so the bit left of < would be a function. So we're calling a nonexistent function and checking if it's less than 7 @Pavel Perl has barewords, not name errors. 12:47 AM Sticking parentheses around something already in parentheses should not error ._. @Pavel just needs a little help: print (foo + 3 eq 0); this is why you don't use perl without use strict; I'm also confused as to why just print Foo; doesn't work. It should treat the bareword as a string and write Foo, no? @Pavel :P 1:04 AM @ASCII-only holy shit I really need to learn Perl this community is awesome It even works with strings of different lengths @DJMcMayhem :P @ASCII-only Could that be changed to iterate through from a different set of characters? @ASCII-only :O @DJMcMayhem not really, see perl's spec (wherever it is) 1:06 AM @ASCII-only this is why perl has an esolangs page it's not that strange @DJMcMayhem protip: learn by trying to match Ton Hospel's bytecount here. it works really well C:\Users\conorob λ irb irb(main):001:0> a = "foo" => "foo" irb(main):002:0> a.next => "fop" irb(main):003:0> a = "999" => "999" irb(main):004:0> a.next => "1000" @DJMcMayhem useful @DJMcMayhem since it contains a number but perl can't turn it into a number perl just makes it 0 instead 1:20 AM @DJMcMayhem ++ coerces the string to an int. If it can't, it assumes 0. Perl just has a weird type system. You can't tell if "1" is an int, float, or string without Data::Dumper, essentially a debugging tool. 1:47 AM @ASCII-only thank you for sharing this site, I haven't had this much fun golfing regular languages in a while! 2:06 AM does anyone know a short way to reverse the digits a number in Ruby? I have "#$.".reverse.to_i

2:20 AM
:( Ruby doesn't have Python slices)

nupe

That's horribly ungolfy

3:05 AM
0

Using your language of choice, write a function that takes a variable number of arguments and returns the number of arguments it was called with. Your language needs to support variadic argument functions; passing an array does not count. The arguments can be of any type; you do not need to suppo...

CMC: given a nonempty list L of nonempty lists of integers, return a list of integers M such that L and M have the same length, and that M[i] in L[i] for all i.

@LeakyNun so, we can return the first from each?

@ngn sure

@LeakyNun APL, 2 bytes: ⊃¨

@NewMainPosts BrainFlak, 6 bytes: ([]<>)

3:14 AM
@DJMcMayhem not a function
plus it's a builtin

That's why I posted it in chat instead of on the challenge
@DestructibleLemon No?

[] is a builtin

The challenge doesn't even say built-ins aren't allowed. And even if it did, [] != Number of arguments
It's stack height, which implicitly happens to equal argcount (at the start of the program)

-1 trivial solution

Trivial challenges call for trivial answers

3:18 AM
@DestructibleLemon still not a builtin... and it's not like there's a longer way to do that...
@NewMainPosts JavaScript (ES6), 16 bytes: (...a)=>a.length

@DestructibleLemon are you joking? just wondering

@ConorO'Brien yes but it clearly wasn't very good

@ASCII-only if no args are 0, then you could do {{}(<>{}())<>}<>

Python 2, 16 bytes, almost certainly also there too: lambda*a:len(a)

0

A certain well-known cable company has a somewhat clumsy 'Search for Program' feature that works through the remote. It takes muchly much button pushing; so, being an admirer of economy of motion, I thought I'd seek out a programmer's help to minimize the number of finger movements I have to make...

3:21 AM
Also, Python 2 :) — Chas Brown 11 mins ago

@DestructibleLemon Oh, I thought you were serious
woosh
Wait, I wonder if that challenge can be answered in lambda flak...

ok something that might actually be interesting: dodos answer to number of args?

@NewMainPosts perl, 7 bytes‌​: {$_=@_} yeah that should work @DestructibleLemon how would bf/dodos have args? dodos is a functional language considering that you've mentioned bf, i suspect you're thinking of sesos, rather than dodos 3:28 AM ...oh, haha yeah i think that might be the least trivial language to answer in dennis sure likes to name his languages with similar letters i was thinking that earlier @NewMainPosts dodos, 39 bytes? 1 hour later… 5:10 AM @Pavel C != C++. Yes That's the point @Cowsquack ( @user56656 ) If crypto is involved it would be near impossible to prove TC anyway. Huh. printf("%s") always prints exactly 6 bytes of garbage: tio.run/##S9ZNT07@/… 5:26 AM @Pavel aka the stack? Yeah, it's just whatever's on the stack, but I wonder why there's always a Null after 6 bytes By "always" do you mean once or twice? 5:49 AM @feersum no @ConorO'Brien wouldn't be surprised if Dennis sees that and names Jelly V2 Jell-Os 2 @Pavel return address of __libc_start_main or something like that maybe? IDK, you might want to check with godbolt or something 6:12 AM Also: yay cauliflower answer 6:25 AM 5 Assembly (gcc, x64, Linux), 1 byte .globl f f: ret # c3 Try it online! The function has to be called with floats as arguments. This works because, in the x86_64 ABI, the eax register holds the number of vector arguments for varadic function. 1 byte... 6:48 AM @Pavel UB, what do you expect... So... stdin 0 returns stdin content in J. Takes an unused argument because there are no niladic function. 0 I made this simple program to convert infix expression to a postfix one.But I am unable to get the desired results.Please check this program once.I have done that numerous times but failed to find the fault. 7:55 AM 0 A Magic Ritual code-golf string Given an input string N perform a sequence of steps. Delete all spaces from the string. Delete all second occurrences of the same letter from the string. If the string contains the letters needed for zero, delete these letters and add the corresponding digit 0 ... @user202729 Hm, not really so: They could have made s. stdin without taking arguments just like a., a:, and _. return values without taking arguments. @user202729 doesn't stdin 0 behave differently than stdin '' s/$/?/

@Cowsquack Not directly, but if you apply the inverse the it makes a difference.

8:48 AM
1

This is an answer-chaining challenge in which each answer builds on the previous answer. Taking no input, you are to output the most recent submission to this thread. I would HIGHLY suggest sorting by oldest and skipping to the last page to find the most recent answer. Scoring This is not code...

0

Input: An 2D array A containing two distinct (optional) values. I'll use 0 and 1 when explaining the rules. The input format is of course flexible. Challenge: Zeros are water, and ones are islands. In order to ensure loneliness, your task is to surround all islands with water by inserting ro...

2 hours later…
10:59 AM
@NewMainPosts Sounds like 2SAT but much harder.

11:12 AM
Vertex cover?

0

Premise So recently I was about half an hour early to an appointment, and decided to wait outside. I also determined that it would look strange if I just stood motionlessly in front of the house. Therefore, I decided to go on a quick walk, within a limited area. I also concluded that if I starte...

12:10 PM
CMC: Given a factorial (i.e a number which is n! for some natural number n), output n. Examples: 120 => 5; 2432902008176640000 => 20

@cairdcoinheringaahing APL (Dyalog Unicode), 4 bytes !⍣¯1 (factorial applied -1 times)

@cairdcoinheringaahing Jelly, 3 bytes R!i

@cairdcoinheringaahing What does the R do?

Range
So much for markdown :/

@cairdcoinheringaahing Why do you need range? Isn't !i (factorial inverse) enough?

12:19 PM
@Adám i is index, not inverse
R builds the range from 1 ... n!, ! takes the factorial of each, then i finds the index of n! in that range

@cairdcoinheringaahing Ah, right, Jelly doesn't have inverse, even though J does. If there was a single-char inverse in APL or J it would be just two bytes.
@cairdcoinheringaahing Whoa, that's going to be a bit slow for 2432902008176640000.

Yeah, it finishes on 7!, but not on 10!. It works theoretically though :P

@cairdcoinheringaahing 4E19 digits. How about requiring that it can calculate for 2432902008176640000 in less than a min?

Nah, it's a code golf :P We don't care about efficiency :P
I might try to make a faster one though

@cairdcoinheringaahing Just divide by 2,3,4,…m until n=m.

12:31 PM
@Adám Faster version at 10 bytes
Never mind, that doesn't work

I don't think inversion is useful in Jelly because -- just make another built-in.

@cairdcoinheringaahing Fast tail-recursive APL version without using the built-in: 2∘{⍺=⍵:⍵⋄(⍺+1)∇⍵÷⍺}

There are plenty of spaces anyway (say, about 1000)

@user202729 APL's inversion can invert composite functions.

@cairdcoinheringaahing Python, 34 bytes: f=lambda n,i=1:n-1and-~f(n//i,i+1)

12:38 PM
@Adám Anyway... do you have a case where inversion would take less bytes?

@user202729 Sure, here is an example from actual work I did:

@cairdcoinheringaahing Python, 33 bytes: f=lambda n,i=2:n and-~f(n//i,i+1)

@Dennis Why is 0Æl -> None?

@user202729 What should it be? ln(0) is undefined

But then None causes some unnecessary error...
Even -÷0 is -inf.
(and is nan)

12:50 PM
CMC: Given a list of lists, remove the first number from the first list and remove the last list entirely (don't just empty it out) if and only if the first list begins with 0 and the last list is just 0.
[[1,2,3],[4,5,6,7]][[1,2,3],[4,5,6,7]]
[[0,1,2,3],[4,5,6,7]][[0,1,2,3],[4,5,6,7]]
[[1,2,3],[4,5,6,7],[0]][[1,2,3],[4,5,6,7],[0]]
[[0,1,2,3],[4,5,6,7],[0]][[1,2,3],[4,5,6,7]]

@user202729 ^^

And the APL solution is invert(append [0], prepend 0 to first element)?

@user202729 Yes, but also needs catching is unsuccessful: Try it online!

@Adám Then... how can it be implemented?

1:03 PM
@user202729 How can what be implemented?

(sounds like Brachylog)

@user202729 Clearly it has been done. Dyalog has some very clever people. Here is another one:
CMC: Given y, find an x such that y=x²·⁵÷3.1¹·⁶ˣ (y=x^2.5/3.1^(1.6*x))

^ ints?

@Fatalize no, floats! (or even complex nums!)

... and ... that's why Brachylog occasionally outgolf Jelly. It doesn't need to describe the algorithm, just the problem.
It would take a lot of effort to implement something like this while being reasonably fast.

1:15 PM
@user202729 So since the function is *∘2.7÷3.1*1.6∘×, the solution is just (*∘2.7÷3.1*1.6∘×)⍣¯1

@Adám (what happens if there are multiple solutions?)

@user202729 Well, we did it. The interpreter has an extensive rule-set and if all else fails, it will use numeric approximation.
@dzaima Exactly the same solution.

1:17 PM
"extensive" --> "a lot of effort"
(@Fatalize Does Brachylog have something like that and how is it implemented?)

@dzaima Interesting. Apparently it is better at inverting derived functions that trains.
@user202729 Well, Dyalog APL cannot solve general problems, only invert invertible functions, i.e. such where data wasn't lost.
@user202729 It returns just one of them. E.g. the inverse of square gives the positive root.

@user202729 Something like what?

@Fatalize Ability to apply a composite function a negative number of times.

I don't understand what that's supposed to mean

@Fatalize Like, describe a way to get the input from the output and the interpreter will solve for the output.

1:24 PM
@user202729 Well yes
but that depends on your description and on what you want it to find

@Fatalize E.g. find me a list of strings such that if I rotate the 2nd and 5th strings by 3 characters I get ["Programming","Puzzles","&","Code","Golf"].
In Dyalog APL that would be 3∘⌽¨@2 5⍣¯1
3∘⌽¨ rotate each by 3
@2 5 applied at the 2nd and 5th elements
⍣¯1 applied negative one time

Ah

@Adám Question: does codegolf.stackexchange.com/a/161776/12012 actually take a variable number of arguments, or does ≢ simply compute the length of the right argument?

I get it but "applied negative one time" is an extremely ugly way of saying it

[@]Adám would this be valid codegolf.stackexchange.com/a/161776/41805? ninja'd

1:31 PM
@Dennis It just computes the length. Invalid as per passing an array does not count.

Thanks.

@Dennis See, that's why I hates the challenge. That's exactly the way how I would implement a function taking >2 args in {Jelly,APL,J}, but it doesn't count simply because the standard doesn't call that variadic.

:43913589 it seems to be taking the arguments as separate items not as an array

@dzaima Right, I realised when I opened the TIO link.

@ASCII-only just saw your rosettio bounties. You realise that some of them are deliberately ungolfed?

1:33 PM
don't know enough C# to tell why that code works though :p

I may make a language where a number is called a function and vice versa.

@user202729 In I all numbers are functions that return themselves.

There may be a number which takes two functions as input and returns an array of functions.

@user202729 What is an array then?

1:36 PM
@ASCII-only you also realise that you can only give one 50 rep bounty on the HW challenge? (possibly not even one if you've got a HW answer yourself)

... just quick draft. The more confusing it is the better.

@Adám an array is a recursive data structure which consists of a function and two child arrays

@user202729 :-D Also in K, you can apply numbers (or any array really) to arrays (or functions).
@MartinEnder Whoa, that makes my head spin when I try to combine it with a number is called a function and vice versa.

@user202729 I'll have to check. 0lØe returns (-inf+nanj), so 0Æl should do the same.

@MartinEnder Then it's infinite...?

1:40 PM
I guess an array could also be empty
or it could actually be infinite (as in lazy)

.oO( The easiest way to fix this is probably to make Æl use lØe internally. )

For languages that allow a function to be called as infix and prefix (or infix and postfix): CMC: return how many arguments it was called with, i.e. 1 or 2.

@user202729 maybe define the plural of "number" to be "strings" and the plural of "function" to be "platypodes"
2

> platypodes

@Adám ±x__:=Tr[1^x] (basically the same as the answer to the challenge, only we need a named operator to make this work)

1:41 PM
@MartinEnder No, we all know that the plural of function is dysfunction.

@Adám J, 6 bytes: 1: :2:

@MartinEnder What language is that?

Mathematica

Mathematica

there might be a shorter solution though, since we only need to handle 1 and 2...

1:43 PM
@user202729 Ah, that's clever, but can't you save a byte (or two?) with 1 :2: or 1:2:? Nah, : doesn't allow array operands.

yeah, ±_=1;±__=2

@Adám Isn't that the only way... ?
I think #@,: may work.
J, 4 bytes: +&1:

@user202729 Yeah, both of those work. Nicely done, sir!

No, f=:#@,: doesn't work for 1f<2.

@user202729 OK, but +&1: is good.
@user202729 A couple of APL solutions, but neither is very elegant: {1⌈⎕NC'⍺'} the max of 1 and the nameclass of the left arg (2 if array, 0 if undef). {6::1⋄2⊣⍺} if value error give 1, try left arg and discard in favour of 2.

1:55 PM
1

Given latitude/longitude of two points on the Moon (lat1, lon1) and (lat2, lon2) in Degree (angle), compute the distance between the two points in kilometre, by using Haversine formula. Input Four integer values lat1, lon1, lat2, lon2 in Degree (angle). Output Rounded integer distance in kil...

@MartinEnder :/ oops
@MartinEnder yes, but i don't know which. i guess it would be better to just periodically ask in chat then?

How do I tag a mapping in YAML? I know, I asked already, but I thought I found the answer and I didn't really.

@ASCII-only well not exactly don't know, just cant be bothered reading through every single post I guess

@ASCII-only For the time being, Jelly v2 is actually called jli, which is pronounced jelly.
3

@ASCII-only Bounty what...? What are you talking about?

2:06 PM
@Dennis makes sense if it's supposed to be shorter :P

Stands for Jelly Language Interpreter btw.

Dennis is very good at finding abbreviations.

Wouldn't be surprised if he named it Jelly just do do this

Nah, Jelly was just a random food item starting with J.
Sure.

@Laikoni I hope it's an easy fix, cause it was a nice answer! :)

2:32 PM
I say that codegolf.stackexchange.com/a/161733/60042 is valid, because the challenges definition of a function is unclear, and shell scripts function exactly the same as functions so a script is essentially a function saved to the disk. I could be convinced otherwise though.

@StewieGriffin It's not, but only because I forgot all about the saving water part over writing the answer.

2:51 PM
0

Are there any limits to how many challenges you can have in the sandbox at one time? Title: The Liquorice All-sort (I'm going with the British spelling here, because I can... and it has more variety) I have just invented a new sorting algorithm, which I would like you to implement in the small...

@cairdcoinheringaahing
BTW, while loop pop instead of peek. Is that intentional?
And peek the empty stack errors out.
Also not having a floordiv is quite annoying.
(my original plan was to copy the stack to other and print it, then after realizing there is no way to interact between memories (except use a while-loop like BF, but it's a bit slow asymptotically) I switch to try to somehow print all values on the stack without destroying them, then realize there are no stack rotation command, switch to div/mod, realize there is no floordiv, and finally have to use this.)

3:15 PM

@user202729 Yes, it's intentional.
@user202729 There is a stack rotation comman : r

@cairdcoinheringaahing Whole stack rotation. Not that.

@user202729 Nice, and thanks so much!

3:59 PM
1

For a challenge, I recently submitted the JavaScript solution [].push To be clear, this isn't x=>[].push. The entry itself is a function: it's the function identified by the JavaScript expression [].push. Is this legal? Importantly, it wouldn't work to place this function in a different varia...

Because Javascript is weird.

4:18 PM
@user202729 Would you like to claim the bounty I set? Just link me to an answer of yours you'd like to get a bit of attention.

4:33 PM
@Scrooble I don't know if you mean it seriously, but the comment here is a tad bit rude imho

5:11 PM

5:27 PM
1

In this answer, the function is defined as With(Math)f=(a,b,c,d)=>... (1) However, f is not used in the function, so it seems fine to write With(Math)(a,b,c,d)=>... (the latter one's return value is also the function) The point is that, you can't write f = With(Math)(a,b,c,d)=>... ...

5:37 PM
I assume you all are interested in a different delimiter? We can go with \$, perhaps. A good next step would be to search existing content to see how many posts would break. — Jon Ericson ♦ 6 mins ago What's the correct syntax to search for that? I tried body:"\$" and body:\$but those don't seem to work @DJMcMayhem Looks like symbols break search, so SEDE would probably be a better idea Oi, my SEDE is really rusty ooh, looks like that issue has been largely ignored, not even @DJMcMayhem try googling \$ site:https://codegolf.stackexchange.com I'm sure many regex answers would be hit

Conveniently, V uses ¤ in place of \$:D 5:46 PM how convenient :) 537 rows :| Although most of those are in code-blocks, which means they'd be safe Question: Does the address-of operator (&) take an instruction or is it evaluated at compile time? @DJMcMayhem I don't think that \$ is something to be used outside code blocks :P

@Pavel C(++)?

Yes

5:57 PM
I would guess it's compile time, but I know so little about assembly and the steps that happen after you write the C that I wouldn't know

6:10 PM
@NathanMerrill Part of it just happened to be that I was the one who bothered to write up the question and Mego was the one who bothered to write up the answer :P
(I know that was an old message, I was just perusing the transcript)

And you showed up seconds after I wrote that...

I was in a different chat room, so I got a ping

@DJMcMayhem and I assume you two are now going to have to deal with other hard stuff too, right? :P

@Dennis do you know if there's a julia type for whole numbers, of either floats or ints?
specifically (x-y problem maybe) I'm trying to make a function that accepts whole numbers of any datatype
I'm trying to throw an error for floats that aren't whole numbers, using throw(MethodError(x, y))
I want to get a custom type-thing for "not-whole-integer", but y is just an example of that datatype (and there's no type that I can find that's what I want)

6:26 PM
what is a "not-whole-integer"...
can't you just say "negative integer"?

no
I mean 'whole' as in 'the decimal part is nonexistant or equal to 0'
i.e. the function should accept 10.0, 10, but not 10.4

So just an integer

Integer and Int error on anything with a decimal, even if it has a 0

makes sense
Why would you want to accept x.0

since I may feed inputs directly from other functions

6:31 PM
Does Julia do equality across types? If so, you could do a floordiv by 1 and test equality against your input to see if it's a .0 or not.

and julia division return floats (even for things like 10/5)
the issue is with throwing the error
I want a MethodError (invalid type for arg)
but there's no type that explains what i want

Oh, I misunderstood your question, then.

(since it's MethodEror(function, type_instance), there's no way to give a specific msg)
tbh if alex was still here I'd probably be pinging him and requesting ^ >.>
I feel like there's got to be a better way to do this :/

Isn't your argument types defined in your man-equivalent? Just throwing an "invalid type" error seems like it would work just fine.

invalid type by itself doesn't exist

6:35 PM
oh

MethodError takes exactly 2 args, it has to specify what the proper type is
and passing the standard float tells you there shouldnt' be anything wrong with it
so I guess I'm just making a new dummy type and using that
(this is going in my juliarc)

Yeah, I guess a dummy type is the way to go.

thanks tnb, y'all are a good rubberduck

Does anyone know if freenode has rate limiting on messages?

I would have to imagine that they do. Did you ask in #freenode?

6:46 PM
I can't actually connect to irc right now (firewall)

Anyone with MATLAB here?

I have this idea. I need to send data between two devices, but I'm too lazy to implement a proper socket server. The idea is to just write the data to a freenode channel with an obscure name and communicate that way.
I know that this is a godawful idea
But I can't think of any reason why it wouldn't work
Security and scalability are nonissues

Too lazy to implement a proper socket server, so you're going out of your way to program a custom, one-off communication method. Makes perfect sense to me. :p

@Pavel You also could use github as a communication channel

6:52 PM
@Angs I have literally used Github as an image hosting site when I couldn't figure out the imgur API.
@AdmBorkBork The actual thing I'm trying to achieve is actually a bit harder than I described earlier, it involves several (~20) clients connected to one server exchanging messages. I was thinking that it kinda resembled the way a chat system works, so I had the brilliant idea of just borrowing Freenode's functionality.

@Pavel it doesn't last I checked

Hooray awful communication protocol is go for launch

I know some have a rate limit and message-in-a-time limit to prevent accidental keyboard spam
@Pavel you serious? what channel
I might pop on in a moment just to see

@Riker Well it's not live yet

@StewieGriffin yea

6:59 PM
@Pavel I believe there are hundreds of IRC-based chatrooms out there. Twitch.tv's is one, for instance. And it works exactly like you described.

@J.Sallé are you implying he should do this with twitch chat instead

@Riker no, I'm implying he could do it with twitch chat.

To be clear, what I'm actual implementing is a game (kinda like pacman), in wihch the player clients communicate their position to the server and the server tells everyone else information like what the map looks like

but an irc channel would be easier, methinks

"0x0000000 kappa"

7:00 PM
IRC is actually really easy to work with

^ my imagination of twitch chat message bots
@Pavel yeah irc would probably work fine for that if you're too cheap to get your own server

@Riker well, back in the day they were all written in mSL, so they wouldn't throw those
But nowadays they're mostly written in java and python iirc

tbh what chatbot isn't in python
(js browser-based ones nonwithstanding)
iirc discord and slack also use python

Well, I know nightbot was originally coded in Java
there's also a friend's project bot that's in Java, it's a machine-learning thingy
he intends it to eventually be able to converse with people through twitch chat
it actually broke when he added it to TwitchPlaysPokemon's chat rofl

7:20 PM
@Riker Thanks for replying, but I don't need it anymore. :) I wanted to check if this works in MATLAB.
I'm still curious though :)

00:00 - 20:0020:00 - 00:00