ch17

原来不一样的地方还挺多的,比如drracket不支持嵌套定义,

(define (a b)
  b
  (define (c d)
    d))

就是define: expected only one expression for the function body, but found 1 extra part。 也就是b和(define (c d) d)就是two part了。

(define (a b)
 
  (define (c d)
    d))

就是define: found a definition that is not at the top level。

所以还是用官方推荐的MIT/GNU SCHEME, 可惜的就是EMACS的快捷键不大会用。

/////////////////////////////////////////////////////////////////

drracket的cons语法好像和scheme有点不一样,scheme里是点对,drracket里cons的两个参数第二个要求是个list,也就是(cons empty 1)和(cons 1 empty)之中,前者是不合法的。

17.1.1 用课本中给出的replace-eol-with 实现和自带的append函数一样功能的函数,纯属练手。

(define (replace-eol-with alon1 alon2)
  (cond
    ((empty? alon1) alon2)
    (else (cons (first alon1) (replace-eol-with (rest alon1)
  alon2)))))
(define (our-append alon1 alon2 alon3)
  (replace-eol-with
   (replace-eol-with alon1 alon2) alon3))

 17.1.2 将给出的符号表和数表中的符号和数一 一配对,设计函数返回所有情况。写这个让我感到辅助函数的重要性...想用一个函数结果会让思路混乱。

example:(cross '(a b c) '(1 2))

output:(list (list 'a 1) (list 'a 2) (list 'b 1) (list 'b 2) (list 'c 1) (list 'c 2))

按照书中的分析方法:

1.Data Definition

2.describe

3.list template

4.example

5.define

6.test

(define (cross los lon)
  (cond
    ((empty? los)
     empty) 
    (else
     (append(pairs(first los)lon)(cross(rest los) lon)))))
(define (pairs s lon)
  (cond
    ((empty? lon)
     empty)
    (else
     (cons(list s (first lon)) (pairs s (rest lon))))))

 

转载于:https://www.cnblogs.com/autoria/p/4739241.html

### STM32 ADC Channel 17 Configuration In the context of configuring an Analog-to-Digital Converter (ADC) on a specific channel such as channel 17 within STM32 microcontrollers, it is important to understand that not all channels are available across different series or packages of STM32 devices. For instance, some pins may only be present in certain package types and might serve multiple functions depending upon the device variant. For configuring ADC channel 17 specifically: - Ensure this channel corresponds to a valid pin for your particular STM32 model. - Initialize the system clock settings appropriately since these affect how fast the ADC can operate `hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;`[^1]. The initialization process involves setting up various parameters including resolution, data alignment, external trigger conversion source among others before enabling continuous mode if required. Here's a simplified example demonstrating part of what needs to happen during setup using HAL library provided by STMicroelectronics: ```c // Assuming ADC1 is being used here static void MX_ADC1_Init(void) { ADC_ChannelConfTypeDef sConfig = {0}; /** Configure the global features of the ADC (Clock prescaler) */ hadc1.Instance = ADC1; hadc1.Init.ScanConvMode = DISABLE; // Single-channel conversion hadc1.Init.ContinuousConvMode = ENABLE; // Continuous conversions enabled hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc1.Init.NbrOfConversion = 1; if (HAL_ADC_Init(&hadc1) != HAL_OK) { Error_Handler(); } /** Configure for the selected ADC regular channel */ sConfig.Channel = ADC_CHANNEL_17; // Configuring channel 17 sConfig.Rank = 1; sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES; if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) { Error_Handler(); } } ``` When dealing with high-speed sampling scenarios where real-time performance matters significantly, implementing DMA transfers alongside software triggers could enhance efficiency while ensuring timely updates without CPU intervention after initial configuration has been completed[^3]. Furthermore, when connecting sensors directly to ADC inputs especially those having low output impedance like thermistors or photodiodes, consider adding buffer amplifiers between sensor outputs and ADC input lines due to potentially significant loading effects caused by relatively lower internal resistance at ADC ports which can distort readings taken from connected peripherals[^4].
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值