'잡동사니'에 해당되는 글 12954건

  1. 2013.01.17 lisp i/o
  2. 2013.01.17 lisp file i/o
  3. 2013.01.16 lisp savefun / load
  4. 2013.01.16 xlisp
  5. 2013.01.15 wkw광명체 광명납작체? 14
  6. 2013.01.15 rpm2cpio를 이용한 rpm 압축해제하기
  7. 2013.01.14 graphviz / neato
  8. 2013.01.14 lisp 연관리스트
  9. 2013.01.14 lisp의 con cell 과 NIL
  10. 2013.01.13 2013 CES 관련 글들을 보며 느낀 추세 4
Programming/lisp2013. 1. 17. 18:53
c언어로 치면 printf() 와 scanf()인데
어짜피 stream 이기 때문에 file을 열어 놓은 스트림을
read나 printf 계열 함수에 연결해서 써도 문제는 없을듯 하니
c언어 보다 더욱 범용성이 있어 보인다고 해야하나
c보다는 리눅스의 FMIO(File Mapped IO)에 가까운 느낌이라고 해야하나?

read an expression
(read [<stream> [<eofp> [<eof> [<rflag>]]]])

print an expression on a new line
(print <expr> [<stream>])

print an expression
(prin1 <expr> [<stream>])

print an expression without quoting
(princ <expr> [<stream>])

pretty print an expression
(pprint <expr> [<stream>])

print to a string
(prin1-to-string <expr>)
(princ-to-string <expr>) 

