658 questions
3 votes
2 answers
140 views
Why does the second macro fail to compile with "invalid use of void expression" while the first works?
I have two versions of a macro carray_at for bounds-checked array access, but the second one fails to compile with an error, while the first works. First Macro (Works) #define carray_at(arr, pos) \ ...
0 votes
1 answer
71 views
Plot cartesian coordinates with the Ternary package
I need to plot cartesian coordinates on a triangle to match the analysis from a previous project. I have a data frame with the x,y values and I can generate a blank triangle using the Ternary package ...
1 vote
0 answers
66 views
Problem with setting scale for ternary plot
I have this code: library(ggtern) data() Coal ggtern(data = Coal, aes(x = Reflectance, y = `H/O`, z = `O/C`)) + geom_point(aes(color = Feedstock), size = 3) + theme_rgbw() Since the highest ...
0 votes
1 answer
83 views
How to Implement Ternary Conditional in a Racket Language Interpreter with Structs?
I’m working on an interpreter for a simple language in Racket, and I need to implement a ternary conditional (Expr ? Expr : Expr) similar to JavaScript. My language supports basic operations like ...
0 votes
2 answers
146 views
Select specific colors for filling a Ternary Plot
As per the documentation and tutorials provided for the Ternary package in R, the following script produces a ternary plot where each vertex of the triangle corresponds to an RGB color. I am trying to ...
1 vote
0 answers
83 views
How Do I Perform Integer Division on a Balanced Ternary String Using C#?
How do I perform integer division on a Ternary string? I'm trying it using the following example 'C'-like code below - which I got from a University professor's page on Ternary math - I'm unfamiliar ...
0 votes
1 answer
87 views
How do I convert a floating point number into balanced ternary?
Here I have some code that converts balanced ternary (-, 0, +) as a string of minuses, zeroes, and pluses into a floating point number (a double). How do I invert this function? I want to get the ...
1 vote
1 answer
42 views
Ternary operator in React stuck in first condition only on mobile
I have an application in React that I am using a loader placeholder on until my data is pulled via promises and async functions. Using the following code works properly on any computer but when ...
0 votes
0 answers
69 views
Ansible task to Toggle a file's encryption status (encrypted/decrypted) using ternary
I am attempting to use ansible to toggle the encryption state of a specified file (encrypt the file if decrypted, decrypt it if encrypted) using the ansible filter "ternary". This is my ...
0 votes
1 answer
106 views
Using += in Java ternary expression
I am trying to use a generic type with a ternary expression to execute expressions that do not return a value. Here is my class: static class Generic<T> { T t; } public static Generic ...
0 votes
1 answer
79 views
Inserting Javascript array elements into another array with ternary operator
I have an array of objects where each object defines a field in a React form. I want to display different sequence of fields depending on a boolean state. This means that I need to insert either one ...
-10 votes
1 answer
83 views
Operator Precedence in JS between ? and || [closed]
In the image above, I get the value some new value as the output. Could somebody explain me why that is happening? I thought I would get test value as the output but it doesn't seems to be the case. ...
1 vote
0 answers
93 views
Python: how to fill a ternary plot
I want to make a legend in python as a ternary plot to compare the values of three matrices A,B,C. This what I am doing. import numpy as np import matplotlib.patches as mpatches def create_color_map(A,...
-3 votes
2 answers
108 views
C# ternary operator + convert in CHAR not working [closed]
I'm currently learning C#, I am a beginner, so I'm not really familiar with the particularities of this language. My problem is: I have this piece of code which is supposed to convert an INTEGER to a ...
0 votes
2 answers
243 views
Flutter text field clear button
I'm trying to build a search field with a clear button who appear when i type some text in. But i tried a ternary condition to display my button, it never appear. Thanks in advance Here is my class: ...