-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spec/comprehension: string construction support #113
Comments
Original reply by @mpvl in cuelang/cue#113 (comment) Personally I would expect there to be spaces between the strings. Is there precedence for this interpretation in other languages? It seems to be very specific functionality to make it in to the spec. Most of the recent features were neutral to the size of the spec, or even shrunk it a bit. This will have a fairly large impact with, seemingly, very little benefit. Note also that using That said, we have been thinking about a reduce functionality. This cannot be done conveniently with a builtin, as CUE doesn't have lambdas (although they exist internally). Picking some arbitrary syntax for now, you would be able to write
But also here, using |
Original reply by @rudolph9 in cuelang/cue#113 (comment) I thing the introduction of detailed benefits and use caseI haven't comprised formal proof but my intuition is cuelang is largely a context-free grammar and could be modeled as a context push down-automoton with the exception of function calls such as A function call such as If indeed cluelang can be considered context-free, again proof is needed, then the time and space complexity it theoretically bounded to n^2 and n^2 where n is the length of the input. Relavant paper Perhaps comprehensions don't fall into the context-free category too, which would throw a wrench in the benefits described in the following, but provided they do and my intuition is correct; the language could be applied variety of different ways very effectively and efficiently. This is especially powerful when you consider data expressed as cuelang being captured and processed across a distributed since the values can be evaluated in any order, even evaluated twice, and ultimately yield the same result. For something something as common as joining strings it would be nice if crossing the Turing-complete function call boundary was necessary to represent them. |
Original reply by @mpvl in cuelang/cue#113 (comment)
Builtin functions are typically not worse than But, there are references, tuples, and conditionals (via comprehensions), which, together make the language TC if unchecked, although it pretty unpractical in its usage. I haven't done so yet, but my plan is to prohibit primitive recursion. For instance, the test cases include an implementation of Fibonacci. This would then no longer be possible. Either way, pertaining to this particular request, I suggest labeling it MaybLater and reconsider after query extensions and reduce are implemented. |
Original reply by @rudolph9 in cuelang/cue#113 (comment) That sounds reasonable. |
Original reply by @rudolph9 in cuelang/cue#113 (comment)
Somewhat relevant to the comment here cuelang/cue#145
@mpvl I don't believe I have permission to add labels. |
Originally opened by @rudolph9 in cuelang/cue#113
@mpvl Would you folks be open to extending the spec of comprehensions to support the construction of strings?
Given and string is effectively an array of char bytes it like it fits the existing spec with regard to the construction of an array.
Obviously the
import "strings"
built in package is able to achieve this functionality but it seem natural to include it in the language core.Proposed syntax follows:
Which would evaluate to:
I would expect to the following to be valid:
The text was updated successfully, but these errors were encountered: