Funk2: Causal Reflective Programming Funk2: nesso di causalità riflettente di programmazione |
|
| Funk2: reflective programming language Funk2: riflettente linguaggio di programmazione
Overview Panoramica
Supported systems Sistemi supportati
| Funk2 currently compiles on 32-bit and 64-bit Linux operating systems. Funk2 attualmente compila a 32-bit e 64-bit dei sistemi operativi 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. Puntatori a 64 bit sono raccomandate a causa della quantità di memoria necessaria per la capacità riflessiva, una a 32 bit macchina è attualmente solo in grado di indicizzare alcuni gigabyte di memoria. |
The goal L'obiettivo
| The goal of the programming language Funk2 is to enable reflective algorithmic tracing for large heterogenous control systems. L'obiettivo del linguaggio di programmazione Funk2 è quello di consentire il rintracciamento algoritmica riflettenti per i grandi sistemi di controllo eterogenei. A few point emphasized in the Funk2 programming language are: Qualche punto sottolineato nel Funk2 linguaggio di programmazione sono: | o o | Layered Critical Causal Reflection Strati di riflessione critica nesso di causalità | | o o | Efficient and Robust Control Efficiente e robusto di controllo | | o o | Learning by Credit Assignment L'apprendimento di cessione di credito | | o o | Divergent Solution Paths Soluzione percorsi divergenti | | o o | Intricate Thread Control Intricato thread di controllo | | o o | Goal-oriented Learning Obiettivo orientato Learning |
|
How does it work? Come funziona? | Examples of the most basic computational features include: (1) memory creation , (2) memory read , and (3) memory write . Esempi dei più elementari computazionale caratteristiche includono: (1) creazione di memoria, (2) di memoria leggere, e (3) di memoria scrivere. Tracing all causal relationships between these basic features allows tracing the context of all other programmer-defined semantic abstractions . Rintracciare tutti i rapporti di causalità tra queste caratteristiche di base permette di rintracciare il contesto di tutti gli altri programmatori definiti semantico astrazioni. All of these computational features create an intricate trace network of dependencies, automatically traceable and shared by many parallel threads of execution. Tutte queste caratteristiche computazionali creare un intricato traccia rete di dipendenze, automaticamente rintracciabile e condiviso da molti fili paralleli di esecuzione. Funk2 allows causal tracing to occur modularly to dynamically chosen parts of large commonsense-scale artificial intelligence projects. Funk2 consente di rintracciare nesso di causalità che si verifichi in modo dinamico modulare scelto parti di grandi dimensioni CommonSense intelligenza artificiale progetti. The resulting causal dependency trace networks can be processed by critical causal reflection threads. La conseguente dipendenza causale traccia reti possono essere trattati da nesso di causalità riflessione critica thread. |
Examples of causal reflective programming Esempi di programmazione nesso di causalità riflettente
|
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): Ecco come recuperare la creazione Causa per qualsiasi pezzo di memoria ([], il valore di simbolo pari a zero, è l'unica cosa che non fa riferimento a un pezzo di memoria): Note that in the Cause object there are multiple named slots holding information in the frame of the cause. Si noti che per la causa oggetto ci sono più slot di nome azienda informazioni nel quadro della causa. The frames of a Cause are thread , env , name , and args . Le cornici di una causa sono thread, env, nome, e args. By default only 7 levels of recursion are printed to the screen. Per impostazione predefinita, solo il 7 livelli di ricorsione sono stampati a schermo. 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. Il simbolo utilizzato per terminare una ricorsione è l'asterisco, *. Al fine di accedere a le bande orarie di un oggetto, è possibile utilizzare funktions che sono chiamati a mutare di accesso e di oggetti. For example, the following example shows how to retrieve only the name and args slots of a cause object. Ad esempio, il seguente esempio mostra come recuperare solo il nome e l'args slot causa di un oggetto.
| in--> [let [[cause [cause-of 12]]] [cons [cause-name cause] [cause-args cause]]] in -> [lasciare [[causa [causa-di 12]]] [Cons [nome di causa-causa] [args causa-causa]]] read> [ let [ [ cause [ cause-of 12 ] ] ] [ cons [ cause-name cause ] [ cause-args cause ] ] ] leggere> [lasciare [[causa [causa-di 12]]] [Cons [nome di causa-causa] [args causa-causa]]] out-> [ primfunk:read #xb7f03420 ] out-> [primfunk: Leggi xb7f03420]
|
Here is an example of how to remember the state of an object at specific historical points in time: Ecco un esempio di come a ricordare lo stato di un oggetto a specifici punti storici nel tempo:
| in--> [globalize a [array-new 10]] in -> [globalizzare una [nuova serie-10]] read> [ globalize a [ array-new 10 ] ] leggere> [globalizzare una [nuova serie-10]] out-> [] out-> []
in--> a in -> uno read> a leggere> un out-> ( [] [] [] [] [] [] [] [] [] [] ) out-> ([] [] [] [] [] [] [] [] [] [])
in--> [tracing_on-set at] in -> [tracing_on-fissato a] read> [ tracing_on-set a t ] leggere> [tracing_on-impostare una t] out-> [] out-> []
in--> [system_date] in -> [system_date] read> [ system_date ] leggere> [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]]] in -> [dotimes [i 5] [array-ELT-set o [i + 10]]] read> [ dotimes [ i 5 ] [ array-elt-set a i [ + i 10 ] ] ] leggere> [dotimes [i 5] [array-ELT-i impostare una [i + 10]]] out-> [] out-> []
in--> a in -> uno read> a leggere> un out-> ( 10 11 12 13 14 [] [] [] [] [] ) out-> (10 11 12 13 14 [] [] [] [] [])
in--> [remember a (date 1970 0 13983 6 28 44 908595)] in -> [ricordo di una (data 1970 0 13983 6 28 44 908595)] read> [ remember a ( date 1970 0 13983 6 28 44 908595 ) ] leggere> [ricordo di una (data 1970 0 13983 6 28 44 908595)] out-> ( [] [] [] [] [] [] [] [] [] [] ) out-> ([] [] [] [] [] [] [] [] [] [])
in--> a in -> uno read> a leggere> un 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: Qui è un altro esempio di come a ricordare lo stato di un oggetto a specifici punti storici nel tempo:
| in--> [globalize a [array-new 10]] in -> [globalizzare una [nuova serie-10]] read> [ globalize a [ array-new 10 ] ] leggere> [globalizzare una [nuova serie-10]] out-> [] out-> []
in--> [tracing_on-set at] in -> [tracing_on-fissato a] read> [ tracing_on-set a t ] leggere> [tracing_on-impostare una t] out-> [] out-> []
in--> [globalize dates [array-new 10]] in -> [globalizzare date [nuova serie-10]] read> [ globalize dates [ array-new 10 ] ] leggere> [globalizzare date [nuova serie-10]] out-> [] out-> []
in--> [dotimes [i 10] [array-elt-set dates i [system_date]] [array-elt-set aii]] in -> [dotimes [i 10] [array-ELT-set date [system_date]] [array-ELT-set-II]] read> [ dotimes [ i 10 ] [ array-elt-set dates i [ system_date ] ] [ array-elt-set a i i ] ] leggere> [dotimes [i 10] [array-ELT-set date [system_date]] [array-ELT-impostare una i i]] out-> [] out-> []
in--> a in -> uno read> a leggere> un out-> ( 0 1 2 3 4 5 6 7 8 9 ) out-> (0 1 2 3 4 5 6 7 8 9)
in--> dates in -> date read> dates leggere> date 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] in -> [lasciare [[storia zero]] [dotimes [i 10] [set storia [cons [ricordo di una [array-ELT date]] storia]]] storia] read> [ let [ [ history [] ] ] [ dotimes [ i 10 ] [ set history [ cons [ remember a [ array-elt dates i ] ] history ] ] ] history ] leggere> [lasciare [[storia []]] [dotimes [i 10] [set storia [cons [ricordo di una [array-ELT date]] storia]]] storia] 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 Esempi di programmazione di base
|
Here is one straightforward way to write a "Hello world!" Qui è una semplice modo per scrivere un "Ciao, mondo!" program in the Funk2 language: programma nel Funk2 lingua:
| in--> [print 'Hello world!'] in -> [stampa 'Ciao mondo!'] read> [ print 'Hello world!' ] leggere> [print 'Ciao mondo!'] 'Hello world!' 'Ciao, mondo!' out-> 'Hello world!' out-> 'Ciao mondo!'
|
Here is another more advanced way to holla your planet: Qui è un altro modo più avanzate a Holla il tuo pianeta:
| in--> [let [[planet 'Earth']] [format stdout 'Hello ' planet '!']] in -> [lasciare [[pianeta 'Terra']] [formato stdout 'Ciao' pianeta'!']] read> [ let [ [ planet 'Earth' ] ] [ format stdout 'Hello ' planet '!' ] ] Hello Earth! leggere> [lasciare [[pianeta 'Terra']] [formato stdout 'Ciao' pianeta '!']] Ciao Terra! out-> [] out-> []
|
Here is how to define and subsequently call a funktion: Ecco come definire e successivamente chiamare un funktion:
| in--> [defunk say-hi [x] [format stdout 'Why, hello there ' x '. in -> [defunk dire hi-[x] [formato stdout 'Perché, vi ciao' x '. It is really great to see you.']] E 'davvero grande di vederla.']] read> [ defunk say-hi [ x ] [ format stdout 'Why, hello there ' x '. It is really great to see you.' ] ] leggere> [defunk dire hi-[x] [formato stdout 'Perché, vi ciao' x '. E' davvero bello vedere voi. ']] defunk say-hi [ x ] defunk dire hi-[x] out-> [] out-> []
| | in--> [say-hi 'Marvin'] in -> [hi-dire 'Marvin'] read> [ say-hi 'Marvin' ] leggere> [hi-dire 'Marvin'] Why, hello there Marvin. Perché, ciao ci Marvin. It is really great to see you. E 'davvero grande di vederla. out-> [] out-> []
|
Here is how to loop over a list of values: Ecco come loop più di una lista di valori:
| in--> [mapc [funk [x] [print x]] [list 1 2 3 #xFF 'dog' `[2 3]]] in -> [mapc [funk [x] [x stampa]] [elenco 1 2 3 # xFF 'cane' »[2 3]]] read> [ mapc [ funk [ x ] [ print x ] ] [ list 1 2 3 #xff 'dog' ` [ 2 3 ] ] ] leggere> [mapc [funk [x] [x stampa]] [elenco 1 2 3 # xff 'cane' »[2 3]]] 1 1 2 2 3 3 #xff # xff 'dog' 'cane' [ 2 3 ] [2 3] out-> [] out-> []
|
Here is how to call our funktion above in a parallel thread: Ecco come il nostro funktion di cui sopra, in un parallelo thread: Re:
| in--> [prog [thread &say-hi [list 'Gerry']] nil] in -> [prog [thread & dire-hi [lista 'Gerry']] zero] read> [ prog [ thread &say &say-hi [ list 'Gerry' ] ] [] ] leggere> [prog [thread & dire e dire-hi [lista 'Gerry']] []] Why, hello there Perché, vi Ciao out-> Gerry. out-> Gerry. It is really great to see you. [] E 'davvero grande di vederla. []
|
Here is how to serially filter every element in a list: Ecco come filtro di serie ogni elemento in un elenco:
| in--> [mapcar [funk [x] [+ x 10]] [list 1 2 3 4 5]] in -> [mapcar [funk [x] [x + 10]] [elenco 1 2 3 4 5]] read> [ mapcar [ funk [ x ] [ + x 10 ] ] [ list 1 2 3 4 5 ] ] leggere> [mapcar [funk [x] [x + 10]] [elenco 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: Ecco come filtro in concomitanza ogni elemento in un elenco:
| in--> [parcar [funk [x] [+ x 10]] [list 1 2 3 4 5]] in -> [parcar [funk [x] [x + 10]] [elenco 1 2 3 4 5]] read> [ parcar [ funk [ x ] [ + x 10 ] ] [ list 1 2 3 4 5 ] ] leggere> [parcar [funk [x] [x + 10]] [elenco 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. Lo scheduler: global_scheduler variabile in ambiente globale può essere usato come un riferimento a livello mondiale funk2 programmatore per la macchina locale. Processor information available from "/dev/proc" during funk2 initial bootstrap compile is available for all machines currently logged into the grid. Processore informazioni disponibili da "/ dev / proc" "durante funk2 iniziale di bootstrap compilare è disponibile per tutte le macchine attualmente connesso in rete. Grid support is in development, this only shows this information for the local machine. Rete di sostegno è in fase di sviluppo, questo mostra solo queste informazioni per la macchina locale. 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. Una volta che il supporto per più macchine sono disponibili, questa variabile cambierà in un funktion che prende una macchina-id come un argomento e restituisce che la macchina oggetto scheduler.
| in--> scheduler:global_scheduler in -> Programma di pianificazione: global_scheduler read> scheduler:global_scheduler leggere> scheduler: global_scheduler out-> [ scheduler out-> [scheduler :processors ( [ processor : processori ([processore :mutation_mutex [ mutex] : mutation_mutex [mutex] :scheduler [ scheduler :processors * ] : scheduler [scheduler: processori *] :pthread #x40a00960 : pthread # x40a00960 :threads [ [ thread : fili [[thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :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 [Thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :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 [Thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :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 [Thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :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 [Thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :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 [Thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :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 [Thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :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 [Thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :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 [Thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :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 [Thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :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 [Thread :program_counter * : program_counter * :stack * : stack * :iter * : * ITER :env * : env * :args * : args * :return * : ritorno * :value * : valore * :trace * : Trace * :critics * : critici * :cause_reg * : cause_reg * |
|
|
|
|