open FSharp.Charting
open System
[<EntryPoint>]
let main argv =
printfn "%A" argv
let x = Chart.Line [ for x in -100 .. 100 -> x, pown x 3]
let y = Console.ReadKey();
0 //return an integer exit code
Run Code Online (Sandbox Code Playgroud)
您好,我正在尝试在PROJECT模式下使用F#而不是脚本.到目前为止,我有上面的代码以及它告诉我添加对System.Drawing的引用,我也做了.
编译时我有0个错误或警告,它运行得非常好.出现控制台屏幕但没有其他事情发生.图表没有显示或任何东西.
我已经在交互式窗口中尝试了这个,它在那里工作得很好.有任何想法吗?
List<MyTable> result = DSL.using(configuration())
.select()
.from(MY_TABLE)
.where(MY_TABLE.ID1.equal(pk_id1))
.and(MY_TABLE.ID2.equal(fk_id2))
.and(MY_TABLE.ID3.equal(fk_id3))
.orderBy(MY_TABLE.ID.asc())
.limit(limit)
.fetchInto(MY_TABLE)
.map(mapper());
Run Code Online (Sandbox Code Playgroud)
我正在尝试编写一些代码,允许我的查询采用三个可选的id,例如我希望查询最终成为
select * from my_table where ID1=5 and ID2=6 and ID3=7 .... etc
Run Code Online (Sandbox Code Playgroud)
但是,我还想选择能够排除任何id
select * from my_table where ID2=6 and ID3=7
Run Code Online (Sandbox Code Playgroud)
要么
select * from my_table where ID3=7
Run Code Online (Sandbox Code Playgroud)
这个问题是第一个"where"子句属于id 1,其余的是ands所以如果我做了一个if语句并且我删除了那里然后我会留下
List<MyTable> result = DSL.using(configuration())
.select()
.from(MY_TABLE)
.and(MY_TABLE.ID2.equal(fk_id2))
.and(MY_TABLE.ID3.equal(fk_id3))
.orderBy(MY_TABLE.ID.asc())
.limit(limit)
.fetchInto(MY_TABLE)
.map(mapper());
Run Code Online (Sandbox Code Playgroud)
它不会起作用.
我试图寻找类似于where id = **are essentianlly没有过滤器的东西,但我找不到那样的东西.
我正在遵循温文尔雅的教程,我正在努力将JSON返回到前端.我目前有代码.(我没有使用Chiron包装).我可以启动网络服务器就好了但是当我去localhost:8083 /你好我收到下面发布的错误信息.我不知道如何调试这个,或者是什么造成了这个.
这是我正在关注的教程
#r "../packages/Suave/lib/net40/Suave.dll"
#r "System.Runtime.Serialization.dll"
#r "../packages/FParsec/lib/net40-client/FParsecCS.dll"
#r "../packages/Aether/lib/net35/Aether.dll"
#r "../packages/Chiron/lib/net40/Chiron.dll"
module Test =
open Suave // always open suave
open Suave.Successful // for OK-result
open Suave.Web // for config
open Suave.Operators
open Suave.Http
open Suave.Filters
open Suave.Json
open System.Runtime.Serialization
open Suave.Writers
[<DataContract>]
type Foo =
{
[<field: DataMember(Name = "foo")>]
foo : string;
}
[<DataContract>]
type Bar =
{
[<field: DataMember(Name = "bar")>]
bar : string;
}
let router =
choose
[path "/hello" >=> (mapJson (fun …Run Code Online (Sandbox Code Playgroud) 在Angular文档中,它说模块共享一个编译上下文.
NgModules为其组件提供编译上下文.根NgModule始终具有在引导期间创建的根组件,但任何NgModule都可以包含任意数量的其他组件,这些组件可以通过路由器加载或通过模板创建.属于NgModule的组件共享编译上下文.
我这里只找到一个解释.但我并不完全理解它或它的重要性.有人可以详细说明"编译上下文"的含义以及模块共享相同上下文的重要性吗?
我正在研究黑客等级问题,我相信我的解决方案是正确的.但是,我的大部分测试用例都已超时.有人可以建议如何提高我的代码的效率?
代码的重要部分始于"Trie Class".
确切的问题可以在这里找到:https://www.hackerrank.com/challenges/contacts
using System;
using System.Collections.Generic;
using System.IO;
class Solution
{
static void Main(String[] args)
{
int N = Int32.Parse(Console.ReadLine());
string[,] argList = new string[N, 2];
for (int i = 0; i < N; i++)
{
string[] s = Console.ReadLine().Split();
argList[i, 0] = s[0];
argList[i, 1] = s[1];
}
Trie trie = new Trie();
for (int i = 0; i < N; i++)
{
switch (argList[i, 0])
{
case "add":
trie.add(argList[i, 1]);
break; …Run Code Online (Sandbox Code Playgroud) 根据CS的基本原理,search未排序列表的功能必须在O(n)时间内发生,而对于HashMaps,直接访问数组将在O(1)时间内发生。
那么将数组映射到字典中然后直接访问该元素是否更有效?还是应该只使用include?这个问题是专门针对JavaScript的,因为我相信这将回落到的核心是如何实现的细节includes()和{}实现的。
let y = [1,2,3,4,5]
y.includes(3)
Run Code Online (Sandbox Code Playgroud)
要么...
let y = {
1: true,
2: true
3: true
4: true
5: true
}
5 in y
Run Code Online (Sandbox Code Playgroud) 我正在阅读F#并查看人们的源代码,我有时会看到
Type test =
| typeone
| typetwo
Run Code Online (Sandbox Code Playgroud)
有时候我会看到
type test = typeone | typetwo
Run Code Online (Sandbox Code Playgroud)
其中一个之前有一个管道而另一个没有.起初我认为一个是enum vs歧视联盟,但我认为他们是一样的.如果有人可以解释差异吗?
let sortStringAsKey (listOfWords : string array) =
let temp = listOfWords
|> Array.map (fun word -> word.ToCharArray() |> Array.sort)
|> Array.map String
|> Array.zip listOfWords
temp
Run Code Online (Sandbox Code Playgroud)
你好,
我写了一些这样的代码,它接受一个单词列表并对它们进行排序,然后创建一个像这样的元组(originalWord,sortedWord); 我希望元组看起来像这样(sortedWord,originalWord).
我知道我们可以简单地完成let语句,然后再做
let newTemp = Array.zip temp |> listOfWords
Run Code Online (Sandbox Code Playgroud)
但我想知道是否有办法以某种方式以某种方式反转curried参数,以便首先应用函数中的第一个参数.这将让我在不使用另一个let语句的情况下完成它.
编辑:
我在想的是,不知何故......如果我可以引用'temp'我可以将自己用作zip中的第一个参数或者其他东西......虽然我知道它不会起作用,因为它只能使用1个函数而且它只需将它自己压缩.
如何在launch.json中设置调试器?
目前,我有
{
"version": "0.1.0",
"configurations": [
{
// Name of configuration
// Appears in the launch configuration drop down menu.
"name": "Launch Lukecxu",
"request": "launch",
"cwd": "/Users/lukexu/lukecxu",
"type": "node",
// Automatically stop program after launch.
"stopOnEntry": true,
"program": "${workspaceRoot}"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我在网上找到了一些,但它没有用.它说我应该将"type"作为单声道但是当我设置它有单声道它说不支持类型.
对于我的系统设置,我做了brew install mono,我也安装了ionide.
现在我无法点击排水沟来设置任何断点,当我点击F5时,它说 "Cannot launch program '/Users/lukexu/lukecxu'; configuring source maps might help."
是否有在VSCode中设置F#调试器的教程?
f# ×5
angular ×1
arrays ×1
c# ×1
charts ×1
dictionary ×1
fsharpchart ×1
ionide ×1
java-8 ×1
javascript ×1
jooq ×1
json ×1
performance ×1
rabbitmq ×1
suave ×1
trie ×1
typescript ×1