> (print "test string") 
"test string"           
"test string"           
> (print '(test string))
(test string)           
(test string)            
 
> (princ "test string") 
test string             
"test string"           
> (princ '(test string))
(test string)           
(test string)           

> (prin1 "test string") 
"test string"           
"test string"           
> (prin1 '(test string))
(test string)           
(test string)           

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

lisp backquote / 유사인용  (0) 2013.01.19
lisp rem, mod  (0) 2013.01.17
lisp file i/o  (0) 2013.01.17
lisp savefun / load  (0) 2013.01.16
xlisp  (0) 2013.01.16
Posted by 구차니
Programming/lisp2013. 1. 17. 18:50
C언어로 치면 feopn() / fclose() / fseek() / fread()

xlisp.exe의 경로에 생성됨.
ubuntu의 clisp는 실행된 "현재경로"에 생성됨.
> (setq out-stream (open "my-temp-file"))                    
error: file does not exist - "my-temp-file"                  
1> (setq out-stream (open "my-temp-file" :direction :output))
#<Character-Output-Stream 4:"my-temp-file">                  
1> (close out-stream)                                        
t                                                            
1> (setq out-stream (open "my-temp-file"))                   
#<Character-Input-Stream 4:"my-temp-file">                   
1> (close out-stream)                                        
t                                                            
1>                                                            

[링크 : http://psg.com/~dlamkins/sl/chapter03-11.html]

open a file stream
(open <fname> &key :direction :element-type :if-exists :if-does-not-exist)

close a file stream
(close <stream>)

check for existance of a file
(probe-file <fname>)

delete a file
(delete-file <fname>)

get length of file
(file-length <stream>)

get or set file position
(file-position <stream> [<expr>])

read a byte from a stream
(read-byte <stream>[<eofp>[<eof>]])

write a byte to a stream
(write-byte <byte> <stream>)

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

lisp rem, mod  (0) 2013.01.17
lisp i/o  (0) 2013.01.17
lisp savefun / load  (0) 2013.01.16
xlisp  (0) 2013.01.16
lisp 연관리스트  (0) 2013.01.14
Posted by 구차니
Programming/lisp2013. 1. 16. 22:05
xlisp의 경우 실행파일 위치가 XLPATH 인듯 하고
해당 위치에 자동으로 *.lsp 파일을 읽거나 저장한다.

load a source file
(load <fname> &key :verbose :print)

An implicit errset exists in this function so that if error occurs during loading, and *breakenable* is NIL, then the error message will be printed and NIL will be returned.  The OS environmental variable XLPATH is used as a search path for files in this function.  If the filename does not contain path separators ('/' for UNIX, and either '/' or '\' for MS-DOS) and XLPATH is defined, then each pathname in XLPATH is tried in turn until a matching file is found.  If no file is found, then one last attempt is made in the current directory.  The pathnames are separated by either a space or semicolon, and a trailing path separator character is optional.

<fname> the filename string, symbol, or a file stream created with open. The extension "lsp" is assumed.
:verbose the verbose flag (default is T)
:print the print flag (default is NIL)
returns T if successful, else NIL 

save function to a file
(savefun <fcn>)

defined in init.lsp

<fcn> function name (saves it to file of same name, with extension ".lsp")
returns T if successful  


사용예
> (defun add (a b) (+ a b))
add                        
> (savefun add)            
"ADD.lsp"                   

> (load "add")        
; loading "add.lsp"    
t                      
> (add 2 3)           
5                      
> #'add               
#<Closure-ADD: #9b92b0> 

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

lisp i/o  (0) 2013.01.17
lisp file i/o  (0) 2013.01.17
xlisp  (0) 2013.01.16
lisp 연관리스트  (0) 2013.01.14
lisp의 con cell 과 NIL  (0) 2013.01.14
Posted by 구차니
Programming/lisp2013. 1. 16. 21:44
xlisp에서 하다보면

1>
2>

이런식으로 숫자가 에러가 날때마다 늘어나는데
무언지 어떻게 줄이는지 몰라서 찾다보니
xlisp 도움말에 다음과 같은 내용이 있었다.

ctrl-c나 ctrl-g를 통해서 한단계 위로 간다고 해도
setq 등을 통해서 선언한 변수는 그대로 살아있다.

XLISP then issues the following prompt (unless standard input has been redirected):

>

This indicates that XLISP is waiting for an expression to be typed.  If the current package is other than user, the the package name is printed before the ">".

When a complete expression has been entered, XLISP attempts to evaluate that expression. If the expression evaluates successfully, XLISP prints the result and then returns for another expression.

The following control characters can be used while XLISP is waiting for input:


Backspace delete last character
Del delete last character
tab tabs over (treated as space by XLISP reader)
ctrl-C goto top level
ctrl-G cleanup and return one level
ctrl-Z end of file (returns one level or exits program)
ctrl-P proceed (continue)
ctrl-T print information 

> (_)                                           
error: unbound function - _                     
if continued: try evaluating symbol again       
1>                                              ctrl-P
[ continue from break loop ]                    
error: unbound function - _                     
if continued: try evaluating symbol again       
1>                                              ctrl-T
[ Free: 7422, Total: 152117, GC calls: 2,       
  Edepth: 31183, Adepth 41579, Sdepth: 999588 ] 
                                                 ctrl-G
[ back to previous break level ]                
>                                                

> (_)                                     
error: unbound function - _               
if continued: try evaluating symbol again 
1>                                             ctrl-C 
[ back to top level ]
>                                          

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

lisp file i/o  (0) 2013.01.17
lisp savefun / load  (0) 2013.01.16
lisp 연관리스트  (0) 2013.01.14
lisp의 con cell 과 NIL  (0) 2013.01.14
lisp #  (0) 2013.01.11
Posted by 구차니
항상 그러하듯 뜬금없이 터지는 이넘의 북한폰트 이야기는 참 징글징글 한데
다르게 이야기 하면, 태어날때 부터 장님인 사람에게 저게 코끼리다! 라는 소리를 들으면
어떤 생각을 할 수 있을까?

저게 설명 광명체라고 하더라도
그걸 인지하려면 최소한 그러한 폰트가 있다는 것을 알아야 하고
그러한 폰트라는걸 증명하기 위해서는 그러한 폰트를 소유하고 있어야 한다.

다르게 말하면 그걸 알아서 말한다고 하는것 자체가
그러한 폰트의 존재를 알고 있었다는 사실의 반증이라는 것.

일반인들에게 광명체를 아세요? 라고 물으면
그게 먼데요? 라고 하지 북한 폰트!!!! 라고 대답할수 있는 사람이 이번 사건이 없었다면 얼마나 알았을까?


[링크 : http://www.dailian.co.kr/%5C./news/news_view.htm?id=322360.]


[링크: http://www.ilbe.com/642757145] << 내가 이동네 링크를 걸어놔야 하나?!

그나저나 wkw광명 이라던가 영어라 kwang ttf 이런식으로 구글링해도 안나오는것 봐서는
정말 북한 내부 망을 통해서 받았거나, 다른 루트로 얻은거 같은데

붉은별 OS의 경우에도
"광명체" 이지 "wkw광명"이나 "광명납작체가 아니고
"천리마", "청봉", "광명", "붓글" 네가지의 폰트가 들어있다고 한다.
그나마 토런토로 붉은별 OS를 받을수 있어서 일반인이 접근 가능한게 광명체 정도라면

도.대.체
wkw광명 이라는 폰트와 광명납작체 라던가 이런 폰트를
이 의혹을 제기한 인간들은 어떻게 알아내고 획득했을까? 


[링크 : http://kldp.org/node/117684]
Posted by 구차니
Linux/Ubuntu2013. 1. 15. 09:18

$ sudo apt-get install rpm2cpio 
$ rpm2cpio [rpm 파일 이름] | cpio -idv
[링크 : http://bs-secretroom.blogspot.kr/2012/10/rpm.html

2009/11/04 - [Linux] - 설치하지 않은 rpm에 포함된 파일의 내용 보기

Posted by 구차니
svn 에서 revision tree를 그리던 녀석인데
lisp 공부하다 보니 이 라이브러리가 의외로 막강하고 단순하다는 사실에 깜짝 놀라는중

$ sudo apt-get install graphviz
$ cat test.dot
digraph {
        a->b;
}
$ neato -Tpng -O test.dot 

 
 

'프로그램 사용 > graphviz' 카테고리의 다른 글

graphviz 출력 포맷  (0) 2013.02.14
Posted by 구차니
Programming/lisp2013. 1. 14. 23:15
associative memory의 줄임말이려나?
아무튼 굳이 NIL로 끝나지 않는 리스트로 하지 않아도 상관은 없지만
(assoc '찾을값 찾을목록)
식으로 사용하면 된다. 하지만 linked list를 이용해서 검색하는 것으로 
성능상의 하락이 있으므로 해싱을 이용하는 등, 다른방법을 강구하는 것이 좋다고 한다.

(setq tt '((bill . double)
            (lisa . coffee)
            (john . latte)))
((BILL . DOUBLE) (LISA . COFFEE) (JOHN . LATTE))
> (assoc 'lisa tt)
(LIST . COFFEE)

(setq ta '((bill double)
            (lisa coffee)
            (john latte)))
((BILL DOUBLE) (LISA COFFEE) (JOHN LATTE))
> (assoc 'lisa ta)
(LIST . COFFEE)


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

lisp savefun / load  (0) 2013.01.16
xlisp  (0) 2013.01.16
lisp의 con cell 과 NIL  (0) 2013.01.14
lisp #  (0) 2013.01.11
만들면서 배우는 리스프 프로그래밍  (2) 2013.01.09
Posted by 구차니
Programming/lisp2013. 1. 14. 23:04
lisp는 이름 그대로 LISt Processing으로
LIST를 기반으로 작업하게 된다.

자료구조에서 배우던 linked list를 이용해서 자료를 저장하게 되는데
C언어에서 항상 문자열은 0x00 혹은 \0으로 끝맺듯
list 도 마지막은 NIL로 표기를 하게 된다.

아래는 NIL로 끝나지 않는 리스트와 NIL로 끝나는 리스트를 만든것으로
. 은 NIL로 끝나지 않는 리스트를 의미하게 된다. 
[1]> '(1 . 2)
(1 . 2)
[2]> (cons 1 2)
(1 . 2)
[3]> '(1 2)
(1 2)
[4]> (cons 1 (cons 2 NIL))
(1 2)
 

last는 안되고 아무튼 rest는 남은걸 나타내는 것이기 때문에 가능한 것 같은데
(1 2)에 대한 rest 두번은 NIL이 나오고
(1 . 2) 에 대한 rest 두번은 존재하지 않기 때문에 에러가 발생하게 된다.
[6]> (rest (rest '(1 2)))
NIL
[6]> (rest (rest '(1 . 2)))

*** - REST: 2 is not a list
The following restarts are available:
ABORT          :R1      Abort debug loop
ABORT          :R2      Abort main loop
[7]> (rest '(1 . 2))
2


그나저나.. 책에 의하면 아래와 같이 뜬다고 하는데
> (defparameter foo '(1 2 3))
FOO
> (setf (cdddr foo) foo)
#1=(1 2 3 . #1#) 

내가 사용하는 clisp 2.49에서는 뻗어버린다 -_-
  i i i i i i i       ooooo    o        ooooooo   ooooo   ooooo
  I I I I I I I      8     8   8           8     8     o  8    8
  I  \ `+' /  I      8         8           8     8        8    8
   \  `-+-'  /       8         8           8      ooooo   8oooo
    `-__|__-'        8         8           8           8  8
        |            8     o   8           8     o     8  8
  ------+------       ooooo    8oooooo  ooo8ooo   ooooo   8

Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/>

Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2010

Type :h and hit Enter for context help.
 
[12]> (defparameter foo '(1 2 3))
FOO
[13]> (setf (cdddr foo) foo)
^C
*** - Ctrl-C: User break
The following restarts are available:

*** - handle_fault error2 ! address = 0x68457000 not in [0x65de5658,0x68457000) !
SIGSEGV cannot be cured. Fault address = 0x68457000.
GC count: 47
Space collected by GC: 0 355764032
Run time: 40 918556
Real time: 164 950564
GC time: 23 933489
Permanently allocated: 94080 bytes.
Currently in use: 1194294496 bytes.
Free space: 12 bytes. 


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

xlisp  (0) 2013.01.16
lisp 연관리스트  (0) 2013.01.14
lisp #  (0) 2013.01.11
만들면서 배우는 리스프 프로그래밍  (2) 2013.01.09
lisp 전역변수 / 지역변수  (0) 2013.01.09
Posted by 구차니
개소리 왈왈/컴퓨터2013. 1. 13. 21:26
영상 : 4K / 플렉서블 LCD / 대형 OLED / 실시간 HDR(60fps)
원래 화면은 큰게 아름답도 좋... (어?)
4K는 영화관에서 많이 쓰인다는데 현실로 오기는 아직 멀고
QHD 혹은 UHD의 경우에도 일반에 도입이 잘 안된 상황이라(시장이 아니라 현실) 4K는 갈길이 멀다는 기분.

접히는 LCD는 안정성의 문제나 양산성의 문제로 곡면 디스플레이로 처음에는 나오다가
나중에는 돌돌돌 말아 다니는 녀석이 나오겠지만
배터리라던가 이런것 접히지 않으니(아직은) 디자인의 제한으로 본체는 배터리 처럼 원통형 길게
액정은 돌돌돌 말아서 다니는 이런게 추세가 될듯

그리고 소니에서 크고 아름다운 OLED 했다가 윈도우가 블루스크린 나와서 욕먹었지만
그래도 큰게 좋다는거 ㅋㅋㅋ

그리고 디카등을 보면 HDR이나 WDR 실시간 지원등이 보이는데 결론은 60fps 처리란거.
결국 이건 CCTV쪽으로도 적용을 빨리 해야 할 듯..




네트워크 : LTE 원칩 / 802.11ac
802.11n도 나온지 오래되었지만 솔찍히 실생활에서 150Mbps도 보기 힘든게 현실이라..
LTE에 이론적으로도 많이 밀리게 되는게 현재 상태인데
802.11ac 가 나온다고 해도 빠르게 교체되어서 사용하게 되진 않을것 같고
현재 추세라면 LTE 보다 느린 wireless LAN이 인식이 될 기분..




AP : 컴패니온 AP 내장
CPU들이 터보부스터 등으로 코어별 클럭 조절 기능이 강화되면서 SMP가 아닌 AMP(Asymmetric MP)로 가는게 추세.
모바일은 전원 문제가 크므로 저전력 cpu로 부하가 적을경우 버티다가 
부하가 걸리면 고성능 코어로 대체해서 사용하는 개념으로 좋아 보이긴 하는데..
문제는 멀티코어도 제대로 못쓰는 상황에서 얼마나 효용이 클지? 라는 점과
x86에서도 이러한 기능을 추가하게 될것인가? 라는점.
atom 시리즈가 더더욱 저전력으로 모바일용으로 나오게 되려면 이런 기능이 나오려나?



[링크 : http://ko.wikipedia.org/wiki/IEEE_802.11ac]

'개소리 왈왈 > 컴퓨터' 카테고리의 다른 글

Geforce GTX650 지름  (0) 2013.02.13
지름신 목록  (2) 2013.02.11
TC1100 무선랜 교체!!  (0) 2012.12.20
장비 분출목록  (0) 2012.12.01
소니 VAIO 노트북 BIOS 암호 풀기  (0) 2012.11.16
Posted by 구차니