'Programming'에 해당되는 글 1762건

  1. 2013.01.02 python2 vs python3
  2. 2012.12.31 lisp 반복문
  3. 2012.12.29 clisp
  4. 2012.12.29 lisp 기본함수
  5. 2012.12.29 xlisp-plus 3.05
  6. 2012.12.25 ARToolKit / openVRML
  7. 2012.12.14 lisp vector
  8. 2012.12.11 lisp atom
  9. 2012.12.06 lisp tutorial
  10. 2012.12.05 lisp - #' 와 '
파이썬 2.7과 파이썬 3.3 두가지 버전이 있어서 무슨 차이가 있나 찾아보니
2.7이후로는 업데이트도 하지 않을 것이기에 3.3을 쓰라고 되어 있다.

2.x에서 3.x으로 이전하게 된 이유가
과거의 잘못 구현된 부분을 바로잡기 위함이기에
5년 정도의 이전기간을 고려하고 있다고 하는데
다르게 말하면 한동안 2.7을 사용해야만 하고
나중에 3.x대로 이전을 반드시 해야 하지만 그동안 언어가 살아있을지도 조금 의문이 되는 상황...

[링크 : http://wiki.python.org/moin/Python2orPython3]
[링크 : http://docs.python.org/3/whatsnew/3.0.html]

'Programming > python(파이썬)' 카테고리의 다른 글

python smtplib의 신비..?  (0) 2016.12.30
python이 인기라는데..  (0) 2014.03.19
PyOpenGL  (0) 2011.10.04
python 3.2.2 64bit 버전 설치  (4) 2011.09.13
python 버전 골라서 실행하기  (0) 2011.05.08
Posted by 구차니
Programming/lisp2012. 12. 31. 21:35
c의 for나 while과 비슷한 반복문 키워드로
loop, dotimes, dolist 등이 있다.

(let ((<var1> <init1>) (<var2> <init2>) …)
<body> )

– Declares local variables.  It is best to declare variables before using them.

(dotimes (<counter> <limit> <result>)
<body>)
(let ((sum 0))
    (dotimes (i 10 sum) (setq sum (+ sum i))) ) => 45
 
[링크 : http://logic.stanford.edu/classes/cs157/2004/programming/lisp.pdf

xlisp 설명서 발췌
Looping Constructs

basic looping form
(loop <expr>...)

fsubr

<expr> the body of the loop
returns never returns (must use non-local exit, such as return)



general looping form
(do (<binding>...) (<texpr> <rexpr>...) <expr>...)
(do* (<binding>...) (<texpr> <rexpr>...) <expr>...)

fsubr. do binds simultaneously, do* binds sequentially

<binding> the variable bindings each of which is either:

1) a symbol (which is initialized to NIL)
2) a list of the form: (<sym> <init> [<step>])

where:
<sym> is the symbol to bind
<init> the initial value of the symbol
<step> a step expression

<texpr> the termination test expression
<rexpr> result expressions (the default is NIL)
<expr> the body of the loop (treated like an implicit prog)
returns the value of the last result expression



loop through a list
(dolist (<sym> <expr> [<rexpr>]) <expr>...)

fsubr

<sym> the symbol to bind to each list element
<expr> the list expression
<rexpr> the result expression (the default is NIL)
<expr> the body of the loop (treated like an implicit prog)
returns the result expression



loop from zero to n-1
(dotimes (<sym> <expr> [<rexpr>]) <expr>...)

fsubr

<sym> the symbol to bind to each value from 0 to n-1
<expr> the number of times to loop (a fixnum)
<rexpr> the result expression (the default is NIL)
<expr> the body of the loop (treated like an implicit prog)
returns the result expression 

'Programming > lisp' 카테고리의 다른 글

lisp 전역변수 / 지역변수  (0) 2013.01.09
lisp car / cdr  (0) 2013.01.03
clisp  (0) 2012.12.29
lisp 기본함수  (0) 2012.12.29
xlisp-plus 3.05  (0) 2012.12.29
Posted by 구차니
Programming/lisp2012. 12. 29. 13:19
윈도우용은 cygwin으로 써야하는군하 -_-

[링크 : http://www.clisp.org/]

'Programming > lisp' 카테고리의 다른 글

lisp car / cdr  (0) 2013.01.03
lisp 반복문  (0) 2012.12.31
lisp 기본함수  (0) 2012.12.29
xlisp-plus 3.05  (0) 2012.12.29
lisp vector  (0) 2012.12.14
Posted by 구차니
Programming/lisp2012. 12. 29. 13:02
xlisp 도움말 발췌

Symbol Functions


set the global value of a symbol
(set <sym> <expr>)
You can also use (setf (symbol-value <sym>) <expr>)
<sym> the symbol being set
<expr> the new value
returns the new value


set the value of a symbol
(setq [<sym> <expr>]...)
fsubr. You can also use (setf <sym> <expr>)
<sym> the symbol being set (quoted)
<expr> the new value
returns the last new value or NIL if no arguments
 

define a function
(defun <sym> <fargs> <expr>...)
define a macro
(defmacro <sym> <fargs> <expr>...)
fsubr
<sym> symbol being defined (quoted)
<fargs> formal argument list (lambda list) (quoted)
<expr> expressions constituting the body of the function (quoted)
returns the function symbol


---
> (defun prt () '(be))                    
prt                                       
> prt                                     
error: unbound variable - prt             
if continued: try evaluating symbol again 
1> (prt)                                  
(be)                                      
 
1> (defun add (a b) (+ a b))             
add                                      
1> ( add 2 4)                            
6                                        
1> add                                   
error: unbound variable - add            
if continued: try evaluating symbol again
2> (add)                                 
error: too few arguments                 

'Programming > lisp' 카테고리의 다른 글

lisp 반복문  (0) 2012.12.31
clisp  (0) 2012.12.29
xlisp-plus 3.05  (0) 2012.12.29
lisp vector  (0) 2012.12.14
lisp atom  (0) 2012.12.11
Posted by 구차니
Programming/lisp2012. 12. 29. 00:07
1999년 이후로 업뎃안하다가 macosx와 64bit 지원으로 인해
3.04에서 3.05로 업그레이드 된 듯.

xlisp의 문서(함수목록)


[링크 : http://www.almy.us/xlisp.html]
[링크 : http://en.wikipedia.org/wiki/XLISP]

'Programming > lisp' 카테고리의 다른 글

clisp  (0) 2012.12.29
lisp 기본함수  (0) 2012.12.29
lisp vector  (0) 2012.12.14
lisp atom  (0) 2012.12.11
lisp tutorial  (0) 2012.12.06
Posted by 구차니
Programming2012. 12. 25. 22:22
오홍~ 링크만 일단 투척
나중에 AR 관련 필요할때 써먹어 봐야할듯

[링크 : http://www.hitl.washington.edu/artoolkit/]
[링크 : http://openvrml.org/index

'Programming' 카테고리의 다른 글

swift 문법(함수/변수)  (0) 2014.06.08
apple 차세대 언어 swift  (0) 2014.06.03
윤년 계산하기  (2) 2012.05.21
TBB/IPP  (2) 2012.02.12
프로그래밍 언어에 대한 생각  (2) 2012.01.25
Posted by 구차니
Programming/lisp2012. 12. 14. 07:37
lisp는 기본적으로 list로 하는데
list의 경우 linked list로 내부적으로 구현하기 때문에 아무래도 순차적으로 이동할때 오버헤드가 걸리는데
array에서 파생된 vector는 constant time에 접근이 가능하다고 한다.

 One-dimensional arrays are called vectors in Common Lisp and constitute the type vector (which is therefore a subtype of array). Vectors and lists are collectively considered to be sequences. They differ in that any component of a one-dimensional array can be accessed in constant time, whereas the average component access time for a list is linear in the length of the list; on the other hand, adding a new element to the front of a list takes constant time, whereas the same operation on an array takes time linear in the length of the array. 

[링크 : http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node30.html]

'Programming > lisp' 카테고리의 다른 글

lisp 기본함수  (0) 2012.12.29
xlisp-plus 3.05  (0) 2012.12.29
lisp atom  (0) 2012.12.11
lisp tutorial  (0) 2012.12.06
lisp - #' 와 '  (0) 2012.12.05
Posted by 구차니
Programming/lisp2012. 12. 11. 07:46
의미를 지니는 최소단위
파서로 치면 token

[링크 : http://nostoc.stanford.edu/jeff/llisp/4.html]

'Programming > lisp' 카테고리의 다른 글

xlisp-plus 3.05  (0) 2012.12.29
lisp vector  (0) 2012.12.14
lisp tutorial  (0) 2012.12.06
lisp - #' 와 '  (0) 2012.12.05
클로져  (0) 2012.12.03
Posted by 구차니
Programming/lisp2012. 12. 6. 18:58
lisp 강의자료나 예제를 찾다가 발견
이 내용을 lisp 처음공부할때 보았더라면 이해를 했을텐데....

[링크 : http://www2.cs.sfu.ca/CourseCentral/310/pwfong/Lisp/]
[링크 : http://www.cs.sfu.ca/CourseCentral/310/pwfong/Lisp/1/tutorial1.html]

'Programming > lisp' 카테고리의 다른 글

lisp vector  (0) 2012.12.14
lisp atom  (0) 2012.12.11
lisp - #' 와 '  (0) 2012.12.05
클로져  (0) 2012.12.03
lisp는 리스트지 prefix 표기법이 아니다  (0) 2012.11.19
Posted by 구차니
Programming/lisp2012. 12. 5. 23:18
'는 quote(인용)인데
함수적 언어인 lisp에서 함수를 쓰지 않고 list나 atom을 만드는데 사용한다.
> (quote a)
A
> 'a
A
> '(a)
(A) 
> (quote (a))
(A) 

>'(+ 1 2)
(+ 1 2)

위의 예제와 같이 (quote val)과 'val은 동일하며 atom을 나타낼때 사용된다.
atom으로 쓰려면 'val
list로 쓰려면 '(val)
로 사용하면 된다. 물론 함수역시 list의 atom으로서 인식이 되어질수 있다.



#'는 lisp 문서를 보다가 찾게 된 녀석인데
#' 는 (function val)과 같은 의미이고
함수 포인터라고 하기도 모호하고 아무튼.. 아직은 이해가 잘 안되는 녀석..
APPLY is also a Lisp primitive function.
APPLY takes a function and a list of objects as input. It invokes the specified function with those objects as its inputs.  The first argument to APPLY should be quoted with #’ rather than an ordinary quote; #’ is the proper way to quote functions supplied as inputs to other functions.  This will be explained in more detail in Chapter 7.
(apply #'+ '(2 3)) ⇒ 5
(apply #’equal '(12 17)) ⇒ nil 

The #’ (or ‘‘sharp quote’’) notation is the correct way to quote a function in Common Lisp.  If you want to see what the function CONS looks like in your implementation, try the following example in your Lisp:
> (setf fn #’cons)
#<Compiled-function CONS {6041410}>
> fn
#<Compiled-function CONS {6041410}>
> (type-of fn)
COMPILED-FUNCTION
> (funcall fn ’c ’d)
(C . D) 

> #'+
#<SYSTEM-FUNCTION +> 

> (function +)
#<SYSTEM-FUNCTION +> 

---2012.12.11

#는 벡터라고 한다.
[링크 : http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node30.html]

'Programming > lisp' 카테고리의 다른 글

lisp atom  (0) 2012.12.11
lisp tutorial  (0) 2012.12.06
클로져  (0) 2012.12.03
lisp는 리스트지 prefix 표기법이 아니다  (0) 2012.11.19
lisp 관련 책  (0) 2012.01.25
Posted by 구차니