Programming/lisp2013. 1. 11. 17:15
#으로 시작하는 매크로인데
공부하면서 접하게 되는건 function 을 대체하는 #' 정도?

2012/12/05 - [Programming/lisp] - lisp - #' 와 '

 In addition, the first character may not be '#' (non-terminating macro character), nor may the symbol have identical syntax with a numeric literal.  Uppercase and lowercase characters are not distinguished within symbol names because, by default, lowercase characters are mapped to uppercase on input.

Standard Non-Terminating Macro Characters
-----------------------------------------
#
[링크 : http://psg.com/~dlamkins/sl/chapter03-11.html]

#
 
This is a dispatching macro character. It reads an optional digit string and then one more character, and uses that character to select a function to run as a macro-character function.
The # character also happens to be a non-terminating macro character. This is completely independent of the fact that it is a dispatching macro character; it is a coincidence that the only standard dispatching macro character in Common Lisp is also the only standard non-terminating macro character.

See the next section for predefined # macro-character constructions.

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

Table 22-4: Standard # Macro Character Syntax
 
#!  undefined *                #<backspace>  signals error 
#"  undefined                  #<tab>        signals error 
##  reference to #= label      #<newline>    signals error 
#$  undefined                  #<linefeed>   signals error 
#%  undefined                  #<page>       signals error 
#&  undefined                  #<return>     signals error 
#'  function abbreviation      #<space>      signals error 
#(  simple vector              #+      read-time conditional 
#)  signals error              #-      read-time conditional 
#*  bit-vector                 #.      read-time evaluation 
#,  load-time evaluation       #/      undefined 
#0  used for infix arguments   #A, #a  array 
#1  used for infix arguments   #B, #b  binary rational 
#2  used for infix arguments   #C, #c  complex number 
#3  used for infix arguments   #D, #d  undefined 
#4  used for infix arguments   #E, #e  undefined 
#5  used for infix arguments   #F, #f  undefined 
#6  used for infix arguments   #G, #g  undefined 
#7  used for infix arguments   #H, #h  undefined 
#8  used for infix arguments   #I, #i  undefined 
#9  used for infix arguments   #J, #j  undefined 
#:  uninterned symbol          #K, #k  undefined 
#;  undefined                  #L, #l  undefined 
#<  signals error              #M, #m  undefined 
#=  label following object     #N, #n  undefined 
#>  undefined                  #O, #o  octal rational 
#?  undefined *                #P, #p  pathname 
#@  undefined                  #Q, #q  undefined 
#[  undefined *                #R, #r  radix-n rational 
#\  character object           #S, #s  structure 
#]  undefined *                #T, #t  undefined 
#^  undefined                  #U, #u  undefined 
#_  undefined                  #V, #v  undefined 
#`  undefined                  #W, #w  undefined 
#{  undefined *                #X, #x  hexadecimal rational 
#|  balanced comment           #Y, #y  undefined 
#}  undefined *                #Z, #z  undefined    
#~  undefined                  #<rubout> undefined
 

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

lisp 연관리스트  (0) 2013.01.14
lisp의 con cell 과 NIL  (0) 2013.01.14
만들면서 배우는 리스프 프로그래밍  (2) 2013.01.09
lisp 전역변수 / 지역변수  (0) 2013.01.09
lisp car / cdr  (0) 2013.01.03
Posted by 구차니
Programming/lisp2013. 1. 9. 22:37
아직 전부를 다읽은건 아니지만
대충 훑어 본바로서는 입문용으로 쓰기에는 약간 난이도가 있지만
리스프를 약간이라도 이해한 사람이라면 단시간에 높은 레벨에 까지 이를수 있을듯한 책이다.

2011년 11월 27일 초판이고, 3.5만원이라 조금 비싸지만
가지고 있을만한 가치가 있는 책이다.
(일단은 구립도서관에서 빌려왔지만 ^^;)

그나저나 누가 이걸 신청할걸까.. 구립도서관에서 자체적으로 구매한걸까?

+ 웹 서버 라던가 생명게임이라던가 조금 난이도 있는 내용들을 다루지만
다르게 말하면 이 책 한권에 웬만한 난이도는 이해할수 있는 내용이 담겨 있다는 것!


[링크 : http://www.yes24.com/24/goods/5968810]

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

lisp의 con cell 과 NIL  (0) 2013.01.14
lisp #  (0) 2013.01.11
lisp 전역변수 / 지역변수  (0) 2013.01.09
lisp car / cdr  (0) 2013.01.03
lisp 반복문  (0) 2012.12.31
Posted by 구차니
Programming/lisp2013. 1. 9. 21:43
define a parameter
(defparameter <sym> <val> [<comment>])

fsubr.

<sym> the symbol (will be marked special)
<val> the value
<comment>  optional comment string (ignored)
returns the value

define a variable
(defvar <sym> [<val> [<comment>]])

fsubr.  Variable only initialized if not previously defined.

<sym> the symbol (will be marked special)
<val> the initial value, or NIL if absent.
<comment>  optional comment string (ignored)
returns the current value

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



전역변수
(defparameter *var_name* value) 마지막에 정의된것으로 변경가능
(defvar *var_namevalue) 처음 정의된것으로 고정

> (defparameter *a* 1)
*a*
> *a*
1
> (defparameter *a* 2)
*a*
> *a*

> (defvar*a* 1)
*a*
> *a*
1> (defvar *a* 2)
*a*
> *a*
1

지역변수
(let ((variable_declarations)) (body)

> (let ((*a* 5)) (princ *a*))
5
5
> *a*
 

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

lisp #  (0) 2013.01.11
만들면서 배우는 리스프 프로그래밍  (2) 2013.01.09
lisp car / cdr  (0) 2013.01.03
lisp 반복문  (0) 2012.12.31
clisp  (0) 2012.12.29
Posted by 구차니
Programming/processing2013. 1. 8. 22:25
과동기에게 들었던 신기한(?) 언어
이두이노도 이녀석으로 IDE를 만들었던거 같아서 신기해 했는데
아무튼 컨셉은 비쥬얼라이즈 언어

[링크 : http://en.wikipedia.org/wiki/Processing_(programming_language)]
[링크 : http://processing.org/]

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

processing 실행  (0) 2014.01.12
processing (언어)  (0) 2012.05.04
Posted by 구차니
Programming/openMP2013. 1. 8. 09:08
OpenMP 처럼 패러럴 프로세싱관련 라이브러리로
Intel에서 제작하고 배포하는데 라이센스는 확인이 필요할듯

[링크 : http://goparallel.sourceforge.net/compiling-tbb-programs-and-examples-on-linux-ubuntu/
[링크 : http://software.intel.com/en-us/intel-tbb...] 30일 버전이나 구입인거 봐서는 free는 아닌듯
[링크 : http://threadingbuildingblocks.org/]

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

openMP 지시어  (0) 2013.03.16
visual studio express 2008에서는 openMP 공식 지원안해!  (0) 2013.03.16
openMP 문서들  (0) 2012.06.18
openmp for문 나누기  (0) 2012.06.18
libgomp 공식 사이트 / 문서  (0) 2012.06.10
Posted by 구차니
클로져라는 녀석이 있는데 먼가 좋다는데 좋은진 모르겠고 -_-
암튼, 함수언어라고 해야하나
함수에 함수를 넣고
함수 변수에 특정 변수를 넣어 함수를 생성해 내는 그런 기능을 클로져라고 하는데


머하는데 써먹지?

[링크 : https://developer.mozilla.org/ko/docs/JavaScript/Guide/Closures]

'Programming > javascript & HTML' 카테고리의 다른 글

jquery  (0) 2015.09.08
div 태그  (0) 2015.09.08
javascript - DOM inspector in Firefox  (0) 2010.08.19
HTML의 style="filter:filter_name()"  (0) 2010.08.06
javascript - Traversing an HTML table with JavaScript and DOM Interfaces  (0) 2010.08.02
Posted by 구차니
Programming/C++ STL2013. 1. 6. 23:28
템플릿을 이용하는건 제너릭 프로그래밍과 동일하지만
컴파일러에 조금더 의존을 해서, 최적화를 한다는데 자세한건 읽어봐야 할 듯

간략하게 한글 위키 내용을 요약하면,
factorial 같은 무거운 함수를 템플릿으로 작성하고
이걸 템플릿 메타 프로그래밍을 적용하면
factorial(N)에 대해서 컴파일러가 미리 처리해서
해당 값을 바로 리턴할수 있도록 컴파일 시간에 값을 정해버린다는 것.

엄청난 퍼포먼스 향상이 있을것으로 생각이 되지만...
컴파일러에 지극히 의존적이라 호환성이 떨어진다고 하니...

[링크 : http://ko.wikipedia.org/wiki/템플릿_메타프로그래밍]
[링크 : http://en.wikipedia.org/wiki/Template_metaprogramming]

[링크 : http://en.wikipedia.org/wiki/Generic_programming]

'Programming > C++ STL' 카테고리의 다른 글

C++ 첫걸음 *-_-*  (0) 2013.02.09
unsigned char -> int 변환 주의사항  (0) 2013.02.04
c++ template  (0) 2012.05.12
리눅스에서 c++ 컴파일시 strcpy / strcat 오류  (0) 2011.10.13
new / new[] / delete / delete[]  (4) 2010.09.16
Posted by 구차니
Programming/C Win32 MFC2013. 1. 6. 23:11
c언어 강좌를 하다가 윈도우 서버 프로그래머 분이 오셔서 이야기를 듣는데
이건 꼭! 내것으로 만들어야 겠다 싶은게 있어서 기록 (오유 i2kas 님)



if(idx == 0)
이라는 문구가 있을경우
idx = 0 으로 쳐도 문법적인 에러는 발생하지 않고
찾기가 상당히 어려운 버그중에 하나인데


if(0 == idx) 로 순서만 바꾸면 문법적으로는 아무런 하자가 없으면서도
== 를 잘못입력하여 = 로 입력했을시 
if(0 = idx)로 lvalue가 constant로 에러가 발생함으로 유용하게 논리에러를 잡아내는데 사용될수 있다.


오홍!!!! 

'Programming > C Win32 MFC' 카테고리의 다른 글

win32api - joystick 예제  (0) 2013.06.15
Windows IME  (0) 2013.02.14
c 변수범위 헤더  (0) 2012.07.02
엔디안 / endian  (2) 2012.06.14
localtime의 return값을 조심하세요  (2) 2012.06.12
Posted by 구차니
Programming/lisp2013. 1. 3. 21:25
난해한(!) 명령어중에 하나로 car / cdr이라는 lisp 명령어가 있다.
car은 first에 대응되며 list의 가장 처음 내용만 보여주고
cdr은 rest에 대응되며 list의 처음것을 제외한 내용을 보여준다.

1> (car '(1 2 3))
1                
1> (cdr '(1 2 3))
(2 3)
1> (rest '(1 2 3))
(2 3) 

return the car of a list node
(car <expr>)

May be used as a place form.

<expr> the list node
returns the CAR of the list node


return the cdr of a list node
(cdr <expr>)

May be used as a place form.

<expr> the list node
returns the CDR of the list node

all cxxr combinations
(cxxr <expr>)
all cxxxr combinations
(cxxxr <expr>)
all cxxxxr combinations
(cxxxxr <expr>)

May be used as place forms when common2.lsp loaded.

a synonym for car
(first <expr>)
a synonym for cadr
(second <expr>)
a synonym for caddr
(third <expr>)
a synonym for cadddr
(fourth <expr>)
fifth list element
(fifth <expr>)
sixth list element
(sixth <expr>)
seventh list element
(seventh <expr>)
eighth list element
(eighth <expr>)
ninth list element
(ninth <expr>)
tenth list element
(tenth <expr>)
a synonym for cdr
(rest <expr>)

May be used as place forms when common2.lsp loaded.  fifth through tenth defined in common2.lsp. 

Etymology

Lisp was originally implemented on the IBM 704 computer, in the late 1950s. The 704 hardware had special support for splitting a 36-bit machine word into four parts, an "address part" and "decrement part" of 15 bits each and a "prefix part" and "tag part" of three bits each.

Precursors to Lisp included functions:

  • car (short for "Contents of the Address part of Register number"),
  • cdr ("Contents of the Decrement part of Register number"),
  • cpr ("Contents of the Prefix part of Register number"), and
  • ctr ("Contents of the Tag part of Register number"),

each of which took a machine address as an argument, loaded the corresponding word from memory, and extracted the appropriate bits.

http://en.wikipedia.org/wiki/CAR_and_CDR]

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

만들면서 배우는 리스프 프로그래밍  (2) 2013.01.09
lisp 전역변수 / 지역변수  (0) 2013.01.09
lisp 반복문  (0) 2012.12.31
clisp  (0) 2012.12.29
lisp 기본함수  (0) 2012.12.29
Posted by 구차니
파이썬 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 구차니