A list of puns related to "Recursive Set"
I am trying to assign three variables based on user input (code, quant and ship):
def addRecord():
code = productCode()
quant = quantity()
ship = shipping()
Inside the productCode() function I have:
def productCode():
x = input("Type the product code for the item you would like to add to your shopping record (0-39) and press Enter.\n\
To go back to the main menu, type END and press Enter.\n")
if x == "END":
askForInput()
elif isValidCode(x) == True:
return int(x)
else:
print("That is an invalid code.")
productCode()
If I type a valid number first time (integer from 0-39) there are no issues. However, if I type an invalid input it will return NoneType to the code variable.
Since I can only recurse back to productCode() and not code = productCode(), I can't fix this the second time. Is there any way to fix this so that whatever the first valid input is will be assigned to code?
I had come across this statement in the book Godel, Escher, Bach, and while reading it, it stumped me and was holding me back from finishing the chapter. Could you provide a layman's explanation of this statement ? Thanks in advance !
TL;DR: Rational Batman.
Chapter 1: https://thegothamite.net/chapter-1/
Chapter 2: https://thegothamite.net/chapter-2/
Chapter 3: https://thegothamite.net/chapter-3/
HEY, EVERYONE, HERE'S AN AUTHOR'S NOTE: I AM NOT ALEXANDER WALES. THIS FIC WAS NOT WRITTEN BY HIM, IT'S WRITTEN BY ME. I/IT WAS INSPIRED BY METROPOLITAN MAN, AND THIS IS A (RECURSIVE, UNOFFICIAL) PARAQUEL/SIDEQUEL BASED ON HIS WORK.
I started working on this in the middle of May, after rereadingΒ Alexander Wales' THE METROPOLITAN MANΒ for a second time and thinking "it would be neat to see Batman in this world" (whichΒ manyΒ of the readers on this sub have thought, and expressed...on this sub previously).
I don't think this isΒ strictlyΒ rationalist, but it for sure tries to follow the basic tenets of rationality, while telling a pretty good story.
I didn't want to post here until I had a couple "sandbag" chapters written, because it really is the worst when someone starts a fic and then doesn't complete it, or just leaves it hanging.
This story is ongoing, and incomplete.
Comments and feedback (here or A03, not on thegothamite dot net; comments are turned off the site) are welcome. I have aΒ general, overarchingΒ story in mind, but things aren't really set in stone just yet.
This is theΒ first fanfiction or attempt at rationalist fictionΒ I'veΒ everΒ written, so if you have suggestions for other places I should post this (including other subs and websites),Β please feel freeΒ to let me know (shoutout to u/whats-a-monad for providing some compelling reasons to post this on AO3)
Hereβs the blurb:
The year is 1934. Bachelor playboy Bruce Wayne has a secret: by night, he's one of the greatest detectives in human history, and a member of a secret society of people trained in the 'oriental fighting arts' known as the "*YΔ«nyΗng"Β or "Ghosts of Gotham." But when sightings and stories of a being with godlike powers start becoming too credible, he starts planning to address this existential crisis on behalf of humanity.
The events of this story start at the same time as THE METROPOLITAN MAN (the exact same time, really), but it is very likely they will continue after that story's terminus.
**Some notes, which may or ma
... keep reading on reddit β‘Hi,
I was looking how to proove that two sets are equal. Say set A and set B. Actually i wasbreading a book (math) and there it was two statements x β¬ A and x β¬ B. So by prooving that two statements are equivalent. Which I actually havent found a definition for what does it mean that two statements are equivalent but I am assuming that in the case of a statement with a variable which those statements are, lets call them P(x) and Q(x), equivalence means that same value of x produces the same result for both of the statements. So basically the book book was saying that those statement equivalent means that A and B have the same elements and hence are equal. Now, what confuses me is those statement were about specific x. Now, i thought, if I am allowed to define a set recursively, such as A = {x | x β¬ A } and B = { x| x β¬ B} where those statements are elementhood test. Then by prooving that those statements are equivalent I can say that sets are also equivalent. Because they have the same elementhood test meaning they have the same elements. The only thing i am worried about is is it allowed to define the set recursively, as I did above. I mean set on the left side: A and the same set the right side as a part of the elementhood test. In other words, I am asking whether A = { x | x β¬ A } is a valid definition or am i not allowed to use the same set I am defining within the elementhood test. Or what may be the complications from it. Thanks in advance .
When I set the argument as sum = 0
, I get the wrong answer:
var rangeSumBST = function(root, low, high) {
return traverse(root,low,high)
}
function traverse (root, L, H, sum = 0){
if (!root){
return sum
}
if (root.val >= L && root.val <= H){
sum += root.val
}
traverse(root.left, L, H, sum);
traverse(root.right, L, H, sum);
console.log(sum)
return sum
}
rangeSumBST([10,5,15,3,7,null,18],7,15);
//RETURNS 10, INCORRECT ANSWER
CONSOLE.LOG:
10
17
10
25
25
10
When I set the argument as an object res = {sum: 0}
I get the correct answer:
var rangeSumBST = function (root, low, high) {
return traverse(root,low,high)
}
function traverse (root, L, H, res = {sum: 0}){
if (!root){
return res.sum
}
if (root.val >= L && root.val <= H){
res.sum += root.val
}
traverse(root.left, L, H, res)
traverse(root.right, L, H, res)
console.log(res.sum)
return res.sum
}
rangeSumBST([10,5,15,3,7,null,18],7,15);
//RETURNS 32, CORRECT ANSWER
CONSOLE.LOG:
10
17
17
32
32
32
What is going on here?
A while back, I made this post asking whether it was automatically possible to generate validation functions for Typescript types. It seems like this is not the case. Libraries like ajv, io-ts, zod, and runtypes exist, but none of them are truly automatic (and there are other issues as well).
About 3 weeks ago, I released typecheck.macro, a compile macro/library for automatically generating validation functions for Typescript types. I've been working on it non-stop since then, and I've added a bunch more features.
The macro supports a fairly large portion of the Typescript type system, so you can automatically generate a validator for most Typescript types. (Look at the README/the bottom of this post for a full list of supported features).
So why use this library/macro? A few reasons:
- It's seamless. You don't need to define your types in a DSL. Just use... Typescript! The macro automatically parses your type declarations and generates validation functions. This removes a lot of mental overhead and makes the overall process way easier since you don't need to worry about issues like, io-ts or runtypes not supporting rest types. (Note: These libraries are also super cool, all comparisons are friendly!)
- It's really really really fast. I did some benchmarking in the original post and some more benchmarking for this post. It turns out when you generate "boolean validators" (validators that only return true/false) this library is consistently 2x - 3x faster than ajv, which is the fastest JSON schema validation library. When you enable error messages, this library is still generally faster than ajv, and it gives waayyy better error messages.
The reason this macro is fast is because it generates optimized code at compile time whereas other libraries don't generate code. (ajv does generate code, but it 1. only does this at runtime 2. can't handle circular references and 3. this library tends to generate less/faster code).
Here's an example of an error message for the following type with this library:
| number
| {
a?: [
`number | { a: [number, Array<number |
... keep reading on reddit β‘I run Project Trident - basically desktop FreeBSD/TrueOS, explanation here - and wrote a very step-by-step, non-intimidating, accessible tutorial for using zfsnap
with it, which was accepted into Trident's official documentation.
The same instructions should work for Linux and other BSDs too, with the following changes:
cron
documentation/man pages. They may work differentlyzfsnap
using your OS' package managervisudo
to edit your crontab. If you're not using Lumina desktop environment that Trident ships with then you'll definitely need to use a different text editor at the very least. The documentation in 1) above should tell you how to proceed (or just ask in that OS' subreddit.)Please note that this guide works for ZFS source filesystems only. The limitations and reasonable expectations are laid out plainly at the beginning.
Hope folks find this helpful.
(1) How would you characterize the set of grammars which recursive descent parsers can apply to:
no left recursion (both immediate and not)
left factored
no cycle
no epsilon rule
...
(2) Predicative parsers are recursive descent parsers, and recursive descent parsers are not necessarily predicative parsers. Is the set of grammars which predicative parsers can apply to exactly the set of all LL(k) grammars, where k>=0 or just k=1?
The following quote from the dragon book seems to say yes ("any grammar that has disjoint FIRST sets for the production bodies belonging to any nonterminal" is exactly a LL(1) grammar?):
> 2.4.4 Designing a Predictive Parser
> We can generalize the technique introduced informally in Section 2.4.2, to apply to any grammar that has disjoint FIRST sets for the production bodies belonging to any nonterminal.
What differences are between LL(k) parser and predicative parser? Are they the same concept?
(3) How would you characterize the set of grammars which "4.4.4 Nonrecursive Predictive Parsing" in the dragon book can apply to?
Is nonrecursive Predictive Parsing not recursive descent Parsing (and thus is not predicative parsing)?
Should I ask the above questions as how to characterize the set of grammars from which ... parsers can be constructed?
Thanks.
Do the same thing to <https://i.stack.imgur.com/yzYIc.png> as done to <https://i.stack.imgur.com/uk5YS.png>.
P.S. I recently started working in ML and am fairly new to building algorithms. Any help would be much appreciated!
Playing and extended space island game and want something to do with the millions of landfill I've stockpiled while FTL research goes and absorb all the islands I cleared out. Anyone have a handy dandy blueprint for an automated landfiller?
Hi /r/PowerShell,
So in our environment we have a lot of Shared Mailboxes, and quite often mailbox owners come to us with requests like "we have new secretary, please give PublishingEditor access rights to all forders in this mailbox" or "please give this person access to this specific folder and subfolders only".
We all know, that in Outlook there is no Recursive permission setting, and Exchange 2013 Administration center only has "Full Access" option, so I've made a tool for myself and my team to use, which saves us a lot of time to do all these kind of modifications.
With the tool you can:
Link on a GitHub: https://github.com/Tristanic1/Set-MailboxFolderPermissionsGUI
It's my first ever GUI script, so let me know if you have any suggestions or modifications.
Is the set A = {A} a valid set in ZFC? In other set theories?
I know it is in naive set theory, but what about the others?
I'm having an issue with some schoolwork writing a recursive setter for a validated integer value. Here's the set code I have so far:
((using System;))
((using static System.Console;))
set
{
int ParseVal;
if(value >= 1 && value <= 10 && int.TryParse(Convert.ToString(value), out ParseVal))
{
length = Convert.ToInt32(value);
} else {
Write(" The value entered is invalid. Try again: ");
length = int.Parse(ReadLine());
}
}
It's part of a public class, set property for private int length.
Suppose I have a table, the purpose of which is to capture the status against an application. An example of the data contained within is:
Id | ApplicationId | StatusNumber | Status | StatusDate |
---|---|---|---|---|
1 | 1 | 1 | Submitted | 2018-02-05 |
2 | 1 | 2 | Active | 2018-02-08 |
3 | 1 | 3 | Pending | 2018-03-01 |
4 | 1 | 4 | Cancelled | 2018-03-05 |
5 | 1 | 5 | Active | 2018-04-01 |
6 | 1 | 6 | Cancelled | 2018-06-01 |
My requirement is to calculate the number of days an application has been active for, per stint. Stated more plainly:
Cancelled
in the Status
column.Active
value in the Status
column - at this point in time, stop the recursion.Simple in concept. Herewith the script I've done so far.
with base as
(
select Id
,ApplicationId
,StatusNumber
,ApplicationStatus
,StatusDate
from
(
values
(1, 1, 1, convert(nvarchar(16), N'Submitted'), convert(date, '2018-02-05'))
,(2, 1, 2, convert(nvarchar(16), N'Active'), convert(date, '2018-02-08'))
,(3, 1, 3, convert(nvarchar(16), N'Pending'), convert(date, '2018-03-01'))
,(4, 1, 4, convert(nvarchar(16), N'Cancelled'), convert(date, '2018-03-05'))
,(5, 1, 5, convert(nvarchar(16), N'Active'), convert(date, '2018-04-01'))
,(6, 1, 6, convert(nvarchar(16), N'Cancelled'), convert(date, '2018-06-01'))
) as V (Id, ApplicationId, StatusNumber, ApplicationStatus, StatusDate)
)
,recurse as
(
select Id
,ApplicationId
,StatusNumber
,ApplicationStatus
,StatusDate
,cast(null as int) as Duration
,cast(null as int) as PrevStatusNumber
,cast(null as nvarchar(16)) as PrevApplicationStatus
,cast(null as date) as PrevStatusDate
from base
where ApplicationStatus = N'Active'
union all
select b.Id
,b.ApplicationId
,b.StatusNumber
,b.ApplicationStatus
,b.StatusDate
,datediff(day, r.StatusDate, b.StatusDate) as Duration
,r.StatusNumber as PrevStatusNumber
,r.ApplicationStatus as PrevApplicationStatus
,r.StatusDate as PrevStatusDate
from base as b
inner join recurse as r on
b.ApplicationId = r.ApplicationId
and b.StatusNumber > r.StatusNumber
where b.ApplicationSt
... keep reading on reddit β‘People on the internet says , that I have to install latest TWRP recovery , but I only have recovery , no OS , and i dont know how to continue . Any ideas ?
I have tried reading in google about informations on how ip next hop recursive works and basically on how I understand it, it is used when the next hop address you plan to configure is not directly connected or not an adjacent router. Im about to give up already because I cannot make it work on this GNS3 setup.
http://imgur.com/51KzCtJ
By the way, as far as routing goes, Client router can ping to ISP2's fa0/0 interface IP address. Also I have configured a default route on webserver router to packets back to ISP2 router.
Anyone here have experience in implementing this kind of PBR? What am I doing wrong? Fyi, I am going to implement this on a real network. Thanks!
Edit: Running IOS on VXR and Main router is C7200-adventerprisek9_SNA-M, Version 15.0(1)M
I am trying to write a recursive method for an array of Double linked lists, I have provided the code I have so far.
private static DLLSet recUnion(DLLSet[] sArray, int first, int last){
DLLSet set1 = new DLLSet();
DLLSet set2 = new DLLSet();
if (first>last)
return set1.union(set2);
else{
set1 = set1.union(sArray[first]);
set2 = set2.union(sArray[last]);
return recUnion(sArray, first+1, last-1);
}
}
The driver routine for the private recursive method is:
public static DLLSet recUnion(DLLSet[] sArray){
return recUnion(sArray,0,sArray.length-1) }
Can someone provide me feedback on it? Also, I am having trouble calling it, do I just call it as is in the main function (set=recUnion(sArray))?
Having trouble with this subject. Using Rosenβs book, but itβs not clicking (especially tree and dictionary proofs). Anyone recommend some papers, blogs etc.
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.