Funk2: Causal Reflective Programming Funk2: causal reflexivo programação |
|
| Funk2: reflective programming language Funk2: reflexivo programação idioma
Overview Visão geral
Supported systems Sistemas Suportados
| Funk2 currently compiles on 32-bit and 64-bit Linux operating systems. Funk2 atualmente compila em 32-bits e 64 bits dos sistemas operacionais Linux. 64-bit pointers are recommended because of the amount of memory needed for the reflective capabilities; a 32-bit machine is currently only able to index a few gigabytes of memory. 64-bit ponteiros são recomendados devido à quantidade de memória necessária para a capacidade reflexiva; uma máquina de 32 bits está actualmente a única capaz de índice de alguns gigabytes de memória. |
The goal A meta
| The goal of the programming language Funk2 is to enable reflective algorithmic tracing for large heterogenous control systems. O objetivo da linguagem de programação é permitir que reflictam Funk2 algorítmica rastreio para grandes sistemas de controlo heterogêneas. A few point emphasized in the Funk2 programming language are: Há alguns pontos enfatizados na programação Funk2 o idioma são: | o o | Layered Critical Causal Reflection Camada reflexão crítica causal | | o o | Efficient and Robust Control Controle eficiente e robusto | | o o | Learning by Credit Assignment Aprender a cessão de crédito | | o o | Divergent Solution Paths Solução caminhos divergentes | | o o | Intricate Thread Control Intrincada thread controle | | o o | Goal-oriented Learning Goal-oriented Learning |
|
How does it work? Como é que funciona? | Examples of the most basic computational features include: (1) memory creation , (2) memory read , and (3) memory write . Exemplos dos mais elementares computacional características incluem: (1) criação de memória, (2) memória ler, e (3) memória escrever. Tracing all causal relationships between these basic features allows tracing the context of all other programmer-defined semantic abstractions . Tracing todas as relações causais entre estas características básicas permite rastrear o contexto de todas as outras programador-definidas abstrações semânticas. All of these computational features create an intricate trace network of dependencies, automatically traceable and shared by many parallel threads of execution. Todos esses recursos computacionais criar uma intrincada rede de dependências traço, automaticamente rastreáveis e partilhada por muitos paralelos threads de execução. Funk2 allows causal tracing to occur modularly to dynamically chosen parts of large commonsense-scale artificial intelligence projects. Funk2 causal permite a detecção ocorrer modularly dinamicamente escolhido para peças de grande escala commonsense inteligência artificial projetos. The resulting causal dependency trace networks can be processed by critical causal reflection threads. A consequente dependência causal traço redes podem ser processados pela reflexão crítica causal threads. |
Examples of causal reflective programming Exemplos de causalidade reflexivo programação
|
Here is how to retrieve the creation Cause for any piece of memory ( [] , the value of the symbol nil , is the only thing that does not reference a piece of memory): Aqui está a forma de recuperar a criação Causa para qualquer pedaço de memória ([], o valor do símbolo nulo, é a única coisa que não se referência um pedaço de memória): Note that in the Cause object there are multiple named slots holding information in the frame of the cause. Note que, no Causa objeto há vários chamado slots exploração informações no âmbito da causa. The frames of a Cause are thread , env , name , and args . Os quadros são Causa de um fio, env, nome, e args. By default only 7 levels of recursion are printed to the screen. Por padrão apenas 7 níveis de recursão são impressas para a tela. The symbol used for ending a recursion is the astrisk, * .In order to access the slots of an object, you can use funktions that are named to access and mutate objects. O símbolo utilizado para pôr termo a uma recursão é o asterisco, *. Para acessar as faixas horárias de um objeto, você pode usar funktions que são nomeadas de acesso e de mutação objetos. For example, the following example shows how to retrieve only the name and args slots of a cause object. Por exemplo, a seguinte exemplo mostra como recuperar apenas o nome eo args slots de causar um objeto.
| in--> [let [[cause [cause-of 12]]] [cons [cause-name cause] [cause-args cause]]] em -> [deixar [[causar [causar-de 12]]] [contras [causa-nome causar] [causa-args causar]]] read> [ let [ [ cause [ cause-of 12 ] ] ] [ cons [ cause-name cause ] [ cause-args cause ] ] ] leia> [deixar [[causar [causar-de 12]]] [contras [causa-nome causar] [causa-args causar]]] out-> [ primfunk:read #xb7f03420 ] out-> [primfunk: ler # xb7f03420]
|
Here is an example of how to remember the state of an object at specific historical points in time: Aqui está um exemplo de como a lembrar o estado de um objeto em um determinado momento histórico em pontos:
| in--> [globalize a [array-new 10]] em -> [globalizar uma [nova matriz-10]] read> [ globalize a [ array-new 10 ] ] leia> [globalizar uma [nova matriz-10]] out-> [] out-> []
in--> a em -> um read> a leia> um out-> ( [] [] [] [] [] [] [] [] [] [] ) out-> ([] [] [] [] [] [] [] [] [] [])
in--> [tracing_on-set at] em -> [tracing_on-fixado em] read> [ tracing_on-set a t ] leia> [tracing_on-um conjunto t] out-> [] out-> []
in--> [system_date] em -> [system_date] read> [ system_date ] leia> [system_date] out-> ( date 1970 0 13983 6 29 7 526235 ) out-> (data 1970 0 13983 6 29 7 526235)
in--> [dotimes [i 5] [array-elt-set ai [+ i 10]]] em -> [dotimes [i 5] [array-ELT-set ai [10 + i]]] read> [ dotimes [ i 5 ] [ array-elt-set a i [ + i 10 ] ] ] leia> [dotimes [i 5] [array-ELT-um conjunto i [10 + i]]] out-> [] out-> []
in--> a em -> um read> a leia> um out-> ( 10 11 12 13 14 [] [] [] [] [] ) out-> (10 11 12 13 14 [] [] [] [] [])
in--> [remember a (date 1970 0 13983 6 28 44 908595)] em -> [lembrar um (data 1970 0 13983 6 28 44 908595)] read> [ remember a ( date 1970 0 13983 6 28 44 908595 ) ] leia> [lembrar um (data 1970 0 13983 6 28 44 908595)] out-> ( [] [] [] [] [] [] [] [] [] [] ) out-> ([] [] [] [] [] [] [] [] [] [])
in--> a em -> um read> a leia> um out-> ( 10 11 12 13 14 [] [] [] [] [] ) out-> (10 11 12 13 14 [] [] [] [] [])
|
Here is another example of how to remember the state of an object at specific historical points in time: Aqui está outro exemplo de como a lembrar o estado de um objeto em um determinado momento histórico em pontos:
| in--> [globalize a [array-new 10]] em -> [globalizar uma [nova matriz-10]] read> [ globalize a [ array-new 10 ] ] leia> [globalizar uma [nova matriz-10]] out-> [] out-> []
in--> [tracing_on-set at] em -> [tracing_on-fixado em] read> [ tracing_on-set a t ] leia> [tracing_on-um conjunto t] out-> [] out-> []
in--> [globalize dates [array-new 10]] em -> [globalizar datas [novo arranjo-10]] read> [ globalize dates [ array-new 10 ] ] leia> [globalizar datas [novo arranjo-10]] out-> [] out-> []
in--> [dotimes [i 10] [array-elt-set dates i [system_date]] [array-elt-set aii]] em -> [dotimes [i 10] [array-ELT definir datas-i [system_date]] [array-ELT-set AII]] read> [ dotimes [ i 10 ] [ array-elt-set dates i [ system_date ] ] [ array-elt-set a i i ] ] leia> [dotimes [i 10] [array-ELT definir datas-i [system_date]] [array-ELT-um conjunto i i]] out-> [] out-> []
in--> a em -> um read> a leia> um out-> ( 0 1 2 3 4 5 6 7 8 9 ) out-> (0 1 2 3 4 5 6 7 8 9)
in--> dates em -> datas read> dates leia> datas out-> ( ( date 1970 0 13983 6 12 19 283811 ) out-> ((data 1970 0 13983 6 12 19 283811) ( date 1970 0 13983 6 12 19 561113 ) (Data 1970 0 13983 6 12 19 561113) ( date 1970 0 13983 6 12 19 828195 ) (Data 1970 0 13983 6 12 19 828195) ( date 1970 0 13983 6 12 20 94674 ) (Data 1970 0 13983 6 12 20 94674) ( date 1970 0 13983 6 12 20 361727 ) (Data 1970 0 13983 6 12 20 361727) ( date 1970 0 13983 6 12 20 629388 ) (Data 1970 0 13983 6 12 20 629388) ( date 1970 0 13983 6 12 20 896560 ) (Data 1970 0 13983 6 12 20 896560) ( date 1970 0 13983 6 12 21 163860 ) (Data 1970 0 13983 6 12 21 163860) ( date 1970 0 13983 6 12 21 431032 ) (Data 1970 0 13983 6 12 21 431032) ( date 1970 0 13983 6 12 21 699425 ) ) (Data 1970 0 13983 6 12 21 699425))
in--> [let [[history nil]] [dotimes [i 10] [set history [cons [remember a [array-elt dates i]] history]]] history] em -> [deixar [[história nil]] [dotimes [i 10] [set história [contras [lembrar um [array-ELT datas i]] história]]] história] read> [ let [ [ history [] ] ] [ dotimes [ i 10 ] [ set history [ cons [ remember a [ array-elt dates i ] ] history ] ] ] history ] leia> [deixar [[história []]] [dotimes [i 10] [set história [contras [lembrar um [array-ELT datas i]] história]]] história] out-> [ ( 0 1 2 3 4 5 6 7 8 [] ) out-> [(0 1 2 3 4 5 6 7 8 []) ( 0 1 2 3 4 5 6 7 [] [] ) (0 1 2 3 4 5 6 7 [] []) ( 0 1 2 3 4 5 6 [] [] [] ) (0 1 2 3 4 5 6 [] [] []) ( 0 1 2 3 4 5 [] [] [] [] ) (0 1 2 3 4 5 [] [] [] []) ( 0 1 2 3 4 [] [] [] [] [] ) (0 1 2 3 4 [] [] [] [] []) ( 0 1 2 3 [] [] [] [] [] [] ) (0 1 2 3 [] [] [] [] [] []) ( 0 1 2 [] [] [] [] [] [] [] ) (0 1 2 [] [] [] [] [] [] []) ( 0 1 [] [] [] [] [] [] [] [] ) (0 1 [] [] [] [] [] [] [] []) ( 0 [] [] [] [] [] [] [] [] [] ) (0 [] [] [] [] [] [] [] [] []) ( [] [] [] [] [] [] [] [] [] [] ) ] ([] [] [] [] [] [] [] [] [] [])]
|
|
Basic Programming Examples Programação Básica exemplos
|
Here is one straightforward way to write a "Hello world!" Aqui está uma maneira simples de escrever um "Olá mundo!" program in the Funk2 language: Funk2 programa na linguagem:
| in--> [print 'Hello world!'] em -> [print 'Olá mundo! "] read> [ print 'Hello world!' ] leia> [print 'Olá mundo! "] 'Hello world!' "Olá mundo!" out-> 'Hello world!' out-> 'Olá mundo! "
|
Here is another more advanced way to holla your planet: Aqui está um outro caminho a mais avançada holla seu planeta:
| in--> [let [[planet 'Earth']] [format stdout 'Hello ' planet '!']] em -> [deixar [[planeta "Terra"]] [formato stdout 'Olá' planeta'!']] read> [ let [ [ planet 'Earth' ] ] [ format stdout 'Hello ' planet '!' ] ] Hello Earth! leia> [deixar [[planeta "Terra"]] [formato stdout 'Olá' planeta '! "]] Earth Olá! out-> [] out-> []
|
Here is how to define and subsequently call a funktion: Aqui está a forma de definir e posteriormente um apelo funktion:
| in--> [defunk say-hi [x] [format stdout 'Why, hello there ' x '. em -> [defunk dizer-oi [x] [formato stdout Por que, então, aí olá 'x'. It is really great to see you.']] É muito bom ver que você '.]] read> [ defunk say-hi [ x ] [ format stdout 'Why, hello there ' x '. It is really great to see you.' ] ] leia> [defunk dizer-oi [x] [formato stdout Por que, então, aí olá 'x'. É muito bom ver que você '.]] defunk say-hi [ x ] defunk dizer-oi [x] out-> [] out-> []
| | in--> [say-hi 'Marvin'] em -> [dizer-oi 'Marvin'] read> [ say-hi 'Marvin' ] leia> [dizer-oi 'Marvin'] Why, hello there Marvin. Porque, olá lá Marvin. It is really great to see you. É muito bom ver você. out-> [] out-> []
|
Here is how to loop over a list of values: Aqui está a forma de laço mais de uma lista de valores:
| in--> [mapc [funk [x] [print x]] [list 1 2 3 #xFF 'dog' `[2 3]]] em -> [mapc [funk [x] [print x]] [Lista 1 2 3 # xff 'cachorro' `[2 3]]] read> [ mapc [ funk [ x ] [ print x ] ] [ list 1 2 3 #xff 'dog' ` [ 2 3 ] ] ] leia> [mapc [funk [x] [print x]] [Lista 1 2 3 # xff 'cachorro' `[2 3]]] 1 1 2 2 3 3 #xff # xff 'dog' 'cachorro' [ 2 3 ] [2 3] out-> [] out-> []
|
Here is how to call our funktion above in a parallel thread: Aqui está a forma de chamar a nossa funktion acima, em paralelo um fio condutor:
| in--> [prog [thread &say-hi [list 'Gerry']] nil] em -> [prog [thread & dizer-oi [list 'Gerry']] nil] read> [ prog [ thread &say &say-hi [ list 'Gerry' ] ] [] ] leia> [prog [thread & & dizer dizer-oi [list 'Gerry']] []] Why, hello there Porque, há Olá out-> Gerry. out-> Gerry. It is really great to see you. [] É muito bom ver você. []
|
Here is how to serially filter every element in a list: Aqui está como a série filtro cada elemento em uma lista:
| in--> [mapcar [funk [x] [+ x 10]] [list 1 2 3 4 5]] em -> [mapcar [funk [x] [x + 10]] [Lista 1 2 3 4 5]] read> [ mapcar [ funk [ x ] [ + x 10 ] ] [ list 1 2 3 4 5 ] ] leia> [mapcar [funk [x] [x + 10]] [Lista 1 2 3 4 5]] out-> [ 11 12 13 14 15 ] out-> [11 12 13 14 15]
|
Here is how to concurrently filter every element in a list: Aqui está a forma de cada elemento filtrante concomitantemente, em uma lista:
| in--> [parcar [funk [x] [+ x 10]] [list 1 2 3 4 5]] em -> [parcar [funk [x] [x + 10]] [Lista 1 2 3 4 5]] read> [ parcar [ funk [ x ] [ + x 10 ] ] [ list 1 2 3 4 5 ] ] leia> [parcar [funk [x] [x + 10]] [Lista 1 2 3 4 5]] out-> [ 11 12 13 14 15 ] out-> [11 12 13 14 15]
|
The scheduler:global_scheduler variable in the global environment can be used as a reference to the global funk2 scheduler for the local machine. O programador: global_scheduler variável no ambiente global pode ser usado como uma referência ao nível mundial funk2 programador para a máquina local. Processor information available from "/dev/proc" during funk2 initial bootstrap compile is available for all machines currently logged into the grid. Processador informação disponível a partir de "/ dev / proc" durante a primeira inicialização funk2 compilar está disponível para todas as máquinas atualmente conectado à rede. Grid support is in development, this only shows this information for the local machine. Grade de apoio está em desenvolvimento, isto só mostra esta informação para a máquina local. Once support for multiple machines is available, this variable will change into a funktion that takes a machine-id as an argument and returns that machine's scheduler object. Depois que o apoio está disponível para várias máquinas, esta variável irá mudar em um funktion que leva a uma máquina-id como um argumento e retorna a máquina do programador objeto.
| in--> scheduler:global_scheduler em -> programador: global_scheduler read> scheduler:global_scheduler leia> programador: global_scheduler out-> [ scheduler out-> [agendador :processors ( [ processor : transformadores ([processador :mutation_mutex [ mutex] : mutation_mutex [mutex] :scheduler [ scheduler :processors * ] : agendador [agendador: processadores *] :pthread #x40a00960 : pthread # x40a00960 :threads [ [ thread : threads [[thread :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * :parent_thread * : parent_thread * :parent_env * : parent_env * :execute_mutex * : execute_mutex * :last_executed_time * ] : last_executed_time *] [ thread [Tópico :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * :parent_thread * : parent_thread * :parent_env * : parent_env * :execute_mutex * : execute_mutex * :last_executed_time * ] : last_executed_time *] [ thread [Tópico :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * :parent_thread * : parent_thread * :parent_env * : parent_env * :execute_mutex * : execute_mutex * :last_executed_time * ] : last_executed_time *] [ thread [Tópico :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * :parent_thread * : parent_thread * :parent_env * : parent_env * :execute_mutex * : execute_mutex * :last_executed_time * ] : last_executed_time *] [ thread [Tópico :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * :parent_thread * : parent_thread * :parent_env * : parent_env * :execute_mutex * : execute_mutex * :last_executed_time * ] : last_executed_time *] [ thread [Tópico :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * :parent_thread * : parent_thread * :parent_env * : parent_env * :execute_mutex * : execute_mutex * :last_executed_time * ] : last_executed_time *] [ thread [Tópico :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * :parent_thread * : parent_thread * :parent_env * : parent_env * :execute_mutex * : execute_mutex * :last_executed_time * ] : last_executed_time *] [ thread [Tópico :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * :parent_thread * : parent_thread * :parent_env * : parent_env * :execute_mutex * : execute_mutex * :last_executed_time * ] : last_executed_time *] [ thread [Tópico :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * :parent_thread * : parent_thread * :parent_env * : parent_env * :execute_mutex * : execute_mutex * :last_executed_time * ] : last_executed_time *] [ thread [Tópico :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * :parent_thread * : parent_thread * :parent_env * : parent_env * :execute_mutex * : execute_mutex * :last_executed_time * ] : last_executed_time *] [ thread [Tópico :program_counter * : program_counter * :stack * : pilha * :iter * : ITER * :env * : env * :args * : args * :return * : voltar * :value * : valor * :trace * : trace * :critics * : os críticos * :cause_reg * : cause_reg * :keep_undead * : keep_undead * |
|
|
|
|