Skip to content

Commit

Permalink
init some functors for racket soft
Browse files Browse the repository at this point in the history
  • Loading branch information
jueqingsizhe66 committed Jul 4, 2018
1 parent 11bfe86 commit ff87b32
Show file tree
Hide file tree
Showing 22 changed files with 140 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .org-id-locations

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions .orgConf.el
Original file line number Diff line number Diff line change
Expand Up @@ -962,15 +962,16 @@ In ~%s~:
(scheme . t)
))

;(setq scheme-program-name "K:\\DanFriedMan\\ChezScheme\\a6nt\\bin\\a6nt\\scheme.exe")
(setq scheme-program-name "c:\\Program Files\\Racket\\Racket.exe")
(setq geiser-active-implementations '(racket))
;(setq geiser-active-implementations '(chez))

;(setq geiser-active-implementations '(racket))
(setq geiser-active-implementations '(chez))

(setq geiser-chez-binary "K:\\DanFriedMan\\ChezScheme\\a6nt\\bin\\a6nt\\scheme.exe")
;(setq geiser-chez-binary "K:\\DanFriedMan\\ChezScheme\\a6nt\\bin\\scheme")
(setq geiser-racket-binary "c:\\Program Files\\Racket\\Racket.exe")

(setq geiser-racket-init-file "~/.emacs.d/GTD/scheme/sicp-init.rkt")
(setq geiser-chez-init-file "~/.emacs.d/GTD/scheme/sicp-init.rkt")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 1. geiser-guile-binary ;;
;; 2. geiser-racket-binary ;;
Expand Down
3 changes: 2 additions & 1 deletion GTD/orgBoss/newgtd.org
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ DEADLINE: <2018-07-01 周日>
3. [ ] 处理结果

*** TODO [#A] 双滑移英文初稿 <2018-06-20 周三 10:54> [0/2] :学术:
DEADLINE: <2018-06-24 周日>
DEADLINE: <2018-07-08 周日>
:PROPERTIES:
:Effort: 4:00
:END:
Expand All @@ -1269,6 +1269,7 @@ DEADLINE: <2018-06-24 周日>

Good writing starts with a plan(I need to finish it)

必须完成
1. [ ] 方法部分

2. [ ] 结果处理部分
Expand Down
70 changes: 70 additions & 0 deletions GTD/org_Brain/SICP.org
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,76 @@
:PROPERTIES:
:ID: ad97756a-d9f1-4272-b953-7d517feb4234
:END:


#+BEGIN_SRC scheme
(define (sum term a next b)
(if (> a b)
0
(+ (term a)
(sum term (next a) next b))))


; (define (inc n) (+ n 1))

(define (cube x) (* x x x))

(define (sum-cubes a b)
(sum cube a inc b))

(sum-cubes 1 10)
#+END_SRC

#+RESULTS:


test2


geiser-racket-init-file

#+NAME: Integral
#+BEGIN_SRC scheme
(define (sum term a next b)
(if (> a b)
0
(+ (term a)
(sum term (next a) next b))))

(define (pi-sum a b)
(sum (lambda (x) (/ 1.0 (* x (+ x 2))))
a
(lambda (x) (+ x 4))
b))



(define (integral f a b dx)
(* (sum f
(+ a (/ dx 2.0))
(lambda (x) (+ x dx))
b)
dx))

(define (square x) (* x x))


; ((lambda (x y z) (+ x y (square z))) 1 2 3)

(define (f x y)
(define a (+ 1 (* x y)))
(define b (- 1 y))
(+ (* x (square a))
(* y b)
(* a b)))

(f 5 6)

#+END_SRC

#+RESULTS: Integral
: 4620

**** 1.3.1 Procedures as Arguments
:PROPERTIES:
:ID: 5f0463de-56a7-46f9-8207-3dfd61f51675
Expand Down
4 changes: 3 additions & 1 deletion GTD/scheme/gstd.scrbl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#lang scribble/base

@title{On the Cookie-Eating Habits of Mic}
@title{On Ehe Cookie-Eating Habits of Mic}


@section{The Consequences of Milk}
Expand All @@ -27,3 +27,5 @@ If a mouse eats all your cookies, put up a sign that says
@itemlist[@item{df}
@item{dfg}
]

@section{}
12 changes: 12 additions & 0 deletions GTD/scheme/sicp-init.rkt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(define (square x) (* x x))
(define (cube x) (* x x x))
(define (inc n) (+ n 1))
(define (factorial n)
(fact-iter 1 1 n))

(define (fact-iter product counter max-count)
(if (> counter max-count)
product
(fact-iter (* counter product)
(+ counter 1)
max-count)))
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6304,6 +6304,31 @@ rackekt还有一点比chez方便的地方,就是加载文件还比较方便
[Choosing-a-Scheme-Implementation][340]


#### 重用性问题

[howardism literate-devops][76]也提到了重用性问题,但只是说可以把通过另外处理的数据输出给一个函数,而我需要的是一个代码段在多个函数快里面重用,
于是我想这可以用geiser提供的初始加载文件即可!

[scheme-init-file][343]

You can also specify a couple more `initialisation `parameters.
For Guile, `geiser-guile-load-path` is a list of paths to add to its load path (and its compiled load path) when it’s started,
while `geiser-guile-init-file` is the path to an initialisation file to be loaded on start-up.
The equivalent variables for Racket are `geiser-racket-collects` and `geiser-racket-init-file`.


`geiser-racket-collects` 可以指定额外库路经
`geiser-racket-init-file` 可以指定初始化文件(一些基本函数)

在orgConf.el设置如下:

```
(setq geiser-racket-init-file "~/.emacs.d/GTD/scheme/sicp-init.rkt")
```

这样每次添加完之后直接`C-c C-c` 那么不用重启Emacs也可以在org babel的代码块使用了!很方便!


### 132. 添加scribble-mode,用racket写大论文

`M-x package-install scribble-mode`
Expand Down Expand Up @@ -6670,3 +6695,4 @@ rackekt还有一点比chez方便的地方,就是加载文件还比较方便
[340]: http://www.nongnu.org/geiser/geiser_3.html#Choosing-a-Scheme-implementation
[341]: http://docs.racket-lang.org/scribble/getting-started.html
[342]:https://github.com/jueqingsizhe66/ranEmacs.d/blob/develop/customizations/img/scribble.png
[343]: http://www.nongnu.org/geiser/geiser_3.html#index-scheme-init-file
3 changes: 3 additions & 0 deletions customizations/scheme-editing.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
(setq auto-mode-alist (cons '("\\.ss" . scheme-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.rkt" . scheme-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.scm" . scheme-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.srcbl" . scheme-mode) auto-mode-alist))
;; bypass the interactive question and start the default interpreter
(defun scheme-proc ()
"Return the current Scheme process, starting one if necessary."
Expand Down Expand Up @@ -60,3 +61,5 @@


(add-hook 'scribble-mode-hook #'geiser-mode)

(add-hook 'scribble-mode-hook #'enable-paredit-mode)
Binary file added elpa/elpy-20180629.513/elpy/__init__.pyc
Binary file not shown.
Binary file added elpa/elpy-20180629.513/elpy/auto_pep8.pyc
Binary file not shown.
Binary file added elpa/elpy-20180629.513/elpy/blackutil.pyc
Binary file not shown.
Binary file added elpa/elpy-20180629.513/elpy/compat.pyc
Binary file not shown.
Binary file added elpa/elpy-20180629.513/elpy/jedibackend.pyc
Binary file not shown.
Binary file added elpa/elpy-20180629.513/elpy/pydocutils.pyc
Binary file not shown.
Binary file added elpa/elpy-20180629.513/elpy/rpc.pyc
Binary file not shown.
Binary file added elpa/elpy-20180629.513/elpy/server.pyc
Binary file not shown.
Binary file added elpa/elpy-20180629.513/elpy/yapfutil.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions eshell/history
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ ledger -f test.ledger bal
ledger -f test.ledger bal
ledger -f test.ledger reg savings
ledger -f test.ledger bal savings
scribble gstd.scrbl
scribble gstd.scrbl
2 changes: 2 additions & 0 deletions geiser-history.racket
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(factorial 3)
}{
4 changes: 2 additions & 2 deletions ido.last
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

;; ----- ido-dir-file-cache -----
(
("c:/Users/yzl/AppData/Roaming/.emacs.d/" (23355 33133 0 0) "url/" "themes/" "testMind3.org" "testMind3.html" "testLisp.lisp" "test.ledger" "test.el" "srecode-map.el" "snippets/" "slidetemplate.org" "slidetemplate.html" "server/" "README.md" "projectile.cache" "projectile-bookmarks.eld" "ncepublack.jpg" "ncepu.jpg" "init.el" "ido.last" "hello-graphviz.png" "GTD/" "eshell/" "emms/" "elpa/" "elisp-tutor.el" "diary" "customizations/" "custom.el" "cider-history" "CalendarDairy/" "bookmarks" "backups/" "auto-save-list/" "ag.exe" "abbrev_defs" ".smex-items" ".session" ".recentf" ".python-environments/" ".orgConf.el" ".org-id-locations" ".mc-lists.el" ".gitmodules" ".gitignore" ".git/" "../" "./")
("c:/Users/yzl/AppData/Roaming/.emacs.d/" (23356 45200 0 0) "url/" "themes/" "testMind3.org" "testMind3.html" "testLisp.lisp" "test.ledger" "test.el" "srecode-map.el" "snippets/" "slidetemplate.org" "slidetemplate.html" "server/" "README.md" "projectile.cache" "projectile-bookmarks.eld" "ncepublack.jpg" "ncepu.jpg" "init.el" "ido.last" "hello-graphviz.png" "GTD/" "eshell/" "emms/" "elpa/" "elisp-tutor.el" "diary" "customizations/" "custom.el" "cider-history" "CalendarDairy/" "bookmarks" "backups/" "auto-save-list/" "ag.exe" "abbrev_defs" ".smex-items" ".session" ".recentf" ".python-environments/" ".orgConf.el" ".org-id-locations" ".mc-lists.el" ".gitmodules" ".gitignore" ".git/" "../" "./")

("c:/Users/yzl/AppData/Roaming/.emacs.d/GTD/" (23355 30843 0 0) "writingtest.org" "thesis-proposal.org" "testXmind2.org" "testXmind.org" "testSlide.org_archive" "testSlide.org" "testSlide.html" "testMind3.org" "staticYaw.org.gpg" "staticYaw.org" "spacemacs.jpg" "science.org" "reveal.js/" "presentation.org" "phd1.org.pgp" "phd1.org" "package/" "org_Brain/" "orgwiki/" "orgTemplate/" "orgBoss/" "org-ref/" "myPlan/" "index.org" "hello.org.gpg" "hello.org" "email.org" "dynamicyaw.org" "Dissertation.org" "clojureBackup.org" "bakupJournal/" ".notes.org" "../" "./")
("c:/Users/yzl/AppData/Roaming/.emacs.d/GTD/" (23356 43917 0 0) "writingtest.org" "thesis-proposal.org" "testXmind2.org" "testXmind.org" "testSlide.org_archive" "testSlide.org" "testSlide.html" "testMind3.org" "staticYaw.org.gpg" "staticYaw.org" "spacemacs.jpg" "science.org" "reveal.js/" "presentation.org" "phd1.org.pgp" "phd1.org" "package/" "org_Brain/" "orgwiki/" "orgTemplate/" "orgBoss/" "myPlan/" "index.org" "hello.scm" "hello.rkt" "hello.org.gpg" "hello.org" "email.org" "dynamicyaw.org" "Dissertation.org" "clojureBackup.org" "bakupJournal/" ".notes.org" "../" "./")

("c:/Users/yzl/AppData/Roaming/.emacs.d/GTD/org_Brain/" (23352 25657 0 0) "调研.org" "背景.org" "网格无关性.org" "结果.org" "科研论文.org" "湍流模型.org" "方法.org" "参考文献.org" "一个idea.org" "URANS时间步无关性.org" "T-SST.org" "SST.org" "SA.org" "ReynoldStress.org" "k-omega.org" "K-e.org" "Appendence.org" "../" "./")

Expand Down
2 changes: 1 addition & 1 deletion projectile.cache

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions test.ledger
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@
Assets:Savings:支付宝Alipay

2018-06-24 购买wife夏季衣服1
Expenses:House-living RMB 533
Equity:Wife RMB 533
Liabilities:花呗Huabei

2018-06-24 商品购买2017款夏季衣服2
Expenses:House-living RMB 360
Equity:Wife RMB 360
Liabilities:花呗Huabei

2018-06-24 拼单收款
Expand Down Expand Up @@ -136,3 +136,12 @@
2018-07-03 内部转账
Assets:Savings:建行1593 RMB 1350
Assets:Savings:建行7889

2018-07-04 西安臊子面
Expenses:Food RMB 16
Assets:Savings:支付宝Alipay


2018-07-04 xinran 面膜
Equity:Wife RMB 675
Assets:Savings:支付宝Alipay

0 comments on commit ff87b32

Please sign in to comment.