« first day (776 days earlier)      last day (1490 days later) » 

07:23
@MartinEnder because integers is the first thing it tries (just an implementation side-effect) and since there are infinitely many of them…
if you didn't have the though and required a string further down the program it would work
is the one that "tries" integer values in that case
 
2 hours later…
09:42
@Fatalize If ignores its right argument, why doesn't the predicate inside {} in this program find just one valid integer and then generate more outputs with ?
Is an unconstrained variable counted as a single output for the predicate or something?
@Zgarb automatically labels its input if its an integer
so once you have in that predicate, that predicate will leave as many choice points as possible labelizations of that integer
findall collects the output variable, but it does so for each possible choice point, regardless of whether it impacts the output variable or not
Wait, but in that case you're dealing with strings
so really the thing generating the choice points is that ~ḅ
10:02
I'm not sure if that answers your question
10:16
I suppose it does. If I understand you correctly, the important thing is that ẉ does not create a choice point for its right argument, if it's not actually used for anything in the predicate.
only creates choice points if its input can be labelled as an integer
otherwise it indeed doesn't
I see some weird stuff happening with different commands. {≤ẉḋ}ᶠ⁾ prints only one number. {≤ẉṅ}ᶠ⁾ gives an error. {≤ẉℕ}ᶠ⁾ prints several numbers.
{≤ẉ^}ᶠ⁾ seems to loop forever for some reason.
The first one only prints one number because generates choice points (since its input is free) and so will bactrack on that first. If you ask for the output, you get your 9 results
The second one gives an error because of a new bug you discovered :)
Yey!
basically it negates an int first, and then on backtracking it will try to negate a float but float operations don't work on free variables
I forgot to add a check for that
?- run_from_atom('{≤ẉṅ}ᶠ⁾',[985,9],Z).
985
986
987
988
989
990
991
992
993
^ fixed, just need to push it to TIO
10:34
Some other arithmetic commands seem to have the same issue.
{≤ẉℕ}ᶠ⁾ works as expected
Abs and root at least.
{≤ẉ^}ᶠ⁾ loops infinitely because of another bug related to floats :p
^ on bactracking tries to compute the integer power of a float, but labels the integer before checking that the float is not a var
I just need to swap two lines…
{≤ẉṡ}ᶠ⁾ only prints half of the expected number of lines. What's going on there?
Fixed the bug for too
@Zgarb I get the same behavior for ^ after fixing it. Basically this is because leaves two choice points: either its input is 0, and then its output is 0, or its input is not 0, and then its output is abs(input)/input
so because you ask for 9 answers, and since leaves two choice points, it will only backtrack up to 4 times, thus printing 5 numbers (including the first pass)
10:46
I see.
I'd guess that Prolog doesn't play well with floats in general.
That's not its forte no. You can't really manipulate them in a declarative manner, unlike ints
@Zgarb BTW did you consider nominating Husk to that language-of-the-month event?
@Fatalize I did consider it, but I was just going to implement a new feature that invalidated some existing syntax, so I wanted to wait for a while.
@Zgarb I've wanted to learn it for a while now but never found the motivation, so something like this would probably make me learn it
10:57
I'll likely nominate it later. :)
Are you the sole maintainer of Husk? Or is Leo still involved?
Leo has been busy for a while now.
11:14
@Fatalize Actually he posted a message in chat that I had missed. He won't have much time for PPCG in the foreseeable future, so I'm effectively the sole maintainer of Husk for now.
12:07
@Zgarb Who had the idea first of making Husk? Or did it come up when you were both talking to each other?
@Zgarb (do you still have snow in Montpellier? :p)
Rod
Rod
12:51
@Fatalize what would be the "right" way to reuse the input? for example how could I write (i+2)*i, I was thinking in something like +₂×₂w but replacing the second with the input
@Rod ? is the input variable, so you can do +₂;?×
Rod
Rod
@Fatalize thanks!!
A;B constructs a list [A,B]
@Fatalize We had thought about a Haskell-based golfing language independently, but I think Leo made the first push into actually implementing something and was looking for collaborators. (Montpellier is still covered in snow and pretty much paralyzed.)
I see
Rod
Rod
13:28
@Fatalize and how would that work for a superscript? like here to replace the , I've tried the same syntax but it didn't work
@Rod You can use subscript parentheses: ^₂⟦₁;?ḍ₎w
^ this
the same thing exist for meta-predicates superscripts
Basically, ;? forms a pair of the current value and the input, and ḍ₎ means "evaluate on the left element of the pair, using the right element as a subscript".
And you don't need the for ^ because its default function is to expect [A,B] as input and output A^B
Rod
Rod
Thanks again
14:15
@all I really like this new challenge and had found a really cool solution to it (which is shorter than the current 05AB1E answer). I'll let some time to people interested in solving it before answering though
it's also shorter than Dennis' Jelly answer, so if you want to reap some green points, start thinking :p
… well Erik just answered :p, but you can still find something shorter
14:35
hm, I can save two bytes just with a shorter main predicate, but I still have the 3-line format
I guess we have the same 7 bytes main predicate
you can avoid using the linebreaks
can you just insert the copies of each predicate in a way that doesn't affect the truthiness of the result or something?
I guess you have to, otherwise you will add some additional character
Yes
Just try to write a tautology with your seven bytes after those 7 bytes
yeah, I think I've got it
ọtᵐ=h≥2≥2ọtᵐ=h should work, I think
Yep
I had one with >1 instead of 2
ọtᵐ=h>1ọtᵐ=h1>
14:40
heh, that's kinda neat too
It's almost two times the same thing, but had to put the 1 before the > in the second part
Also for style points (but 2 more bytes), you could get rid of the new lines and get a palindromic answer: ọtᵐ=h>1 1>h=ᵐtọ
:D
mind if I post ọtᵐ=hℕ₂ℕ₂ọtᵐ=h?
Well no go ahead!
Didn't think of that one but that's actually the most elegant one
@MartinEnder Wait don't post it it's wrong
oh yeah
if the character count is something like 112, that won't work
if e.g. you have 101 a in your string it wwon't work
that was too good to be true :p
14:46
then I just move the h after the N2
your other solution is fine and the same length, just doesn't have that nice symmetry…
yeah you could do that
I wonder if = would be more useful if it unified the output with that equal element.
Rod
Rod
how can I execute a predicate before pairing on the right side? tried with parentheses but it still failed : dl;(?d)j₍w
@MartinEnder From experience, it's not clear it would be better. We often use it to constrain some free variable and need the input list right after it
14:54
@Rod I'm not sure I understand what you mean
like you want the result of ?d to be used in j?
You would need to use named variables
For example: dXl;Xj₍w
You just call the result of ?d as X and reuse it further down
I think I've got 12: ọtᵐℕ₂ᵐ==tℕ₂ọ
Rod
Rod
yes, exactly what i wanted
@MartinEnder Jeeeeeez
I think you're right
(good thing you found that too because they just posted a 14 bytes Husk answer :p)
actually I could have also used t twice instead of using t and h
@Fatalize is the subscript column of writeln a typo in the docs?
@MartinEnder No but I admit that it's not very clear
basically the subscripts for writeln are the same as for write
15:05
oh okay
I wonder whether there's a good solution that uses twice instead of using =.
@MartinEnder Wouldn't ọtᵐọl1l1tᵐ work?
for 10 bytes
that doesn't ensure that the count is at least 2, does it?
right
ọtᵐọhh>1tᵐ1> but still 12 bytes
this doesn't ensure that there's only one run after the second , I think?
right
—.—
15:14
you need to make sure that the result after the second Occurrences is [[>=2,_]]
Maybe using ^ on that [>=2, _]
It would always be greater than 1 if non-discriminating
ọtᵐọ^ᵐ but still need to check that there's only one result and it's greater than 1
and reuse t
are z and \ equivalent when the input is rectangular?
yes
(I think I'll implement something equivalent to Ċ and but for a singleton list)
that sounds useful
There's Ė = [], Ċ = [_, _] and Ṫ = [_, _, _] but somehow never thought of [_]
15:28
I guess currently, you'd do that with ~g?
(although that would give access to the element, not the singleton at the end)
so ~gg or something...
yes
which is ugly
and also if you needed to reuse it somewhere else you would need to give it a name also
15:37
:D
hm that group idea is interesting, because we can stuff quite a lot of predicates into the first one
I would have expected ≥ᵐ2 to work as an alternative to ℕ₂ᵐ, how come it doesn't?
maps the input to the output
so you would need a list of 2s in the output
ohh, okay
that makes sense
is there anyway to map a predicate only over input or output?
Not directly no
I don't know how hard this would be to implement, but it seems like meta-predicates of the form "All elements of ? satisfy the predicate with ." and "Any element of ? satisfies the predicate with ." could be useful.
I don't think it would be that hard
I have to go, could you please submit an issue on Github so that I remember it?
15:46
sure
Thanks, later!
16:32
0
A: Non-discriminating Programming

H.PWizBrachylog, 10 bytes =ᵍbᵐbᵐlᵍ=l Try it online! Explanation =ᵍ Group all equal elements together bᵐbᵐ Remove the first element of each group twice. This fails if there are fewer than 2 elements lᵍ Group elements together that have th...

I'm slightly surprised that ` =ᵍ` works
Damn that's good.
17:12
@H.PWiz well damn
it's tied with Jelly now though
@H.PWiz it works because maps to each char of the string, and = on one char outputs that char
@MartinEnder that constraint that the program mus tbe non-discriminating makes this really interesting
yeah, surprisingly.
17:31
@Fatalize Cool, so its like ≡ᵍ on strings?
yeah

« first day (776 days earlier)      last day (1490 days later) »