Funk2: Causal Reflective Programming Funk2: causal reflexiva de programación |
|
| Funk2: reflective programming language Funk2: reflexivo lenguaje de programación
Overview Descripción general
Supported systems Sistemas soportados
| Funk2 currently compiles on 32-bit and 64-bit Linux operating systems. Funk2 actualmente compila en 32 bits y 64 bits, los sistemas operativos 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. Punteros de 64 bits se recomienda debido a la cantidad de memoria necesaria para la capacidad reflexiva, una de 32 bits máquina por el momento sólo se pueden indexar unos pocos gigabytes de memoria. |
The goal El objetivo
| The goal of the programming language Funk2 is to enable reflective algorithmic tracing for large heterogenous control systems. El objetivo del lenguaje de programación Funk2 es permitir el rastreo de reflexión algorítmico para las grandes heterogéneos sistemas de control. A few point emphasized in the Funk2 programming language are: Algunos hicieron hincapié en el punto en el Funk2 lenguaje de programación son los siguientes: | o o | Layered Critical Causal Reflection Capas de causalidad reflexión crítica | | o o | Efficient and Robust Control Eficiente y sólido control | | o o | Learning by Credit Assignment Aprendizaje de cesión de crédito | | o o | Divergent Solution Paths Divergentes caminos de solución | | o o | Intricate Thread Control Intrincado hilo de control | | o o | Goal-oriented Learning Orientado hacia los objetivos de aprendizaje |
|
How does it work? ¿Cómo funciona? | Examples of the most basic computational features include: (1) memory creation , (2) memory read , and (3) memory write . Ejemplos de los más elementales de cálculo características incluyen: (1) la creación de memoria, (2) lectura de memoria, y (3) memoria escribir. Tracing all causal relationships between these basic features allows tracing the context of all other programmer-defined semantic abstractions . El rastreo de todas las relaciones de causalidad entre estas características básicas permite localizar el contexto de todos los demás-programador define semántica abstracciones. All of these computational features create an intricate trace network of dependencies, automatically traceable and shared by many parallel threads of execution. Todas estas características computacionales crear una intrincada red de rastrear las dependencias, automáticamente la trazabilidad y compartida por muchos hilos paralelos de ejecución. Funk2 allows causal tracing to occur modularly to dynamically chosen parts of large commonsense-scale artificial intelligence projects. Funk2 causal permite la localización a ocurrir modular de forma dinámica elegido piezas de gran escala común de inteligencia artificial proyectos. The resulting causal dependency trace networks can be processed by critical causal reflection threads. El resultado causal rastrear las redes de dependencia puede ser procesado por la reflexión crítica de causalidad hilos. |
Examples of causal reflective programming Ejemplos de programación causal reflexiva
|
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): Aquí es cómo recuperar la creación Causa para cualquier pieza de memoria ([], el valor del símbolo nulo, es la única cosa que no se referencia un trozo de memoria): Note that in the Cause object there are multiple named slots holding information in the frame of the cause. Tenga en cuenta que en la Causa objeto hay múltiples ranuras de nombre que contienen la información en el marco de la causa. The frames of a Cause are thread , env , name , and args . Los fotogramas de una Causa son el hilo, env, el nombre y args. By default only 7 levels of recursion are printed to the screen. Por defecto sólo el 7 niveles de recursión se imprimen a la pantalla. 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. El símbolo utilizado para poner fin a una recursión es el astrisk, *. Para tener acceso a las ranuras de un objeto, puede utilizar funktions que se nombran para acceder a mutar y objetos. For example, the following example shows how to retrieve only the name and args slots of a cause object. Por ejemplo, el siguiente ejemplo muestra cómo recuperar sólo el nombre y la args ranuras de una de las causas objeto.
| in--> [let [[cause [cause-of 12]]] [cons [cause-name cause] [cause-args cause]]] --> [permitir [[causa [de causa-12]]] [los contras [nombre causa-causa] [causa-causa args]]] read> [ let [ [ cause [ cause-of 12 ] ] ] [ cons [ cause-name cause ] [ cause-args cause ] ] ] leer> [permitir [[causa [de causa-12]]] [los contras [nombre causa-causa] [causa-causa args]]] out-> [ primfunk:read #xb7f03420 ] a-> [primfunk: # xb7f03420 leer]
|
Here is an example of how to remember the state of an object at specific historical points in time: Aquí está un ejemplo de cómo recordar el estado de un objeto histórico en puntos específicos en el tiempo:
| in--> [globalize a [array-new 10]] --> [globalizar una [nueva gama-10]] read> [ globalize a [ array-new 10 ] ] leer> [globalizar una [nueva gama-10]] out-> [] a-> []
in--> a --> read> a leer> out-> ( [] [] [] [] [] [] [] [] [] [] ) a-> ([] [] [] [] [] [] [] [] [] [])
in--> [tracing_on-set at] --> [tracing_on-set at] read> [ tracing_on-set a t ] leer> [tracing_on de establecer un t] out-> [] a-> []
in--> [system_date] --> [system_date] read> [ system_date ] leer> [system_date] out-> ( date 1970 0 13983 6 29 7 526235 ) a-> (fecha 1970 0 13983 6 29 7 526235)
in--> [dotimes [i 5] [array-elt-set ai [+ i 10]]] --> [dotimes [i 5] [array-ELT-set ai [+ i 10]]] read> [ dotimes [ i 5 ] [ array-elt-set a i [ + i 10 ] ] ] leer> [dotimes [i 5] [array-ELT-establecer un i [+ i 10]]] out-> [] a-> []
in--> a --> read> a leer> out-> ( 10 11 12 13 14 [] [] [] [] [] ) a-> (10 11 12 13 14 [] [] [] [] [])
in--> [remember a (date 1970 0 13983 6 28 44 908595)] --> [recordar a (fecha 1970 0 13983 6 28 44 908595)] read> [ remember a ( date 1970 0 13983 6 28 44 908595 ) ] leer> [recordar a (fecha 1970 0 13983 6 28 44 908595)] out-> ( [] [] [] [] [] [] [] [] [] [] ) a-> ([] [] [] [] [] [] [] [] [] [])
in--> a --> read> a leer> out-> ( 10 11 12 13 14 [] [] [] [] [] ) a-> (10 11 12 13 14 [] [] [] [] [])
|
Here is another example of how to remember the state of an object at specific historical points in time: Aquí hay otro ejemplo de cómo recordar el estado de un objeto histórico en puntos específicos en el tiempo:
| in--> [globalize a [array-new 10]] --> [globalizar una [nueva gama-10]] read> [ globalize a [ array-new 10 ] ] leer> [globalizar una [nueva gama-10]] out-> [] a-> []
in--> [tracing_on-set at] --> [tracing_on-set at] read> [ tracing_on-set a t ] leer> [tracing_on de establecer un t] out-> [] a-> []
in--> [globalize dates [array-new 10]] --> [globalizar fechas [arreglo de nuevo 10]] read> [ globalize dates [ array-new 10 ] ] leer> [globalizar fechas [arreglo de nuevo 10]] out-> [] a-> []
in--> [dotimes [i 10] [array-elt-set dates i [system_date]] [array-elt-set aii]] --> [dotimes [i 10] [array-ELT-i fechas establecidas [system_date]] [matriz-ELT-set AII]] read> [ dotimes [ i 10 ] [ array-elt-set dates i [ system_date ] ] [ array-elt-set a i i ] ] leer> [dotimes [i 10] [array-ELT-i fechas establecidas [system_date]] [matriz-ELT-set a i i]] out-> [] a-> []
in--> a --> read> a leer> out-> ( 0 1 2 3 4 5 6 7 8 9 ) a-> (0 1 2 3 4 5 6 7 8 9)
in--> dates --> fechas read> dates leer> fechas out-> ( ( date 1970 0 13983 6 12 19 283811 ) a-> ((fecha 1970 0 13983 6 12 19 283811) ( date 1970 0 13983 6 12 19 561113 ) (Fecha 1970 0 13983 6 12 19 561113) ( date 1970 0 13983 6 12 19 828195 ) (Fecha 1970 0 13983 6 12 19 828195) ( date 1970 0 13983 6 12 20 94674 ) (Fecha 1970 0 13983 6 12 20 94674) ( date 1970 0 13983 6 12 20 361727 ) (Fecha 1970 0 13983 6 12 20 361727) ( date 1970 0 13983 6 12 20 629388 ) (Fecha 1970 0 13983 6 12 20 629388) ( date 1970 0 13983 6 12 20 896560 ) (Fecha 1970 0 13983 6 12 20 896560) ( date 1970 0 13983 6 12 21 163860 ) (Fecha 1970 0 13983 6 12 21 163860) ( date 1970 0 13983 6 12 21 431032 ) (Fecha 1970 0 13983 6 12 21 431032) ( date 1970 0 13983 6 12 21 699425 ) ) (Fecha 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] --> [permitir [[historia nil]] [dotimes [i 10] [set la historia [los contras [Recuerdo una [serie-ELT fechas i]] historia]]] la historia] read> [ let [ [ history [] ] ] [ dotimes [ i 10 ] [ set history [ cons [ remember a [ array-elt dates i ] ] history ] ] ] history ] leer> [permitir [[historia []]] [dotimes [i 10] [set la historia [los contras [Recuerdo una [serie-ELT fechas i]] historia]]] la historia] out-> [ ( 0 1 2 3 4 5 6 7 8 [] ) a-> [(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 Ejemplos básicos de programación
|
Here is one straightforward way to write a "Hello world!" Esta es una sencilla forma de escribir un "Hola mundo!" program in the Funk2 language: en el programa Funk2 idioma:
| in--> [print 'Hello world!'] --> [print 'Hola mundo! "] read> [ print 'Hello world!' ] leer> [print 'Hola mundo! "] 'Hello world!' 'Hola mundo! " out-> 'Hello world!' a-> 'Hola mundo! "
|
Here is another more advanced way to holla your planet: Aquí hay otro modo avanzado a holla su planeta:
| in--> [let [[planet 'Earth']] [format stdout 'Hello ' planet '!']] --> [dejar que [[planeta 'Tierra']] [formato stdout 'Hola' planeta'!']] read> [ let [ [ planet 'Earth' ] ] [ format stdout 'Hello ' planet '!' ] ] Hello Earth! leer> [dejar que [[planeta 'Tierra']] [formato stdout 'Hola' planeta '! "]] Hola Tierra! out-> [] a-> []
|
Here is how to define and subsequently call a funktion: Aquí es cómo definir y, posteriormente, llamar a un funktion:
| in--> [defunk say-hi [x] [format stdout 'Why, hello there ' x '. --> [defunk decir-hi [x] [formato stdout '¿Por qué, hello there' x '. It is really great to see you.']] Es realmente grande para verlo '.]] read> [ defunk say-hi [ x ] [ format stdout 'Why, hello there ' x '. It is really great to see you.' ] ] leer> [defunk decir-hi [x] [formato stdout '¿Por qué, hello there' x '. Es realmente grande para verlo'.]] defunk say-hi [ x ] defunk decir-hi [x] out-> [] a-> []
| | in--> [say-hi 'Marvin'] --> [decir-hi 'Marvin'] read> [ say-hi 'Marvin' ] leer> [decir-hi 'Marvin'] Why, hello there Marvin. ¿Por qué, Hola Marvin. It is really great to see you. Es realmente grande para verlo. out-> [] a-> []
|
Here is how to loop over a list of values: Aquí está la forma de bucle más de una lista de valores:
| in--> [mapc [funk [x] [print x]] [list 1 2 3 #xFF 'dog' `[2 3]]] --> [mapc [funk [x] [print x]] [lista 1 2 3 # xff 'perro' `[2 3]]] read> [ mapc [ funk [ x ] [ print x ] ] [ list 1 2 3 #xff 'dog' ` [ 2 3 ] ] ] leer> [mapc [funk [x] [print x]] [lista 1 2 3 # xff 'perro' `[2 3]]] 1 1 2 2 3 3 #xff # xff 'dog' "perro" [ 2 3 ] [2 3] out-> [] a-> []
|
Here is how to call our funktion above in a parallel thread: Aquí es cómo llamar a nuestro funktion arriba en un hilo paralelo:
| in--> [prog [thread &say-hi [list 'Gerry']] nil] --> [prog [hilo y decir-hi [la lista 'Gerry']] nil] read> [ prog [ thread &say &say-hi [ list 'Gerry' ] ] [] ] leer> [prog [hilo y decir y decir-hi [la lista 'Gerry']] []] Why, hello there ¿Por qué, Hola out-> Gerry. a-> Gerry. It is really great to see you. [] Es realmente grande para verlo. []
|
Here is how to serially filter every element in a list: Aquí está la forma de serie filtro de cada elemento en una lista:
| in--> [mapcar [funk [x] [+ x 10]] [list 1 2 3 4 5]] --> [mapcar [funk [x] [x + 10]] [lista 1 2 3 4 5]] read> [ mapcar [ funk [ x ] [ + x 10 ] ] [ list 1 2 3 4 5 ] ] leer> [mapcar [funk [x] [x + 10]] [lista 1 2 3 4 5]] out-> [ 11 12 13 14 15 ] a-> [11 12 13 14 15]
|
Here is how to concurrently filter every element in a list: Aquí está la manera de filtro simultáneamente todos los elementos en una lista:
| in--> [parcar [funk [x] [+ x 10]] [list 1 2 3 4 5]] --> [parcar [funk [x] [x + 10]] [lista 1 2 3 4 5]] read> [ parcar [ funk [ x ] [ + x 10 ] ] [ list 1 2 3 4 5 ] ] leer> [parcar [funk [x] [x + 10]] [lista 1 2 3 4 5]] out-> [ 11 12 13 14 15 ] a-> [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. El planificador: global_scheduler variable en el medio ambiente mundial puede ser utilizado como una referencia mundial para la funk2 planificador de la máquina local. Processor information available from "/dev/proc" during funk2 initial bootstrap compile is available for all machines currently logged into the grid. Procesador de información disponible "/ dev / proc" durante el arranque inicial funk2 compilar está disponible para todas las máquinas actualmente conectado a la red. Grid support is in development, this only shows this information for the local machine. Grid es el apoyo en el desarrollo, esto sólo muestra esta información para la 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. Una vez que el apoyo a múltiples máquinas está disponible, esta variable va a cambiar en un funktion que tenga una máquina-id como argumento y devuelve la máquina objeto del planificador.
| in--> scheduler:global_scheduler --> planificador: global_scheduler read> scheduler:global_scheduler leer> planificador: global_scheduler out-> [ scheduler a-> [planificador :processors ( [ processor : transformadores ([procesador :mutation_mutex [ mutex] : mutation_mutex [mutex] :scheduler [ scheduler :processors * ] : planificador [planificador: procesadores *] :pthread #x40a00960 : pthread # x40a00960 :threads [ [ thread : hilos [[hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : 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 [Hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : 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 [Hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : 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 [Hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : 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 [Hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : 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 [Hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : 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 [Hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : 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 [Hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : 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 [Hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : 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 [Hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : 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 [Hilo :program_counter * : program_counter * :stack * : pila * :iter * : ITER * :env * : env * :args * : args * :return * : return * :value * : valor * :trace * : traza * :critics * : críticos * :cause_reg * : cause_reg * |
|
|
|
|