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.

190 questions
3
votes
1 answer

EF Core Quotations - filter composite key by list of ids

There is an entity that using composite key: [] type Entity = { Id1: int Id2: int Number: string } I'd like to filter entities by list of ids tuple using EF Core. Ideally the produced query should use many wheres like…
torcylius
  • 91
  • 1
  • 8
3
votes
5 answers

Quotation real usages

I faced with the 'quotation' term and I'm trying to figure out some real-life examples of usage of it. Ability of having AST for each code expression sounds awesome, but how to use it in real life? Does anyone know such example?
madcyree
  • 1,427
  • 3
  • 15
  • 28
3
votes
3 answers

Why is plotly() and enquo + !! in conflict?

I am writing a function that uses plot_ly for a pieplot. The tilde (~) within argument labels = ~ is in conflict with the unquote operator !!. Is there a solution for this problem? pieplotr <- function (df, Property){ Property_Name <-…
Soph Carr
  • 31
  • 5
3
votes
1 answer

Retrieving the F# code inside a Quotation

How can I get the original F# code inside a quotation? I know that in C# Expression.ToString() gives a reasonable string but it's not 100% and doesn't work in F#.
alakfq
  • 135
  • 8
3
votes
1 answer

composing many quotations into linq queries

I'm working on a project in which I'm trying to use F# and Linq for UDF's and stored procs in an SQL server. Part of that has been to statically define all the valid queries, the sorting criteria, and a means of scoring the results of the…
Alex Mumme
  • 85
  • 6
3
votes
5 answers

Bash How to wrap values of the first line of a csv file with quotations, if they do not exist

The other day I asked how to wrap values of the first line of a csv file with quotations. I was given this reply which worked great. $ cat file.csv word1,word2,word3,word4,word5 12345,12346,12347,12348,12349 To put quotes around the items in…
Vituvo
  • 1,008
  • 1
  • 9
  • 29
3
votes
1 answer

Capturing group number

I've been making a parser using Regex in PowerShell, and it works really well so far, except for that issue I'm having. \s*([a-zA-Z_]+)\s*=(?:\s*"(.*)"|([^;#]*)) I've made this Regex to match, with success, these scenarios: Name= "Value"…
Blah
  • 43
  • 8
3
votes
2 answers

F# Type Providers - nested properties instantiation

I'm trying to build my first toy-like Type Provider. What I'm trying to achieve is to have dynamically generated properties of dynamically generated types. collection |> getItems |> Seq.map(fun mapItem -> let nestedType =…
mickl
  • 48,568
  • 9
  • 60
  • 89
3
votes
1 answer

Using untyped F# quotations to copy an array without knowing the type

I'm working on a small project to using quotations to clone trees of some basic record types and I have it working in most cases, the big problem I'm having is with arrays. module FSharpType = /// predicate for testing types to see if they are…
Rick Minerich
  • 3,078
  • 19
  • 29
3
votes
1 answer

How to get F# quotation for a interface instance method?

In F#, we can create interface instance by object expression, but while I'm trying to use attribute ReflectedDefinition on the instance method, then I cannot get the quotations. The method info is declared in the interface type, not the instance…
Xiang Zhang
  • 2,831
  • 20
  • 40
3
votes
1 answer

F# code quotation invocation, performance, and run-time requirements

Here are 4 deeply related questions about F# code quotations - How do I invoke an F# code quotation? Will it be invoked in a manner less efficient than if it were just a plain old F# lambda? to what degree? Will it require run-time support for…
Bryan Edds
  • 1,696
  • 12
  • 28
3
votes
1 answer

fsharp quotation Expr list -> Expr handling

What can I do to get the following working? I need to make a function that accepts a Expr list and returns a Expr (Expr list -> Epxr). type DataObject() = let data = System.Collections.Generic.Dictionary() member this.AddValue…
BBL
  • 105
  • 5
3
votes
1 answer

Trouble with FSharp active patterns

I'm parsing code quotations in FSharp and am building up pattern helpers. All was going well till I tried let (|BinaryFn|_|) fn (input:Expr) = function | SpecificCall fn (_,_,l::r::[]) -> Some(l,r) | _ -> None let (|Multiply|_|) x = …
bradgonesurfing
  • 30,949
  • 17
  • 114
  • 217
3
votes
1 answer

Comparing code quotations in F# for equality fails

I have the beginnings of a calculus toolbox in f#. It's as much about learning f# as having something useful at the end to use in some other projects I have in mind. The basic and incomplete code is namespace BradGoneSurfing.Symbolics open…
bradgonesurfing
  • 30,949
  • 17
  • 114
  • 217
3
votes
3 answers

How to extract citations from a text (PHP)?

Hello! I would like to extract all citations from a text. Additionally, the name of the cited person should be extracted. DayLife does this very well. Example: “They think it’s ‘game over,’ ” one senior administration official said. The phrase…
caw
  • 30,999
  • 61
  • 181
  • 291