Tag: haskell

提高function性能

我正在整理一个小程序,检查Brocard问题的解决方案或所谓的Brown Number ,我首先在ruby中创建了一个草稿: class Integer def factorial f = 1; for i in 1..self; f *= i; end; f end end boundary = 1000 m = 0 # Brown Numbers – pair of integers (m,n) where n factorial is equal with square root of m while m <= boundary n = 0 while n <= […]

使用pandoc ruby​​将HTML和内联Mathjax数学转换为LaTeX

我正在构建一个Rails应用程序,我正在寻找一种方法将数据库条目与html和内联MathJax数学(TeX)转换为LaTeX以进行pdf创建。 我发现了类似我的类似问题: 使用pandoc将html mathjax转换为markdown 如何使用pandoc将带有mathjax的HTML转换为latex? 我在这里看到两个选项: 创建一个Haskell可执行文件,在将html转换为LaTeX时,只留下像\(y=f(x)\)这样的东西 编写一个执行以下操作的ruby方法: 取string并将其拆分为带有正则表达式的array ( string.split(regex) ) 循环创建的array ,如果内容匹配regex将部分转换为LaTeX,不包括使用PandocRuby.html(string).to_latex内联数学PandocRuby.html(string).to_latex 将所有内容连接在一起( array.join ) 我更喜欢ruby方法解决方案,因为我在Heroku上托管我的应用程序,我不喜欢将二进制文件签入git。 注意: pandoc二进制文件以这种方式实现http://www.petekeen.net/introduction-to-heroku-buildpacks ) 所以我的问题是: regex应该将string分割为\(math\) 。 例如, string可以如下所示: text \(y=f(x) \iff \log_{10}(b)\) and \(a+b=c\) text 并且为了完整起见,在转换为LaTeX时,如何编写Haskell脚本以留下\(math\)并且ruby方法不是可能的解决方案?

是否有任何Haskell土地相当于Ruby-land的Bundler等。 al,如果没有,如何设计一个如此结构的项目?

读者注意 :请耐心等待。 我保证会有一个问题。 我有一个问题要解决,并对自己思考“哦,我会用Ruby做的。” $ bundle gem problemsolver create problemsolver/Gemfile create problemsolver/Rakefile create problemsolver/.gitignore create problemsolver/problemsolver.gemspec create problemsolver/lib/problemsolver.rb create problemsolver/lib/problemsolver/version.rb Initializating git repo in /tmp/harang/problemsolver 删除在s.add_development_dependency “rspec” problemsolver/problemsolver.gemspec对s.add_development_dependency “rspec”的评论,然后 $ bundle exec rspec –init The –configure option no longer needs any arguments, so true was ignored. create spec/spec_helper.rb create .rspec 新测试将进入spec/并且必须位于以_spec.rb结尾的文件中。 例如, spec/version_spec.rb describe ‘Problemsolver’ […]