Questions tagged [programming-languages]

Questions related to design, implementation, and analysis of programming languages. NOT for questions about how to program, which are off-topic on this site.

Filter by
Sorted by
Tagged with
0
votes
1answer
35 views

Is JavaScript a homoiconic language?

I can't help but notice the uncanny resemblence JavaScript has to LISP. JSON (JavaScript Object Notation), for instance, is a data structure that can be reconstituted into an object by subjecting it ...
2
votes
0answers
15 views

When did our current concepts of program modularity develop?

I take it that the concept of a modular subroutine call/return existed prior to the concept of a call stack (and hence to the possibility of recursive subroutines or of recursion limits). I would ...
-1
votes
0answers
15 views

determinant of the matrix [on hold]

Here the program for determinant of the matrix http://cpp.sh/6bv3d but i don't understand how to do that can anyone help me with this program please im new to c++
1
vote
1answer
19 views

Does an ADT have multiple or only one representations/implementations?

Section 24.2 in Types and Programming Languages by Pierce defines ADTs in existential types: A conventional abstract data type (or ADT) consists of (1) a type name A, (2) a concrete representation ...
0
votes
1answer
18 views

Why can System F1 a.k.a. λ → have kind `*`, but no quantification `∀`?

In Types and Programming Languages by Pierce, on p461 in Section 30.4 Fragments of 30.4.1 Definition: In System F1 , the only kind is ...
-1
votes
0answers
17 views

Layman explanation of algorithms [closed]

I am understanding artificial imagination. artificial imagination What is an algorithm.WHAT IS THE ROCCHIO ALGORITHM and evolutionary algorithm explained easily?
0
votes
0answers
18 views

What order logic does a system correspond to under Curry–Howard correspondence?

In Types and Programming Languages by Pierce, Section 9.4 Curry–Howard correspondence on p109 has a table Does the table mean that the simply typed lambda calculus ...
0
votes
0answers
9 views

Can two type expressions in different kinds have subtyping relation and equivalence relation?

In Higher-order bounded quantification ($F^ω_{<:}$), introduced in Ch31 in Types and Programming Langauges by Pierce, its subtyping and equivalence rules are: Does subtyping relation only exist ...
0
votes
1answer
51 views

How can mainstream OO languages support strong binary operations by classes?

Section 24.2 in Types and Programming Languages by Pierce compares ADT and existential objects,in terms of how well they support strong binary operations: Other binary operations cannot be ...
0
votes
0answers
29 views

Is `→` a type operator?

In Types and Programming Languages by Pierce, The level of types contains two sorts of expressions. First, there are proper types like Nat, Nat→Nat, Pair Nat Bool, and ∀X.X→X, which are ...
-1
votes
0answers
18 views

Basic for computer engineering [closed]

I am going pursue computer science engineering next year,but i have no idea about alogrithum ,what does it mean,what basic course i should do before taking the first class of my engineering studies,...
0
votes
0answers
23 views

Does λ→ have type operators?

In Types and Programming Languages by Pierce, Ch11 Simple Extensions introduces λ→ as the simply typed lambda calculus with simple extensions, and introduces <...
0
votes
0answers
19 views

Is the language “untyped arithmetic expressions” in Types and Programming Languages not Turing complete?

In Types and Programming Languages by Pierce, is it correct that the language introduced in Chapter 3 Untyped Arithmetic Expressions is not Turing complete? Because it doesn't provide recursion. the ...
0
votes
0answers
23 views

What are the differences and relations between a type constructor and a type operator?

What are the definitions of a type constructor and a type operator? What are their differences and relations? I think a type operator is a function whose parameters are n types and return is a type. A ...
0
votes
0answers
14 views

How can we directly reaching inside and looking at the state of a partially existential object?

Types and Programming Languages by Pierce says in Section 26.5 Bounded Existential Types, about partial existential objects implemented in terms of bounded existential types: We can make a similar ...
0
votes
1answer
34 views

How can an existential type be defined in terms of universal type?

In Types and Programming Languages by Pierce, how does the following achieve the definition of an existential type in terms of universal type, by polymorphic version of Church encoding of pairs? ...
0
votes
1answer
55 views

