我试图在OSX Lion 10.7上运行本地Python scriot时出现以下错误:
You are using the base settings file.
You are advised to create a local.py file (based on local_sample.py) with your personal settings.
Traceback (most recent call last):
File "manage.py", line 39, in <module>
detect_port(sys.argv)
File "manage.py", line 22, in detect_port
default_port = getattr(settings, 'RUNSERVER_PORT', None)
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 132, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module …Run Code Online (Sandbox Code Playgroud) 我做了一个简单的OpenGL应用程序(链接).在那里,您可以看到它应该如何显示的图像 - 以及它在我的计算机上的外观(OSX):

问题是:当我的客户端克隆并在他的计算机上编译它(Ubuntu)时,这就是他所看到的:
错误的http://dl.dropboxusercontent.com/u/62862049/Screenshots/wl.png
我真的很困惑.如果我可以重现这个错误,那就没问题,但是不能这样做让我对如何开始修复它一无所知.我该如何处理这个问题?
我发现了许多从数组创建Float32Array的方法,但所有这些方法都涉及复制所有元素.我想避免这种成本,因为数组将永远不会再次使用.我只是想施展它.怎么可能?
Morte旨在作为超级优化功能程序的中间语言.为了保持强规范化,它没有直接递归,因此,诸如列表之类的归纳类型表示为折叠,而诸如无限列表之类的导电类型表示为流:
finiteList :: List Int
finiteList = \cons nil -> cons 0 (cons 1 (cons 2 nil))
infiniteList :: Stream Int
infiniteList = Stream 0 (\n -> (n, n + 1))
Run Code Online (Sandbox Code Playgroud)
我想enumFromTo在Morte 上重写Haskell ,所以:
enumFromTo 0 2
Run Code Online (Sandbox Code Playgroud)
归一化为:
\cons nil ? cons 0 (cons 1 (cons 2 nil))
Run Code Online (Sandbox Code Playgroud)
那可能吗?
haskell functional-programming data-structures induction coinduction
我一直在Haskell上解决一些组合问题,所以我写下了这两个函数:
permutations :: (Eq a) => [a] -> [[a]]
permutations [] = [[]]
permutations list = do
x <- list
xs <- permutations (filter (/= x) list)
return (x : xs)
combinations :: (Eq a, Ord a) => Int -> [a] -> [[a]]
combinations 0 _ = [[]]
combinations n list = do
x <- list
xs <- combinations (n-1) (filter (> x) list)
return (x : xs)
Run Code Online (Sandbox Code Playgroud)
其工作原理如下:
*Main> permutations [1,2,3]
[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
*Main> combinations 2 [1,2,3,4]
[[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
Run Code Online (Sandbox Code Playgroud)
那些令人不舒服的相似,所以我不得不 …
假设我在Haskell中定义一个类型类,
class (Bool a) where
false :: a
true :: a
Run Code Online (Sandbox Code Playgroud)
为了定义任何通用not操作Bool,需要对其潜在值进行模式匹配:
not :: Bool a => a ? a
not true = false
not false = true
Run Code Online (Sandbox Code Playgroud)
但是,这不会编译.我怎样才能让它发挥作用?
请注意以下代码段:
<svg style="" width="60" height="60">
<rect
x = "0"
y = "0"
rx = "1"
ry = "1"
width = "17"
height = "15"
fill = "rgb(254,199,186)"
stroke = "rgb(152,119,111)"
stroke-width = "1">
</rect>
<text
x = "8"
y = "8"
fill = "rgb(50,39,37)"
font-size = "16"
font-family = "monospace"
alignment-baseline = "middle"
text-anchor = "middle">
a
</text>
</svg>Run Code Online (Sandbox Code Playgroud)
Chrome会将该代码段呈现为:

而在FireFox上,这是结果:

如何以跨浏览器兼容的方式复制此代码段?
这个:
foldrRange :: (Int -> t -> t) -> t -> Int -> Int -> t
foldrRange cons nil a b = foldr cons nil [a..b-1]
Run Code Online (Sandbox Code Playgroud)
定义从atil 折叠列表的函数b.这个:
foldrRange :: (Int -> t -> t) -> t -> Int -> Int -> t
foldrRange cons nil a b = go (b-1) nil where
go b !r | b < a = r
| otherwise = go (b-1) (cons b r)
{-# INLINE foldrRange #-}
Run Code Online (Sandbox Code Playgroud)
由于适当的严格使用(我们知道最后一个元素,所以我们可以滚动foldl' …
我试图通过Morte项目探索和理解建筑微积分的领域.我知道可以在Agda中表示这样的数据类型,但是对于我来说如何在这样的极简主义环境中表示它并不明显.怎么可能这样呢?我的意思是这个数据类型,在Idris中:
data Tree : Nat -> Type -> Type where
Leaf : a -> Tree Z a
(::) : Tree k a -> Tree k a -> Tree (S k) a
Run Code Online (Sandbox Code Playgroud) 这是zipWithMorte中几乎有效的定义:
zipWith
= ? (u : *)
-> ? (f : (u -> u -> u))
-> ? (a : (#List u))
-> ? (b : (#List u))
-> ? (List : *)
-> ? (cons : (u -> List -> List))
-> ? (nil : List)
-> ((? (A:*) -> ? (B:*) ->
(a (B -> List)
(? (h:u) -> ? (t : (B -> List) -> ? k : B -> (k h t)))
(? (k:B) …Run Code Online (Sandbox Code Playgroud)