« first day (565 days earlier)      last day (1804 days later) » 

 
11 hours later…
5:05 PM
I can't for the life of me figure out how to say "if this, then output this, else if this output this, else output this".
I've got Ɠ⁼10 to evaluate if the input is "10". I have “!ẇ⁼dzḤƥMḋ» to output "you get a brownie". But I can't figure out the if else factor
 
Use ?.
> ? Ternary if. <if-clause><else-clause><condition>?
Which can be quite confusing, but try using it.
Its arity is the max of the arity of the parameters. They're given ?'s parameters as input.
 
I have no idea how I missed the ternary
I was literally Ctrl+Fing for ternary lol
Wrong page probably
 
It's on the quicks page.
 
Got it :)
Not sure where' I'm going wrong here - tio.run/##y0rNyan8//…
Trying to output “!ẇ⁼dzḤƥMḋ» if input=10, and output "test" if not
 
<condition>` needs to be 1 link, not 3. Use ¤ to group them together.
Also, close string with , not .
Actually because ? passes its argument to the argument links, Ɠ“!ẇ⁼dzḤƥMḋ»“test”⁼?⁵ works too.
But note that Ɠ evaluates its input, so tio.run/#%23y0rNyan8///Y5EcNcxQf7mp/… .
 
5:21 PM
Ah, so I can just use ɠ probably
@user202729 Er, I guess I still need to evaluate it when using this.
Welp, I'm confused now lol
 
x A B c? y for nilad x, y, A, B and dyad c is equivalent to A B (x c y)?.
 
I guess I understand that now, thanks :)
Now the second step is to do sort of an "else if". So nesting ternaries I guess
I guess I still don't understand why my original ternary wasn't working. Can you show me how it should be written? Where the condition is the first link?
 
“!ẇ⁼dzḤƥMḋ»“test”Ɠ⁼⁵¤?
 
5:36 PM
Ahhhh I understand more now.
¤ essentially combines the comparing of STDIN=5 as the condition?
 
> ¤ Nilad followed by links as a nilad.
Without it, the code is parsed like this “!ẇ⁼dzḤƥMḋ» | “test” | (Ɠ | ⁼ | ⁵ ?)
instead of “!ẇ⁼dzḤƥMḋ» | “test” | (Ɠ | ⁼ | ⁵¤) ?
 
Ah I see
That makes more sense, :)
Last thing I need to figure out now is how to nest the ternaries lol
non-jelly pseudocode would be
`input == 10 ? 'output10' : bonus == 20 ? 'output20' : 'outputelse'`

So if I use the current code
` Ɠ“!ẇ⁼dzḤƥMḋ»“test”⁼?⁵`

“test” needs to be replaced with another ternary that takes the input, checks if it's equal to 20, and returns something depending on what it is. Although I think I need to combine some parts of the expressions so it doesn't get confused when running
Actually, I think my issue is that I'm reading a line and then I need to read the same line, so I can't just use Ɠ again
Is there a way to get only the first line from STDIN?
 
Actually Jelly is not really designed to take input from stdin.
@TristanWiley Doesn't ɠ/Ɠ do that already?
 
@TristanWiley Make Ɠ the current value. Transform it using a nested ternary.
Jelly is a tacit language.
Something like Ɠ V1 V2 V3 ⁼B$? ⁼?A
with nilad A, B, V1, V2, V3.
Note that ⁼B$ forms a monad as a parameter to the inner ?.
 
5:54 PM
Gonna be honest, I'm lost lol
 
Take Ɠ 1 2 3 ⁼4$? ⁼?5 as an example. What does it do?
 
6:10 PM
Alright, I got my solution, now to learn and understand what you're saying. Sorry for the delay!
It takes in the input and checks if it is not equal to 5. If that is the case, it returns 1. If it isn't it checks to see if it's not equal to 4, and if it is returns 2, else returns 3?
 
 
3 hours later…
8:50 PM
@TristanWiley Its recommended to use the implicit command line arguments, rather than STDIN
 
9:46 PM
That's what I ended up using :)
 

« first day (565 days earlier)      last day (1804 days later) »