Why are ADT packages opened immediately after they are built, while existential objects opened as late as possible?

Section 24.2 in Types and Programming Languages by Pierce defines ADTs in existential types: A conventional abstract data type (or ADT) consists of (1) a type name A, (2) a concrete representation ...
1
vote
2answers
89 views

Can we always transform a set of lines to a function?

If I have n lines in a programming language like Python (globally or inside a function): ...
0
votes
1answer
32 views

How does this allow list operations to be applied to lists with elements of any type?

In Types and Programming Languages by Pierce, Chapter 11 is simple extensions of the simply typed lambda calculus with any simple base types. Section 11.12 introduces Lists. How does the section ...
0
votes
1answer
37 views

Are type abstraction values and universal types not for non functions, but only for functions?

In Types and Programming Languages by Pierce, Chapter 23 Universal Types has a summary of System F in the following figure, in particular, "type abstraction values" and their types "universal types". ...
0
votes
0answers
21 views

Mutually contradicting rules in Prolog

What will happen in a Prolog program, if I set two rules/facts which contradict each other.. will it go with the rule/fact that appears first.. or it will show an error?
0
votes
0answers
40 views

Why algebraic semantics of programming languages have died out and have not used today?

Algebraic semantics is one type of semantics that uses algebraic expressions for connecting the formal descriptions of initial and final states of some operation of some operation that is defined in ...
1
vote
1answer
17 views

What does it mean that a let-binding can be treated polymorphically, only if its right-hand side is a syntactic value?

Types and Programming Languages by Pierce says: 22.7 Let polymorphism A final point worth mentioning is that, in designing full-blown programming languages with let-polymorphism, we need to ...
0
votes
1answer
23 views

What is the purpose of erasing a type application to a term-application in parametric polymorphism?

From Types and Programming Languages by Pierce 23 Polymorphism 23.7 Erasure and Evaluation Order in a full-blown programming language, which may include side- effecting features such as ...
0
votes
0answers
15 views

Languages with Static Upper Bounds for Resource Consummations

For Topics related to Blockchains and Smart Contracts, I'm developing a programming language that has the property that it is possible to calculate an upper bound on the consumed resources of a ...
0
votes
1answer
53 views

Do the following concepts belong to syntax or semantics?

I am not very sure about the difference between syntax and semantics. Does each of the following concepts belong to syntax or semantics? terms values: terms that are possible final results of ...
0
votes
1answer
21 views

Does a term being normalizable mean the same as the term has a normal form?

