Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for r~~
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Comment | Post #291228 |
Intuitively, sure, although it's not a very big intuitive leap if you have `bind h` and you know you want `bind (switch f)`. It's as mechanical as algebra once you're used to it. (more) |
— | 16 days ago |
Edit | Post #291228 |
Post edited: |
— | 16 days ago |
Edit | Post #291232 | Initial revision | — | 18 days ago |
Answer | — |
A: Why does `let map f = id >=> switch f` work in F#? > when I look at the type signatures, it is not supposed to work. The types work because they're parameterized. The types of the combinators involved are (renaming all parameters to be unique for clarity): ``` id : 'a -> 'a switch : ('b -> 'c) -> 'b -> Result (>=>) : ('d -> Result) -> ... (more) |
— | 18 days ago |
Edit | Post #291228 |
Post edited: |
— | 18 days ago |
Comment | Post #291228 |
I don't think this particular formulation is typical in other FPLs—the `switch` combinator is a bit unusual. But it follows easily from your other definitions; I'll expand my answer to detail how. (more) |
— | 18 days ago |
Edit | Post #291228 | Initial revision | — | 18 days ago |
Answer | — |
A: How to implement `map` using the fish (>=>, Kleisli composition) operator in F#? > Is there a "cleaner" implementation similar to `map`'s? Yes: ``` let map f = id >=> switch f ``` This follows from two of your other equations: ``` map f = bind (switch f) g >=> h = g >> bind h ``` So if you want to get `bind (switch f)` out of `(>=>)`, you can start by making `... (more) |
— | 18 days ago |
Edit | Post #290805 | Initial revision | — | 2 months ago |
Answer | — |
A: Why does `Zip` require `Semialign` There's good reason to believe this is simply historical accident. The `Semialign` class came first, and used to include `zip` and `zipWith` directly. When those members were separated out into their own class, the motivation was types that had `align` but not `zip` (one example is `NEMap`), so `Zip`... (more) |
— | 2 months ago |
Edit | Post #290338 | Initial revision | — | 5 months ago |
Answer | — |
A: What does "namespace" mean? A namespace is a category to which a name can belong. Think of family names for people: I may be friends with several Jims, and if only one of them is present I can just call him Jim. But if multiple are present, I can disambiguate which I mean by saying Jim Jones or Jim Smith. ‘Jones’ and ‘Smith’ ar... (more) |
— | 5 months ago |
Comment | Post #290250 |
Have you read https://software.codidact.com/help/formatting? (more) |
— | 5 months ago |
Comment | Post #290032 |
Yes, for a new file you need to run `git add -N foo.txt` first (short for `git add --intent-to-add`). This adds the file to the index but without any content, which allows `git add -p` to make a diff containing the whole file. (more) |
— | 6 months ago |
Edit | Post #289969 | Initial revision | — | 6 months ago |
Answer | — |
A: Set transform of SVG element `` does seem to be a bit finicky for this case, doesn't it? You can use `` if you set the `values` attribute on it instead of the `to` attribute, like this: ``` ``` (more) |
— | 6 months ago |
Comment | Post #289831 |
After over a century of use, it's *not* an analogy, meaning ‘to behave like an electrical short circuit’; it's an idiom, meaning ‘to bypass’. Judging a newer application of the idiom by the etymological source of the idiom is kind of counter to the way language works, I think. (more) |
— | 7 months ago |
Comment | Post #289831 |
I think you're overthinking the short-circuit connection to electrical engineering. ‘Short-circuit’ has been in use as a figurative expression meaning ‘to bypass’ in non-EE contexts since [at least 1900](https://www.google.com/books/edition/Intestinal_Obstruction/HzI4AQAAMAAJ?hl=en&gbpv=1&pg=PA530&pr... (more) |
— | 7 months ago |
Edit | Post #289579 |
Post edited: revert meddling |
— | 7 months ago |
Comment | Post #289628 |
I've not used Crossfilter before, but from scanning the documentation I would assume that this is a group in the sense of SQL's [`GROUP BY` statement](https://en.wikipedia.org/wiki/Group_by_(SQL)). (more) |
— | 8 months ago |
Comment | Post #289605 |
A quick internet search for Python libraries that handle keystrokes should provide plenty of results that would be relevant for this problem. If you have one in mind already, perhaps ask a question that targets a specific difficulty you've had with it; otherwise, this question doesn't have enough evi... (more) |
— | 8 months ago |
Comment | Post #289584 |
This feature is called ‘hijacking your users' paste function to do something they probably weren't expecting’. Many users don't like this.
If you're writing this just for yourself, or for a small audience whose tastes you know well, go in peace. If you're writing this for a public website, please ... (more) |
— | 8 months ago |
Edit | Post #289595 | Initial revision | — | 8 months ago |
Answer | — |
A: Is it okay to use python operators for tensorflow tensors? No, you can't use `and` for this. In Python, `a and b` always, always, always means `b if a else a`. It cannot be overridden and cannot mean anything else. Likewise `not`, and any other boolean keywords, as opposed to operators. You could instead write `a & b`, which should mean the same thing ... (more) |
— | 8 months ago |
Edit | Post #289579 |
Post edited: |
— | 8 months ago |
Comment | Post #289579 |
Maybe not ‘reasonably simple’, but I've added a solution that uses `walk` without defining a new function. I don't think you'll be able to do better than this, without cutting some corners in terms of what inputs you accept. (more) |
— | 8 months ago |
Edit | Post #289579 |
Post edited: |
— | 8 months ago |
Edit | Post #289579 | Initial revision | — | 8 months ago |
Answer | — |
A: Replace leaf arrays with joined strings in a nested structure in jq As the `walk` documentation describes: > When an array is encountered, f is first applied to its elements and then to the array itself In other words, `walk` is bottom-up. So when you apply your filter to your nested-array input, first you're flattening the innermost arrays into strings. Then ... (more) |
— | 8 months ago |
Edit | Post #289513 | Initial revision | — | 8 months ago |
Answer | — |
A: How can I schedule a later task in Python? If `systemd-run` works for you, that is probably the simplest thing you can do here. Otherwise, you can use `os.fork()` from within Python to spawn a child that stays alive after the parent exits. If someone else is reading this based on the title, but is writing an industrial Python applicatio... (more) |
— | 8 months ago |
Edit | Post #289512 | Initial revision | — | 8 months ago |
Answer | — |
A: How can a Python program send itself to the background? Use `os.fork()`. Example: ```python import os import time pid = os.fork() if pid == 0: os.setsid() # Prevents the child from being killed if the parent dies time.sleep(10) os.system('somecmd') os.exit(os.EXOK) # This is important after a fork; otherwise Python cleans up it... (more) |
— | 8 months ago |
Comment | Post #278211 |
That's not what I said. The general concept of answering your own questions isn't awkward, but it's an awkward *fit* for the existing usage patterns of a Q&A site. It doesn't integrate well into the system of voting on questions and answers individually, or the notifications that get generated on mul... (more) |
— | 10 months ago |
Edit | Post #288100 | Initial revision | — | 12 months ago |
Answer | — |
A: Is it possible to get the current function in a trace function? CPython only very recently started keeping a reference on frames to function objects internally, and that reference isn't exposed from inside Python. There's an old PEP that would have defined a `function` local, which, combined with the `flocals` field on frame objects, probably would have done w... (more) |
— | 12 months ago |
Edit | Post #288035 | Initial revision | — | about 1 year ago |
Answer | — |
A: How do I get something similar to dictionary views, but for sequences? It isn't writable (but then again, neither are the dictionary views), but you might be interested in moreitertools.SequenceView. (more) |
— | about 1 year ago |
Edit | Post #287858 |
Post edited: |
— | about 1 year ago |
Edit | Post #287858 | Initial revision | — | about 1 year ago |
Answer | — |
A: Adding elements to wrapper after calling wrap doesn't work Remember that jQuery selectors in general can match more than one element. If you had multiple `` elements in your page, `$('p').wrap(wrapper)` would put wrapper divs around each of them. So `.wrap` uses its argument as a template to clone new wrappers for each match. Other jQuery DOM manipulation... (more) |
— | about 1 year ago |
Edit | Post #287604 |
Post edited: |
— | over 1 year ago |
Edit | Post #287615 | Initial revision | — | over 1 year ago |
Answer | — |
A: Dealing with code maintenance when saving a large and complex entity in a single business transaction Chain of Responsibility doesn't strike me as appropriate for this problem, at least as I understand it. You want to use CoR if you have multiple different requirements for the processing of the same data—authentication, logging, A-B testing—things we generally call concerns. What it sounds like you'r... (more) |
— | over 1 year ago |
Comment | Post #287607 |
The number 2 is also an important concept used in many software applications but it'd be madness to suggest a tag for it, because who searches for ‘questions related to 2-ness’?
I don't know if SO is doing the right thing and I'm asking under what circumstances would a user (here or there) say, wh... (more) |
— | over 1 year ago |
Comment | Post #287607 |
Are any of these tags worth it? Who's searching for questions related to interface-the-abstract-concept or interfaces-as-occurring-in-c#, in our community of 589 posts? (more) |
— | over 1 year ago |
Edit | Post #287604 | Initial revision | — | over 1 year ago |
Answer | — |
A: When would one not want to return an interface? `IList` is not necessarily representative of the general case; it's an interface that is (A) widely implemented by a variety of classes from a variety of sources, which themselves (B) tend to add additional functionality or constraints not captured by the signature of `IList`. There is, in my opinion... (more) |
— | over 1 year ago |
Comment | Post #287561 |
As a rule of thumb, I'd propose mentally replacing the string ‘ChatGPT’ with ‘this guy I go drinking with’ and doing what seems appropriate in that situation. (more) |
— | over 1 year ago |
Edit | Post #287572 | Initial revision | — | over 1 year ago |