Questions tagged [quotations]

Code quotations, a language feature that enables you to generate and work with F# code expressions programmatically. This feature lets you generate an abstract syntax tree that represents F# code.

Code quotations, a language feature that enables you to generate and work with F# code expressions programmatically. This feature lets you generate an abstract syntax tree that represents F# code.

For more information about F# quotations, please visit its MSDN page.

180 questions
69
votes
2 answers

Why is it better to have 100 functions operate on one data structure than 10 functions on 10 data structure

I have seen this quoted in a lot of places: "It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures." —Alan Perlis But I have never seen it explained why this should be true. Is it just the idea…
GlennS
  • 4,490
  • 4
  • 23
  • 30
36
votes
6 answers

How to insert text with single quotation sql server 2005

I want to insert text with single quote Eg john's to table in sql server 2005 database
ramesh
31
votes
3 answers

Extract string from between quotations

I want to extract information from user-inputted text. Imagine I input the following: SetVariables "a" "b" "c" How would I extract information between the first set of quotations? Then the second? Then the third?
Reznor
  • 1,125
  • 4
  • 13
  • 23
29
votes
4 answers

Down angled quote (« and ») in HTML

Possible Duplicate: Does unicode or HTML have a vertical double guillemet (chevron)? Is there a downwards facing alternative to « and » (« and » respectively)? I have tried to find an answer elsewhere but to no avail. I assume css…
rickyduck
  • 3,790
  • 13
  • 55
  • 90
18
votes
4 answers

How do I match a pattern with optional surrounding quotes?

How would one write a regex that matches a pattern that can contain quotes, but if it does, must have matching quotes at the beginning and end? "?(pattern)"? Will not work because it will allow patterns that begin with a quote but don't end with…
Jake
  • 2,707
  • 5
  • 19
  • 21
14
votes
1 answer

Code quotations and Expression trees

I wonder if there is any difference in how the two features are implemented under the hood? I.e. Aren't just code quotations built on top of the old good expression trees? Thanks.
ay.metallo
  • 715
  • 6
  • 16
13
votes
5 answers

Evaluate Quoted Expression in F#

I hope I haven't missed something obvious, but I've been playing with F# expressions and I want to evaluate quoted expressions on the fly. For example, I want write something like this: let x = <@ 2 * 5 @> let y = transform x // replaces op_Multiply…
Juliet
  • 76,873
  • 44
  • 191
  • 224
13
votes
1 answer

Inconsistent behaviour between (+) and (-) when using 'inline' and quotation evaluation

Does anyone know why sub throws an exception when add does not? And is this a bug? open Microsoft.FSharp.Linq.QuotationEvaluation let inline add x = x + x let inline sub x = x - x let answer = <@ add 1 @>.Eval() // 2, as expected let answer2 = <@…
TimC
  • 227
  • 1
  • 7
13
votes
2 answers

Difference between double and single quotation marks in fortran?

I'm just starting out on Fortran and am confused with the usage of double vs single quotation marks.
Zen
  • 186
  • 2
  • 8
12
votes
3 answers

F# special quotes? (##)

I just ran across http://frankniemeyer.blogspot.com/2010/04/minimalistic-native-64-bit-array.html Which contains the line (# "sizeof !0" type('T) : nativeint #) I believe the technical phrase is "what the heck?" I have never in my (~8 months) of F#…
Snark
  • 1,604
  • 13
  • 27
10
votes
1 answer

F#: Quotation with type definition?

I'm playing around with quotations and I can't see an expression pattern for type definitions. Is there really not one, or am I missing something? <@@ type MyType (name:string) = member x.Name = name @@> Gives "Unexpected keyword 'type' in…
zmj
  • 215
  • 1
  • 6
9
votes
2 answers

How can I create an Action in F#?

I am using the Moq framework for unit testing and would like to be able to pass in Action for logging void methods. let log = new Mock() let quot = <@ fun (mock:ILog) -> mock.Info(It.IsAny) @> let expr = (quot.ToLinqExpression() :?>…
YonahW
  • 14,450
  • 7
  • 38
  • 45
9
votes
1 answer

Converting F# Quotations into LINQ Expressions

I can convert a quotation of type Expr<'a -> 'b> to a Linq expression via the following snippet: /// Converts a F# Expression to a LINQ Lambda let toLambda (exp:Expr) = let linq = exp.ToLinqExpression() :?> MethodCallExpression …
forki23
  • 2,704
  • 1
  • 23
  • 40
9
votes
2 answers

When to favor untyped over typed quotations in F#?

F# has both typed and untyped code quotations and I wonder what are the use cases where one would choose one over the other? Is the distinction just convenience and untyped and typed quotations are convertible to each in all cases or are typed…
soc
  • 27,310
  • 18
  • 99
  • 209
8
votes
2 answers

Multiline inline-block becomes a block and ruins my nifty quote effect

I'm trying to create a block quote that has huge quotation marks on it's sides. The text content of the block quote is dynamic and so the marks should align according to it's size. I've used an inline-block element so it will shrink-to-fit and…
Arieleo
  • 311
  • 2
  • 13
1
2 3
11 12