Questions tagged [let-binding]

7 questions
6
votes
3 answers

How do I properly implement a property in F#?

Consider my first attempt, a simple type in F# like the following: type Test() = inherit BaseImplementingNotifyPropertyChangedViaOnPropertyChanged() let mutable prop: string = null member this.Prop with public get() = prop …
Greg D
  • 43,259
  • 14
  • 84
  • 117
6
votes
3 answers

Discriminated Union & let binding?

Why are let bindings not permitted in a discriminated union? I assume it has to do with let bindings being executed in a default constructor? On a secondary note any suggestions on how I could rewrite AI_Choose would be appreciated. I want to keep…
gradbot
  • 13,732
  • 5
  • 36
  • 69
4
votes
2 answers

Is assignment with "let" not against the idea of functional programming in Clojure

Assignment should avoided in functional programming, but in clojure we often use let. Is let just a way of being practical or is assignment not the same as using let? Should we not avoid assignment in functional programming?
David
  • 2,926
  • 1
  • 27
  • 61
4
votes
1 answer

What characters are allowed in F# identifiers, module, type and member names?

This question is about characters in identifiers, not keywords as identifiers. I found this question on C# names, but couldn't readily find the same on F#. Normally this is hardly relevant, but in my tests naming I often use the dot . and was…
Abel
  • 56,041
  • 24
  • 146
  • 247
3
votes
2 answers

Alternative approach to avoid "Incomplete pattern match" warning

I have written a function that takes an array as input and returns an array of equal size as output. For example: myFunc [| "apple"; "orange"; "banana" |] > val it : (string * string) [] = [|("red", "sphere"); ("orange", "sphere"); ("yellow",…
JDB
  • 25,172
  • 5
  • 72
  • 123
2
votes
1 answer

Common Lisp `loop`: maximize into local variable introduced by `let`

The loop facility in Common Lisp allows several value accumulation clauses, maximize amongst others. Now, it is also possible to give a variable var to the maximize clause: (loop for x from 0 to 10 maximize (func x) into var) My question is: Is it…
Aroob
  • 113
  • 8
0
votes
0 answers

example of tvm letnode

In tvm, according to the docs Let binding is used in every high-level programming language. In Relay, it is a data structure with three fields Let(var, value, body). When we evaluate a let expression, we first evaluate the value part, assign it to…
irasin
  • 145
  • 6