From Types and Programming Languages by Pierce A term $t$ is in normal form if no evaluation rule applies to it— i.e., if there is no $t'$ such that $t -→ t'$. and A term $t$ is typable (or ...
1
vote
1answer
15 views

Do determinacy of one-step evaluation and uniqueness of normal forms apply to all (or most) languages in TAPL?

In Types and Programming Languages by Pierce, when talking about untyped arithmetic expressions in Chapter 3, there are two theorems: $-→$ is single-step evaluation relation: 3.5.4 Theorem [...
7
votes
3answers
2k views

Differences between programming model and programming paradigm?

What is the relation and difference between a programming model and a programming paradigm? (especially when talking about the programming model and the programming paradigm for a programming language....
1
vote
1answer
23 views

Does Types and Programming Languages use a recursive equation to define a recursive type or its generator?

In Types and Programming Languages by Pierce et al: The recursive equation specifying the type of lists of numbers is similar to the equation specifying the recursive factorial function on page 52: ...
0
votes
1answer
57 views

Composition of compostion as a functor

"Composition of Composition" (i.e., (.) . (.)) in Haskell), has type ...
7
votes
2answers
614 views

In the Curry-Howard isomorphism as applied to Hindley-Milner types, what proposition corresponds to a -> [a]?

(Using Haskell syntax, since the question is inspired by Haskell, but it applies to general Hindley-Milner polymorphic type systems, such as SML or Elm). If I have a type signature ...
0
votes
0answers
50 views

Converting Turing machine into the source code in industrial programming language?

Are there methods how to convert Turing machine (e.g. neural Turing machine or other rigorous Turing machine) into the source code/program that is written in some industrial programming language like ...
4
votes
0answers
43 views

How shall I understand the definitions of `let` expression?

let as used in programming languages is defined in lambda calculus as per https://en.wikipedia.org/wiki/Let_expression#Let_definition_defined_from_lambda_calculus ...
3
votes
0answers
150 views

Dennis Ritchie citation for “the C declarator syntax is an experiment that failed”?

I've often heard that the C declarator syntax described as "an experiment that failed." I've seen claims that this sentiment is also shared by its creator Dennis Ritchie. Does anybody have an actual ...
0
votes
0answers
14 views

In normative order evaluation, is there distinction between call by value, call by reference, call by sharing, etc?

Consider different ways of evaluating a procedure call and its arguments. Essentials of Programming Languages says All the parameter-passing mechanisms (natural parameter passing, call by value, ...
4
votes
4answers
8k views

What are differences between Static Scope and Dynamic Scope?

My teacher has provided the following pseudo-code, and says that the output using static scope is 1 2 3, but the output using dynamic scope is ...
2
votes
0answers
16 views

How can we convert between a program using `call/cc` and a program using functions written in CPS?

The Scheme Programming Language says It turns out that any program that uses call/cc can be rewritten in CPS without call/cc, but a total rewrite of the program (sometimes including even system-...
0
votes
0answers
13 views

Can the value model for variables only be used together with static typing, not with dynamic typing?

There are two models of variables: the value model (e.g. variables in C) and the reference model (e.g. variables in Python). There is also a distinction between static typing and dynamic typing. Can ...
27
votes
4answers
4k views

Clear, intuitive derivation of the fixed-point combinator (Y combinator)?

The fixed-point combinator FIX (aka the Y combinator) in the (untyped) lambda calculus ($\lambda$) is defined as: FIX $\triangleq \lambda f.(\lambda x. f~(\lambda y. x~x~y))~(\lambda x. f~(\lambda y. ...
3
votes
1answer
150 views

Are fixed-point combinators general recursive?

I don't know if I'm using the vocabulary correctly, but what I'm interested in is this: If your language has fixed-point combinators, is it Turing-complete?
8
votes
1answer
447 views

Representation of the concatenation at the type level

I would like to learn more about concatenative programming through the creation of a small simple language, based on the stack and following the concatenative paradigm. Unfortunately, I haven't found ...
2
votes
1answer
58 views

Are the definitions of constructs in terms of lambda terms issues in implementation/design or uses of functional languages?

In Lambda Calculus, natural numbers, boolean values, list processing functions, recursion, if function are defined in terms of lambda terms. For example, natural numbers are defined as Church numerals,...
0
votes
0answers
17 views

SICP: applicative or normal order evaluation

I'm trying to solve Problem 1.5 from SICP book. Consider the following definitions: (define (p) (p)) (define (test x y) (if (= x 0) 0 y)) (test 0 (p)) The ...
4
votes
0answers
73 views

Scopes vs objects — would a language make sense that voids the difference?

So there's this adage that says "Objects are a poor man's closures", which can equally well be reversed, which I understand to mean that they are equivalently expressive. What strikes me about the ...
0
votes
0answers
44 views

Regex to match number ranges less than a certain number

I'm trying to write some code to match numbers below certain bounds. I would much appreciate nay help somebody could give, I'm pretty lost with this one... NB. I've checked the forums and can find ...
-1
votes
1answer
105 views

Is the infinite program Turing-recognizable/decidable?

Imagine we have a program which does an infinite loop: while(true){loop} We run the program on a linux machine(assume the compilation is ok), then this linux ...
0
votes
1answer
21 views

How does this example violate Liskov substitution principle, which then causes violation of the open-closed principle?

From Agile Principles, Patterns, and Practices in C# by Robert Martin, Listing 10-1. A violation of LSP causing a violation of OCP ...
0
votes
1answer
25 views

Does the concept of subtype require dynamic method binding?

https://en.wikipedia.org/wiki/Subtyping says In programming language theory, subtyping (also subtype polymorphism or inclusion polymorphism) is a form of type polymorphism in which a subtype is a ...