Nп/п : 84 из 93
 От   : Kaz Kylheku                         2:5075/128        21 сен 23 14:02:40
 К    : none) (albert                                         21 сен 23 17:05:04
 Тема : Re: Understanding apply in MAL (clojure dialect)
----------------------------------------------------------------------------------
                                                                                 
@MSGID: <20230921065214.723@kylheku.com> 97d9cbd6
@REPLY:
fe9d7b71
@REPLYADDR Kaz Kylheku <864-117-4973@kylheku.com>
@REPLYTO 2:5075/128 Kaz Kylheku
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: <20230921065214.723@kylheku.com>
@RFC-References:

@TZUTC: -0000
@PID: slrn/pre1.0.4-9 (Linux)
@TID: FIDOGATE-5.12-ge4e8b94
On 2023-09-21, albert@cherry.(none) (albert)  wrote:
> (apply symbol? (list (quote two))
> We arrive at the list to be evaluated
> (<#4623388> ) where  #4623388 is the actual function symbol? refers to.
>
> This is an abstract structure tree: a list consisting of a a function
> and a symbol.
>
> Now we are supposed to evaluate this list.

No, that would be a double evaluation.

In a Lisp-1 dialect,

  (apply fun (list a b c))

is the same as

  (fun a b c)

You`re talking about:

  ((eval fun) (eval (list a b c)))

apply is an ordinary function. After evaluating the arguments
we have these items

 (#<4580123> #<4623388> (two))
   ^         ^
   apply     symbol?

we are now ready to call the function: we call #<4580123>,
which is apply, passing it #<4623388> and (two).

apply doesn`t eval anything: apply takes the list (two) and spreads
it into individual arguments, which are passed to #<4623388>.

The expectation that (apply symbol? (list two)) will yield
true requires either very weird semantics that depart far from
classic Lisp, or else that two is a variable which holds a symbol.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don`t see you, unless you`re whitelisted.
--- slrn/pre1.0.4-9 (Linux)
 * Origin: A noiseless patient Spider (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх