SlideShare a Scribd company logo
1 of 42
Download to read offline
SICP
2017/05/26
SICP
SICP
SICP
SICP
:
SICP
MIT
Structure and Interpretation of Computer
Programs ( :
)
Scheme
SCHEME
LISP
1998 `R5RS` 50
(Gauche, Racket, etc.)
Gauche
SICP - GAUCHE
# macOS, homebrewを想定
# Gaucheのインストール
```
brew install gosh
brew install rlwrap # いれておくと便利
```
# slibのインストール(`trace`のため)
```
curl -O 'http://groups.csail.mit.edu/mac/ftpdir/scm/slib-3b5.zip'
unzip slib-3b5.zip
mv slib /usr/local
cd /usr/local/slib
./configure
make
sudo make install
```
SCHEME HELLO WORLD
$ echo '(print "Hello World!")' | gosh
Hello World!
SICP -VIM
vim `:!gosh %`
`NeoBundle 'thinca/vim-quickrun'`
`silent! map <Space>q <Plug>(quickrun)` - <Space>q
`NeoBundle 'tpope/vim-surround'`
S
`NeoBundle ‘vim-scripts/vim-niji'`
`NeoBundle 'haruyama/vim-matchopen'`
TRACE :
; fib.scm
(use slib)
(require 'trace)
(define (fib n)
(cond ((= n 0) 0)
((= n 1) 1)
(else (+ (fib (- n 1))
(fib (- n 2))))))
(trace fib)
(fib 3)
; CALL fib 3
; CALL fib 2
; CALL fib 1
; RETN fib 1
; CALL fib 0
; RETN fib 0
; RETN fib 1
; CALL fib 1
; RETN fib 1
; RETN fib 2
SICP
https://sicp.connpass.com/
(http://sicp.iijlab.net/fulltext/xfore.html) HTML
7
SICP 4
https://web.archive.org/web/20150104041426/http://oss.timedia.co.jp/show/SICP/Answer%20Book
Excersize 3.26 ( )
3
http://labs.timedia.co.jp/2014/11/reading-sicp-3.22-3.23.html
Exersise 3.22 Exersise 3.55 ( )
SICP
(lambda )
LISP ( )
SICP
1
LISP(Scheme) lambda
2
( Huffman etc)
3 .
3.4.4 ←
4 - Scheme Scheme
5 - Scheme
3.3.4
(wires)
(function boxes)
(event-driven simulation)
output = !(A) output = A || B output = A && B
. (HALF-ADDER)
2 (A B)
S: (sum)
C: (carry)
(D E: )
. (HALF-ADDER)
A B S C
0 0 0 0
1 0 1 0
0 1 1 0
1 1 0 1
(define a (make-wire))
(define b (make-wire))
(define c (make-wire))
(define d (make-wire))
(define e (make-wire))
(define s (make-wire))
(or-gate a b d)
(and-gate a b c)
(inverter c e)
(and-gate d e s)
. (HALF-ADDER)
(define (half-adder a b s c)
(let ((d (make-wire))
(e (make-wire)))
(or-gate a b d)
(and-gate a b c)
(inverter c e)
(and-gate d e s)
'ok))
. ( )
: (FULL-ADDER)
S:
Cout:
: (FULL-ADDER)
A B CI S CO
0 0 0 0 0
1 0 0 1 0
0 1 0 1 0
1 1 0 0 1
0 0 1 1 0
1 0 1 0 1
0 1 1 0 1
1 1 1 1 1
(define (full-adder a b c-in sum c-out)
(let ((s (make-wire))
(c1 (make-wire))
(c2 (make-wire)))
(half-adder b c-in s c1)
(half-adder a s sum c2)
(or-gate c1 c2 c-out)
'ok))
: (FULL-ADDER)
(get-signal ⟨wire⟩)
(set-signal! ⟨wire⟩ ⟨new value⟩)
(add-action! ⟨wire⟩ ⟨ ⟩)
.
(after-delay ⟨ ⟩ ⟨ ⟩)
add-action!
(define (inverter input output)
(define (invert-input)
(let ((new-value (logical-not (get-signal input))))
(after-delay inverter-delay ;遅延時間(定数)
(lambda ()
(set-signal! output new-value)))))
(add-action! input invert-input)
'ok)
-
(define (logical-not s)
(cond ((= s 0) 1)
((= s 1) 0)
(else (error "Invalid signal" s))))
(define (and-gate a1 a2 output)
(define (and-action-procedure)
(let ((new-value
(logical-and (get-signal a1) (get-signal a2))))
(after-delay and-gate-delay ;遅延時間(定数)
(lambda ()
(set-signal! output new-value)))))
(add-action! a1 and-action-procedure)
(add-action! a2 and-action-procedure)
'ok)
-
(define (logical-and s1 s2)
(cond ((and (= s1 0) (= s2 0)) 0)
((and (= s1 0) (= s2 1)) 0)
((and (= s1 1) (= s2 0)) 0)
((and (= s1 1) (= s2 1)) 1)
(else (error "Invalid signal" s1 s2))))
3.28
“ .
or-gate , and-gate . ”
3.28
“ .
or-gate , and-gate . ”
(define (or-gate a1 a2 output)
(define (or-action-procedure)
(let ((new-value
(logical-or (get-signal a1) (get-signal a2))))
(after-delay or-gate-delay
(lambda () (set-signal! output new-value)))))
(add-action! a1 or-action-procedure)
(add-action! a2 or-action-procedure)
'ok)
(define (logical-or s1 s2)
(cond ((and (= s1 0) (= s2 0)) 0)
((and (= s1 0) (= s2 1)) 1)
((and (= s1 1) (= s2 0)) 1)
((and (= s1 1) (= s2 1)) 1)
(else (error "Invalid signal" s1 s2))))
3.29 ( )
“ , ,
. or-gate .
and-gate-delay inverter-delay .”
3.29 ( )
“ , ,
. or-gate .
and-gate-delay inverter-delay .”
3.29 ( )
“ , ,
. or-gate .
and-gate-delay inverter-delay .”
A1 A2 A1 && A2 !A1 && !A2 !(!A1 && !A2)
0 0 0 1 0
1 0 0 0 1
0 1 0 0 1
1 1 1 0 1
3.29 ( )
“ , ,
. or-gate .
and-gate-delay inverter-delay .”
(define (or-gate a1 a2 output)
(let ((i1 (make-wire))
(i2 (make-wire))
(a (make-wire)))
(inverter a1 i1)
(inverter a2 i2)
(and-gate i1 i2 a)
(inverter a output))
'ok)
3.29 ( )
“ , ,
. or-gate .
and-gate-delay inverter-delay .”
(define (or-gate a1 a2 output)
(let ((i1 (make-wire))
(i2 (make-wire))
(a (make-wire)))
(inverter a1 i1)
(inverter a2 i2)
(and-gate i1 i2 a)
(inverter a output))
'ok)
:
2 * inverter-delay + and-gate-delay
3.30
“ 3.27 n (ripple-carry adder) .
n . A1,A2,
A3, ...,An B1, B2, B3, ..., Bn ( Ak Bk 0 1).
n S1, S2, S3, ..., Sn , C .
ripple-carry-adder . n
--- Ak, Bk Sk--- , C .
,
. n , ,
, . ”
3.30 (RIPPLE-CARRY
ADDER)
3.30 (RIPPLE-CARRY
ADDER)
“ 3.27 n (ripple-carry adder) . n
. A1,A2,A3, ...,An B1, B2,
B3, ..., Bn ( Ak Bk 0 1). n S1, S2, S3, ..., Sn ,
C . ripple-carry-adder .
n --- Ak, Bk Sk--- , C
. ”
3.30 (RIPPLE-CARRY
ADDER)
(define (ripple-carry-adder as bs ss c)
(define (iter as bs ss ck-1)
(if (not (null? as))
(let ((ak (car as))
(bk (car bs))
(sk (car ss))
(ck (make-wire)))
(full-adder ak bk ck sk ck-1)
(iter (cdr as) (cdr bs) (cdr ss) ck))))
(let ((c1 (make-wire)))
(full-adder (car as) (car bs) c1 (car ss) c)
(iter (cdr as) (cdr bs) (cdr ss) c-in)))
“ 3.27 n (ripple-carry adder) . n
. A1,A2,A3, ...,An B1, B2,
B3, ..., Bn ( Ak Bk 0 1). n S1, S2, S3, ..., Sn ,
C . ripple-carry-adder .
n --- Ak, Bk Sk--- , C
. ”
* 1インバータ遅延(Di)
* 1アンドゲート遅延(Da)
* 1オアゲート遅延(Do)
* Do >= Da + Di と仮定
半加算器の遅延:
Sの遅延(Dhs) = max(Do, Da + Di) + Da
= Do + Da
Cの遅延(Dhc) = Da
“ , . n
, , ,
. ”
3.30 (RIPPLE-CARRY
ADDER)
3.30 (RIPPLE-CARRY
ADDER)
半加算器 Sの遅延(Dhs) = Do + Da
半加算器 Cの遅延(Dhc) = Da
全加算器の遅延:
Sの遅延(Dfs) = max(0, Dhs) + Dhs
= 2Dhs
= 2(Do + Da)
= 2Do + 2Da
Cの遅延(Dfc) = max(Dhs + Dhc, Dhc) + Do
= Dhs + Dhc + Do
= (Do + Da) + (Da) + Do
= 2Do + 2Da
“ , . n
, , ,
. ”
全加算器 Sの遅延(Dfs) = 2Do + 2Da
全加算器 Cの遅延(Dfc) = 2Do + 2Da
n桁の繰上り伝播加算器:
S1の遅延 Drs = (n-1) * Dfc + Dfs
= (n-1) * (2Do + 2Da) + 2Do + 2Da
= n(2Do + 2Da)
= 2n(Do + Da)
Cの遅延 Drc = (n-1) * Dfc + Dfc
= n * Dfc
= 2n(Do + Da)
= n(2Do + 2Da)
= 2n(Do + Da)
例:
Di = 2, Da = 3, Do = 5 の時、
Drs = Drc = 2n(3 + 5) = 16n
3.30 (RIPPLE-CARRY
ADDER)
“ , . n
, , ,
. ”
- 3.3.5
2017/06/07( ) 19:30
21:00 @3F
- 🍕 🍣
connpass(http://sicp.iijlab.net/fulltext/x335.html )
SICP
Structure and Interpretation of Computer Programs https://mitpress.mit.edu/sicp/full-text/book/book.html - HTML
http://sicp.iijlab.net/fulltext/ - HTML
minghai/sicp-pdf: SICP PDF with Texinfo and LaTeX source https://github.com/minghai/sicp-pdf - minghai
hiroshi-manabe/sicp-pdf: SICP PDF with Texinfo and LaTeX source https://github.com/hiroshi-manabe/sicp-pdf - hiroshi-manabe
SICP
Lisper MIT SICP( ) - Qiita http://qiita.com/kaz-yos/items/d1ecd4bfe9989c290e99
SICP - sicp http://sicp.g.hatena.ne.jp/hyuki/
(SICP) - Higepon’s blog http://d.hatena.ne.jp/higepon/20061027/1161960363
(SICP) | http://kinokoru.jp/archives/794
( ) https://web.archive.org/web/20150104041426/http://oss.timedia.co.jp/
show/SICP/Answer%20Book
SICP-Solutions http://community.schemewiki.org/?SICP-Solutions

More Related Content

What's hot

Weapons grade React by Ken Wheeler
Weapons grade React by Ken Wheeler Weapons grade React by Ken Wheeler
Weapons grade React by Ken Wheeler React London 2017
 
W9_2: Jumps and loops
W9_2: Jumps and loopsW9_2: Jumps and loops
W9_2: Jumps and loopsDaniel Roggen
 
Design and Implementation of GCC Register Allocation
Design and Implementation of GCC Register AllocationDesign and Implementation of GCC Register Allocation
Design and Implementation of GCC Register AllocationKito Cheng
 
Java lejos-multithreading
Java lejos-multithreadingJava lejos-multithreading
Java lejos-multithreadingMr. Chanuwan
 
How to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITHow to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITEgor Bogatov
 
Schrödinger's ARM Assembly
Schrödinger's ARM AssemblySchrödinger's ARM Assembly
Schrödinger's ARM AssemblySaumil Shah
 
PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...Andrey Karpov
 
Java Time Puzzlers
Java Time PuzzlersJava Time Puzzlers
Java Time PuzzlersEric Jain
 
Introduction to Debuggers
Introduction to DebuggersIntroduction to Debuggers
Introduction to DebuggersSaumil Shah
 
Performance testing of microservices in Action
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in ActionAlexander Kachur
 
Code vectorization for mobile devices
Code vectorization for mobile devicesCode vectorization for mobile devices
Code vectorization for mobile devicesSt1X
 
C c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdoC c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdoKim Phillips
 

What's hot (20)

Multi qubit entanglement
Multi qubit entanglementMulti qubit entanglement
Multi qubit entanglement
 
Weapons grade React by Ken Wheeler
Weapons grade React by Ken Wheeler Weapons grade React by Ken Wheeler
Weapons grade React by Ken Wheeler
 
Snake.c
Snake.cSnake.c
Snake.c
 
W9_2: Jumps and loops
W9_2: Jumps and loopsW9_2: Jumps and loops
W9_2: Jumps and loops
 
Design and Implementation of GCC Register Allocation
Design and Implementation of GCC Register AllocationDesign and Implementation of GCC Register Allocation
Design and Implementation of GCC Register Allocation
 
Java lejos-multithreading
Java lejos-multithreadingJava lejos-multithreading
Java lejos-multithreading
 
How to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITHow to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJIT
 
Schrödinger's ARM Assembly
Schrödinger's ARM AssemblySchrödinger's ARM Assembly
Schrödinger's ARM Assembly
 
user2015 keynote talk
user2015 keynote talkuser2015 keynote talk
user2015 keynote talk
 
PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...PVS-Studio team experience: checking various open source projects, or mistake...
PVS-Studio team experience: checking various open source projects, or mistake...
 
Java Time Puzzlers
Java Time PuzzlersJava Time Puzzlers
Java Time Puzzlers
 
Introduction to Debuggers
Introduction to DebuggersIntroduction to Debuggers
Introduction to Debuggers
 
CARACTERES ASCII ENSAMBLADOR
CARACTERES ASCII ENSAMBLADORCARACTERES ASCII ENSAMBLADOR
CARACTERES ASCII ENSAMBLADOR
 
Lec06
Lec06Lec06
Lec06
 
Performance testing of microservices in Action
Performance testing of microservices in ActionPerformance testing of microservices in Action
Performance testing of microservices in Action
 
Code vectorization for mobile devices
Code vectorization for mobile devicesCode vectorization for mobile devices
Code vectorization for mobile devices
 
C c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdoC c++-meetup-1nov2017-autofdo
C c++-meetup-1nov2017-autofdo
 
Polling server
Polling serverPolling server
Polling server
 
R/C++ talk at earl 2014
R/C++ talk at earl 2014R/C++ talk at earl 2014
R/C++ talk at earl 2014
 
Debugging TV Frame 0x09
Debugging TV Frame 0x09Debugging TV Frame 0x09
Debugging TV Frame 0x09
 

Similar to SICP勉強会について

Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Tom Paulus
 
Getting Started with Raspberry Pi - USC 2013
Getting Started with Raspberry Pi - USC 2013Getting Started with Raspberry Pi - USC 2013
Getting Started with Raspberry Pi - USC 2013Tom Paulus
 
Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Svet Ivantchev
 
Wireshar training
Wireshar trainingWireshar training
Wireshar trainingLuke Luo
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentAnne Nicolas
 
VLSI experiments II
VLSI experiments IIVLSI experiments II
VLSI experiments IIGouthaman V
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Tom Paulus
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby SystemsEngine Yard
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate CompilersFunctional Thursday
 
Udp socket programming(Florian)
Udp socket programming(Florian)Udp socket programming(Florian)
Udp socket programming(Florian)Flor Ian
 
The Joy of ServerSide Swift Development
The Joy  of ServerSide Swift DevelopmentThe Joy  of ServerSide Swift Development
The Joy of ServerSide Swift DevelopmentGiordano Scalzo
 
The Joy Of Server Side Swift Development
The Joy Of Server Side Swift DevelopmentThe Joy Of Server Side Swift Development
The Joy Of Server Side Swift DevelopmentGiordano Scalzo
 
The Joy of Server Side Swift Development
The Joy  of Server Side Swift DevelopmentThe Joy  of Server Side Swift Development
The Joy of Server Side Swift DevelopmentGiordano Scalzo
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADlostcaggy
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Ontico
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging RubyAman Gupta
 
Microcontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprogramsMicrocontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprogramsVedavyas PBurli
 

Similar to SICP勉強会について (20)

Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1
 
Getting Started with Raspberry Pi - USC 2013
Getting Started with Raspberry Pi - USC 2013Getting Started with Raspberry Pi - USC 2013
Getting Started with Raspberry Pi - USC 2013
 
Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016Gaztea Tech Robotica 2016
Gaztea Tech Robotica 2016
 
Wireshar training
Wireshar trainingWireshar training
Wireshar training
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
 
Ns network simulator
Ns network simulatorNs network simulator
Ns network simulator
 
VLSI experiments II
VLSI experiments IIVLSI experiments II
VLSI experiments II
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
 
Udp socket programming(Florian)
Udp socket programming(Florian)Udp socket programming(Florian)
Udp socket programming(Florian)
 
The Joy of ServerSide Swift Development
The Joy  of ServerSide Swift DevelopmentThe Joy  of ServerSide Swift Development
The Joy of ServerSide Swift Development
 
The Joy Of Server Side Swift Development
The Joy Of Server Side Swift DevelopmentThe Joy Of Server Side Swift Development
The Joy Of Server Side Swift Development
 
The Joy of Server Side Swift Development
The Joy  of Server Side Swift DevelopmentThe Joy  of Server Side Swift Development
The Joy of Server Side Swift Development
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RAD
 
Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)Performance tweaks and tools for Linux (Joe Damato)
Performance tweaks and tools for Linux (Joe Damato)
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging Ruby
 
Microcontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprogramsMicrocontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprograms
 
Procesos
ProcesosProcesos
Procesos
 
Direct analog
Direct analogDirect analog
Direct analog
 

Recently uploaded

DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 

Recently uploaded (20)

DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 

SICP勉強会について

  • 3. SICP MIT Structure and Interpretation of Computer Programs ( : ) Scheme
  • 4. SCHEME LISP 1998 `R5RS` 50 (Gauche, Racket, etc.) Gauche
  • 5. SICP - GAUCHE # macOS, homebrewを想定 # Gaucheのインストール ``` brew install gosh brew install rlwrap # いれておくと便利 ``` # slibのインストール(`trace`のため) ``` curl -O 'http://groups.csail.mit.edu/mac/ftpdir/scm/slib-3b5.zip' unzip slib-3b5.zip mv slib /usr/local cd /usr/local/slib ./configure make sudo make install ```
  • 6. SCHEME HELLO WORLD $ echo '(print "Hello World!")' | gosh Hello World!
  • 7. SICP -VIM vim `:!gosh %` `NeoBundle 'thinca/vim-quickrun'` `silent! map <Space>q <Plug>(quickrun)` - <Space>q `NeoBundle 'tpope/vim-surround'` S `NeoBundle ‘vim-scripts/vim-niji'` `NeoBundle 'haruyama/vim-matchopen'`
  • 8. TRACE : ; fib.scm (use slib) (require 'trace) (define (fib n) (cond ((= n 0) 0) ((= n 1) 1) (else (+ (fib (- n 1)) (fib (- n 2)))))) (trace fib) (fib 3) ; CALL fib 3 ; CALL fib 2 ; CALL fib 1 ; RETN fib 1 ; CALL fib 0 ; RETN fib 0 ; RETN fib 1 ; CALL fib 1 ; RETN fib 1 ; RETN fib 2
  • 12.
  • 14. 1 LISP(Scheme) lambda 2 ( Huffman etc) 3 . 3.4.4 ← 4 - Scheme Scheme 5 - Scheme
  • 16. output = !(A) output = A || B output = A && B
  • 17. . (HALF-ADDER) 2 (A B) S: (sum) C: (carry) (D E: )
  • 18. . (HALF-ADDER) A B S C 0 0 0 0 1 0 1 0 0 1 1 0 1 1 0 1
  • 19. (define a (make-wire)) (define b (make-wire)) (define c (make-wire)) (define d (make-wire)) (define e (make-wire)) (define s (make-wire)) (or-gate a b d) (and-gate a b c) (inverter c e) (and-gate d e s) . (HALF-ADDER)
  • 20. (define (half-adder a b s c) (let ((d (make-wire)) (e (make-wire))) (or-gate a b d) (and-gate a b c) (inverter c e) (and-gate d e s) 'ok)) . ( )
  • 22. : (FULL-ADDER) A B CI S CO 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 0 1 1 1 1 1 1
  • 23. (define (full-adder a b c-in sum c-out) (let ((s (make-wire)) (c1 (make-wire)) (c2 (make-wire))) (half-adder b c-in s c1) (half-adder a s sum c2) (or-gate c1 c2 c-out) 'ok)) : (FULL-ADDER)
  • 24. (get-signal ⟨wire⟩) (set-signal! ⟨wire⟩ ⟨new value⟩) (add-action! ⟨wire⟩ ⟨ ⟩) . (after-delay ⟨ ⟩ ⟨ ⟩) add-action!
  • 25. (define (inverter input output) (define (invert-input) (let ((new-value (logical-not (get-signal input)))) (after-delay inverter-delay ;遅延時間(定数) (lambda () (set-signal! output new-value))))) (add-action! input invert-input) 'ok) - (define (logical-not s) (cond ((= s 0) 1) ((= s 1) 0) (else (error "Invalid signal" s))))
  • 26. (define (and-gate a1 a2 output) (define (and-action-procedure) (let ((new-value (logical-and (get-signal a1) (get-signal a2)))) (after-delay and-gate-delay ;遅延時間(定数) (lambda () (set-signal! output new-value))))) (add-action! a1 and-action-procedure) (add-action! a2 and-action-procedure) 'ok) - (define (logical-and s1 s2) (cond ((and (= s1 0) (= s2 0)) 0) ((and (= s1 0) (= s2 1)) 0) ((and (= s1 1) (= s2 0)) 0) ((and (= s1 1) (= s2 1)) 1) (else (error "Invalid signal" s1 s2))))
  • 27. 3.28 “ . or-gate , and-gate . ”
  • 28. 3.28 “ . or-gate , and-gate . ” (define (or-gate a1 a2 output) (define (or-action-procedure) (let ((new-value (logical-or (get-signal a1) (get-signal a2)))) (after-delay or-gate-delay (lambda () (set-signal! output new-value))))) (add-action! a1 or-action-procedure) (add-action! a2 or-action-procedure) 'ok) (define (logical-or s1 s2) (cond ((and (= s1 0) (= s2 0)) 0) ((and (= s1 0) (= s2 1)) 1) ((and (= s1 1) (= s2 0)) 1) ((and (= s1 1) (= s2 1)) 1) (else (error "Invalid signal" s1 s2))))
  • 29. 3.29 ( ) “ , , . or-gate . and-gate-delay inverter-delay .”
  • 30. 3.29 ( ) “ , , . or-gate . and-gate-delay inverter-delay .”
  • 31. 3.29 ( ) “ , , . or-gate . and-gate-delay inverter-delay .” A1 A2 A1 && A2 !A1 && !A2 !(!A1 && !A2) 0 0 0 1 0 1 0 0 0 1 0 1 0 0 1 1 1 1 0 1
  • 32. 3.29 ( ) “ , , . or-gate . and-gate-delay inverter-delay .” (define (or-gate a1 a2 output) (let ((i1 (make-wire)) (i2 (make-wire)) (a (make-wire))) (inverter a1 i1) (inverter a2 i2) (and-gate i1 i2 a) (inverter a output)) 'ok)
  • 33. 3.29 ( ) “ , , . or-gate . and-gate-delay inverter-delay .” (define (or-gate a1 a2 output) (let ((i1 (make-wire)) (i2 (make-wire)) (a (make-wire))) (inverter a1 i1) (inverter a2 i2) (and-gate i1 i2 a) (inverter a output)) 'ok) : 2 * inverter-delay + and-gate-delay
  • 34. 3.30 “ 3.27 n (ripple-carry adder) . n . A1,A2, A3, ...,An B1, B2, B3, ..., Bn ( Ak Bk 0 1). n S1, S2, S3, ..., Sn , C . ripple-carry-adder . n --- Ak, Bk Sk--- , C . , . n , , , . ”
  • 36. 3.30 (RIPPLE-CARRY ADDER) “ 3.27 n (ripple-carry adder) . n . A1,A2,A3, ...,An B1, B2, B3, ..., Bn ( Ak Bk 0 1). n S1, S2, S3, ..., Sn , C . ripple-carry-adder . n --- Ak, Bk Sk--- , C . ”
  • 37. 3.30 (RIPPLE-CARRY ADDER) (define (ripple-carry-adder as bs ss c) (define (iter as bs ss ck-1) (if (not (null? as)) (let ((ak (car as)) (bk (car bs)) (sk (car ss)) (ck (make-wire))) (full-adder ak bk ck sk ck-1) (iter (cdr as) (cdr bs) (cdr ss) ck)))) (let ((c1 (make-wire))) (full-adder (car as) (car bs) c1 (car ss) c) (iter (cdr as) (cdr bs) (cdr ss) c-in))) “ 3.27 n (ripple-carry adder) . n . A1,A2,A3, ...,An B1, B2, B3, ..., Bn ( Ak Bk 0 1). n S1, S2, S3, ..., Sn , C . ripple-carry-adder . n --- Ak, Bk Sk--- , C . ”
  • 38. * 1インバータ遅延(Di) * 1アンドゲート遅延(Da) * 1オアゲート遅延(Do) * Do >= Da + Di と仮定 半加算器の遅延: Sの遅延(Dhs) = max(Do, Da + Di) + Da = Do + Da Cの遅延(Dhc) = Da “ , . n , , , . ” 3.30 (RIPPLE-CARRY ADDER)
  • 39. 3.30 (RIPPLE-CARRY ADDER) 半加算器 Sの遅延(Dhs) = Do + Da 半加算器 Cの遅延(Dhc) = Da 全加算器の遅延: Sの遅延(Dfs) = max(0, Dhs) + Dhs = 2Dhs = 2(Do + Da) = 2Do + 2Da Cの遅延(Dfc) = max(Dhs + Dhc, Dhc) + Do = Dhs + Dhc + Do = (Do + Da) + (Da) + Do = 2Do + 2Da “ , . n , , , . ”
  • 40. 全加算器 Sの遅延(Dfs) = 2Do + 2Da 全加算器 Cの遅延(Dfc) = 2Do + 2Da n桁の繰上り伝播加算器: S1の遅延 Drs = (n-1) * Dfc + Dfs = (n-1) * (2Do + 2Da) + 2Do + 2Da = n(2Do + 2Da) = 2n(Do + Da) Cの遅延 Drc = (n-1) * Dfc + Dfc = n * Dfc = 2n(Do + Da) = n(2Do + 2Da) = 2n(Do + Da) 例: Di = 2, Da = 3, Do = 5 の時、 Drs = Drc = 2n(3 + 5) = 16n 3.30 (RIPPLE-CARRY ADDER) “ , . n , , , . ”
  • 41. - 3.3.5 2017/06/07( ) 19:30 21:00 @3F - 🍕 🍣 connpass(http://sicp.iijlab.net/fulltext/x335.html )
  • 42. SICP Structure and Interpretation of Computer Programs https://mitpress.mit.edu/sicp/full-text/book/book.html - HTML http://sicp.iijlab.net/fulltext/ - HTML minghai/sicp-pdf: SICP PDF with Texinfo and LaTeX source https://github.com/minghai/sicp-pdf - minghai hiroshi-manabe/sicp-pdf: SICP PDF with Texinfo and LaTeX source https://github.com/hiroshi-manabe/sicp-pdf - hiroshi-manabe SICP Lisper MIT SICP( ) - Qiita http://qiita.com/kaz-yos/items/d1ecd4bfe9989c290e99 SICP - sicp http://sicp.g.hatena.ne.jp/hyuki/ (SICP) - Higepon’s blog http://d.hatena.ne.jp/higepon/20061027/1161960363 (SICP) | http://kinokoru.jp/archives/794 ( ) https://web.archive.org/web/20150104041426/http://oss.timedia.co.jp/ show/SICP/Answer%20Book SICP-Solutions http://community.schemewiki.org/?SICP-Solutions