티스토리 툴바

Programming Language

github 에 올렸습니다.
git clone git@github.com:rafael81/clj-anagram.git
저작자 표시
Posted by 창민짱 Trackback 0 Comment 0
clojure.contrib.duck-streams 을 보면 알겠지만 파일명은 "duck_streams.clj" 언더바(_) 를 사용하면서 namespace에는 아래와 같이 하이픈(-)으로 정의되어 있다. 난 몰랐다 ㅠㅠ 다른분들은 유념하시길...
(ns 
   ^{:author "Stuart Sierra",
     :deprecated "1.2"
     :doc "This file defines \"duck-typed\" I/O utility functions for Clojure.
           The 'reader' and 'writer' functions will open and return an
           instance of java.io.BufferedReader and java.io.PrintWriter,
           respectively, for a variety of argument types -- filenames as
           strings, URLs, java.io.File's, etc.  'reader' even works on http
           URLs.

           Note: this is not really \"duck typing\" as implemented in languages
           like Ruby.  A better name would have been \"do-what-I-mean-streams\"
           or \"just-give-me-a-stream\", but ducks are funnier."} 
  clojure.contrib.duck-streams


저작자 표시
Posted by 창민짱 Trackback 0 Comment 0
.emacs 파일을 생성할 필요도 없습니다.

clojure box 설치후 아래파일에 아래 paredit 항목만 추가해 주세요~

C:\Program File\Clojure Box\emacs\site-lisp\default.el
;; load paredit

(load "paredit.el")


(add-hook 'emacs-lisp-mode-hook
          (lambda ()
    (paredit-mode +1)
    (setq abbrev-mode t)))


(add-hook 'lisp-mode-hook
          (lambda ()
             (paredit-mode +1)
             (setq abbrev-mode t)))

(add-hook 'clojure-mode-hook
          (lambda ()
             (paredit-mode +1)
             (setq abbrev-mode t)))

(add-hook 'slime-repl-mode-hook (lambda () (paredit-mode +1)))
(add-hook 'slime-mode-hook      (lambda () (paredit-mode +1)))

(setq slime-net-coding-system 'utf-8-unix)



저작자 표시
Posted by 창민짱 Trackback 0 Comment 0

안드로이드폰으로 손으로 꾹꾹 눌러가며 코딩하게 생겼네요.ㅋㅋㅋ

이와같은 일이 가능한건 damonkohler 라는 개발자가 가능하게 했죠 ^^


python 뿐만이 아니라 아래와 같이 jruby, lua, perl 등도 가능합니다.


단지 Android 안에서 Script Language 를 지원하는게 아니라 Application 제작도 할 수 있죠.
Matt Cutts 님은 6줄의 Python Code 를 통해 책의 바코드를 스캔해서 구글 북스에 저장하는 일도 하셨습니다.
또 어떤분은 모터사이클이 몰고 집 근처에 가면 안드로이드폰을 이용해 차고문이 열리도록 하기도 했다더군요. -_-
참으로 놀랍습니다.
이제 자야겠네요.~ 피곤해요~ =_=
저작자 표시
Posted by 창민짱 Trackback 0 Comment 0
안녕하세요. 

python 으로 제작된 moinmoin 위키에 대해서는 익히들어 아실거라고 생각합니다. 

moinmoin은 Debian, Apache, Ubuntu 등 유명한 곳에서도 사용중인 위키 엔진입니다. 

파이썬의 매력에 푹 빠진중이라 공부도할겸 python 으로 제작된 위키 엔진이 뭐가 있을까하고 구글링해보니 moinmoin 을 많이 사용하시더군요. 

그래서 개인적인 업무도 정리할겸 윈도우 xp 에 설치하였는데 한글명으로 된 파일들이 첨부가 되지 않더군요. 

그래서 한글명 파일도 첨부가 가능하게 수정하였습니다. 

수정한 moinmoin 위키 엔진 버전은 1.8.5 입니다. 

moinmoin 을 많이 사용하시는 분들이 계실지 모르겠지만 필요하신 분들이 있을꺼 같아서 공유합니다. 

설치방법: 
1. 한글명 첨부 패치가 된 moinmoin 1.8.5 를 다운로드 한다.moinmoin1.8.5 
2. 다운로드한 파일 압축을 풉니다. 
3. c:\Python26\Lib\site.py(사용자마다 설치 디렉토리가 다를수 있습니다) 파일의 setencoding() 함수안의 encoding 변수를 "ascii" 에서 "mbcs" 로 수정합니다. 

코드:
... 
def setencoding(): 
    """Set the string encoding used by the Unicode implementation.  The 
    default is 'ascii', but if you're willing to experiment, you can 
    change this.""" 
    encoding = "mbcs"

4. wikiserver.py 실행후 사용합니다. 
5. 끝 

수정된 파일만 보고 싶은분들은 아래 2개 파일을 원본 소스와 비교해 보시면됩니다. 
1.__init__(MoinMoin\request) 
2.AttachFile.py(MoinMoin\action)

Known Issue
첨부된 txt 파일등이 웹에서 출력될때 한글내용이 깨져서 나옴
저작자 표시
Posted by 창민짱 Trackback 0 Comment 6
#include <stdio.h>
#if defined(A) || (B)
#define C
#endif
int main(void)
{
#if defined(C)
printf("hello world");
#endif
return 0;
}
위 코드를 컴파일 하면 컴파일은 되지만 당연히 "hello world" 는 찍히지 않습니다.
소스를 수정하지 않코 "hello world" 를 찍는 방법은

c:\>gcc -DB test.c -o test.exe


위와 같이 컴파일 후 test.exe 를 실행하면  "hello world" 가 찍힙니다; -_-
살다보니 define 걸때 이런경우도 있더라구요.~

저작자 표시
Posted by 창민짱 Trackback 0 Comment 0

파이썬 메일링 리스트를 살펴보다가 누가 Go PL에 대해서 글을 올렸더군요.

구글에서 발표한 언어구요.

공식사이트를 가보니 a systems programming language 라고 대문에 적혀있네요.

과연 어떤 언어인지.. 구글 개발팀에서 자바처럼 프로젝트 domain 용으로 사용하다가 공식 발표를 한건지.. 살펴보는중입니다.

공식사이트 발표동영상

Posted by 창민짱 Trackback 0 Comment 0

Posted by 창민짱 Trackback 0 Comment 0

&rest

2009/05/16 15:40 : Programming Language/LISP
CL-USER> (defun our-compose (&rest fns)
       (reverse fns))
OUR-COMPOSE
CL-USER> (our-compose #'list #'round #'sqrt)
(#<SYSTEM-FUNCTION SQRT> #<SYSTEM-FUNCTION ROUND> #<SYSTEM-FUNCTION LIST>)
CL-USER> (reverse '(1 2 3))
(3 2 1)
CL-USER> (reverse #'list #'sqrt)
; Evaluation aborted.
CL-USER> (reverse '(#'list #'sqrt))
(#'SQRT #'LIST)
CL-USER> (reverse '(list sqrt))
(SQRT LIST)
CL-USER>
Posted by 창민짱 Trackback 0 Comment 0
(destructuring-bind (x y z) (list 1 2 3)
(list :x x :y y :z z)) ==> (:X 1 :Y 2 :Z 3)

(destructuring-bind (x y z) (list 1 (list 2 20) 3)
(list :x x :y y :z z)) ==> (:X 1 :Y (2 20) :Z 3)

(destructuring-bind (x (y1 y2) z) (list 1 (list 2 20) 3)
(list :x x :y1 y1 :y2 y2 :z z)) ==> (:X 1 :Y1 2 :Y2 20 :Z 3)

(destructuring-bind (x (y1 &optional y2) z) (list 1 (list 2 20) 3)
(list :x x :y1 y1 :y2 y2 :z z)) ==> (:X 1 :Y1 2 :Y2 20 :Z 3)

(destructuring-bind (x (y1 &optional y2) z) (list 1 (list 2) 3)
(list :x x :y1 y1 :y2 y2 :z z)) ==> (:X 1 :Y1 2 :Y2 NIL :Z 3)

(destructuring-bind (&key x y z) (list :x 1 :y 2 :z 3)
(list :x x :y y :z z)) ==> (:X 1 :Y 2 :Z 3)

(destructuring-bind (&key x y z) (list :z 1 :y 2 :x 3)
(list :x x :y y :z z)) ==> (:X 3 :Y 2 :Z 1)

(destructuring-bind ((&key w x) &rest y) '((:w 3) a)
(list w x y))
(3 NIL (A))
&key 에 의해서 w 는 3 이되고
x 는 nil
y 는 a 지만 &rest 에 의해서 리스트화된다.

아래의 2개의 결과가 같다는것을 참고.

CL-USER> (destructuring-bind (x y . z) '(1 2 3)
    (list x y z))
(1 2 (3))

CL-USER> (destructuring-bind (x y &rest z) '(1 2 3)
    (list x y z))
(1 2 (3))


Posted by 창민짱 Trackback 0 Comment 0