self-reference Questions

4

Solved

As in this question, when a local variable not defined is used within its own assignment, it is evaluated to nil. x = x # => nil But when the name of a local variable conflicts with an exist...
Vitalis asked 3/10, 2012 at 10:33

8

import os A = os.path.join(os.path.dirname(__file__), '..') B = os.path.dirname(os.path.realpath(__file__)) C = os.path.abspath(os.path.dirname(__file__)) I usually just hard-wire these with th...
Talion asked 14/2, 2012 at 3:52

8

Solved

How can I get a reference to a module from within that module? Also, how can I get a reference to the package containing that module?
Refund asked 4/11, 2009 at 21:42

2

Solved

I read quite a number of posts of programmers that run into the Unable to determine a valid ordering for dependent operations. Dependencies may exist due to foreign key constraints, model requireme...

10

Solved

In a worksheet function in Excel, how do you self-reference the cell, column or row you're in?
Vanderhoek asked 13/6, 2011 at 19:54

7

Can anyone tell me how to create a linked-list in swift with node as structure and linked-list as class. I tried to create a node Node with reference to itself and faced a error "value type 'Node'...
Tilney asked 6/2, 2018 at 16:52

4

Solved

In my vim plugin, I have two files: myplugin/plugin.vim myplugin/plugin_helpers.py I would like to import plugin_helpers from plugin.vim (using the vim python support), so I believe I first need...
Ennis asked 12/2, 2011 at 6:52

3

Solved

Trying to refer a class inside itself. For e.g. class Test: FOO_DICT = {1 : Test.bar} # NameError: name 'Test' is not defined @staticmethod def bar(): pass Does this usage make sense? Any b...
Janettjanetta asked 2/12, 2016 at 5:36

2

Solved

In JavaScript, values of objects and arrays can be indexed like the following: objOrArray[index]. Is there an identity "index" value? In other words: Is there a value of x that makes the ...
Ramires asked 5/10, 2021 at 1:23

4

Solved

I've been reading Albaharis' "C# 5.0 in A Nutshell" and I've encountered this in Generics section and it is said to be legal: class Bar<T> where T : Bar<T> { ... } And it meant nothi...
Laural asked 30/10, 2015 at 7:5

5

Solved

After seeing a conversation in a forum from many years ago that was never resolved, it caused me to wonder how one would correctly create a tuple that referenced itself. Technically, this is a very...
Pishogue asked 8/8, 2012 at 21:27

3

Solved

Abstract Problem: I'd like to implement a self-reference / pointer in Elm. Specific Problem: I'm writing a toy LISP interpreter in Elm inspired by mal. I'm attempting to implement something lik...
Tantalus asked 28/2, 2020 at 22:59

3

Solved

create table EMP(Eid int primary key) insert into EMP values(11e3) --self referencing alter table EMP add constraint fk_EMP_Eid foreign key (Eid) references EMP(Eid) --now insert insert in...
Albrecht asked 26/3, 2011 at 13:45

2

Solved

Is there a way to declare a std::map whose value type is an iterator to itself? map<string, map<string, (#)>::iterator> myMap; The above code snippet wouldn't work because the iterat...
Instantaneous asked 21/2, 2019 at 13:0

2

Solved

Disclaimer: I'm finding it hard to summarise the problem in the title of the question, so if you have better suggestions, please let me know in the comments. Let's take the following simplified Ty...
Freemanfreemartin asked 4/12, 2015 at 18:50

3

Solved

I a trying to make a std::variant that can contain a vector of the same variant: class ScriptParameter; using ScriptParameter = std::variant<bool, int, double, std::string, std::vector<Scrip...
Enwreathe asked 27/11, 2018 at 15:18

4

Solved

I have this simple interface: public interface Node<E extends Node<E>> { public E getParent(); public List<E> getChildren(); default List<E> listNodes() { List<E&...
Joacimah asked 20/11, 2018 at 19:15

3

Solved

For a typedef of a struct in C, I can't do this: typedef struct { unsigned id; node_t *left; node_t *right; } node_t; because node_t is not known until it is defined, so it can't be used in i...
Dressmaker asked 30/12, 2015 at 7:38

7

Solved

Consider the following sscce public enum Flippable A (Z), B (Y), Y (B), Z (A); private final Flippable opposite; private Flippable(Flippable opposite) { this.opposite = opposite; } publi...
Jacqulynjactation asked 17/10, 2013 at 14:22

3

Solved

I want to self-referentiate a model in a RoR app but, I don't know exactly how. I want to save a linked list where the next node has the id of the previous one. how can I do this rails way? It is a...
Weidar asked 23/5, 2011 at 12:37

3

Solved

list_a = [2, 4, 3, 6, 3, 8, 5] list comprehension is very useful. list_b = [a**2 for a in list_a] I want to know how to write a self-reference in the list comprehension. For example: list_c...
Roundup asked 11/1, 2018 at 10:18

3

Solved

I ran into these lines: #define bool bool #define false false #define true true I don't think I need to say more than "wtf?", but just to be clear: What is the point of defining something to its...
Wenonawenonah asked 17/10, 2017 at 19:29

1

Solved

I have the following django model: class Category(models.Model): name = models.CharField(maxlength=20) parent = models.ForeignKey('self', null=True) Note that the field parent is self referenc...
Bacterin asked 22/11, 2016 at 13:37

0

I am trying to convert a ProtoBuf to Map by using the below mentioned code. Map map = objectMapper.convertValue(obj, Map.class); Sample PB data causing this: id: "1" metadata { type: "UNIT" isV...
Mountfort asked 7/11, 2016 at 8:32

3

Solved

So I just came across the term Quine on Wikipedia and cannot figure out what the heck it is meant for. I'm more than confused about it. Are there any real-world uses for it?
Kimon asked 28/4, 2012 at 22:3

© 2022 - 2025 — McMap. All rights reserved.